LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathematicl basics, How to do an expansion?

How do I do an equation similar to a binomial expansion, except the exp is a variable.
ie. (.99325+.00675)^x, where x is any number from 0-50.
The output should be some kind of array of numbers.
Thanks for the help!!!
0 Kudos
Message 1 of 18
(2,781 Views)
Use Numeric/Logarithmic/Power of X.vi
This vi computes x^y, where y is same as x in your question. Both x and y can be numbers or arrays.
0 Kudos
Message 2 of 18
(2,781 Views)
Good answer nchernin. However, I have a feeling that Johnny is after something else here. In his example, we have 1.000^x and that is always 1... But to expand the equation we need to use Pascals triangle to get the binomial coefficients. Johnny, is this what you are after? In other words, the result being an array that, when you sum the elements, give you the result that also can be computed as ncherning indicated. What I mean is this if your equation is (a+b)^2 the result would be an array with the elements a^2, 2*a*b,b^2. Please let us know more details and I am sure we can guide you in the right direction. /Mikael
0 Kudos
Message 3 of 18
(2,781 Views)
Correct Mikael, sorry about the vague description. I am looking to get a result using the pascal triangle method. Thanks for the prompt reply.
Also, I cannot find the mathematical function panel(version 5.5), is this a feature that needs to be installed seperately?
0 Kudos
Message 4 of 18
(2,781 Views)
Correction, version 5.1

I have attached a word file that explains better what I am trying to do. It doesn't appear that Labview is robust enough at mathematical calculations. Thanks for your patience, I am a university student working on a project.
0 Kudos
Message 5 of 18
(2,781 Views)
What you need is polynomial algebra functions. HiQ,a software also from NI, has a polynomial object. For example the polynomial P<<-(2x+1) may be represented by an array [2,1] and polynomial multiplication P*P results as the array [4,4,1] which is 4x^2+4x+1.

A polynomial object with VIs to implement multiplication and addition should not be too difficult to implement with LabVIEW. It is an interesting topic, indeed, maybe some group members will be glad to make their teeth on it... Polynomial addition is trivial, just resize the smallest order array to match the longest and add. Multiplication is more involved and requires to multiply every elements of one array with every elements of the other array(make use of outer product VI "A x B.vi" if yo
u have it on your LV package) and sum elements of the same order, e.g. sum elements of the outer product C(i,j) having the same sum (i+j).


LabVIEW, C'est LabVIEW

Message 6 of 18
(2,781 Views)
I have done it. Attached are one VI to add polynomial coefficients, one VI to multiply polynomial coefficients and one to compute polynomial powers. Enjoy!


LabVIEW, C'est LabVIEW

Download All
0 Kudos
Message 7 of 18
(2,781 Views)
Thanks for your help!!!
I am not sure how to implement these .vi into actually calculating the polynomial...I understand that they will do the sorting afterwards, but how would I integrate the designated P(x) function?

Am attaching a revised description of my problem.
0 Kudos
Message 8 of 18
(2,781 Views)
JohnnyRocket,

To use these VIs, create a polynomial array for each chemical element:
H = [0, 0.999851, 0.00015]
C = [0,0,0,0,0,0,0,0,0,0,0,0,0.98938, 0.01078]
N = [...]
O = [...]
I = [...]

For C15H11I4NO4, take poly C and raise to power 15 using the power VI. Do the same for each element and then multiply the resulting polynomials. This polynomial will contain the relative abundance of molecular weight for the molecule e.g. array element N is the relative abundance of molecular weight N.

A quick test for good result is to sum the array elements; it should always be 1.0 +/- numerical accuracy if the sum of chemical elements arrays H,C,... are also 1.0


LabVIEW, C'est LabVIEW

0 Kudos
Message 9 of 18
(2,781 Views)
WOW, your a genius!
To create the polynomial array, do I simply use the build array function and input all the numbers as a constant (seems to take up a ton of space) or is there an easier way to do this, ie. some hidden "create polynomial array" button?

Thanks for your patience, am a novice.
0 Kudos
Message 13 of 18
(2,713 Views)