Yes, it borrows multiplication from the pi calculation.
That worksheet has addition, subtraction, multiplication, and division methods for very large numbers.
I can re-post it here or someone can look it up. It may be useful for this problem.
The question rather was how to use those functions to implement a numerically ordinary function S2() using those routines. We need an ordinary number in an ordinary variable at the end.
Her are a few ideas to force the symbolic processsor to produce (hopefully) "correct" answers.
Regards
Andy
The problem with your functions ist the same as with mine http://communities.ptc.com/message/203150#203150
that the results look like scalars but aren't, they are expressions. So they will not plot, which is what Adnan Mustafa demanded.
To make your initial definition of S2(p,m) work like you expected, you can do as I did, leaving the original if-condition intact, or you simply need to set the RHS in parantheses (first insert the parentheses, then copy the symbolic eval inside).
For a while there I thought you found what I am looking for. Using the symbolic processor does give accurate results now -thanks! But it can only be used as a scalar. What's strange is that when I'm calling the function now to setup an array, you see it doing all the calculations "live" in front of your eyes! ... but they are not saved in the array!
What you have is really impressive, but does not help me in my problem.
Adnan Mustafa wrote:
For a while there I thought you found what I am looking for. Using the symbolic processor does give accurate results now -thanks! But it can only be used as a scalar. What's strange is that when I'm calling the function now to setup an array, you see it doing all the calculations "live" in front of your eyes! ... but they are not saved in the array!
Add a numeric evaluation = after the call of SS2(p,j) and it works. This seems to make the values "numeric/scalar". Unfortunately I know of no way to do that conversion aleady inside the functun S2.
But as already said, that kind of function will behave somewhat strange in some situations, as the results are not seen as scalars by Mathcad but as an expression. Thats the reason the function S2 could not be used to plot. But (depending on what plots you are after) storing the values to be plotted in vectors and then plotting them should work.
BTW, I'm not sure why, but the if-condition to catch if p<m seems to be unnecessary. The sum will yield 0 in that case anyway.