Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Programming an interaction

Certainly due to my lack of competence this code

pol = polygon([(0,0), (0,10), (10,10), (0,0)], fill=True,> rgbcolor=(0.81,0.81,0.81))

g = plot(x,(0,10),color="blue",ymin=0,ymax=10)

@interact

def _(c=slider(0,1,step_size=0.2,default=.5),inac=checkbox(True,"Domaine Inaccessible")):

a = solve(-c*x+6==x, x)

aa = a[0].right()

h = plot(-c*x+6,(aa, 6),color="green",ymin=0,ymax=10)

graph = h+g 

if inac :

    graph += pol    

 show(graph)

conplains that graph is not defined.

Is there some thing I have not understood in the construction of @interact?

click to hide/show revision 2
None

Programming an interaction

Certainly due to my lack of competence this code

 

pol = polygon([(0,0), (0,10), (10,10), (0,0)], fill=True,> fill=True, rgbcolor=(0.81,0.81,0.81))

g = plot(x,(0,10),color="blue",ymin=0,ymax=10)

g = plot(x,(0,10),color="blue",ymin=0,ymax=10)

@interact def _(c=slider(0,1,step_size=0.2,default=.5),inac=checkbox(True,"Domaine Inaccessible")):

@interact

def _(c=slider(0,1,step_size=0.2,default=.5),inac=checkbox(True,"Domaine Inaccessible")):

a = solve(-c*x+6==x, x)
  aa = a[0].right()
  h = plot(-c*x+6,(aa, 6),color="green",ymin=0,ymax=10)
  graph = h+g 
  if inac :
      graph += pol    
   show(graph)

conplains that graph is not defined.

Is there some thing I have not understood in the construction of @interact?