LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quadratic Formula question.

If I was using the quadratic formula in Labview (-b±√b²-4ac/2a,) how would I represent the ± using the Mathmatics functions?

0 Kudos
Message 1 of 10
(8,861 Views)

Do you understand what the Quadratic Formula means?  [I was just talking to a high school sophomore about this -- she didn't get it, either].

 

All quadratic equations have two (2) answers.  A mathematical short-hand to write both of the answers with fewer pen strokes is to use the symbol ± to mean "One answer uses + and the other answer uses -".  How would you take three numbers (the coefficients of the second degree polynomial) and produce a two-part answer (in LabVIEW)?  How would you represent that two-part answer?

 

Bob Schor

0 Kudos
Message 2 of 10
(8,845 Views)

Out of interest, how do you get LabView to generate a complex result when the parameters demand it?

0 Kudos
Message 3 of 10
(8,814 Views)

I still cant figure it out. Here is a screenshot of both my Block Diagram and GUI.

0 Kudos
Message 4 of 10
(8,800 Views)

Simple -- feed the real and imaginary parts into the Re/Im to Complex function and out pops a Complex number.  Look on the Numeric palette.  [If you don't see it, your version of LabVIEW is "too old"].

 

Bob Schor

0 Kudos
Message 5 of 10
(8,795 Views)

Don't attach a picture -- attach the VI itself.  This lets us "play with it" (and run it to see what it does).  It's not that we're too lazy to squint at a tiny image and try to painstakingly reproduce your code, but then you'd have to triple what you are paying to use the Forum ...

 

Bob Schor

0 Kudos
Message 6 of 10
(8,791 Views)

Bob_Schor.png

 

You can literally google image search "quadratic equation labview" and find how someone else has already solved this in LabVIEW.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 7 of 10
(8,756 Views)
Bob Thats not the question I was asking: If I wire a complex type out of the square root function, will it automatically generate a complex result when the input to the square root function is negative? Or, more generally, will all Labview arithmetic functions work correctly if wired with `complex` wires?
0 Kudos
Message 8 of 10
(8,724 Views)

I would imagine all the basic math primitives will work with complex - enough to solve your quadratic.. but a lot of stuff won't. It would only take you a minute to try it.

0 Kudos
Message 9 of 10
(8,709 Views)

@SteveD123 wrote:
Bob Thats not the question I was asking: If I wire a complex type out of the square root function, will it automatically generate a complex result when the input to the square root function is negative? Or, more generally, will all Labview arithmetic functions work correctly if wired with `complex` wires?

That's a good question -- I do not know the answer, but I can (and did) find out in less than a minute.  I opened a new VI, created a Dbl constant (4), wired it to a Sqrt function, and wired a Dbl and a Complex indicator to the outpu.  I ran it, it returned 2 (dbl) and 2+0i (complex).  I then changed the input to -4 and tried again.  I got NaN and NaN+0i.  Finally, I changed the input representation to Complex (so it read -4+0i).  When you take the minute to do this yourself (which you should have done, rather than ask us to just give you all the answers), you'll learn how LabVIEW handles Complex quantities.

 

Bob Schor

0 Kudos
Message 10 of 10
(8,679 Views)