Ask Your Question
0

Problem with solve

asked 2011-10-27 16:19:28 -0500

saradocbrandi gravatar image

updated 2011-10-27 16:44:34 -0500

Hi, I'm very very new in Sage. I have a problem trying this:

x=var('x')

f=10*(1-exp(-0.23*(x)))^2

g=20*(1-exp(0.23*(x-14)))^2-10

I'm want to get the intersection point(s). From Maple, I know there is three, but when I try to solve for x:

solve(f==g,x)

[ ]

Sage gives me that [ ]! What does it mean? Thanks in advance

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2011-10-27 16:32:05 -0500

kcrisman gravatar image

Just putting this in standard syntax:

sage: f = 10*(1-exp(-.23*x))^2
sage: g = 20*(1-exp(-.23*(x-14)))^2-10
sage: g
20*(e^(-0.230000000000000*x + 3.22000000000000) - 1)^2 - 10
sage: f
10*(e^(-0.230000000000000*x) - 1)^2
sage: solve(f==g,x)
[]

Sage gives solutions in list form by default. Python (which Sage is largely based upon) lists are in square brackets. This one has no items, so it is the empty list.

sage: solve(f==g,x,to_poly_solve=True)  # invokes another type of solver, but one which doesn't always return exact answers
[]

But there is another issue, which is that solve (which is from Maxima's solve) seeks exact solutions, in general. If it can't solve it exactly, it may indeed return no answers, even if there are some.

Now, a little playing with find_root discovers something interesting.

sage: f.subs(x=1000)
10.0000000000000
sage: g.subs(x=1000)
10.0000000000000

Well, maybe Maxima's solve capabilities should have found that... but apparently it didn't. However, you may find find_root is what you are actually interested in.

sage: find_root(f-g,0,20)
11.070582936901683
edit flag offensive delete link more

Comments

1

I think you accidentally flipped a sign in the exponent of g, which changes the details a bit, but not the conclusion that (dividing into regions and then) using find_root is probably the way to go.

DSM gravatar imageDSM ( 2011-10-27 17:51:45 -0500 )edit

Yup, you're right. Does that mean x=10 is not a solution? ;-)

kcrisman gravatar imagekcrisman ( 2011-10-28 03:00:02 -0500 )edit
0

answered 2011-10-29 09:43:46 -0500

saradocbrandi gravatar image

My apologies kcrisman, you were right. Maple solves it numerically too. I had to use find_root, that was the correct way. Maple has some advantages manipulating symbols, but I choose Sage. Thanks for your help.

Bye bye.

edit flag offensive delete link more

Comments

Great, glad we could help. Also, appreciate the Tolkien reference in the username.

kcrisman gravatar imagekcrisman ( 2011-10-29 14:23:52 -0500 )edit
0

answered 2011-10-28 16:46:08 -0500

saradocbrandi gravatar image

Thank you for spend your time answering my question. Finally I used Maple in the solving of my problem. Greetings.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2011-10-27 16:19:28 -0500

Seen: 552 times

Last updated: Oct 29 '11