Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Strange comportment in simplifying a function

I am developping a long notebook to master Sage. But each time I fall on a problem. This time

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)
h(x, D, p, w0)=g(x, D, 1, p, I, w_0).collect(D).collect(x).simplify()
show(f)
show(g)
show(h)

1) this is the main question : You can observe that g is independanr of I. But h is g with $\beta = 1$. So why I does reappear in h ?

2) How could we explain SM to write the slope of the 3 curves as I would write them in a sheet of paper ?

Strange comportment in simplifying a function

I am developping a long notebook to master Sage. But each time I fall on a problem. This time

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)
h(x, D, p, w0)=g(x, D, 1, p, I, w_0).collect(D).collect(x).simplify()
show(f)
show(g)
show(h)

1) this is the main question : You can observe that g is independanr of I. But h is g with $\beta = 1$. So why I does reappear in h ?

2) How could we explain SM to write the slope of the 3 curves as I would write them in a sheet of paper ?