# My error with @interact I suppose it's not the custom to reuse a question, but the precedent was not a problem with Sagemath but with my computer

Here is a true question due to my incompetence. The following code leads onlys to the slider not the display of the function.

p, D, w_0, x, I = var('p, D, w_0, x, I')
β = var('beta')
π = var('pi')
w00=8
D1=6
p1=0.5

A = matrix(SR, 2, 2, [[w_0, 1],[w_0-π,1]])
y = vector([w_0-D, w_0-D-π+I])
sol=A.solve_right(y)
sola=sol.full_simplify().function(D, π, w_0)
solb=sol.full_simplify().function(D, π, I, w_0)
f=(sola*x + solb).function(x, D, π, I, w_0)
g=f(x, D, β*I*(1-p), I, w_0).factor().collect(x).simplify().function(x, D, β, p, w_0)
show(g(x,D1,β,p1,w00))
@interact
def _(β=slider(1,5, step_size=1)):
s1sol=solve(g(x,D1,β,p1,w00)==x, x)
intersect2=s1sol.rhs()
glou=plot(g(x,D1,β,p1,w00),(x, intersect2,w00))
glou+=circle((intersect2,intersect2), .075, fill=True, edgecolor='red', facecolor='red')
glou+=arc((w00,w00-D1),1.75,1.75,0,(3.14/2+3.14/4,3.14), linestyle="--", color="green")
glou


What do I do wrong ?

edit retag close merge delete

Sort by » oldest newest most voted

You should ask the function to actually do something, so replace glou+plccp with show(glou+plccp). By the way, plccp is not defined in your code.

more

Yes of course. I will erase plccp since it add nothing to the question. Thanks