Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
I am trying to find a way to find the 20 first roots of the following equation:
cotan(x) + a*x + b/x = 0
where a, b are parameters.
A Newton-Raphson method seems adequate but I have no idea how to code it into Mathcad.
I should mention that I'm a new to the Mathcad world and I have for the most part no idea how to write blocks and other non--trivial things in MC.
Also, I am using Mathcad Prim 1.0.
Any example on how to implement a mutliple-roots solver would be greatly appreciated.
Thank you.
Solved! Go to Solution.
The attached files are the implementation of Newton-Ralphson iteration as a matrix iteration scheme. (If I recall correctly, Prime 1.0 doesn't have programming.)
To do NR, it's necessary to take the derivative of the function. I've used the symbolic processor in 14 to get that. (Also not available in Prime.
Attached is the version 14 sheet and the pdf.
Greatest challenge is picking the starting points correctly.
Please provide a worksheet.
Mike
There are mutliple roots to this equation with the chosen parameters.
I know the roots for these parameters (from an external source) but I want to change the parameters. The root() function does not even allow to find roots in a different interval so I guess I need to implement something else...
Roots for the chosen parameter values:
0.9842 |
3.4290 |
6.4363 |
9.5282 |
12.6443 |
15.7705 |
18.9017 |
22.0359 |
25.1719 |
28.3092 |
31.4473 |
34.5860 |
37.7252 |
40.8648 |
44.0047 |
47.1448 |
50.2851 |
53.4255 |
Might want to look at this threadFinding roots of a non-rational function
I suppose you could also write a short program that steps across the x axis, and every time there is a sign change, call the root function with the range set by the point before and the current point (with the sign change). Then plot to make sure there were not multiple sign changes within a step, reduce the step if needed.
The attached files are the implementation of Newton-Ralphson iteration as a matrix iteration scheme. (If I recall correctly, Prime 1.0 doesn't have programming.)
To do NR, it's necessary to take the derivative of the function. I've used the symbolic processor in 14 to get that. (Also not available in Prime.
Attached is the version 14 sheet and the pdf.
Greatest challenge is picking the starting points correctly.
Exactly what I needed! Thanks!
Exactly what I needed! Thanks!
Fred Kohlhepp wrote:
...If I recall correctly, Prime 1.0 doesn't have programming...
The module "Programming" is present in the version Mathcad Prime 1.0.