10-05-2015 01:10 PM
If I was using the quadratic formula in Labview (-b±√b²-4ac/2a,) how would I represent the ± using the Mathmatics functions?
10-05-2015 01:46 PM
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
10-05-2015 02:30 PM
Out of interest, how do you get LabView to generate a complex result when the parameters demand it?
10-05-2015 02:55 PM
I still cant figure it out. Here is a screenshot of both my Block Diagram and GUI.
10-05-2015 02:59 PM
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
10-05-2015 03:01 PM
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
10-05-2015 04:45 PM
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> ---'
10-06-2015 02:42 AM
10-06-2015 04:13 AM
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.
10-06-2015 08:15 AM
@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