06-16-2020 08:50 AM
Oops, sorry to have not returned and responded. I thought I'd leave you with the following Demo, which you can compare with your own Recursive routine. I'm using Strings (to demonstrate that recursion works in all kinds of situations) instead of numbers, but it is the same idea. I have an Array, Q, of Coefficients (the Array has ["a1", "a2", "a3", "a4", "a5"] in "text-language notation" for an array of strings, the first being the string "a1", etc.) and a variable X (the string "x"). It calls the Recursive Routine, which produces the Polynomial, the string "a1 + x * (a2 + x * (a3 + x * (a4 + x * a5))))". The calling routine is simple:
The Recursive Evaluate routine is a tiny bit more complicated, but here is the main Recursive call:
Here's how it works:
And that does it! Substituting Arrays of Dbls for the coefficients and a Dbl for X, and replacing the string operations with their arithmetic counterparts will let you do Polynomial Evaluation numerically.
Enjoy.
Bob Schor
06-18-2020 07:09 AM
Hi Bob,
Thanks for your patience and explaining me the concepts in detail. Truely, your inputs helped me a lot. Thanks again!
06-18-2020 08:43 AM
@rajram75 wrote:
Hi Bob,
Thanks for your patience and explaining me the concepts in detail.
It's always fun (for me) when a Forum topic hits on something about LabVIEW that I find to be especially interesting, like Recursion ...
Bob Schor