Ask Your Question
0

to_poly_solve problem?

asked 2017-06-20 04:15:34 +0100

happys5 gravatar image

updated 2017-06-20 04:31:21 +0100

Hello,

I have:

var ('N,m,sec,a,t,c')

T = (1.27 * 10^6)
Fg = ((9.81*107000))
a = ((T-Fg)/107000)
a = 2.05915887850467

v = a*t
P3 = plot(v, (t,0,11))

v.integral(t)
y = 1.029579439252335*t^2

P1 = plot(y, (t,0,12))

T1 = 1.27*e^(-(t-11)/2) * 10^6
Fg = 9.81*107000
a1 =(T1-Fg)/107000

v1 = a1.integral(t)
v1 = -9.81*t - 23.738317757009348*e^(-1/2*t + 11/2) + 154.299065420560
P4 = plot(v1, (t,11,22))

v1.integral(t)

y1 = -4.905*t^2 + 154.29906542056*t + 47.476635514018696*e^(-1/2*t + 11/2) -1026.68224299065

P2 = plot (y1, (t,12,22))

P = P1 + P2; 
show(P)

Impact = y1.find_root(21,22)
Impact

P5 = P3 + P4
show(P5)

differentiate = diff(y1, t)

solve(-9.81000000000000*t - 23.73831775700935*e^(-1/2*t + 11/2) + 154.299065420560 == 0, t, to_poly_solve=True)

I am learning SageMath.

When I try to solve the last solve equation that has an exponential with a "t" (the last line in the code) while using to_poly_solve=True, I get the following error:

TypeError: 'sage.symbolic.expression.Expression' object does not support indexing

I would like to solve for "t" so that I can find the maximum of a function.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-20 10:14:07 +0100

ndomes gravatar image

If solve can't find an explicit solution, you can use find_root or the sympy solver:

var ('N,m,sec,a,t,c')

T = (1.27 * 10^6)
Fg = ((9.81*107000))
a = ((T-Fg)/107000)

v = a*t
P3 = plot(v, (t,0,11))

y = v.integral(t)
P1 = plot(y, (t,0,12))

T1 = 1.27*e^(-(t-11)/2) * 10^6
Fg = 9.81*107000
a1 =(T1-Fg)/107000

v1 = a1.integral(t)
v1 = v1 + 154.299065420560
P4 = plot(v1, (t,11,22))

y1 = v1.integral(t) - 1026.68224299065
P2 = plot (y1, (t,12,22))

P = P1 + P2 

Impact = y1.find_root(21,22)
#print Impact

P5 = P3 + P4
show(P5)

dy1 = diff(y1, t)
#print dy1

print 'solve with maxima solver:', solve(v1,t)
print 'solve with find_root:', v1.find_root(0,20)
import sympy
print 'solve with sympy solver:', sympy.solve(v1,t)
edit flag offensive delete link more

Comments

Thanks! find_root worked just fine.

happys5 gravatar imagehappys5 ( 2017-06-20 21:10:35 +0100 )edit

Hello,

When I use sympy for:

differ = -9.81000000000000*t - 23.73831775700935*e^(-1/2*t + 11/2) + 154.299065420560 == 0
import sympy
sympy.solve(differ,t)

I get the following error text:

line 220, in __call__ return self.relation(ex, operator) File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.py", line 340, in relation raise NotImplementedError("relation") NotImplementedError: relation

happys5 gravatar imagehappys5 ( 2017-06-20 21:26:35 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-06-20 04:15:34 +0100

Seen: 1,097 times

Last updated: Jun 20 '17