LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Computing the value of sin(x)

Is this now a different "that" or are you still talking about that other thread?

Each term of the expansion can be calculated directly from [I]. All you need is to add them up. Where do you have problems?
0 Kudos
Message 11 of 26
(1,814 Views)

I do not know how to correctly set it up that way... I have tried many times but it does not work. I do not know where my problem is

0 Kudos
Message 12 of 26
(1,808 Views)

This is very simple. Part of the problem could be that you have some of your inputs reversed. For example instead of "(-1)^n" you seem to calculate "n^(-1)", which is someting completely different! Also mind your representations. The value wired to N should be an integer (blue). You definitely don't need a formula express VI.

 

For each iteration you need the following terms based on the iteration number obtained from [i]:

  • (-1)^n
  • x^(2n+1)
  • (2n+1)!

combine them according to the formula and run the loop N times and autoidenx the result at the right loop boundary. After the loop, use "add array elements" to create the sum. You don't even need a shift register.

 

There are many other ways to do it (e.g. as in the quoted thread), but try this first. Post your code (the actual VI, not pictures!) if you get stuck.

 

0 Kudos
Message 13 of 26
(1,799 Views)

I am trying to do this. But I can't on configure formula. This looks hard to me. Would you kindly provide an example? 

Thanks!

0 Kudos
Message 14 of 26
(1,547 Views)

@BArtzon wrote:

I am trying to do this. But I can't on configure formula. This looks hard to me. Would you kindly provide an example? 


You are adding to a very old thread with many posts.

 

What is "this" that you are trying to do?

Why are you trying to use a formula node at all and what exactly seems hard to you?

0 Kudos
Message 15 of 26
(1,536 Views)

I had to try it for funsies. It's quite impressive how well it hits the target just with n=5.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 16 of 26
(1,529 Views)

@Yamaeda wrote:

I had to try it for funsies. It's quite impressive how well it hits the target just with n=5.


Yes, it is pretty good. In my old post, I claim that with 14 terms we get within 1e-15 of the correct values.

 

TaylorSine

Message 17 of 26
(1,506 Views)

You gave me the solution, but I think I missed something. I am getting the wrong output. Can you check what is wrong? I am new to this.  

0 Kudos
Message 18 of 26
(1,487 Views)

did you notice the inversion circle on the lowest input of the middle compound arithmetic node? Right-click the terminal and select invert, resulting in a division. The rest is correct.

 

DivideIt.png

 

You probably also want to remove that wait. Makes no sense to have it there

 

Btw, my code is posted here. (Also, the above image is a snippet)

Message 19 of 26
(1,483 Views)

Thank you!

I am trying to do the taylor expansion of sinx using the formula node but don't quite understand how to go about defining the factorial. How would you do that?

 

 

0 Kudos
Message 20 of 26
(1,439 Views)