Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Impossible to plot arc()

I take the following code from

g = Graphics()
g += text('g1', (10,4.5))
g += plot(2/5*x + 1,(x,-4,10)) #g1

#gradient triangle
g += line([(0,1), (5,1)], rgbcolor=('#00c736'))
g += text('kw = 5', (2.5,0.5), rgbcolor=('#00c736'))
g += line([(5,1), (5,3)],rgbcolor=('#f6a200'))
g += text('ks = 2', (5.5,2), rgbcolor=('#f6a200'))

g += text('g2', (10,1.5))
g += plot(2/5*x - 2,(x,-4, 10)) #g2

g += text('h1', (10,-1.5))
g += plot(-1/2*x+1,(x,-4, 10)) #h1
g += text('h2', (10,-4.5))
g += plot(-1/2*x+4,(x,-4, 10)) #h2
#corners 
g += arc((0.5,1), 1, sector=(pi*0,-pi/4+0.1))
g += arc((0.5,1), 1, sector=(pi*0,pi/4-0.2))

g.show()

from the following question drawing the corners for the inner parallelogram(solved). Without the two lines with arc it works fine. But I cannot add this two lines without the following error unable to simplify to float approximation. I have test it since I was unable to manage arc().

Impossible to plot arc()

I take 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 fromleads onlys to the slider not the display of the function.

g p, D, w_0, x, I = Graphics()
g += text('g1', (10,4.5))
g += plot(2/5*x 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[0].full_simplify().function(D, π, w_0)
solb=sol[1].full_simplify().function(D, π, I, w_0)
f=(sola*x + 1,(x,-4,10)) #g1

#gradient triangle
g += line([(0,1), (5,1)], rgbcolor=('#00c736'))
g += text('kw = 5', (2.5,0.5), rgbcolor=('#00c736'))
g += line([(5,1), (5,3)],rgbcolor=('#f6a200'))
g += text('ks = 2', (5.5,2), rgbcolor=('#f6a200'))

g += text('g2', (10,1.5))
g += plot(2/5*x - 2,(x,-4, 10)) #g2

g += text('h1', (10,-1.5))
g += plot(-1/2*x+1,(x,-4, 10)) #h1
g += text('h2', (10,-4.5))
g += plot(-1/2*x+4,(x,-4, 10)) #h2
#corners 
g += arc((0.5,1), 1, sector=(pi*0,-pi/4+0.1))
g += arc((0.5,1), 1, sector=(pi*0,pi/4-0.2))

g.show()
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[0].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+plccp

from the following question drawing the corners for the inner parallelogram(solved). Without the two lines with arc it works fine. But What do I cannot add this two lines without the following error unable to simplify to float approximation. I have test it since I was unable to manage arc().do wrong ?

Impossible to plot arc()

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[0].full_simplify().function(D, π, w_0)
solb=sol[1].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[0].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+plccp

What do I do wrong ?

Impossible to plot arc()My error with@intercact

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[0].full_simplify().function(D, π, w_0)
solb=sol[1].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[0].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+plccp
glou

What do I do wrong ?

click to hide/show revision 5
None

My error with@intercact

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[0].full_simplify().function(D, π, w_0)
solb=sol[1].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[0].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 ?