# Simple trigonometric equation solving

I was a MapleV user in the past (~25 years ago) an I'm very pleased to find such an elegant solution the sage is. I try to see how it works trying to solve an easy trigonometry calculation:

var('r,l,m')
ex = l/sin(m/2/r)-r
solve(ex,r)

[r == l/sin(1/2*m/r)]


Do not want, ok. To simplify I put some real values m and l and tried again:

exval = ex.subs(l=7.2,m=10)
solve(exval,r)

[r == 36/5/sin(5/r)]


still not solving, r=3.68357 is what I'm searching for. What would be a right way to proceed? Thank you in advance, v42

edit retag close merge delete

Due to mis-reading the question, I inadvertently left here a pile of manure...

My apologies to whomever I may have misled.

( 2021-01-14 17:02:24 +0200 )edit

Sort by » oldest newest most voted

This plot :

var('r,l,m')
ex = l/sin(m/2/r)-r
plot(ex.subs(l=36/6, m=10), (r, -5, 5), ymin=-5, ymax=5, detect_poles=True, plot_points=1000)


suggests that ex has no (real) roots around 0. Proving it may require a non-trivial analytical exploration, possibly requiring the non-trivial use of non-trivial tools...

However, trying the suggested numerical solution :

print("Value of ex at suggested root r=%f is %f"%(3.68357, ex.subs([l==36/5,m==10]).subs(r==3.68357)))
Value of ex at suggested root r=3.683570 is 3.683570


suggests a typo in the question : at this value, ex approximately equals r. Which suggests that this value is (ano approximation of) a root of ex-r, which can be found more elegantly by :

print("Root of ex-r : %f"%find_root(ex.subs(l=36/5, m=10)-r, 2, 5))
Root of ex-r : 3.683570


See plot and computations in Sagecell

more

Dear Emmanuel, Thank you a lot for your reply and explanation, this is what I tried to achieve. You're right with ex - r. Thanks again, I pursue my exploration of this superb piece of software :).

( 2021-01-15 17:58:56 +0200 )edit