Juste à temps pour le lancement des journées 
Pour une fois, les mises à jour ciblent aussi bien les dernières générations monochromes et couleurs que les générations les ayant précédées :
Des nouveautés d'importance sont donc ici transversales, d'où notre tentative de les traiter dans un unique article.
Avant cela, nous avons une petite chose à mettre au point. Les logiciels d'installation de mises à jour


Pour ce qui est simple, nous avons donc :
Quant à la mise à jour
Maintenant que nous avons toutes ces bases, découvrons ensemble les nouveautés.
APMEP
ce week-end, Casio
nous a offert une mise à jour majeure de l'ensemble de sa gamme graphique non formelle ! 
Pour une fois, les mises à jour ciblent aussi bien les dernières générations monochromes et couleurs que les générations les ayant précédées :
- 3.50pourGraph 90+Eetfx-CG50
- 3.40pour la génération monochromeUSB Power Graphic 3(Graph 35+E IIen France,fx-9750GIIIetfx-9860GIIIdans d'autres pays)
- 3.12pourfx-CG10etfx-CG20
- 2.11pour les anciennes générations monochromesUSB Power Graphic 1etUSB Power Graphic 2
Des nouveautés d'importance sont donc ici transversales, d'où notre tentative de les traiter dans un unique article.
Avant cela, nous avons une petite chose à mettre au point. Les logiciels d'installation de mises à jour
Casio
contiennent usuellement plusieurs images système installables sur différentes variantes d'un modèle selon les pays. Avant de traiter des nouveautés, listons donc rapidement ce que nous avons ici afin de pouvoir nous y référer plus tard :Mise à jour | Image système | Version nouvelle + précédente | Timbre à date nouveau + précédent | Référence modèles ciblés | Modèles ciblés |
3.50 | 3070 | 3.50 3.40 | 2020.0924.1830 2020.0313.0216 | CY810A | Graph 90+E, fx-CG50 |
3071 | 3.50 3.40 | 2020.0924.1845 2020.0313.0229 | CY810F | fx-CG50AU | |
3.40 | 3070 | 3.40 3.30 | 2020.0918.1757 2020.0313.0229 | CY835A | Graph 35+E II |
3071 | 3.40 3.21 | 2020.0918.1811 2020.0313.0229 | CY837A | fx-9860GIII | |
3072 | 3.40 3.21 | 2020.0918.1820 2020.0313.0229 | CY838A | fx-9750GIII | |
3.12 | 3070 | 3.12 3.11 | 2020.0924.1914 2018.0308.1942 | LY755A | fx-CG10/20 |
3071 | 3.12 3.11 | 2020.0924.1926 2018.0308.1951 | LY755F | fx-CG20AU | |
2.11 | 3071 | 2.08 | 2015.1201.1207 | GY493A | fx-9860GII SD ( USB Power Graphic 1 ) |
3072 | 2.08 | 2015.1201.1207 | GY493B | Graph 95 ( USB Power Graphic 1 ) | |
3073 | 2.08 | 2015.1201.1215 | GY495A | fx-9860GII ( USB Power Graphic 1 ) | |
3074 | 2.08 | 2015.1201.1219 | GY495B | Graph 75 ( USB Power Graphic 1 ) | |
3075 | 2.08 | 2015.1201.1223 | GY495E | fx-9860G AU | |
3080 | 2.11 2.09 | 2020.0910.1404 2015.1204.1158 | GY497A | fx-9860GII SD ( USB Power Graphic 2 ) | |
3081 | 2.09 | 2015.1204.1203 | GY497B | Graph 95 ( USB Power Graphic 2 ) | |
3082 | 2.09 | 2015.1204.1208 | GY498A | fx-9860GIIs | |
3083 | 2.11 2.09 | 2020.0910.1353 2015.1204.1213 | GY499A | fx-9860GII ( USB Power Graphic 2 ) | |
3084 | 2.09 | 2015.1204.1218 | GY499B | Graph 75+ | |
3085 | 2.09 | 2015.1204.1223 | GY499E | fx-9860G AU+ | |
3086 | 2.09 | 2015.1202.1718 | CY802A | Graph 75+E |
- la Graph 90+Eet ses équivalents internationauxfx-CG50qui passent de la versiondu3.40à la nouvelle version13 mars 20203.50compilée le24 septembre 2020
- la Graph 35+E IIqui passe de la versiondu3.30à la nouvelle version13 mars 20203.40compilée le18 septembre 2020
- ses pendants internationaux fx-9750GIIIetfx-9860GIIIqui passent directement de la versiondu3.21à la nouvelle version13 mars 20203.40compilée le18 septembre 2020
2.11
pour les anciennes générations monochromes USB Power Graphic 1
et USB Power Graphic 2
:- rien de nouveau pour les modèles de la génération USB Power Graphic 1(processeurqui ne seront mis à jour qu'au maximum vers la versionSH3)2.08compilée le1er décembre 2015
- rien de nouveau non plus pour les déclinaisons locales à certains pays de la génération USB Power Graphic 2(qui ne seront mis à jour qu'au maximum vers la versionGraph 75+etGraph 75+Epour laFrance,fx-9860G AU+pour l'Australie,fx-9860GIIspourSingapour)2.09compilée le4 décembre 2015
2.11
que les seuls modèles internationaux de la génération USB Power Graphic 2
: fx-9860G II
et fx-9860GII SD
.Maintenant que nous avons toutes ces bases, découvrons ensemble les nouveautés.
1) Python et casioplot
Go to topPython
intégrée apportées à la fois :- par la mise à jour 3.50de la dernière génération couleur :
- Graph 90+E
- fx-CG50
- par la mise à jour 3.40de la dernière génération monochrome :
- Graph 35+E II
- fx-9860GIII
- fx-9750GIII
fx-9860GIII
et fx-9750GIII
, équivalents de la Graph 35+E II
respectivement en Europe et Amérique du Nord, n'ont à la différence de cette dernière pas bénéficié d'une mise à jour intermédiaire 3.30
3.21
3.40
, leur application Python
bénéficie déjà de tout ce qui a été apporté sur Graph 35+E II
avec la version 3.30
et que nous t'invitons à aller consulter, et notamment enfin du module de tracé par pixels casioplot
. 
Passons maintenant aux nouveautés spécifiquement apportées par la dernière version
3.40
ou 3.50
.

casioplot
offrait une fonction clear_screen()
pour effacer l'écran, fonction parfaitement fonctionnelle mais qui bizarrement n'était pas au catalogue de modules et fonctions accessible via SHIFT
4, et les appels à cette fonction doivent redonc être saisis à la main caractère par caractère.
2) Python et turtle
Go to topLa dernière mise à jour apportait donc le module de tracé par pixels

Ce choix de passer par un script
Et bien gros changement sur les modèles français 
Il devient donc à la fois :
A noter que cette amélioration semble ne concerner que les modèles français. La 
Sur ces modèles il faudra donc continuer à passer par les scripts additionnels que nous te lierons en fin d'article, scripts qui deviendront indisponibles en mode examen.
casioplot
. Casio France
diffusait de plus un script turtle.py
, une réécriture complète en Python
du module de tracés relatifs turtle
standard.

turtle.py
additionnel avait toutefois trois inconvénients majeurs :- déjà, turtle.pyne venait pas avec les mises à jour et devait donc être ajouté manuellement dans la calculatrice
- les fonctions du module turtlen'étaient pas listées au catalogue ; elles devaient donc être connues et saisies manuellement caractère par caractère
- comme tout fichier additionnel, turtle.pyétait de plus inutilisable en mode examen.

Graph 90+E
et Graph 35+E II
avec la dernière version, le module turtle
est désormais directement intégré au système ! 
Il devient donc à la fois :
- disponible immédiatement
- décrit au catalogue
- utilisable en mode examen
fx-9750GIII
mise à jour ne bénéficie pas de cette amélioration, et probablement pas mieux pour les autres modèles internationaux fx-9860GIII
et fx-CG50
. 
Sur ces modèles il faudra donc continuer à passer par les scripts additionnels que nous te lierons en fin d'article, scripts qui deviendront indisponibles en mode examen.
3) Exemples turtle
Go to topCe qui était déjà remarquable avec la réécriture intégrale du module
Voici quelques exemples utilisant du code
Comme tu peux le voir, les
Niveau fonctions dont les appels ont ici été protégés pour palier leur absence sur certaines plateformes, en fait il ne manque pas grand chose aux
turtle
par Casio
, c'est la haute conformité au standard que l'on vérifiait aisément en comparant ce que donne le même script sur ordinateur, et on peut en passant comparer avec les plateformes concurrentes.Voici quelques exemples utilisant du code
turtle
standard. Nous allons juste mettre dans le code quelques protections concernant les fonctions parfois non définies sur certaines plateformes, afin que leur appel n'empêche pas l'affichage du tracé obtenu. Mais nous ne coderons ici rien pour corriger des incompatibilités avec la norme.ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
|
Comme tu peux le voir, les
Graph 90+E
et Graph 35+E II
comptaient déjà parmi les meilleures solutions sur le critère de la conformité au standard turtle
, pas d'écart sur ces exemples contrairement à certaines solutions concurrentes ! 
Niveau fonctions dont les appels ont ici été protégés pour palier leur absence sur certaines plateformes, en fait il ne manque pas grand chose aux
Graph 90+E
et Graph 35+E II
, juste turtle.colormode()
.4) Nouveautés turtle
Go to topNous remarquons en fait que le module
Nous avions remarqué un petit écart avec la fonction
Non finalement pas de changement ici, mais vu en comparaison les énormes écarts que se permettent d'autres plateformes on peut bien passer l'éponge cette fois-ci.
turtle
désormais intégré est toujours écrit en Python
, son code étant lisible en clair en mémoire. Et nous notons surtout qu'il s'agit d'une nouvelle version par rapport à celle sortie au printemps dernier, une mise à jour assez majeure si tu compares toutes les différences ci-dessous :- Code: Select all
import casioplot
from math import sqrt
from math import pi
from math import cos
from math import sin
from math import atan2
turtleshapes={"classic":[[-9,5],[-9,4],[-8,4],[-8,3],[-8,2],[-8,-2],[-8,-3],[-8,-4],[-9,-4],[-9,-5],[-7,4],[-7,1],[-7,0],[-7,-1],[-7,-4],[-6,3],[-6,-3],[-5,3],[-5,-3],[-4,2],[-4,-2],[-3,2],[-3,-2],[-2,1],[-2,-1],[-1,1],[-1,-1],[0,0]],"turtle": [[-3,3],[2,3],[-2,2],[-1,2],[0,2],[1,2],[-2,1],[-1,1],[1,1],[0,1],[2,1],[3,1],[-2,0],[-1,0],[0,0],[1,0],[-1,-1],[-2,-1],[0,-1],[1,-1],[2,0],[3,0],[-3,-2],[2,-2]]}
turtle_name="classic"
turtle_data=turtleshapes[turtle_name]
turtle_pos=[0,0]
turtle_angle=0
turtle_color=(0,0,0)
writing=True
pen_size=1
turtle_buffer=[[]]
turtle_speed=5
frame_count=0
turtle_visible=True
def draw_turtle(x,y,a,c):
global turtle_buffer
def inbuffer(x,y):
inlist=False
for i in range(1,len(turtle_buffer)):
if x==turtle_buffer[i][0] and y==turtle_buffer[i][1]:
inlist=True
return inlist
if turtle_visible==True:
u=cos(a*pi/180)
v=sin(a*pi/180)
for point in turtle_data:
xx=x+(point[0]*u-point[1]*v)
yy=y+(point[1]*u+point[0]*v)
xpixel=int(round(xx+192))
ypixel=int(round(-yy+96))
if (0<=xpixel<=383 and 0<=ypixel<=191):
if not inbuffer(xpixel,ypixel):
turtle_buffer+=[[xpixel,ypixel,casioplot.get_pixel(xpixel,ypixel)]]
casioplot.set_pixel(xpixel,ypixel,c)
def erase_turtle():
global turtle_buffer
for i in range(1,len(turtle_buffer)):
xpixel=turtle_buffer[i][0]
ypixel=turtle_buffer[i][1]
if turtle_buffer[i][2]!=None :
lastcolor=turtle_buffer[i][2]
else:
lastcolor=(255,255,255)
casioplot.set_pixel(xpixel,ypixel,lastcolor)
turtle_buffer=[[]]
def pen_brush(x,y,turtle_color):
global frame_count
erase_turtle()
xpixel=int(round(x+192))
ypixel=int(round(-y+96))
if writing==True and (0<=xpixel<=383 and 0<=ypixel<=191) :
colorpixel=(int(turtle_color[0]*255), int(turtle_color[1]*255),int(turtle_color[2]*255))
casioplot.set_pixel(xpixel,ypixel,colorpixel)
frame_count+=1
if turtle_speed!=0:
if frame_count%(turtle_speed*4)==0:
draw_turtle(x,y,turtle_angle,colorpixel)
casioplot.show_screen()
else :
if frame_count%500==0:
draw_turtle(x,y,turtle_angle,colorpixel)
casioplot.show_screen()
def refresh_turtle():
c=(int(turtle_color[0]*255), int(turtle_color[1]*255),int(turtle_color[2]*255))
erase_turtle()
draw_turtle(turtle_pos[0],turtle_pos[1],turtle_angle,c)
casioplot.show_screen()
def back(n):
forward(-n)
def backward(n):
back(n)
def bk(n):
back(n)
def circle(radius,extent=360):
global turtle_angle, turtle_pos
x1=turtle_pos[0]
y1=turtle_pos[1]
if round(radius)==0:
pen_brush(x1,y1,turtle_color)
turtle_angle+=extent
elif round(extent,8)==0:
pen_brush(x1,y1,turtle_color)
else:
e=radius/abs(radius)
theta=extent*pi/180*e
Rx=cos(theta)
Ry=sin(theta)
Dx=radius*sin(turtle_angle*pi/180)
Dy=-radius*cos(turtle_angle*pi/180)
xcenter=x1-Dx
ycenter=y1-Dy
nbpixelarc=int(round(abs(radius*theta*1.05)))
angle=turtle_angle
if nbpixelarc!=0:
alpha=theta/nbpixelarc
for k in range(nbpixelarc+1):
x=xcenter+Dx*cos(alpha*k)-Dy*sin(alpha*k)
y=ycenter+Dx*sin(alpha*k)+Dy*cos(alpha*k)
turtle_angle+=alpha*180/pi
pen_brush(x,y,turtle_color)
turtle_pos[0]=xcenter+Dx*Rx-Dy*Ry
turtle_pos[1]=ycenter+Dx*Ry+Dy*Rx
turtle_angle=angle+extent*e
refresh_turtle()
def clear():
erase_turtle()
casioplot.clear_screen()
casioplot.show_screen()
refresh_turtle()
def distance(x,y):
return sqrt((x-turtle_pos[0])**2+(y-turtle_pos[1])**2)
def down():
global writing
writing=True
def fd(d):
forward(d)
def forward(d):
global turtle_pos
dx=d*cos(turtle_angle*pi/180)
dy=d*sin(turtle_angle*pi/180)
x1=turtle_pos[0]
y1=turtle_pos[1]
if round(abs(d))==0:
pen_brush(x1+dx,y1+dy,turtle_color)
elif abs(dx)>=abs(dy):
e=int(dx/abs(dx))
m=dy/dx
p=y1-m*x1
for x in range(int(round(x1)),int(round(x1+dx)),e):
pen_brush(x,m*x+p,turtle_color)
else:
e=int(dy/abs(dy))
m=dx/dy
p=x1-m*y1
for y in range(int(round(y1)),int(round(y1+dy)),e):
pen_brush(m*y+p,y,turtle_color)
turtle_pos[0]+=dx
turtle_pos[1]+=dy
refresh_turtle()
def goto(x,y):
a=turtle_angle
setheading(towards(x,y))
forward(distance(x,y))
setheading(a)
refresh_turtle()
def heading():
return turtle_angle
def hideturtle():
global turtle_visible
turtle_visible=False
refresh_turtle()
def home():
global turtle_pos,turtle_angle
turtle_pos[0]=turtle_pos[1]=0
turtle_angle=0
refresh_turtle()
def ht():
hideturtle()
def isdown():
return writing
def isvisible():
return turtle_visible
def left(a):
right(-a)
def lt(a):
right(-a)
def pd():
down()
def pencolor(*c):
global turtle_color
colornames={"black":(0,0,0),"blue":(0,0,1),"green":(0,1,0),"red":(1,0,0),"cyan":(0,1,1),"yellow":(1,1,0),"magenta":(1,0,1),"white":(1,1,1),"orange":(1,0.65,0),"purple":(0.66,0,0.66),"brown":(0.75,0.25,0.25),"pink":(1,0.75,0.8),"grey":(0.66,0.66,0.66)}
if c==():
return turtle_color
elif c[0] in colornames:
turtle_color=colornames[c[0]]
elif isinstance(c[0],(list,tuple)) and len(c[0])==3 and isinstance(c[0][0],(int,float)) and isinstance(c[0][1],(int,float)) and isinstance(c[0][2],(int,float)) and 0<=c[0][0]<=1 and 0<=c[0][1]<=1 and 0<=c[0][2]<=1:
turtle_color=list(c[0])
else:
raise ValueError('error using pencolor : enter a color text or 3 floats between 0 and 1')
refresh_turtle()
def pendown():
down()
def pensize(n):
global pen_size
pen_size=n
refresh_turtle()
def penup():
global writing
writing=False
def pos():
return (xcor(),ycor())
def position():
return (xcor(),ycor())
def pu():
penup()
def reset():
global turtle_color,writing,pen_size,speed,turtle_visible
clear()
turtle_color=(0,0,0)
home()
writing=True
pen_size=1
speed=5
turtle_visible=True
shape("classic")
refresh_turtle()
def right(a):
global turtle_angle
turtle_angle-=a
refresh_turtle()
def rt(a):
right(a)
def seth(a):
setheading(a)
def setheading(a):
global turtle_angle
turtle_angle=a
refresh_turtle()
def setpos(x,y):
goto(x,y)
refresh_turtle()
def setposition(x,y):
setpos(x,y)
def setx(x):
global turtle_pos
turtle_pos[0]=x
refresh_turtle()
def sety(y):
global turtle_pos
turtle_pos[1]=y
refresh_turtle()
def shape(text=None):
global turtle_name,turtle_data
if text==None:
return turtle_name
elif text in turtleshapes:
turtle_name=text
turtle_data=turtleshapes[text]
else:
raise ValueError('available shapes: "classic" or "turtle"')
refresh_turtle()
def showturtle():
global turtle_visible
turtle_visible=True
refresh_turtle()
def speed(v=None):
global turtle_speed
speedwords = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 }
if v==None:
pass
elif isinstance(v,(int,float)) and (v<=0.5 or v>=10.5):
turtle_speed=0
elif isinstance(v,(int,float)) and (0.5<v<10.5):
turtle_speed=int(round(v))
elif isinstance(v,str) and v in speedwords:
turtle_speed=speedwords[v]
else:
raise ValueError("Error using function speed: enter a real between 0 & 10")
def st():
showturtle()
def towards(x,y):
if round(x-turtle_pos[0],8)==0 and round(y-turtle_pos[1],8)==0:
return 0
else:
return (atan2(y-turtle_pos[1],x-turtle_pos[0])*180/pi)
def up():
penup()
def width(n):
pensize(n)
def write(text):
xpixel=int(round(turtle_pos[0]+192))
ypixel=int(round(-turtle_pos[1]+96))
c=(int(turtle_color[0]*255), int(turtle_color[1]*255),int(turtle_color[2]*255))
casioplot.draw_string(xpixel,ypixel,str(text),c,"small")
casioplot.show_screen()
def xcor():
return round(turtle_pos[0],6)
def ycor():
return round(turtle_pos[1],6)
- Code: Select all
import casioplot
from math import sqrt
from math import pi
from math import cos
from math import sin
from math import atan2
turtleshapes={"classic":[[-9,5],[-9,4],[-8,4],[-8,3],[-8,2],[-8,-2],[-8,-3],[-8,-4],[-9,-4],[-9,-5],[-7,4],[-7,1],[-7,0],[-7,-1],[-7,-4],[-6,3],[-6,-3],[-5,3],[-5,-3],[-4,2],[-4,-2],[-3,2],[-3,-2],[-2,1],[-2,-1],[-1,1],[-1,-1],[0,0]],"turtle": [[-3,3],[2,3],[-2,2],[-1,2],[0,2],[1,2],[-2,1],[-1,1],[1,1],[0,1],[2,1],[3,1],[-2,0],[-1,0],[0,0],[1,0],[-1,-1],[-2,-1],[0,-1],[1,-1],[2,0],[3,0],[-3,-2],[2,-2]]}
turtle_name="classic"
turtle_data=turtleshapes[turtle_name]
turtle_pos=[0,0]
turtle_angle=0
turtle_color=(0,0,0)
writing=True
pen_pixels=[[0,0]]
turtle_buffer=[]
turtle_speed=5
frame_count=0
turtle_visible=True
pen_size=1
def _draw_turtle(x,y,a,c):
global turtle_buffer
def inbuffer(x,y):
inlist=False
for i in range(len(turtle_buffer)):
if x==turtle_buffer[i][0] and y==turtle_buffer[i][1]:
inlist=True
return inlist
if turtle_visible==True:
u=cos(a*pi/180)
v=sin(a*pi/180)
for point in turtle_data:
xx=x+(point[0]*u-point[1]*v)
yy=y+(point[1]*u+point[0]*v)
xpixel=int(round(xx+192))
ypixel=int(round(-yy+96))
if (0<=xpixel<=383 and 0<=ypixel<=191):
if not inbuffer(xpixel,ypixel):
turtle_buffer+=[[xpixel,ypixel,casioplot.get_pixel(xpixel,ypixel)]]
casioplot.set_pixel(xpixel,ypixel,c)
def _erase_turtle():
global turtle_buffer
for i in range(len(turtle_buffer)):
xpixel=turtle_buffer[i][0]
ypixel=turtle_buffer[i][1]
if turtle_buffer[i][2]!=None :
lastcolor=turtle_buffer[i][2]
else:
lastcolor=(255,255,255)
casioplot.set_pixel(xpixel,ypixel,lastcolor)
turtle_buffer.clear()
def _pen_brush(x,y,turtle_color):
global frame_count
_erase_turtle()
xpixel=int(round(x+192))
ypixel=int(round(-y+96))
if writing==True and (0<=xpixel<=383 and 0<=ypixel<=191) :
colorpixel=(int(turtle_color[0]*255), int(turtle_color[1]*255),int(turtle_color[2]*255))
for point in pen_pixels:
casioplot.set_pixel(xpixel+point[0],ypixel+point[1],colorpixel)
frame_count+=1
if turtle_speed!=0:
if frame_count%(turtle_speed*4)==0:
_draw_turtle(x,y,turtle_angle,colorpixel)
casioplot.show_screen()
else :
if frame_count%500==0:
_draw_turtle(x,y,turtle_angle,colorpixel)
casioplot.show_screen()
def _refresh_turtle():
c=(int(turtle_color[0]*255), int(turtle_color[1]*255),int(turtle_color[2]*255))
_erase_turtle()
_draw_turtle(turtle_pos[0],turtle_pos[1],turtle_angle,c)
casioplot.show_screen()
def _conv_angle(a):
a=a%360
if a < 0:
a=360+a
return a
def back(n):
forward(-n)
def backward(n):
back(n)
def bk(n):
backward(n)
def circle(radius,extent=360):
global turtle_angle, turtle_pos
x1=turtle_pos[0]
y1=turtle_pos[1]
if round(radius)==0:
_pen_brush(x1,y1,turtle_color)
turtle_angle+=extent
elif round(extent,8)==0:
_pen_brush(x1,y1,turtle_color)
else:
e=radius/abs(radius)
theta=extent*pi/180*e
Rx=cos(theta)
Ry=sin(theta)
Dx=radius*sin(turtle_angle*pi/180)
Dy=-radius*cos(turtle_angle*pi/180)
xcenter=x1-Dx
ycenter=y1-Dy
nbpixelarc=int(round(abs(radius*theta*1.05)))
angle=turtle_angle
if nbpixelarc!=0:
alpha=theta/nbpixelarc
for k in range(nbpixelarc+1):
x=xcenter+Dx*cos(alpha*k)-Dy*sin(alpha*k)
y=ycenter+Dx*sin(alpha*k)+Dy*cos(alpha*k)
turtle_angle+=alpha*180/pi
_pen_brush(x,y,turtle_color)
turtle_pos[0]=xcenter+Dx*Rx-Dy*Ry
turtle_pos[1]=ycenter+Dx*Ry+Dy*Rx
turtle_angle=angle+extent*e
turtle_angle=_conv_angle(turtle_angle)
_refresh_turtle()
def clear():
_erase_turtle()
casioplot.clear_screen()
casioplot.show_screen()
_refresh_turtle()
def distance(x,y):
return sqrt((x-turtle_pos[0])**2+(y-turtle_pos[1])**2)
def down():
global writing
writing=True
def fd(d):
forward(d)
def forward(d):
global turtle_pos
dx=d*cos(turtle_angle*pi/180)
dy=d*sin(turtle_angle*pi/180)
x1=turtle_pos[0]
y1=turtle_pos[1]
if round(abs(d))==0:
_pen_brush(x1+dx,y1+dy,turtle_color)
elif abs(dx)>=abs(dy):
e=int(dx/abs(dx))
m=dy/dx
p=y1-m*x1
for x in range(int(round(x1)),int(round(x1+dx)),e):
_pen_brush(x,m*x+p,turtle_color)
else:
e=int(dy/abs(dy))
m=dx/dy
p=x1-m*y1
for y in range(int(round(y1)),int(round(y1+dy)),e):
_pen_brush(m*y+p,y,turtle_color)
turtle_pos[0]+=dx
turtle_pos[1]+=dy
_refresh_turtle()
def goto(x,y):
a=turtle_angle
setheading(towards(x,y))
forward(distance(x,y))
setheading(a)
_refresh_turtle()
def heading():
return turtle_angle
def hideturtle():
global turtle_visible
turtle_visible=False
_refresh_turtle()
def home():
global turtle_angle
goto(0,0)
turtle_angle=0
_refresh_turtle()
def ht():
hideturtle()
def isdown():
return writing
def isvisible():
return turtle_visible
def left(a):
right(-a)
def lt(a):
left(a)
def pd():
down()
def pencolor(*c):
global turtle_color
colornames={"black":(0,0,0),"blue":(0,0,1),"green":(0,1,0),"red":(1,0,0),"cyan":(0,1,1),"yellow":(1,1,0),"magenta":(1,0,1),"white":(1,1,1),"orange":(1,0.65,0),"purple":(0.66,0,0.66),"brown":(0.75,0.25,0.25),"pink":(1,0.75,0.8),"grey":(0.66,0.66,0.66)}
if c==():
return turtle_color
elif c[0] in colornames:
turtle_color=colornames[c[0]]
elif isinstance(c[0],(list,tuple)) and len(c[0])==3 and isinstance(c[0][0],(int,float)) and isinstance(c[0][1],(int,float)) and isinstance(c[0][2],(int,float)) and 0<=c[0][0]<=1 and 0<=c[0][1]<=1 and 0<=c[0][2]<=1:
turtle_color=list(c[0])
elif len(c)==3 and isinstance(c[0],(int,float)) and isinstance(c[1],(int,float)) and isinstance(c[2],(int,float)) and 0<=c[0]<=1 and 0<=c[1]<=1 and 0<=c[2]<=1:
turtle_color=list(c)
else:
raise ValueError('error using pencolor : enter a color text or 3 floats between 0 and 1')
_refresh_turtle()
def pendown():
down()
def pensize(n=None):
global pen_pixels,pen_size
penshape=[[0,0],[1,0],[0,1],[-1,0],[0,-1],[1,1],[1,-1],[-1,1],[-1,-1],[2,0],[0,2],[-2,0],[0,-2],[2,1],[1,2],[-2,1],[-1,2],[2,-1],[1,-2],[-2,-1],[-1,-2]]
if n==None:
return pen_size
elif isinstance(n,(int,float)) and n>=0:
pen_size=n
if round(n)==0 or round(n)==1 :
pen_pixels=[[0,0]]
elif round(n)==2 :
pen_pixels=penshape[0:5]
elif round(n)==3 :
pen_pixels=penshape[0:9]
elif round(n)==4 :
pen_pixels=penshape[0:13]
elif round(n)==5 :
pen_pixels=penshape[0:21]
elif round(n)>5 :
pen_pixels=penshape[0:21]
pen_size=5
print('Userwarning: pensize over 5 automatically set to 5.')
else:
raise ValueError('Error using function pensize: enter a real between 0 & 5')
_refresh_turtle()
def penup():
global writing
writing=False
def pos():
return position()
def position():
return (xcor(),ycor())
def pu():
penup()
def reset():
global turtle_color,writing,pen_pixels,turtle_speed,turtle_visible,pen_size
turtle_color=(0,0,0)
clear()
hideturtle()
penup()
home()
pendown()
writing=True
pen_size=1
pen_pixels=[[0,0]]
turtle_speed=5
shape("classic")
turtle_visible=True
_refresh_turtle()
def right(a):
global turtle_angle
if isinstance(a, (int, float)):
turtle_angle = _conv_angle(turtle_angle-a)
else:
raise ValueError('error')
_refresh_turtle()
def rt(a):
right(a)
def seth(a):
setheading(a)
def setheading(a):
global turtle_angle
turtle_angle=_conv_angle(a)
_refresh_turtle()
def setpos(x,y):
goto(x,y)
def setposition(x,y):
setpos(x,y)
def setx(x):
goto(x,turtle_pos[1])
def sety(y):
goto(turtle_pos[0],y)
def shape(name=None):
global turtle_name,turtle_data
if name==None:
return turtle_name
elif name in turtleshapes:
turtle_name=name
turtle_data=turtleshapes[name]
else:
raise ValueError('available shapes: "classic" or "turtle"')
_refresh_turtle()
def showturtle():
global turtle_visible
turtle_visible=True
_refresh_turtle()
def speed(speed=None):
global turtle_speed
speedwords = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 }
if speed==None:
return turtle_speed
elif isinstance(speed,(int,float)) and (speed<=0.5 or speed>=10.5):
turtle_speed=0
elif isinstance(speed,(int,float)) and (0.5<speed<10.5):
turtle_speed=int(round(speed))
elif isinstance(speed,str) and speed in speedwords:
turtle_speed=speedwords[speed]
else:
raise ValueError("Error using function speed: enter a real between 0 & 10")
def st():
showturtle()
def towards(x,y):
if round(x-turtle_pos[0],8)==0 and round(y-turtle_pos[1],8)==0:
return 0
else:
ang=atan2(y-turtle_pos[1],x-turtle_pos[0])*180/pi
if ang>=0:
return (ang)
else:
return (360+ang)
def up():
penup()
def width(n=None):
return pensize(n)
def write(text):
_refresh_turtle()
xpixel=int(round(turtle_pos[0]+192))
ypixel=int(round(-turtle_pos[1]+96))
c=(int(turtle_color[0]*255), int(turtle_color[1]*255),int(turtle_color[2]*255))
casioplot.draw_string(xpixel,ypixel,str(text),c,"small")
casioplot.show_screen()
def xcor():
return round(turtle_pos[0],6)
def ycor():
return round(turtle_pos[1],6)
Nous avions remarqué un petit écart avec la fonction
turtle.write()
, cette dernière écrivant le texte fourni dans un rectangle dont la tortue occupe le sommet supérieur gauche, alors que dans le standard c'est le sommet inférieur gauche. Vérifions :ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
|
Non finalement pas de changement ici, mais vu en comparaison les énormes écarts que se permettent d'autres plateformes on peut bien passer l'éponge cette fois-ci.
Autre chose que nous avions remarqué, un petit
bug
au niveau de la fonction turtle.pensize()
qui semblait inopérante :ordi | Graph 90+E Graph 35+E II | NumWorks | TI-83 Premium CE TI-84 Plus CE | |
![]() | ![]() ![]() | ![]() | ![]() | ![]() |
5) Python et matplotlib.pyplot
Go to topIci aussi

Ce choix de passer par un script
Gros changement en conséquence sur les modèles français 
Il devient donc à la fois :
A noter que cette amélioration semble ici encore ne concerner que les modèles français. La 
Sur ces modèles il faudra donc continuer à passer par les scripts additionnels que nous te lierons en fin d'article, scripts qui seront inutilisables en mode examen.
Casio France
diffusait depuis la dernière mise à jour un script matplotl.py
, une réécriture complète en Python
du module de tracés par coordonnées matplotl.pyplot
standard.

matplotl.py
additionnel avait ici encore plusieurs inconvénients majeurs :- matplotl.pyne venait pas avec les mises à jour et devait donc être ajouté manuellement dans la calculatrice
- Les fonctions du module matplotln'étaient pas listées au catalogue ; elles devaient donc être connues et saisies manuellement caractère par caractère
- Comme tout fichier additionnel, matplot.pyétait de plus inutilisable en mode examen.
- La calculatrice ne gérant que partiellement les noms de fichiers longs, le fichier de script correspondant avait donc été nommé matplotl.pyet nonmatplotlib.pyplot.pyafin de respecter la limitation à 8 caractères, ce qui introduisait donc une incompatibilté avec les scripts conçus pour le standardmatplotlib.pyplot.
La compatibilité avec des scripts conçus pour d'autres plateformes nécessitait un léger effort, quelques lignes d'importation spécifiques en début de script :- Code: Select all
try: from matplotlib.pyplot import *
except ImportError: from matplotl import *

Graph 90+E
et Graph 35+E II
avec la dernière version, le module est désormais directement intégré au système et de plus renommé correctement en matplotlib.pyplot
! 
Il devient donc à la fois :
- disponible immédiatement
- décrit au catalogue
- utilisable en mode examen
- directement utilisable avec les scripts matplotlib.pyplotconçus pour d'autres plateformes, même plus besoin de modifier les lignes d'importation
fx-9750GIII
mise à jour ne bénéficie pas de cette amélioration, et même si nous n'en disposons pas c'est probablement pareil sur les autres modèles internationaux fx-9860GIII
et fx-CG50
. 
Sur ces modèles il faudra donc continuer à passer par les scripts additionnels que nous te lierons en fin d'article, scripts qui seront inutilisables en mode examen.
6) Exemples matplotlib.pyplot
Go to topPour une réécriture intégrale, observons ici encore la remarquable compatibilité avec le standard
Comme tu peux le noter, les
matplotlib.pyplot
de l'ordinateur, ainsi que ce que donnent les implémentations concurrentes :ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|
ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|
Comme tu peux le noter, les
Graph 90+E
et Graph 35+E II
comptent ici encore parmi les meilleures solutions du point de vue de la compatibilité avec le standard matplotlib.pyplot
, pas d'écart sur ces exemples contrairement à certaines solutions concurrentes ! 
7) Nouveautés matplotlib.pyplot
Go to topLe module
Donc quelles nouveautés dans tout ça ? Revenons sur le tracé de diagrammes en boîte à l'aide de la fonction

Petit problème concernant donc la fonction
Afin d'y remédier,
On pouvait toutefois regretter un écart par rapport au standard.
Dans le nouveau
L'appel équivalent à
Nous avons donc vu plus haut le diagramme en barres à l'aide de la fonction

Si tu regardes bien, tu noteras que la fonction
Et bien nouvel effort remarquable de
Autre ajout, la fonction
Peut-être serait-il bon de remplir les barres afin d'en faciliter la lecture graphique, notamment sur
Nous avons également plusieurs corrections de
Intéressons-nous à la fonction

Toutefois,
Ce n'est pas le plus embêtant, nous allons y venir, mais cet ajout est assez gourmand en temps d'exécution. Le tracé de notre exemple de vecteur nécessite dans les avec l'ancien additionnel, et désormais
Nous avions déjà noté plusieurs bugs concernant la fonction

Quelque chose de bien embêtant par contre, et que ce changement sur
Réduisons progressivement le pas angulaire dans notre appel de
Et puis soudainement avec 11 pour le tracé d'un champ de 32 vecteurs, ça ne marche plus avec le nouveau
Un champ d'une 30aine de vecteurs, ce n'est pas inimaginable en Physique-Chimie, c'est bien embêtant.
Et ce n'est pas juste une légère variation de la limite, avec l'ancien
Mais que se passe-t-il ?
Selon notre analyse
Tous nos appels rajoutent à des listes globales de primitives à tracer
Et avec le nouveau
Or comme
matplotlib.pyplot
intégré est toujours écrit en Python
, son code étant lisible en clair en mémoire. Et il s'agit surtout d'une nouvelle version par rapport à celle sortie au printemps dernier, une mise à jour assez majeure selon toutes les différences ci-dessous :- Code: Select all
import casioplot as plt
limits=[40,165,384,0]
fenetre=[0,1,0,1]
points=[[]]
lines=[[]]
textes=[[]]
xmin,xmax,ymin,ymax=0,1,0,1
win_scaling='init'
axis_display='on'
color_auto=['b','r','g','k','m','c','y']
color_count=0
def axis(*L):
global fenetre,win_scaling,axis_display
if L==():
if win_scaling=='auto':
if xmin==xmax:
if xmin==0:
fenetre[0:2]=[-0.05,0.05]
else:
fenetre[0:2]=[0.95*xmin,1.05*xmin]
else:
fenetre[0:2]=[xmin-0.05*(xmax-xmin),xmax+0.05*(xmax-xmin)]
if ymin==ymax:
if ymin==0:
fenetre[2:4]=[-0.05,0.05]
else:
fenetre[2:4]=[0.95*ymin,1.05*ymin]
else:
fenetre[2:4]=[ymin-0.05*(ymax-ymin),ymax+0.05*(ymax-ymin)]
return fenetre
elif isinstance(L[0],(list,tuple)) and len(L[0])==4:
fenetre=list(L[0])
if fenetre[0]==fenetre[1]:
if fenetre[0]==0:
fenetre[0:2]=[-0.05,0.05]
else:
fenetre[0:2]=[0.95*fenetre[0],1.05*fenetre[0]]
raise Exception('Userwarning: attempting to set identical bottom == top in function axis(); automatically expanding.')
if fenetre[2]==fenetre[3]:
if fenetre[2]==0:
fenetre[2:4]=[-0.05,0.05]
else:
fenetre[2:4]=[0.95*fenetre[2],1.05*fenetre[2]]
raise Exception('Userwarning: attempting to set identical bottom == top in function axis(); automatically expanding.')
win_scaling='fixed'
axis_display='on'
return fenetre
elif L[0]=='off':
axis_display='off'
elif L[0]=='on':
axis_display='on'
elif L[0]=='auto':
win_scaling='auto'
if xmin==xmax:
if xmin==0:
fenetre[0:2]=[-0.05,0.05]
else:
fenetre[0:2]=[0.95*xmin,1.05*xmin]
else:
fenetre[0:2]=[xmin-0.05*(xmax-xmin),xmax+0.05*(xmax-xmin)]
if ymin==ymax:
if ymin==0:
fenetre[2:4]=[-0.05,0.05]
else:
fenetre[2:4]=[0.95*ymin,1.05*ymin]
else:
fenetre[2:4]=[ymin-0.05*(ymax-ymin),ymax+0.05*(ymax-ymin)]
return fenetre
else:
raise Exception('function axis() : error using arguments')
def text(x,y,txt):
global textes
if textes==[[]]:
textes[0]=[x,y,txt]
else:
if [x,y,txt] not in textes :
textes+=[[x,y,txt]]
def plot(*L,**kwargs):
global color_count,win_scaling
# if len(L)==2:
# L=([list(L[0]),list(L[1])])
def plotpoint(x,y,c):
global points,xmin,xmax,ymin,ymax
if points==[[]]:
points[0]=[x,y,c]
xmin=xmax=x
ymin=ymax=y
else:
if [x,y,c] not in points :
points+=[[x,y,c]]
xmin=min(x,xmin)
xmax=max(x,xmax)
ymin=min(y,ymin)
ymax=max(y,ymax)
def plotline(x1,y1,x2,y2,c):
global lines,xmin,xmax,ymin,ymax
if lines==[[]]:
lines[0]=[x1,y1,x2,y2,c]
xmin=min(x1,x2)
xmax=max(x1,x2)
ymin=min(y1,y2)
ymax=max(y1,y2)
else:
if [x1,y1,x2,y2,c] not in lines :
lines+=[[x1,y1,x2,y2,c]]
xmin=min(x1,x2,xmin)
xmax=max(x1,x2,xmax)
ymin=min(y1,y2,ymin)
ymax=max(y1,y2,ymax)
color=kwargs.get('color',None)
if color!=None and not color in ['b','r','g','k','m','c','y','w','blue','red','green','black','magenta','cyan','yellow','white']:
raise ValueError('function plot() : unknown color code')
if len(L)==2 and isinstance(L[0],(int,float)) and isinstance(L[1],(int,float)):
plotpoint(L[0],L[1],color)
if win_scaling=='init':
win_scaling='auto'
elif len(L)==2 and isinstance(L[0],(list,tuple)) and isinstance(L[1],(list,tuple)):
if (len(L[0])==len(L[1])):
if color==None:
color=color_auto[color_count%7]
color_count+=1
for i in range(len(L[0])-1):
plotline(L[0][i],L[1][i],L[0][i+1],L[1][i+1],color)
if win_scaling=='init':
win_scaling='auto'
else:
raise ValueError('function plot() : x and y must have same dimension')
elif len(L)==1 and isinstance(L[0],(list,tuple)):
if color==None:
color=color_auto[color_count%7]
color_count+=1
for i in range(len(L[0])-1):
plotline(i,L[0][i],i+1,L[0][i+1],color)
if win_scaling=='init':
win_scaling='auto'
elif len(L)==3 and isinstance(L[0],(int,float)) and isinstance(L[1],(int,float)) and isinstance(L[2],(str)):
color=L[2]
if (len(color)==2 and color[0] in ['b','r','g','k','m','c','y','w']) and color[1] in ['o','.','+','*','-']:
plotpoint(L[0],L[1],color[0])
if win_scaling=='init':
win_scaling='auto'
elif color in ['b','r','g','k','m','c','y','w','blue','red','green','black','magenta','cyan','yellow','white']:
plotpoint(L[0],L[1],color)
if win_scaling=='init':
win_scaling='auto'
elif color in ['o','.','+','*','-']:
color=color_auto[color_count%7]
color_count+=1
plotpoint(L[0],L[1],color)
if win_scaling=='init':
win_scaling='auto'
else:
raise ValueError('function plot() : available color codes are b,r,g,k,m,c,y,w')
elif len(L)==3 and isinstance(L[0],(list,tuple)) and isinstance(L[1],(list,tuple)) and isinstance(L[2],(str)):
if (len(L[0])==len(L[1])):
color=L[2]
if (len(color)==2 and color[0] in ['b','r','g','k','m','c','y','w']) and color[1] in ['o','.','+','*','-']:
for i in range(len(L[0])-1):
plotline(L[0][i],L[1][i],L[0][i+1],L[1][i+1],color[0])
if win_scaling=='init':
win_scaling='auto'
elif color in ['b','r','g','k','m','c','y','w','blue','red','green','black','magenta','cyan','yellow','white']:
for i in range(len(L[0])-1):
plotline(L[0][i],L[1][i],L[0][i+1],L[1][i+1],color)
if win_scaling=='init':
win_scaling='auto'
elif color in ['o','.','+','*','-']:
color=color_auto[color_count%7]
color_count+=1
for i in range(len(L[0])-1):
plotline(L[0][i],L[1][i],L[0][i+1],L[1][i+1],color)
if win_scaling=='init':
win_scaling='auto'
else:
raise ValueError('function plot() : available color codes are b,r,g,k,m,c,y,w')
else:
raise ValueError('function plot() : x and y must have same dimension')
elif len(L)==2 and isinstance(L[0],(list,tuple)) and isinstance(L[1],(str)):
color=L[1]
if (len(color)==2 and color[0] in ['b','r','g','k','m','c','y','w']) and color[1] in ['o','.','+','*','-']:
for i in range(len(L[0])-1):
plotline(i,L[0][i],i+1,L[0][i+1],color[0])
if win_scaling=='init':
win_scaling='auto'
elif color in ['b','r','g','k','m','c','y','w','blue','red','green','black','magenta','cyan','yellow','white']:
for i in range(len(L[0])-1):
plotline(i,L[0][i],i+1,L[0][i+1],color)
if win_scaling=='init':
win_scaling='auto'
elif color in ['o','.','+','*','-']:
color=color_auto[color_count%7]
color_count+=1
for i in range(len(L[0])-1):
plotline(i,L[0][i],i+1,L[0][i+1],color)
if win_scaling=='init':
win_scaling='auto'
else:
raise ValueError('function plot() : available color codes are b,r,g,k,m,c,y,w')
else:
raise Exception('function plot() : error using arguments')
def show():
global fenetre, limits, points, lines, textes, xmin, ymin, xmax, ymax, win_scaling, axis_display, color_count
def RGB(c):
if c=="k" or c=="black":
return (0,0,0)
elif c=="b" or c=="blue":
return (0,0,255)
elif c=="g" or c=="green":
return (0,255,0)
elif c=="r" or c=="red":
return (255,0,0)
elif c=="c" or c=="cyan":
return (0,255,255)
elif c=="y" or c=="yellow":
return (255,255,0)
elif c=="m" or c=="magenta":
return (255,0,255)
elif c=="w" or c=="white":
return (255,255,255)
else:
raise ValueError("invalid color code")
def printable(x,y):
global limits
return(limits[0]<=x<=limits[2] and limits[3]<=y<=limits[1])
def echelle(a,b):
k=0
e=abs(b-a)
while e>=10 :
e/=10
k+=1
while e<1 :
e*=10
k-=1
return k
def pas(a,b):
pas=10**echelle(a,b)
while (abs(b-a))//pas<4:
pas/=2
return pas
def converttopixel(x,y):
global fenetre,limits
ax=(limits[2]-limits[0])/(fenetre[1]-fenetre[0])
bx=limits[0]-ax*fenetre[0]
xpixel=round(ax*x+bx)
ay=(limits[3]-limits[1])/(fenetre[3]-fenetre[2])
by=limits[1]-ay*fenetre[2]
ypixel=round(ay*y+by)
return xpixel,ypixel
color_count=0
plt.clear_screen()
if win_scaling=='auto':
if xmin==xmax:
if xmin==0:
fenetre[0:2]=[-0.05,0.05]
else:
fenetre[0:2]=[0.95*xmin,1.05*xmin]
else:
fenetre[0:2]=[xmin-0.05*(xmax-xmin),xmax+0.05*(xmax-xmin)]
if ymin==ymax:
if ymin==0:
fenetre[2:4]=[-0.05,0.05]
else:
fenetre[2:4]=[0.95*ymin,1.05*ymin]
else:
fenetre[2:4]=[ymin-0.05*(ymax-ymin),ymax+0.05*(ymax-ymin)]
if axis_display=='on' or axis_display=='boxplot':
for i in range(limits[0],limits[2]+1):
plt.set_pixel(i,limits[1],RGB("k"))
for j in range(limits[3],limits[1]+1):
plt.set_pixel(limits[0],j,RGB("k"))
fenetreb=sorted([fenetre[0],fenetre[1]])+sorted([fenetre[2],fenetre[3]])
gx=round(fenetreb[0],-echelle(fenetreb[0],fenetreb[1]))
gy=round(fenetreb[2],-echelle(fenetreb[2],fenetreb[3]))
if axis_display=='boxplot':
for i in range(nbre_boite):
y=fenetre[2]
xpixel,ypixel=converttopixel(i+1,y)
plt.set_pixel(xpixel,ypixel+1,RGB("k"))
plt.set_pixel(xpixel,ypixel+2,RGB("k"))
plt.set_pixel(xpixel,ypixel+3,RGB("k"))
plt.draw_string(xpixel,ypixel+13,str(round(i+1,8)),[0,0,0],"small")
else :
for i in range(-11,11):
x=gx+i*pas(fenetreb[0],fenetreb[1])
y=fenetre[2]
xpixel,ypixel=converttopixel(x,y)
if printable(xpixel,ypixel):
plt.set_pixel(xpixel,ypixel+1,RGB("k"))
plt.set_pixel(xpixel,ypixel+2,RGB("k"))
plt.set_pixel(xpixel,ypixel+3,RGB("k"))
plt.draw_string(xpixel,ypixel+13,str(round(x,8)),[0,0,0],"small")
for j in range(-11,11):
x=fenetre[0]
y=gy+j*pas(fenetreb[2],fenetreb[3])
xpixel,ypixel=converttopixel(x,y)
if printable(xpixel,ypixel):
plt.set_pixel(xpixel-1,ypixel,RGB("k"))
plt.set_pixel(xpixel-2,ypixel,RGB("k"))
plt.set_pixel(xpixel-3,ypixel,RGB("k"))
plt.draw_string(xpixel-40,ypixel,str(round(y,8)),[0,0,0],"small")
if points!=[[]]:
if points[0]==[]:
del points[0]
for i in range(len(points)):
xpixel,ypixel=converttopixel(points[i][0],points[i][1])
if printable(xpixel,ypixel) and points[i][2]!=None:
for j in range(-2,3):
plt.set_pixel(xpixel+j,ypixel,RGB(points[i][2]))
plt.set_pixel(xpixel,ypixel+j,RGB(points[i][2]))
if textes!=[[]]:
if textes[0]==[]:
del textes[0]
for i in range(len(textes)):
xpixel,ypixel=converttopixel(textes[i][0],textes[i][1])
if printable(xpixel,ypixel):
plt.draw_string(xpixel,ypixel,textes[i][2],[0,0,0],"small")
if lines!=[[]]:
if lines[0]==[]:
del lines[0]
for i in range(len(lines)):
xpixel1,ypixel1=converttopixel(lines[i][0],lines[i][1])
xpixel2,ypixel2=converttopixel(lines[i][2],lines[i][3])
deltax=abs(xpixel2-xpixel1)
deltay=abs(ypixel2-ypixel1)
if deltax==deltay==0:
if printable(xpixel1,ypixel1):
plt.set_pixel(xpixel1,ypixel1,RGB(lines[i][4]))
if deltax<=1 and deltay<=1:
if printable(xpixel1,ypixel1):
plt.set_pixel(xpixel1,ypixel1,RGB(lines[i][4]))
plt.set_pixel(xpixel2,ypixel2,RGB(lines[i][4]))
if deltax>=deltay and deltax!=0:
m=(ypixel2-ypixel1)/(xpixel2-xpixel1)
p=ypixel1-m*xpixel1
xpixelmin=max(limits[0],min(xpixel1,xpixel2))
xpixelmax=min(limits[2],max(xpixel1,xpixel2))
if xpixelmin<=limits[2] and xpixelmax>=limits[0]:
for xpixel in range(xpixelmin,xpixelmax+1):
ypixel=round(m*xpixel+p)
if printable(xpixel,ypixel):
plt.set_pixel(xpixel,ypixel,RGB(lines[i][4]))
if deltay>deltax:
m=(xpixel2-xpixel1)/(ypixel2-ypixel1)
p=xpixel1-m*ypixel1
ypixelmin=max(limits[3],min(ypixel1,ypixel2))
ypixelmax=min(limits[1],max(ypixel1,ypixel2))
if ypixelmin<=limits[1] and ypixelmax>=limits[3]:
for ypixel in range(ypixelmin,ypixelmax+1):
xpixel=round(m*ypixel+p)
if printable(xpixel,ypixel):
plt.set_pixel(xpixel,ypixel,RGB(lines[i][4]))
axis([limits[0]-50,limits[2],limits[1]+50,limits[3]])
axis("off")
plt.show_screen()
points=[[]]
lines=[[]]
textes=[[]]
xmin,xmax,ymin,ymax=0,1,0,1
fenetre=[0,1,0,1]
axis_display='on'
win_scaling='init'
color_count=0
def bar(val,eff,lar=0.8):
val=list(val)
eff=list(eff)
global color_count
if isinstance(val,(list,tuple)) and isinstance(eff,(list,tuple)):
if len(val)==len(eff):
for i in range(len(val)):
plot([val[i]-lar/2,val[i]-lar/2],[0,eff[i]],color_auto[color_count%7])
plot([val[i]+lar/2,val[i]+lar/2],[0,eff[i]],color_auto[color_count%7])
plot([val[i]-lar/2,val[i]+lar/2],[eff[i],eff[i]],color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function bar() : lists must have same dimension')
elif isinstance(val,(int,float)) and isinstance(eff,(int,float)):
for i in range(len(val)):
plot([val[i]-lar/2,val[i]-lar/2],[0,eff[i]],color_auto[color_count%7])
plot([val[i]+lar/2,val[i]+lar/2],[0,eff[i]],color_auto[color_count%7])
plot([val[i]-lar/2,val[i]+lar/2],[eff[i],eff[i]],color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function bar() : error using arguments or arguments not available in this version')
def scatter(xlist,ylist):
xlist=list(xlist)
ylist=list(ylist)
global color_count
if isinstance(xlist,(list,tuple)) and isinstance(ylist,(list,tuple)):
if len(xlist)==len(ylist):
for i in range(len(xlist)):
plot(xlist[i],ylist[i],color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function scatter() : x and y must have same dimension')
elif isinstance(xlist,(int,float)) and isinstance(ylist,(int,float)):
plot(xlist,ylist,color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function scatter() : error using arguments or arguments not available in this version')
def boxplotFR(L):
L=list(L)
global fenetre,color_count,nbre_boite, axis_display,win_scaling
print("boxplotFR:definition \nfrancaise du \ndiagramme en boite")
axis_display='boxplot'
n=len(L)
if type(L[0])==int or type(L[0])==float:
n=1
nbre_boite=n
largeur=0.3/n
def mediane(l):
l=sorted(l)
r=len(l)
if r%2==0:
return (l[r//2]+l[r//2-1])/2
else:
return l[r//2]
def quartiles(l):
l=sorted(l)
r=len(l)
return (l[r//4],l[(3*r)//4])
def deciles(l):
l=sorted(l)
r=len(l)
return (l[r//10],l[(9*r)//10])
for i in range(n):
if n==1:
if type(L[0])==int or type(L[0])==float:
K=L
else:
K=L[0]
else :
K=L[i]
if type(K)==int or type(K)==float:
plot([i+1-largeur,i+1+largeur],[K,K],'r')
elif type(K[0])==int or type(K[0])==float:
K=sorted(K)
p=len(K)
Q1=quartiles(K)[0]
Q3=quartiles(K)[1]
D1=deciles(K)[0]
D9=deciles(K)[1]
plot([i+1-largeur,i+1+largeur,i+1+largeur,i+1-largeur,i+1-largeur],[Q1,Q1,Q3,Q3,Q1],'k')
plot([i+1,i+1],[Q1,D1],'k')
plot([i+1,i+1],[Q3,D9],'k')
plot([i+1-largeur/2,i+1+largeur/2],[D1,D1],'k')
plot([i+1-largeur/2,i+1+largeur/2],[D9,D9],'k')
plot(i+1,K[0],'k')
plot(i+1,K[p-1],'k')
plot([i+1-largeur,i+1+largeur],[mediane(K),mediane(K)],'r')
elif type(min(L[0]))!=int and type(min(L[0]))!=float:
raise ValueError('wrong type of argument')
if type(L[0])==int or type(L[0])==float:
fenetre=[0,2,min(L)-1,max(L)+1]
Max=max(L)
else:
Min=min(L[0])
Max=max(L[0])
for i in range(len(L)):
if type(L[i])==int or type(L[i])==float:
if L[i]<Min:
Min=L[i]
if L[i]>Max:
Max=L[i]
else:
if min(L[i])<Min:
Min=min(L[i])
if max(L[i])>Max:
Max=max(L[i])
fenetre=[0,len(L)+1,Min-1,Max+1]
win_scaling='fixed'
text(len(L)+1/4,Max+1/2,"boxplotFR")
def boxplot(L,**kwargs):
L=list(L)
global fenetre,color_count,nbre_boite, axis_display,win_scaling
whis=kwargs.get('whis',1.5)
axis_display='boxplot'
n=len(L)
if type(L[0])==int or type(L[0])==float:
n=1
nbre_boite=n
largeur=0.3/n
def mediane(l):
r=1
if type(l)!=int and type(l)!=float:
l=sorted(l)
r=len(l)
if r%2==0 and r//2>0:
return (l[r//2]+l[r//2-1])/2,l[:r//2],l[r//2:]
else:
return l[r//2],l[:r//2],l[r//2+1:]
return l,l,l
if type(L[0])==int or type(L[0])==float:
if min(L)==max(L):
ampl=1
else:
ampl=max(L)-min(L)
fenetre=[0,2,min(L)-ampl/20,max(L)+ampl/20]
else:
Min=min(L[0])
Max=max(L[0])
for i in range(len(L)):
if type(L[i])==int or type(L[i])==float:
if L[i]<Min:
Min=L[i]
if L[i]>Max:
Max=L[i]
else:
if min(L[i])<Min:
Min=min(L[i])
if max(L[i])>Max:
Max=max(L[i])
if Min==Max:
ampl=1
else:
ampl=Max-Min
fenetre=[0,len(L)+1,Min-ampl/20,Max+ampl/20]
win_scaling='fixed'
for i in range(n):
if n==1:
if type(L[0])==int or type(L[0])==float:
K=L
else:
K=L[0]
else :
K=L[i]
if type(K)==int or type(K)==float:
plot([i+1-largeur,i+1+largeur],[K,K],'r')
elif type(K[0])==int or type(K[0])==float:
K=sorted(K)
p=len(K)
Q1,Q3=mediane(mediane(K)[1])[0],mediane(mediane(K)[2])[0]
down=0
if Q1-whis*(Q3-Q1)<=K[0]:
down=0
else :
while Q1-whis*(Q3-Q1)>K[down]:
down+=1
up=p-1
if Q3+whis*(Q3-Q1)>=K[p-1]:
up=p-1
else :
while Q3+whis*(Q3-Q1)<K[up]:
up-=1
plot([i+1-largeur,i+1+largeur,i+1+largeur,i+1-largeur,i+1-largeur],[Q1,Q1,Q3,Q3,Q1],'k')
plot([i+1,i+1],[Q1,K[down]],'k')
plot([i+1,i+1],[Q3,K[up]],'k')
plot([i+1-largeur/2,i+1+largeur/2],[K[down],K[down]],'k')
plot([i+1-largeur/2,i+1+largeur/2],[K[up],K[up]],'k')
from math import pi
from math import cos
from math import sin
if down>0:
for t in range(down):
x=[i+1+0.05*(fenetre[1])/3*cos(2*j*pi/50) for j in range(50)]
y=[K[t]+0.05*(fenetre[3]-fenetre[2])/3*sin(2*j*pi/50) for j in range(50)]
plot(x,y,'k')
if up<p-1:
for t in range(p-1-up):
x=[i+1+0.05*(fenetre[1])/3*cos(2*j*pi/50) for j in range(50)]
y=[K[p-1-t]+0.05*(fenetre[3]-fenetre[2])/3*sin(2*j*pi/50) for j in range(50)]
plot(x,y,'k')
plot([i+1-largeur,i+1+largeur],[mediane(K)[0],mediane(K)[0]],'r')
elif type(min(L[0]))!=int and type(min(L[0]))!=float:
raise ValueError('wrong type of argument')
def arrow(x,y,dx,dy,**kwargs):
global win_scaling
a=x+dx
b=y+dy
win_scaling='fixed'
color=kwargs.get('ec','k')
color=kwargs.get('edgecolor',color)
headcolor=kwargs.get('fc',color)
headcolor=kwargs.get('facecolor',headcolor)
L=kwargs.get('head_width',0.003)
l=kwargs.get('head_length',1.5*L)
plot((x,a),(y,b),color)
def resol(A,B,C):
D=B**2-4*A*C
if D>0:
return((-B-D**0.5)/(2*A),(-B+D**0.5)/(2*A))
if dx==0:
if dy>=0:
c=1
else:
c=-1
plot((a-L/2,a+L/2,a,a-L/2),(b,b,b+c*l,b),color)
elif dy==0:
if dx>=0:
c=1
else:
c=-1
plot((a,a,a+c*l,a),(b-L/2,b+L/2,b,b-L/2),color)
else:
m=dy/dx
p=y-m*x
S=resol(m**2+1,2*(-a-b*m+m*p),p**2+a**2+b**2-l**2-2*b*p)
if S[0]*dx<0:
X=S[0]
else:
X=S[1]
Y=m*X+p
k=b+a/m
T=resol(1+1/m**2,2*(-a-k/m+b/m),a**2+k**2-2*b*k+b**2-(L**2)/4)
plot((T[0],T[1],X,T[0]),(-T[0]/m+k,-T[1]/m+k,Y,-T[0]/m+k),headcolor)
- Code: Select all
import casioplot as plt
limits=[40,165,384,0]
fenetre=[0,1,0,1]
points=[[]]
lines=[[]]
textes=[[]]
extrem=[0,1,0,1]
win_scaling='init'
axis_display='on'
color_auto=['b','r','g','m','k','c','y']
color_count=0
grid_display='off'
color_grid='grey'
available_colors=['b','r','g','k','m','c','y','w','blue','red','green','black','magenta','cyan','yellow','white','grey','orange','purple','brown','pink']
def axis(*L):
global fenetre,win_scaling,axis_display
if len(L)==1 and L[0]=='auto':
win_scaling='auto'
if L==() or L[0]=='auto':
if win_scaling=='auto':
for i in [0,2]:
if extrem[i]==extrem[i+1]:
if extrem[i]==0:
fenetre[i:i+2]=[-0.05,0.05]
else:
fenetre[i:i+2]=[extrem[i]-0.05*abs(extrem[i]),extrem[i]+0.05*abs(extrem[i])]
else:
fenetre[i:i+2]=[1.05*extrem[i]-0.05*extrem[i+1],1.05*extrem[i+1]-0.05*extrem[i]]
return fenetre
elif isinstance(L[0],(list,tuple)) and len(L[0])==4:
fenetre=list(L[0])
if fenetre[0]==fenetre[1]:
if fenetre[0]==0:
fenetre[0:2]=[-0.05,0.05]
else:
fenetre[0:2]=[0.95*fenetre[0],1.05*fenetre[0]]
print('Userwarning: attempting to set identical bottom == top in function axis(); automatically expanding.')
if fenetre[2]==fenetre[3]:
if fenetre[2]==0:
fenetre[2:4]=[-0.05,0.05]
else:
fenetre[2:4]=[0.95*fenetre[2],1.05*fenetre[2]]
print('Userwarning: attempting to set identical bottom == top in function axis(); automatically expanding.')
win_scaling='fixed'
axis_display='on'
return fenetre
elif L[0]=='off':
axis_display='off'
elif L[0]=='on':
axis_display='on'
else:
raise Exception('function axis() : error using arguments')
def text(x,y,txt):
global textes
txt=str(txt)
if textes==[[]]:
textes[0]=[x,y,txt]
else:
if [x,y,txt] not in textes :
textes+=[[x,y,txt]]
def plot(*L,**kwargs):
global color_count,win_scaling
def plotpoint(x,y,c):
global points,extrem,win_scaling
if points==[[]] and lines==[[]]:
points[0]=[x,y,c]
extrem=[x,x,y,y]
else:
if [x,y,c] not in points :
points+=[[x,y,c]]
extrem=[min(x,extrem[0]),max(x,extrem[1]),min(y,extrem[2]),max(y,extrem[3])]
if win_scaling=='init':
win_scaling='auto'
def plotline(x1,y1,x2,y2,c):
global lines,extrem,win_scaling
if lines==[[]] and points==[[]]:
lines[0]=[x1,y1,x2,y2,c]
extrem=[min(x1,x2),max(x1,x2),min(y1,y2),max(y1,y2)]
else:
if [x1,y1,x2,y2,c] not in lines :
lines+=[[x1,y1,x2,y2,c]]
extrem=[min(x1,x2,extrem[0]),max(x1,x2,extrem[1]),min(y1,y2,extrem[2]),max(y1,y2,extrem[3])]
if win_scaling=='init':
win_scaling='auto'
def auto(c):
global color_count
if (c != None and len(c)==2 and c[0] in available_colors and c[1] in ['o','.','+','*','-']):
c=c[0]
if c in [None,'o','.','+','*','-']:
color=color_auto[color_count%7]
color_count+=1
return color
else:
return c
def testcolor(c):
if (len(c)==2 and c[0] in available_colors and c[1] in ['o','.','+','*','-']) or (c in available_colors+['o','.','+','*','-']) :
return True
else:
raise ValueError('function plot() : unknown color code')
color=kwargs.get('color',None)
if color!=None and not color in available_colors:
raise ValueError('function plot() : unknown color code')
if len(L)==2 and isinstance(L[0],(int,float)) and isinstance(L[1],(int,float)):
plotpoint(L[0],L[1],auto(color))
elif len(L)==2 and isinstance(L[0],(list,tuple)) and isinstance(L[1],(list,tuple)):
if (len(L[0])==len(L[1])):
c=auto(color)
for i in range(len(L[0])-1):
plotline(L[0][i],L[1][i],L[0][i+1],L[1][i+1],c)
else:
raise ValueError('function plot() : x and y must have same dimension')
elif len(L)==1 and isinstance(L[0],(list,tuple)):
c=auto(color)
for i in range(len(L[0])-1):
plotline(i,L[0][i],i+1,L[0][i+1],c)
elif len(L)==3 and isinstance(L[0],(int,float)) and isinstance(L[1],(int,float)) and isinstance(L[2],(str)):
if testcolor(L[2])==True:
plotpoint(L[0],L[1],auto(L[2]))
elif len(L)==3 and isinstance(L[0],(list,tuple)) and isinstance(L[1],(list,tuple)) and isinstance(L[2],(str)):
if (len(L[0])==len(L[1])):
if testcolor(L[2])==True :
c=auto(L[2])
for i in range(len(L[0])-1):
plotline(L[0][i],L[1][i],L[0][i+1],L[1][i+1],c)
else:
raise ValueError('function plot() : x and y must have same dimension')
elif len(L)==2 and isinstance(L[0],(list,tuple)) and isinstance(L[1],(str)):
if testcolor(L[1])==True :
c=auto(L[1])
for i in range(len(L[0])-1):
plotline(i,L[0][i],i+1,L[0][i+1],c)
else:
raise Exception('function plot() : error using arguments')
def show():
global fenetre, limits, points, lines, textes, extrem, win_scaling, axis_display, color_count, color_grid, grid_display
def RGB(c):
colornames={"black":(0,0,0),"k":(0,0,0),"blue":(0,0,255),"b":(0,0,255),"green":(0,255,0),"g":(0,255,0),"red":(255,0,0),"r":(255,0,0),"cyan":(0,255,255),"c":(0,255,255),"yellow":(255,255,0),"y":(255,255,0),"magenta":(255,0,255),"m":(255,0,255),"white":(255,255,255),"w":(255,255,255),"orange":(255,166,0),"purple":(128,0,128),"brown":(166,42,42),"pink":(255,192,202),"grey":(215,215,215)}
if c in colornames:
return colornames[c]
else:
raise ValueError("invalid color code")
def printable(X):
global limits
return(limits[0]<=X[0]<=limits[2] and limits[3]<=X[1]<=limits[1])
def echelle(a,b):
k=0
e=abs(b-a)
while e>=10 :
e/=10
k+=1
while e<1 :
e*=10
k-=1
return k
def pas(a,b):
pas=10**echelle(a,b)
while (abs(b-a))//pas<4:
pas/=2
return pas
def converttopixel(X):
global fenetre,limits
ax=(limits[2]-limits[0])/(fenetre[1]-fenetre[0])
bx=limits[0]-ax*fenetre[0]
xpixel=round(ax*X[0]+bx)
ay=(limits[3]-limits[1])/(fenetre[3]-fenetre[2])
by=limits[1]-ay*fenetre[2]
ypixel=round(ay*X[1]+by)
return [xpixel,ypixel]
color_count=0
plt.clear_screen()
if win_scaling=='auto':
for i in [0,2]:
if extrem[i]==extrem[i+1]:
if extrem[i]==0:
fenetre[i:i+2]=[-0.05,0.05]
else:
fenetre[i:i+2]=[extrem[i]-0.05*abs(extrem[i]),extrem[i]+0.05*abs(extrem[i])]
else:
fenetre[i:i+2]=[1.05*extrem[i]-0.05*extrem[i+1],1.05*extrem[i+1]-0.05*extrem[i]]
if axis_display=='on' or axis_display=='boxplot':
for i in range(limits[0],limits[2]+1):
plt.set_pixel(i,limits[1],RGB("k"))
for j in range(limits[3],limits[1]+1):
plt.set_pixel(limits[0],j,RGB("k"))
fenetreb=sorted([fenetre[0],fenetre[1]])+sorted([fenetre[2],fenetre[3]])
pasx=pas(fenetreb[0],fenetreb[1])
pasy=pas(fenetreb[2],fenetreb[3])
gx=round(fenetreb[0],-echelle(fenetreb[0],fenetreb[1]))
gy=round(fenetreb[2],-echelle(fenetreb[2],fenetreb[3]))
if axis_display=='boxplot':
for i in range(nbre_boite):
pix=converttopixel((i+1,fenetre[2]))
plt.set_pixel(pix[0],pix[1]+1,RGB("k"))
plt.set_pixel(pix[0],pix[1]+2,RGB("k"))
plt.set_pixel(pix[0],pix[1]+3,RGB("k"))
plt.draw_string(pix[0],pix[1]+13,str(i+1),[0,0,0],"small")
else :
for i in range(-10,10):
x=gx+i*pasx
pix=converttopixel((x,fenetre[2]))
if printable(pix):
plt.set_pixel(pix[0],pix[1]+1,RGB("k"))
plt.set_pixel(pix[0],pix[1]+2,RGB("k"))
plt.set_pixel(pix[0],pix[1]+3,RGB("k"))
plt.set_pixel(pix[0],pix[1]+1,(1,1,1))
if grid_display=='on':
for z in range(1,165):
if pix[0]!=limits[0]:
plt.set_pixel(pix[0],pix[1]-z,RGB(color_grid))
plt.draw_string(pix[0],pix[1]+13,'{:.4g}'.format(x),[0,0,0],"small")
for j in range(-10,10):
y=gy+j*pasy
pix=converttopixel((fenetre[0],y))
if printable(pix):
plt.set_pixel(pix[0]-1,pix[1],RGB("k"))
plt.set_pixel(pix[0]-2,pix[1],RGB("k"))
plt.set_pixel(pix[0]-3,pix[1],RGB("k"))
if grid_display=='on':
for z in range(1,340):
if pix[1]!=limits[1]:
plt.set_pixel(pix[0]+z,pix[1],RGB(color_grid))
plt.draw_string(pix[0]-40,pix[1],'{:.4g}'.format(y),[0,0,0],"small")
if points!=[[]]:
if points[0]==[]:
del points[0]
for i in range(len(points)):
pix=converttopixel((points[i][0],points[i][1]))
if printable(pix) and points[i][2]!=None:
for j in range(-2,3):
plt.set_pixel(pix[0]+j,pix[1],RGB(points[i][2]))
plt.set_pixel(pix[0],pix[1]+j,RGB(points[i][2]))
if textes!=[[]]:
if textes[0]==[]:
del textes[0]
for i in range(len(textes)):
pix=converttopixel((textes[i][0],textes[i][1]))
if printable(pix):
plt.draw_string(pix[0],pix[1],textes[i][2],[0,0,0],"small")
if lines!=[[]]:
if lines[0]==[]:
del lines[0]
for i in range(len(lines)):
pixels=[converttopixel((lines[i][j],lines[i][j+1])) for j in [0,2]]
deltax=abs(pixels[1][0]-pixels[0][0])
deltay=abs(pixels[1][1]-pixels[0][1])
if deltax<=1 and deltay<=1:
if printable((pixels[0][0],pixels[0][1])):
plt.set_pixel(pixels[0][0],pixels[0][1],RGB(lines[i][4]))
plt.set_pixel(pixels[1][0],pixels[1][1],RGB(lines[i][4]))
else:
if deltax>=deltay:
j=0
else:
j=1
m=(pixels[1][1-j]-pixels[0][1-j])/(pixels[1][j]-pixels[0][j])
p=pixels[0][1-j]-m*pixels[0][j]
pix_extrem=(max(limits[0],min(pixels[0][0],pixels[1][0])),min(limits[2],max(pixels[0][0],pixels[1][0])),max(limits[3],min(pixels[0][1],pixels[1][1])),min(limits[1],max(pixels[0][1],pixels[1][1])))
if pix_extrem[2*j]<=limits[2-j] and pix_extrem[2*j+1]>=limits[-j]:
pix=[0,0]
for pix[j] in range(pix_extrem[2*j],pix_extrem[2*j+1]+1):
pix[1-j]=round(m*pix[j]+p)
if printable(pix):
plt.set_pixel(pix[0],pix[1],RGB(lines[i][4]))
axis([limits[0]-50,limits[2],limits[1]+50,limits[3]])
axis("off")
plt.show_screen()
points=[[]]
lines=[[]]
textes=[[]]
extrem=[0,1,0,1]
fenetre=[0,1,0,1]
axis_display='on'
win_scaling='init'
color_count=0
grid_display='off'
def bar(val,eff,width=0.8):
global color_count
if isinstance(val,(tuple)):
val=list(val)
if isinstance(eff,(tuple)):
eff=list(eff)
if isinstance(val,(int,float)):
val=[val]
if isinstance(eff,(int,float)):
eff=[eff]
if isinstance(val,(list)) and isinstance(eff,(list)):
if len(val)==len(eff):
for i in range(len(val)):
plot([val[i]-width/2,val[i]-width/2],[0,eff[i]],color_auto[color_count%7])
plot([val[i]+width/2,val[i]+width/2],[0,eff[i]],color_auto[color_count%7])
plot([val[i]-width/2,val[i]+width/2],[eff[i],eff[i]],color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function bar() : lists must have same dimension')
else:
raise ValueError('function bar() : error using arguments')
def scatter(xlist,ylist):
global color_count
if isinstance(xlist,(tuple)):
xlist=list(xlist)
if isinstance(ylist,(tuple)):
ylist=list(ylist)
if isinstance(xlist,(int,float)):
xlist=[xlist]
if isinstance(ylist,(int,float)):
ylist=[ylist]
if isinstance(xlist,(list)) and isinstance(ylist,(list)):
if len(xlist)==len(ylist):
for i in range(len(xlist)):
plot(xlist[i],ylist[i],color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function scatter() : x and y lists must have same dimension')
else:
raise ValueError('function scatter() : error using arguments')
def hist(x,bins=10,**kwargs):
global color_count
hist_type=kwargs.get('hist_type','std')
if hist_type not in ['fr','std']:
raise ValueError('function hist() : hist_type must be std or fr')
if isinstance(x,(tuple,list)):
x=sorted(list(x))
if isinstance(bins,(tuple)):
bins=list(bins)
if isinstance(x,(int,float)):
x=[x]
if isinstance(bins,(int)) and bins>=1:
if x[-1]!=x[0]:
bins=[round(x[0]+k*(x[-1]-x[0])/bins,8) for k in range(bins+1)]
else :
bins=[round(x[0]-0.5+k/bins,8) for k in range(bins+1)]
if isinstance(bins,(list)) and bins!=[]:
bins=sorted(bins)
qt=[]
for i in range(len(bins)-1):
if i==len(bins)-2:
eff=len([val for val in x if bins[i]<=val<=bins[i+1]])
else:
eff=len([val for val in x if bins[i]<=val<bins[i+1]])
if hist_type=='fr':
if abs(bins[i+1]-bins[i])>1e-8:
eff=eff/(bins[i+1]-bins[i])
else :
raise ValueError('function hist(,hist_type=''fr'') : bins cannot contain 2 identical values')
qt+=[eff]
plot([bins[i],bins[i],bins[i+1],bins[i+1]],[0,eff,eff,0],color_auto[color_count%7])
color_count+=1
else:
raise ValueError('function hist() : error using arguments')
return qt,bins
def boxplot(L,**kwargs):
L=list(L)
global fenetre,nbre_boite,color_count,axis_display,win_scaling
boxplot_type=kwargs.get('boxplot_type','std')
if boxplot_type not in ['fr','std']:
raise ValueError('function boxplot() : boxplot_type must be std or fr')
def mediane(l,p):
if p%2==0:
return (l[p//2]+l[p//2-1])/2
else:
return l[p//2]
def quantiles(l,p,r):
if boxplot_type=='fr':
if p%r==0:
return (l[p//r-1],l[((r-1)*p)//r-1])
else:
return (l[p//r],l[((r-1)*p)//r])
if boxplot_type=='std':
def percentile(N, q):
k = (len(N)-1) * q
f = int(k)
c = int(k)+1
if f == k:
return N[int(k)]
d0 = N[f] * (c-k)
d1 = N[c] * (k-f)
return d0+d1
return (percentile(l,0.25),percentile(l,0.75))
whis=kwargs.get('whis',1.5)
if whis<0:
whis=0
axis_display='boxplot'
n=len(L)
if isinstance(L[0],(int,float)):
n=1
Max,Min=max(L),min(L)
if Max==Min:
ampl=1
else:
ampl=Max-Min
fenetre=[0,2,Min-ampl/20,Max+ampl/20]
else:
Max,Min=max([max(L[i]) for i in range(len(L))]),min([min(L[i]) for i in range(len(L))])
if Min==Max:
ampl=1
else:
ampl=Max-Min
fenetre=[0,len(L)+1,Min-ampl/20,Max+ampl/20]
nbre_boite,largeur=n,0.3/n
win_scaling='fixed'
for i in range(n):
if n==1:
if isinstance(L[0],(int,float)):
K=L
else:
K=L[0]
else :
K=L[i]
if isinstance(K,(int,float)):
plot([i+1-largeur,i+1+largeur],[K,K],'r')
elif isinstance(K[0],(int,float)):
K,p=sorted(K),len(K)
med=mediane(K,p)
Q1,Q3=quantiles(K,p,4)
if boxplot_type=='std':
down,up=0,p-1
while Q1-whis*(Q3-Q1)>K[down]:
down+=1
while Q3+whis*(Q3-Q1)<K[up]:
up-=1
left_whis,right_whis=K[down],K[up]
if Q1<K[down]:
left_whis=Q1
if Q3>K[up]:
right_whis=Q3
if boxplot_type=='fr':
D1,D9=quantiles(K,p,10)
down=K.index(D1)
up=K.index(D9)
left_whis,right_whis=K[down],K[up]
while(up<p-1 and K[up]==K[up+1]):
up=up+1
right_whis=K[up]
plot([i+1-largeur,i+1+largeur,i+1+largeur,i+1-largeur,i+1-largeur],[Q1,Q1,Q3,Q3,Q1],'k')
plot([i+1,i+1],[Q1,left_whis],'k')
plot([i+1,i+1],[Q3,right_whis],'k')
plot([i+1-largeur/2,i+1+largeur/2],[left_whis,left_whis],'k')
plot([i+1-largeur/2,i+1+largeur/2],[right_whis,right_whis],'k')
if down>0 or up<p-1:
from math import pi,cos,sin
Z=[i for i in range(down)]+[j for j in range(up+1,p)]
for t in Z:
x=[i+1+0.05*(fenetre[1])/3*cos(2*j*pi/50) for j in range(50)]
y=[K[t]+0.05*(fenetre[3]-fenetre[2])/3*sin(2*j*pi/50) for j in range(50)]
plot(x,y,'k')
plot([i+1-largeur,i+1+largeur],[med,med],'r')
else:
raise ValueError('wrong type of argument')
def arrow(x,y,dx,dy,**kwargs):
global win_scaling
a,b=x+dx,y+dy
win_scaling='fixed'
color=kwargs.get('ec','k')
color=kwargs.get('edgecolor',color)
headcolor=kwargs.get('fc','b')
headcolor=kwargs.get('facecolor',headcolor)
L=kwargs.get('head_width',0.003)
l=kwargs.get('head_length',1.5*L)
plot((x,a),(y,b),color)
def resol(A,B,C):
D=B**2-4*A*C
if D>0:
return((-B-D**0.5)/(2*A),(-B+D**0.5)/(2*A))
if abs(dx)<0.00001:
dx=0
if dx==0:
if dy>=0:
c=1
else:
c=-1
plot((a-L/2,a+L/2,a,a-L/2),(b,b,b+c*l,b),color)
for i in range(15):
plot((a-(i/15)*L/2,a-(i/15)*L/2),(b,b+(15-i)/15*c*l),headcolor)
plot((a+i/15*L/2,a+i/15*L/2),(b,b+(15-i)/15*c*l),headcolor)
elif dy==0:
if dx>=0:
c=1
else:
c=-1
plot((a,a,a+c*l,a),(b-L/2,b+L/2,b,b-L/2),color)
for i in range(15):
plot((a,a+(15-i)/15*c*l),(b-i/15*L/2,b-i/15*L/2),headcolor)
plot((a,a+(15-i)/15*c*l),(b+i/15*L/2,b+i/15*L/2),headcolor)
else:
m=dy/dx
p=y-m*x
S=resol(m**2+1,2*(-a-b*m+m*p),p**2+a**2+b**2-l**2-2*b*p)
if (a-S[0])*dx<0:
X=S[0]
else:
X=S[1]
Y=m*X+p
k=b+a/m
T=resol(1+1/m**2,2*(-a-k/m+b/m),a**2+k**2-2*b*k+b**2-(L**2)/4)
plot((T[0],T[1],X,T[0]),(-T[0]/m+k,-T[1]/m+k,Y,-T[0]/m+k),color)
plot((a,X),(b,Y),headcolor)
listeX=[]
listeY=[]
if abs(X-T[0])<0.000001:
for i in range(15):
listeX+=[T[0]+i*(a-T[0])/15]+[T[0]]
listeY+=[-listeX[2*i]/m+k]+[-T[0]/m+k+i*(Y+T[0]/m-k)/15]
else:
M=(Y+T[0]/m-k)/(X-T[0])
P=Y-M*X
for i in range(15):
listeX+=[T[0]+i*(a-T[0])/15]+[T[0]+i*(X-T[0])/15]
listeY+=[-listeX[2*i]/m+k]+[listeX[2*i+1]*M+P]
plot(listeX,listeY,headcolor)
listeX=[]
listeY=[]
if abs(X-T[1])<0.000001:
for i in range(15):
listeX+=[T[1]+i*(a-T[1])/15]+[T[1]]
listeY+=[-listeX[2*i]/m+k]+[-T[1]/m+k+i*(Y+T[1]/m-k)/15]
else:
M=(Y+T[1]/m-k)/(X-T[1])
P=Y-M*X
for i in range(15):
listeX+=[T[1]+i*(a-T[1])/15]+[T[1]+i*(X-T[1])/15]
listeY+=[-listeX[2*i]/m+k]+[listeX[2*i+1]*M+P]
plot(listeX,listeY,headcolor)
def grid(*a,**kwargs):
global color_grid,grid_display
color=kwargs.get('color',None)
if a==():
affichage=a
else:
affichage=a[0]
if color!=None:
color_grid=color
affichage='on'
if color not in available_colors:
color_grid='grey'
if affichage==():
if grid_display=='on':
grid_display='off'
else:
grid_display='on'
elif affichage=='on' or affichage=='True' or affichage==True or affichage=='true':
grid_display='on'
elif affichage=='off' or affichage=='False' or affichage==False or affichage=='false':
grid_display='off'
else:
raise ValueError('string must be one of : "on","off","True",or "False"')
Donc quelles nouveautés dans tout ça ? Revenons sur le tracé de diagrammes en boîte à l'aide de la fonction
boxplot()
:ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|


boxplot()
standard de matplotlib.pyplot
, les diagrammes en boîte qu'elle trace ne sont pas conformes à ceux enseignés au lycée français.Afin d'y remédier,
Casio
avait ajouté avec sa propre fonction boxplotFR()
.On pouvait toutefois regretter un écart par rapport au standard.
Dans le nouveau
matplotlib.pyplot
intégré, Casio
fait un effort sur ce dernier point. La fonction boxplotFR()
est supprimée, remplacée par un paramètre nommé boxplot_type
pouvant être passé à la fonction boxplot()
, pouvant prendre les valeurs "std"
ou "fr"
. 
L'appel équivalent à
boxplotFR(l)
est donc boxplot(l, boxplot_type="fr")
avec la nouvelle version.Nous avons donc vu plus haut le diagramme en barres à l'aide de la fonction
bar()
. Et bien grosse nouveauté du matplotlib.pyplot
intégré, nous avons droit à une nouvelle fonction cette fois-ci pour les histogrammes, hist()
: 
ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|


hist()
de matplotlib.pyplot
ne respecte pas la définition française des histogrammes, à savoir que c'est l'aire des bandes qui indique la valeur.Et bien nouvel effort remarquable de
Casio
pour concilier le standard matplotlib.pyplot
et l'enseignement français, il te suffira ici encore de passer le paramètre nommé hist_type="fr"
pour obtenir le bon histogramme. 
Autre ajout, la fonction
grid()
pour tracer un quadrillage : 
ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|
Peut-être serait-il bon de remplir les barres afin d'en faciliter la lecture graphique, notamment sur
Graph 90+E
.Nous avons également plusieurs corrections de
bugs
, sur les fonctions axis()
, boxplot()
et arrow()
entre autres.Intéressons-nous à la fonction
arrow()
:ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|

Casio
nous offrait donc déjà le tracé de pointes de flèches de vecteurs le plus proche du standard.Toutefois,
Casio
a quand même souhaité améliorer la chose. Avec le nouveau matplotlib.pyplot
intégré de la Graph 90+E
, ces pointes font l'objet d'un remplissage.Ce n'est pas le plus embêtant, nous allons y venir, mais cet ajout est assez gourmand en temps d'exécution. Le tracé de notre exemple de vecteur nécessite dans les
2,5s
matplotl.py
7s
avec le nouveau matplotlib.pyplot
intégré.Nous avions déjà noté plusieurs bugs concernant la fonction
arrow()
:- pointe de flèche tracée de la mauvaise couleur dans certains cas
- pointe de flèche tracée à l'envers dans certains cas
ordi | Graph 90+E Graph 35+E II | NumWorks | |
![]() | ![]() ![]() | ![]() | ![]() |
|


arrow()
met en évidence, c'est que malgré les 1 Mio
de heap (tas)
de la Graph 90+E
nous ne sommes pas loin d'une erreur de mémoire à l'exécution.Réduisons progressivement le pas angulaire dans notre appel de
rotarrow()
, 15, 14, 13... 12 pour le tracé d'un champ radial de $mathjax$\frac{360}{12}=30$mathjax$
vecteurs marche encore.Et puis soudainement avec 11 pour le tracé d'un champ de 32 vecteurs, ça ne marche plus avec le nouveau
matplotlib.pyplot
intégré, alors que cela fonctionnait parfaitement avec l'ancien matplotl.py
additionnel. 
Un champ d'une 30aine de vecteurs, ce n'est pas inimaginable en Physique-Chimie, c'est bien embêtant.

matplotl.py
additionnel aucun problème pour 180 vecteurs.Mais que se passe-t-il ?
Selon notre analyse
rapide
du code Python
de matplotlib.pyplot
, tout vient du fait que les tracés sont différés, uniquement effectués à l'appel de show()
.Tous nos appels rajoutent à des listes globales de primitives à tracer
(points, lines, textes...)
.Et avec le nouveau
matplotlib.pyplot
intégré viennent plein d'éléments supplémentaires dans la liste lines
afin de remplir les différentes pointes de flèches de vecteurs.Or comme
matplotlib.pyplot
est écrit en Python
, ces listes globales sont des objets Python
, et par conséquent comme nous l'avons déjà vu maintes fois ils sont très gourmands en mémoire.Casio
gagnerait sans doute soit à optimiser ce stockage global, soit à passer à une implémentation native de matplotlib.pyplot
maintenant que c'est de toutes façons intégré au système. Ce sera certes dommage pour nous de ne plus avoir accès au code source, mais si cela peut arranger les utilisateurs c'est l'essentiel.8) Bilan modules Python
Go to topSuite à ces ajouts
Nous compterons les éléments offerts par chaque module à l'aide des scripts suivants :
L'appel
D'où notre bilan :
Python
majeurs, petit bilan de la richesse des solutions Python
disponibles sur calculatrices.Nous compterons les éléments offerts par chaque module à l'aide des scripts suivants :
- Code: Select all
from autopfrm import *
pf = get_pf()
sh_inf = shell_infos(pf)
unsafe = ()
if pf == 4: #HP Prime
unsafe = ('count','encode','endswith','find','format','index','islower','lstrip','replace','rfind','rindex','rsplit','rstrip','split','splitlines','startswith','strip','from_bytes','to_bytes','fromkeys','get','pop','setdefault','update','values','sort','__enter__','__exit__','read','readinto','readline','seek','write')
if pf == 5 or pf == 7 or pf == 9: #CasioPython / Nspire+NumWorks KhiCAS MicroPython
unsafe = ('sys.argv', 'sys.path')
if pf >= 0:
curline=0
_p = print
def print(*ls):
global curline
st=""
for s in ls:
if not(isinstance(s,str)):
s=str(s)
st=st+s
stlines=1
if sh_inf[1]:
stlines += sh_inf[2]*int(len(st)/sh_inf[1])
if curline+stlines>=sh_inf[0]:
input("Input to continue:")
curline=0
_p(st)
curline+=stlines
def sstr(obj):
try:
s=obj.__name__
except:
s=str(obj)
a=s.find("'")
b=s.rfind("'")
if a>=0 and b!=a:
s=s[a+1:b]
return s
def isExplorable(obj):
if str(obj).startswith("<module"): return False
l = ()
try: l = dir(obj)
except: pass
return len(l)
def explmodr(pitm, pitm_name_l=[], pitm_str_l=[], pitm_val_l=[], reset=True):
global curline, found
pitm_name=sstr(pitm)
if(reset):
curline=0
found = []
pitm_name_l=[pitm_name]
pitm_str_l=[str(pitm)]
pitm_val_l=[pitm]
hd="."*(len(pitm_name_l)-1)
c = 0
l = sorted(dir(pitm))
for i in range(len(l)):
l[i] = (l[i], getattr(pitm, l[i]), str(l[i]))
try:
if not isinstanceof(pitm, str):
for i in range(len(pitm)):
l.append((pitm_name+'['+str(i)+']',pitm[i],str(pitm[i])))
except: pass
for itm in l:
isFound = itm[0] in found
c += not isFound
isUnsafe = '.'.join(pitm_name_l + [itm[0]]) in unsafe or itm[0] in unsafe
try:
if isUnsafe: raise Exception
print(hd+itm[0]+"="+str(itm[1]))
except:
print(hd+itm[0])
if not isFound:
found.append(itm[0])
if not isUnsafe and isExplorable(itm[1]) and itm[1] not in pitm_val_l and itm[2] not in pitm_str_l:
pitm_name_l2, pitm_val_l2, pitm_str_l2 = pitm_name_l.copy(), pitm_val_l.copy(), pitm_str_l.copy()
pitm_name_l2.append(itm[0])
pitm_val_l2.append(itm[1])
pitm_str_l2.append(itm[2])
c += explmodr(itm[1], pitm_name_l2, pitm_str_l2, pitm_val_l2, False)
return c
def explmod(s):
global found
module = __import__(s)
found = []
return explmodr(module)
- Code: Select all
# detects calculator Python platform
def get_pf():
c256 = True
try:
if chr(256)==chr(0):
# Xcas/KhiCAS Python compatibility
if "HP" in version():
return 13 # HP Prime
else:
if not white:
return 12 # Graph 35+E II
elif "Numworks" in version():
return 10 # NumWorks
elif "Nspire" in version():
return 8 # Nspire
else: # Graph 90+E
return 11
except:
c256 = False
try:
import sys
try:
if sys.platform == "nspire":
try: # Nspire Ndless
import graphic
return 7 # KhiCAS Micropython
except: # MicroPython
return 6
elif sys.platform == "TI-Nspire":
return 3 # Nspire CX II
elif sys.platform == "numworks":
return 9 # NumWorks KhiCAS Micropython
elif sys.platform.startswith('TI-Python'):
return 2 # 83P/84+ CE
except: # Graph 35+E/USB / 75/85/95
return 5
except:
pass
if not c256:
return 1 # Graph 90/35+E II
try:
import kandinsky
return 0 # NumWorks
except:
try: # HP Prime
import hpprime
return 4
except:
pass
return -1
#return get_pixel and set_pixel functions for the platform
gp_prime = lambda x, y: GETPIX_P(x, y)
sp_prime = lambda x, y, c: PIXON_P(x, y, c)
def get_pixel_functions(pf):
gp, sp = lambda: None, lambda: None
if pf == 0: # NumWorks
import kandinsky
gp, sp = kandinsky.get_pixel, kandinsky.set_pixel
elif pf == 1: # Graph 90/35+E II
import casioplot
gp, sp = casioplot.get_pixel, casioplot.set_pixel
elif pf == 2: # 83P/84+ CE
import ti_graphics
gp, sp = ti_graphics.getPixel, ti_graphics.setPixel
elif pf == 3: # Nspire CX II
pass
elif pf == 4: # HP Prime
import hpprime
sp = hpprime.pixon
elif pf == 6: # Nspire: Ndless MicroPython
from nsp import Texture
canvas = Texture(320, 240, 0)
gp, sp = canvas.getPx, canvas.setPx
elif pf == 7 or pf == 9: # Nspire/NumWorks: KhiCAS-MicroPython
import graphic
gp, sp = graphic.get_pixel, graphic.set_pixel
elif pf == 13: # HP Prime
gp, sp = gp_prime, sp_prime
return gp, sp
#returns platform shell infos : visible lines, visible columns, if larger strings are displayed on several lines or not
def shell_infos(pf):
#NW small: [00] 12.5x30 -> 16 x 42
#HP small: [03] 11.5x39 -> 15.5 x 45 [12] 14 x39 -> 18.5 x 45
#HP big : [03] 11.5x39 -> 09 x 35 [12] 14 x39 -> 11 x 35
# uPy uPy
# G352 CPy uPy KhiCAS---------------> CAS
# NW G90 CE CX2 HP GXX NS NS NS NW NW G90 G352HP
l_vlines = (12, 07, 11, 11, 12, 09, 29, 11, 11, 11, 11, 09, 07, 14)
l_vcols = (30, 21, 32, 00, 39, 32, 53, 32, 32, 29, 29, 30, 19, 39)
b_vcr = 0b1111100
if pf >= 0:
return l_vlines[pf], l_vcols[pf], b_vcr // 2**pf % 2
else:
return max(l_vlines), max(l_vcols), 1
L'appel
explmod('nom_module')
explore le module en question et en compte les différents éléments internes, en évitant les doublons. Nous noterons en rouge les modules inaccessibles en mode examen :TI- 83PCE TI- Python | TI- 83PCE Edition Python | TI- 84+CE-T Python Edition | TI- Nspire CX II | Casio Graph 90+E 35+E II | Num Works | ||||||||
builtins array (u)binascii board cmath (u)collections (u)ctypes (u)errno gc (u)hashlib (u)heapq (u)io (u)json linalg math matplotlib .pyplot micropython numpy os (u)random (u)re storage (u)struct sys time (u)timeq turtle (u)zlib TOTAL | 152 26 . . . 24 . . 29 . . . . . 50 . . . . . 30 . . . 68 26 . . . 405 | 153 26 . . . 24 . . 29 . . . . . 50 . . . . . 30 . . . 68 26 . . . 406 | 153 26 . . . 24 . . 29 . . . . . 50 . . . . . 30 . . . 68 28 . . . 406 | 166 33 33 . 40 48 60 68 36 32 32 . . . 69 . . 41 . . 36 35 . . 80 40 . . . 849 | 141 . . . . . . . . . . . . . 47 24 59 . . . 30 . . . . . . 114 . 391 | 146 . . . 34 . . . . . . . . . 63 25 22 29 . . 31 . . . . 25 . 62 . 437 | 165 32 . . 40 . . 68 36 . . . . . 69 . . 37 . . . . . . 80 . . . . 527 | 154 27 . 22 35 25 . . 30 . . . . . 64 . . 29 . 38 31 . 45 . 71 31 . . . 602 | 160 30 . . 38 . . . 33 . . . . . 67 . . 29 . . . . . . 62 . . . . 419 | 165 . 31 . 38 46 66 66 34 30 30 45 31 67 69 . 44 34 81 28 34 34 . 32 73 . . 82 32 1192 | 155 30 . . 38 . . . 33 . . . . . 67 . . 32 . . 34 . . . 55 . . . . 444 | 146 . . . 34 . . . . . . . . . 63 25 22 29 . 27 31 . . . . 25 . 62 . 472 | 168 . 34 . 41 49 69 . 37 30 33 48 34 70 72 . 47 38 46 31 37 37 . 35 77 . 34 85 35 1187 |
TI- 83PCE Edition Python | TI- 84+CE-T Python Edition | TI- Nspire CX II | Casio Graph 90+E 35+E II | Num Works | |||||
analogin:44 analogout:46 bbport:40 brightns:29 ce_box:32 ce_chart:58 ce_quivr:41 ce_turtl:65 color:30 colorinp:39 conservo:45 dht:45 digital:46 led:45 light:30 lightlvl:44 loudness:44 magnetic:46 mb_butns:38 mb_disp:40 mb_grove:51 mb_music:37 mb_neopx:54 mb_pins:48 mb_radio:40 mb_sensr:54 microbit:28 moisture:44 potentio:44 power:45 ranger:43 relay:45 rgb:45 rgb_arr:51 sound:29 squarewv:44 temperat:43 thermist:44 ti_graphics:67 ti_hub:42 ti_plotlib:78 ti_rover:79 ti_system:34 speaker:35 timer:35 vernier:44 vibmotor:45 | analogin:44 analogout:46 bbport:40 brightns:29 ce_box:32 ce_chart:58 ce_quivr:41 ce_turtl:65 color:30 colorinp:39 conservo:45 dht:45 digital:46 led:45 light:30 lightlvl:44 loudness:44 magnetic:46 mb_butns:38 mb_disp:40 mb_grove:51 mb_music:37 mb_neopx:54 mb_pins:48 mb_radio:40 mb_sensr:54 microbit:28 moisture:44 potentio:44 power:45 ranger:43 relay:45 rgb:45 rgb_arr:51 sound:29 squarewv:44 temperat:43 thermist:44 ti_graphics:67 ti_hub:42 ti_plotlib:78 ti_rover:79 ti_system:34 speaker:35 timer:35 vernier:44 vibmotor:45 | ti_draw:54 ti_hub:193 ti_image:53 ti_innovator:48 ti_picture:35 ti_plotlib:90 ti_rover:142 ti_st:41 ti_system:83 | casioplot | ion:72 kandinsky:28 | prime:30 | nsp:10 | arit:38 cas:28 graphic:55 nsp:37 | ion:72 kandinsky:28 | arit:41 cas:31 graphic:58 nsp:32 |
1509- 2095 | 2095 | 739 | 28 | 100 | 30 | 10 | 158 | 100 | 162 |
D'où notre bilan :
- 1915éléments +(dont:406éléments standard)TI-83 Premium CE Edition Python
- 1588éléments +(dont:849éléments standard)TI-Nspire CX II
- 557éléments +(dont:527éléments standard)HP Prime(version alpha)
- 537éléments +(dont:437éléments standard)NumWorks
- 419éléments +(dont:391éléments standard)Casio Graph 90+E / 35+E II
- 246éléments +(dont:218éléments standard)Casio Graph 90+E / 35+E II
- 1915éléments +(dont:406éléments standard)TI-83 Premium CE Edition Python
- 1588éléments +(dont:849éléments standard)TI-Nspire CX II
- 1349éléments +(dont:1187éléments standard)NumWorks
- 578éléments +(dont:472éléments standard)NumWorks(firmware Omega)
- 557éléments +(dont:527éléments standard)HP Prime(version alpha)
- 537éléments +(dont:437éléments standard)NumWorks
- 419éléments +(dont:391éléments standard)Casio Graph 90+E / 35+E II
- 246éléments +(dont:218éléments standard)Casio Graph 90+E / 35+E II
- 2501éléments +(dont:406éléments standard)TI-83 Premium CE Edition Python / TI-84 Plus CE-T Python Edition
- 1588éléments +(dont:849éléments standard)TI-Nspire CX II
- 557éléments +(dont:527éléments standard)HP Prime(version alpha)
- 537éléments +(dont:437éléments standard)NumWorks
- 419éléments +(dont:391éléments standard)Casio Graph 90+E / 35+E II
- 416éléments +(dont:388éléments standard)Casio Graph 90+E / 35+E II
- 405éléments :TI-83 Premium CE + TI-Python
- 2501éléments +(dont:406éléments standard)TI-83 Premium CE Edition Python / TI-84 Plus CE-T Python Edition
- 1588éléments +(dont:849éléments standard)TI-Nspire CX II
- 1350éléments +(dont:1192éléments standard)TI-Nspire CX
- 1349éléments +(dont:1187éléments standard)NumWorks
- 602éléments :TI-83 Premium CE + TI-Python(tiers)
- 578éléments +(dont:472éléments standard)NumWorks(firmware Omega)
- 557éléments +(dont:527éléments standard)HP Prime(version alpha)
- 537éléments +(dont:437éléments standard)NumWorks
- 429éléments +(dont:419éléments standard)TI-Nspire(Ndless + MicroPython)
- 419éléments +(dont:391éléments standard)Casio Graph 90+E / 35+E II
- 416éléments +(dont:388éléments standard)Casio Graph 90+E / 35+E II
- 405éléments :TI-83 Premium CE + TI-Python+Casio Graph 35/75+E(appli CasioPython)
Un net progrès même si cela ne renverse pas la tendance, la solution 

Python
de Casio
est désormais intégralement disponible en mode examen ! 
Casio
n'a sans doute pas la solution Python
la plus riche, mais on peut quand même noter un soin méticuleux à rester aussi proche que possible du standard et donc faciliter la vie des élèves et des enseignants en ne leur rajoutant pas de travail, préoccupation que l'on ne trouve pas chez tout-le-monde. 
9) Nouveaux modes examens
Go to top

Casio
est ici globale, concernant également des modèles d'avant-dernière génération.Les changements dont il est question ici ne concernent pas les modèles spécifiques à la France, uniquement les
fx-9860GII
, fx-9750GIII
, fx-9860GIII
, fx-CG10
, fx-CG20
et fx-CG50
.Sur ces modèles, lorsque l'on demande l'accès au mode examen, l'écran confirmant le succès de l'opération affiche désormais le numéro de version du système de la calculatrice.
Particulièrement utile hors de France dans les pays où ce sont les surveillants qui activent le mode examen des candidats, ou encore pour les examens qui exigent d'installer la dernière version système, une version système récente ou encore une version système spécifique.
Cela permet de s'assurer que le candidat n'utilise pas une version interdite, plus ancienne ou même obsolète qui présenterait des failles dans le mode examen.
Mais bien évidemment, lorsque ce sont les candidats qui activent le mode examen en début d'épreuve, impossible d'avoir les yeux sur tous les écrans.


Casio
avait également prévu quelque chose pour ça, un écran d'information sur le mode examen accessible via ALPHA
(-), non fonctionnel sur les modèles français.
Cet écran indiquait déjà le temps écoulé depuis l'activation du mode examen, permettant ainsi de repérer certaines tentatives de fraude. Notamment les candidats qui auraient activé le mode examen avant l'épreuve et donc potentiellement réinjecté toutes les données de leur choix, et d'une façon ou d'une autre trompé le surveillant sur l'état de la calculatrice en arrivant à leur épreuve
(en dissimulant le clignotement de la diode et faisant mine d'appuyer sur les touches ou peu importe)
.Et bien nouveauté, cet écran d'information indique dorénavement lui aussi la version de système d'exploitation utilisé. Le surveillant peut donc désormais tout vérifier à n'importe quel moment de l'épreuve en seulement 2 touches.

Mais ce n'est pas tout. Historiquement chez
Casio
nous avions 2 modes examen aux comportements différents répartis sur différents modèles :- mode examen français (Graph 35+E II,Graph 75+E,Graph 90+E)
- mode examen international (fx-9860GII,fx-9750GIII,fx-9860GIII,fx-CG10,fx-CG20,fx-CG50)
Avec la mise à jour
3.30
Casio
avait rajouté un 2ème mode examen sur la fx-CG50
(mais pas sur la
, portant donc le nombre total de modes examens différents à 3.Graph 90+E
)Le mode examen historique de la
fx-CG50
était renommé "mode examen 1"
, et le nouveau "mode examen 2"
.- mode examen français (Graph 35+E II,Graph 75+E,Graph 90+E)
- mode examen international / mode examen 1 (fx-9860GII,fx-9750GIII,fx-9860GIII,fx-CG10,fx-CG20,fx-CG50)
- mode examen 2 (qui avait l'avantage d'autoriser l'usage de l'appli additionnelle officiellefx-CG50)Graphe 3D
Avec les dernières mises à jour traitées aujourd'hui, c'est un festival :
- 2 nouveaux modes examen sont rajoutés, portant le total à 5 modes examen différents :
- un pour les Pays-Basqui a la particularité d'interdire le calcul exact sur les irrationnels
- un pour le Texasqui a la particularité d'interdire les représentations graphiques d'inéquations, et ouiCasiova chasser sur les terres deTI
- un pour les
- un même modèle peut désormais gérer jusqu'à un maximum de 4 modes examen différents
- sur les modèles qui proposent plusieurs modes examens, le mode examen international historique ou mode examen 1 sur la fx-CG50est renommé en tant que mode examen pour le Baccalauréat International
- le mode examen 2 de la fx-CG50est renommé en tant que mode examen pour le Royaume-Uni
Voici le détail des modes examens présents sur chaque modèle après la dernière mise à jour :
Graph 35+E II Graph 75+E Graph 90+E | fx-9860G AU+ fx-9860GIIs fx-9860GIII Graph 75/95 | fx-9750GIII | fx-9860GII fx-CG10/20 | fx-CG50 | |
France | ✓ | ||||
Baccalauréat international | ✓ | ✓ | ✓ | ✓ | |
Pays-Bas | ✓ | ✓ | |||
Royaume-Uni | ✓ | ||||
Texas | ✓ | ✓ | |||
Total | 1 | 1 | 2 | 2 | 4 |

Une deuxième confirmation est de plus demandée dans le cas où le mode examen invoqué ne convient pas au Baccalauréat International.
Une fois le mode examen activé, il reste quand même identifiable à tout moment par le drapeau clignotant en haut à droite de l'écran, ainsi que sur les modèles couleur par la bordure de l'écran qui utilise une couleur différente.
Voici ci-dessous résumé en un seul coup d'œil tout ce qui concerne les désormais 5 modes examens de
Casio
:France | Baccalauréat International | Pays-Bas | Royaume-Uni | Texas | ||
Modèles | Graph 35+E II Graph 75+E Graph 90+E | fx-9750GIII fx-9860GIIs | Graph 75/95 fx-9860G AU+ fx-9860GII/GIII fx-CG10/20/50 | fx-9860GII fx-CG10/20/50 | fx-CG50 | fx-9750GIII fx-CG50 |
Activation | cos 7 | cos 7 | cos 7 | → 8 | , 1 | + ÷ |
Drapeau | R | |||||
Bordure | ||||||
Calcul exact irrationnels | Autorisé | Interdit | Autorisé | Interdit | Autorisé | Autorisé |
Calcul vectoriel | Interdit | Interdit | Interdit | Interdit | Autorisé | Interdit |
Graphes inégalités | Autorisé | Autorisé | Autorisé | Autorisé | Autorisé | Interdit |
Appli intégrée Programme | Autorisé | Interdit | Interdit | Interdit | Interdit | Interdit |
Appli intégrée Python | Autorisé | Interdit | Interdit | Interdit | Interdit | Interdit |
Appli additionnelle officielle Graphe 3D | Interdit | Interdit | Interdit | Interdit | Autorisé | Interdit |
Autres applis additionnelles officielles | Interdit | Interdit | Interdit | Interdit | Interdit | Interdit |
Applis additionnelles non officielles | Interdit | Interdit | Interdit | Interdit | Interdit | Interdit |
Contenu mémoire préexistant | Interdit | Interdit | Interdit | Interdit | Interdit | Interdit |
10) Modifications d'interfaces
Go to top

Casio
ne publie pas de changelog
détaillé.Sur
Graph 90+E
et fx-CG50
, lorsque l'on réalise un backup
de la calculatrice dans l'application Système
, nous avons un message d'alerte contre l'écrasement si l'opération a déjà été réalisée. En français sa formulation avait changé lors de la mise à jour 3.20
Avec la mise à jour
3.12
, les fx-CG10
et fx-CG20
passent à leur tour à la nouvelle formulation, rattrapant leur retard.

"Elemento aggiuntivo"
pour les applications additionnelles dans les applications Mémoire
et Système
avait été remplacée par "Add-In"
sur Graph 90+E
et fx-CG50
lors de la mise à jour 3.30
Avec la mise à jour
3.12
, les fx-CG10
et fx-CG20
profitent elles aussi désormais de cette nouvelle formulation.

Graph 90+E
et fx-CG50
dès la mise à jour 3.30
Avec la mise à jour
3.12
, même changement dorénavant sur les fx-CG10
et fx-CG20
.




Système
on choisissait de supprimer les applications additionnelles, dans toutes les langes le message d'avertissement mentionnait en anglais un MAIN MENU
.En effet c'était un héritage lors de l'adaptation pour l'écran couleur du système
Casio Graph
monochrome en 2012, le titre du menu principal n'étant pas traduit sur les modèles monochromes.Les
Graph 90+E
et fx-CG50
avaient enfin bénéficié d'une correction pertinente de ce message pour la mise à jour 3.40
3.12
les fx-CG10
et fx-CG20
en bénéficient à leur tour.


fx-CG10
et fx-CG20
mentionnaient en anglais une application SYSTEM
, héritage là encore des modèles monochromes où les noms d'applications ne sont pas traduits.Si on peut certes deviner l'application dont il est question dans la plupart des langues, c'était moins évident en Italien où l'application
Système
s'appelle Set-Up
.Quoiqu'il en soit avec la mise à jour
3.12
le message est désormais correct dans toutes les langues.Casio
fait visiblement attention au moindre petit détail d'intuitivité. 
11) Conclusion
Go to topUne très belle mise à jour. La solution 
Nous louons le soin méticuleux que
Même si cela ne concerne pas la France pour le moment, nous sommes heureux de voir que les choses commencent à bouger niveau mode examen, que
Le mode examen de
Nous apprécierions donc si le mode examen français de
Python
de Casio
est maintenant intégralement disponible en mode examen, le constructeur semble être fort à l'écoute de sa communauté d'utilisateurs et avoir traité la moindre des critiques bienveillantes formulées lors de notre annonce de la version précédente. 
Nous louons le soin méticuleux que
Casio
semble apporter au respect d'un standard Python
préexistant avec les modules de tracé par coordonnées matplotlib.pyplot
et tracé relatif turtle
, évitant de réinventer la roue, et épargnant donc double travail aux élèves et enseignants ! 
Un exemple à suivre ! 

Même si cela ne concerne pas la France pour le moment, nous sommes heureux de voir que les choses commencent à bouger niveau mode examen, que
Casio
a enfin accepté l'idée d'avoir plusieurs modes examens plutôt qu'un unique mode examen avec la somme des restrictions réclamées par chaque institution ou pays concerné.Le mode examen de
Casio
a en effet le défaut (du point de vue utilisateur en tous cas)
d'être le plus restrictif tous constructeurs confondus, allant même jusqu'à bloquer ses propres applications additionnelles officielles alors que de telles applications ou fonctionnalités équivalentes restent parfaitement disponibles chez les modes examens concurrents.Nous apprécierions donc si le mode examen français de
Casio
pouvait également être affiné à son tour pour mieux coller aux seuls interdits réclamés par la réglementation (infos personnelles préchargées)
, autorisant donc l'usage des applications additionnelles officielles (
, voir même d'applications additionnelles tierces comme . Conversions
sur Graph 90E+
, Graphe 3D
, Physium
, ProbSim
, Géométrie
)
12) Téléchargements et liens
Go to topTéléchargements
:- Mise à jour 3.40pourGraph 35+E IIetfx-9750/9860GIII(avecWindows)
- Mise à jour 3.50pourGraph 90+Eetfx-CG50avec /
- Mise à jour 3.12pourfx-CG10/20(avecWindows)
- Mises à jour 2.08à2.11pourGraph 75,fx-9860Getfx-9860GII(avecWindows)
- interface turtle.pypour /
- interface matplotl.pypour /
Référence
:Envie d'en découvrir davantage sur le nouveau
Python
? Casio
vient d'annoncer plusieurs vidéoconférences traitant de cette dernière mise à jour :- Lundi 19 octobre 14h-14h45 : Python sur les calculatrices Graph 35+E II et Graph 90+E
- Mardi 27 octobre 14h-14h45 : Les bibliothèques graphiques Python : Turtle & Matplotlib