02-10-2016 01:07 AM
I have been searching the boards for a working rootfinder which can have complex results without much luck. Some suggestions about converting into r,theta, but not sure how to go about doing that. And my equation is not a polynomial(since I see there is a complex polynomial root finder) and converting it into one would be deadful.
I have already solved this in mathematica and the result is a real number with a negligable imaginary part. (using newtons method)(shown in mathematica notebook attachment)
I attempted to make a newton-rapson VI using fomula nodes but it results in NaN.
It works when it searches for negative numbers, but this is not what I need. This makes me believe it is the the complex nature of the result that is what is giving me problems.
I have been looking into using MathScript to solve this, would this be a better approach? But again not finding any information on complex solutions.
I attached the VI and the original Mathematica Notebook from which it is being derived for some context.
I have created a working version of end part of this notebook in a seperate VI, but am now trying to make the part from
"findroot (pthing)
.
.
.
nofz = findroot(zofn)"
The attached VI is attempting to solve "findroot(pthing)"
Any advice is appriciated
thank you
Solved! Go to Solution.
02-10-2016 02:04 AM
Without looking into the details, i see that you are using pure double values. Obviously you are not aware that you can change the numeric presentation of numeric elements to complex (right-click >> Representation >>CXT).
Also note that there are functions to handle complex numbers and change between polar and complex representation.
Trying to solve everything with one formula node is NOT programming LV. You should go into learning to program in LV....
Norbert
02-10-2016 03:23 AM
I will tansition my question to the appropriate section.
But, I was able to transition into a MathScript so that I could use the CXE data type.
Now I am having trouble with the MathScript. Would this question also be in the section you suggested or in the MathScript specific section?
I attached the updated VI, which "runs" but yeilds an error in the MathScript.
02-10-2016 03:28 AM
The error message is quite clear: You are using the variable "z0" incorrectly.
From that point moving forward i found that your formula starts:
Z = z0(b[...]
It seems that there is a mathematical operation like '*' or '+' missing between z0 and the bracket......
Norbert
02-10-2016 03:35 AM
Whats funny is that, as you can see, the equation is rather long and I had a few of those to fix after copying the equaiton from another source, but all the others registered as a broken arrow. Why this one was different is odd.
My lastest result exactly matches my previous result and I can now procede into incorperating this into my larger VI.
Thank you very much for the help!
02-10-2016 03:37 AM
here is the workign VI, just for completeness
and again
thank you