Ask Your Question
0

plot of sine, parabola intersection works but solve makes no sense

asked 2020-10-18 08:14:31 +0200

cybervigilante gravatar image

updated 2020-10-18 08:28:51 +0200

When I plot a sine and parabola I get two obvious intersections

plot(x^2-5,-10,10,ymax=20) + plot(sin(x),-10,10)

But when I solve to get the two numeric x values, the answer makes no sense.

solve(x^2-5==sin(x),x)
[x == -sqrt(sin(x) + 5), x == sqrt(sin(x) + 5)]

image description

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-10-18 12:09:15 +0200

rburing gravatar image

It makes sense: it tried to solve symbolically, and it didn't get very far (it isolated the square, and took ± the square root).

You don't want to solve symbolically but numerically. You want to find the two real zeros of x^2 - 5 - sin(x), and from the picture you (roughly) know intervals where these are located, so you can use find_root:

sage: find_root(x^2 - 5 - sin(x), -5, 0)
-2.025211637444818
sage: find_root(x^2 - 5 - sin(x), 0, 5)
2.3846766601465696
edit flag offensive delete link more

Comments

Thanks. Although it's odd that plot can "solve" it but solve cannot. Maybe in a future iteration of sagemath, a symbolic failure will default to find_root.

cybervigilante gravatar imagecybervigilante ( 2020-10-18 16:59:03 +0200 )edit

Can you only get this numerically or is there some form of advanced math that could solve a trig/algebra equivalence? I couldn't think of a way to do it by hand.

cybervigilante gravatar imagecybervigilante ( 2020-10-18 21:34:08 +0200 )edit

Most equations have no clean solution and must be evaluated with numerical approximations. This is one of them. Even polynomials can cause problems.

dazedANDconfused gravatar imagedazedANDconfused ( 2020-10-19 02:05:23 +0200 )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: 2020-10-18 08:14:31 +0200

Seen: 188 times

Last updated: Oct 18 '20