# Problem with solve

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 close merge delete

Sort by » oldest newest most voted

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

more

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.

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

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

( 2011-10-28 03:00:02 -0500 )edit

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.

more

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

( 2011-10-29 14:23:52 -0500 )edit

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

more