LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

complex root finder

Solved!
Go to solution

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

 

 

 

 

Download All
0 Kudos
Message 1 of 6
(4,831 Views)
Solution
Accepted by topic author grantmetheny

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(4,810 Views)

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.

0 Kudos
Message 3 of 6
(4,792 Views)
Solution
Accepted by topic author grantmetheny

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 6
(4,788 Views)

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!

0 Kudos
Message 5 of 6
(4,781 Views)

here is the workign VI, just for completeness

 

and again 

 

thank you

0 Kudos
Message 6 of 6
(4,775 Views)