Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: how to solve tan(x)=3x/(3+x^2)
Replies: 1   Last Post: Feb 13, 2013 4:11 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Christopher Creutzig

Posts: 285
Registered: 2/24/09
Re: how to solve tan(x)=3x/(3+x^2)
Posted: Feb 13, 2013 4:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 13.02.13 00:54, Jingxin wrote:
> So I tried to use Solve function to solve this equation, tried root, findroot. By using FindRoot, I was able to get one solution which is closest to x0, but, what if I want all the answers from 0,10 or the first 10 term?

Just a disclaimer up front: Numerically (and without interval numerics),
you can never know how many zeroes a transcendental (i.e.,
non-polynomial) equation has, so there is no way to guarantee finding
all of them.

Your input is sufficiently tame that finding (approximations) to all
zeroes in some range is a reasonable expectation, though. I don't think
there is a nice calling syntax in the symbolic toolbox yet, but you can
call MuPAD commands directly using feval, so you can for example use
numeric::realroots, which returns ranges such that any zero of your
function is in one of those:

>> eq = tan(x)==3*x/(3+x^2)

eq =

tan(x) == (3*x)/(x^2 + 3)

>> s = feval(symengine, 'numeric::realroots', ...
eq, 'x=0..10', 1e-4)

s =

[ [0.0, 0.0485992431640625], [3.726348876953125, 3.7264251708984375],
[6.681365966796875, 6.6814422607421875], [9.7154998779296875,
9.715576171875]]

>> vpasolve(eq, x, s(1))

ans =

0

>> vpasolve(eq, x, s(2))

ans =

3.7263846964537519995745420194228

>> vpasolve(eq, x, s(3))

ans =

6.6814348529499497169811754681414

>> vpasolve(eq, x, s(4))

ans =

9.7155660951117226365449206516755


HTH,
Christopher




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.