10-23-2012 11:11 AM
Same as in my code above, you don't need the factorial function. It is just a series of multiplications. Since you need 50% of the intermediary results anyway, using a native factorial function would lead to a lot of unecessary duplicate computations.
Both mathscript and the formula node support loops, and that's all you need to e.g. translate my code above into text.
Of course I see absolutely no reason to do this "in text" if a good plain LabVIEW implementation exists, unless this is an exercise or homework.
Since your only concern was the absence of the factorial function in the formula node, and I just told you that you actually don't need it, maybe you can figure all this out by yourself. Once you have a solution, please post it. 😄
10-23-2012 12:16 PM
@altenbach wrote:
Same as in my code above, you don't need the factorial function. It is just a series of multiplications. Since you need 50% of the intermediary results anyway, using a native factorial function would lead to a lot of unecessary duplicate computations.
Both mathscript and the formula node support loops, and that's all you need to e.g. translate my code above into text.
Of course I see absolutely no reason to do this "in text" if a good plain LabVIEW implementation exists, unless this is an exercise or homework.
Since your only concern was the absence of the factorial function in the formula node, and I just told you that you actually don't need it, maybe you can figure all this out by yourself. Once you have a solution, please post it. 😄
My answer is not matching with your code..Can u please tell me where does the error lies
10-23-2012 12:56 PM - edited 10-23-2012 12:58 PM
10-23-2012 01:02 PM
Look this is waht i have written in the Mathscript editor.
"y=0
for i=0:1:n
y=y+(((-1)^n)*(x^(2*n+1))/(factorial(2*n+1)))
end
"
as you can see in the expression i have divided it by the factorial
I am sorry to say that I didnt get the meaning of ur first line
10-23-2012 01:24 PM - edited 10-23-2012 01:26 PM
Your Y output is of complex (CDB) datatype. Notice the red coercion dot? You need to make N an integer to avoid that.
10-23-2012 02:15 PM
@altenbach wrote:
Your Y output is of complex (CDB) datatype. Notice the red coercion dot? You need to make N an integer to avoid that.
Hi
I am novice to this Labview., so its bit difficult for me to understand.. I didnt get what do you mean actually.
n is already accepting integer values only, den what is the problem
10-23-2012 02:18 PM
Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.
10-23-2012 02:25 PM
@altenbach wrote:
Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.
I have done that but still its far from the desired reult.
Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.
10-24-2012 10:06 AM
Anu body please help me with this piece of code...
@TarunAgarwal wrote:
@altenbach wrote:
Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.
I have done that but still its far from the desired reult.
Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.
@TarunAgarwal wrote:
@altenbach wrote:
Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.
I have done that but still its far from the desired reult.
Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.
@TarunAgarwal wrote:
@altenbach wrote:
Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.
I have done that but still its far from the desired reult.
Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.
@TarunAgarwal wrote:
@altenbach wrote:
Right-click N and set the representation to I32 (it will turn blue). Currently, the repesentation of N is DBL and mathscript will use complex math to do the exponentiations.
I have done that but still its far from the desired reult.
Suppose i take n=5 and x=.7853(pi/4) then the o/p should be 1/sqrt(2) i.e is 0.707 but its differet here.
10-24-2012 01:48 PM
Your post seems a bit redundant 😮