how to solve non-linear transcendental equation with many roots

6 views (last 30 days)
Hi All,
I have to solve the following equation
x-(2*(sinh(x)*((cos(x)).^2+cos(x)-1)+sin(x)*(cosh(x)-1)))/((1-cos(x)*cosh(x))) =0.
It is a nonlinear with many roots, so is there any function in matlab can do it? the function fzero only return a root near a initial root value, which is not a automatic task.
Thank you.

Answers (3)

Walter Roberson
Walter Roberson on 13 Feb 2013
I suspect not, but I do not have the Symbolic Toolbox to test with. Using a different symbolic package, I find that there are an infinite number of roots, some real and some imaginary. There is no nice analytic expression for the roots.
One of the basic items repeated over and over in the forms is the root of cos(x) = x, which has no analytic solution.
The generalized solution for reals has three forms; the overall solution is the union of {0} and these three forms and three forms for the imaginary solutions. The three real forms are:
.7429621155 + 1.655668423 * B + 6.283185308 * Z
-0.7429621155 + 4.627516885 * B + 6.283185308 * Z
3.141592654 * B + 6.283185308 * Z
where B must be either 0 or 1, and Z is any arbitrary integer.
The 6.28<etc> is obviously 2*Pi, and the 3.14<etc> is obviously Pi, but the other numeric values have no obvious interpretation.
  4 Comments
Walter Roberson
Walter Roberson on 14 Feb 2013
It is possible that the above solution is incorrect; I am working through some difficulties I found with the other package.
Walter Roberson
Walter Roberson on 14 Feb 2013
I have confirmed that the solution I showed in my Answer is incorrect, but I do not have anything worked out yet as to what the correct general solution should be.

Sign in to comment.


Youssef  Khmou
Youssef Khmou on 13 Feb 2013
Edited: Youssef Khmou on 13 Feb 2013
Hi, there many ways to get solution,
You use a function Handle :
>>f=@(x) x-(2*(sinh(x)*((cos(x))^2+cos(x)-1)+sin(x)*(cosh(x)-1)))/(1-cos(x)*cosh(x))
>>y=fsolve(f,10e-3)
'fsolve' starts at x0=10e-3 and tries to solve the equation , you can verify the solution :
>>f(y)
-2.0334e-009
This helps ?
  3 Comments
David Zhang
David Zhang on 14 Feb 2013
Yes, it has infinite number of real roots. What i need is the first several results, such as the first 50 roots.

Sign in to comment.


Youssef  Khmou
Youssef Khmou on 13 Feb 2013
2nd answer :
You can use " solve" with symbolic variable :
syms x
y=x-(2*(sinh(x)*((cos(x))^2+cos(x)-1)+sin(x)*(cosh(x)-1)))/((1-cos(x)*cosh(x)))
z=solve(y) .
  12 Comments
David Zhang
David Zhang on 14 Feb 2013
I guess i have got the results. pls see the following code,
clear clc close all
xx=0:0.001:100; for i=1:length(xx) x=xx(i); fx(i)=(2*(sinh(x)*((cos(x)).^2+cos(x)-1)+sin(x)*(cosh(x)-1)))/((1-cos(x)*cosh(x))); flinerx(i)=x; end
plot(xx, fx); hold on plot(xx, flinerx, 'r') axis([0, max(xx), -max(xx), max(xx)])
options=optimset('Display','iter','TolFun',1e-10); % Option to display output
xguess = [2, 5,12, 18, 24, 30, 37, 43, 49, 55.5, 62, 68, 75, 81, 87, 93.5, 99.5]; for i=1:length(xguess) % Root_results(i)=fzero(@myfun,xguess(i)); Root_results(i,1)=fsolve(@myfun,xguess(i),options); end
fsolve is much better than fzero in finding the root, so i finally use fsolve instead of fzero.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!