Narasipur Suryanarayana wrote:
I still have a small problem. Increasing the value of n I find the array of the results become huge. Is there any way that only last two or three columns of the results can be displayed?
I modified my routine "shanks()" so that the second argument now controls how many of the last iteration columns are returned. If this value is zero (or negative) the result is just the last calculated value (as was the case in the older routine when the argument mode was 0).
Find the modified worksheet attached.
P.S.: I lost track about the filed in play here so I, modified the first version I posted. The modification could be applied to the other version I posted in exactly the same way - its only the last few lines which have to be changed.
Sorry to be bugging you Mr. Werner; I am still having a problem even though I am trying to copy your second version faithfully. Could you kindly tell me where I am going wrong and also if there are other problems where I may have issues?
OK, here we go:
1) BLUE: Its the letter O, not a zero. It does not harm in your case, as you have ORIGIN=0 anyway. The only reason for using O (which is set to the current value of ORIGIN at the beginning of the program) instead of zero is, so that you can use the very same program unchanged in a sheet which has set ORIGIN to something different.
2) GREEN: You changed the 1 to 3 which will make one additional iteration even though our vector is just consisting of a single element. You would get an error es of using an invalid index.
3) YELLOW: Sorry for that. We have 1 x 2 matrices on both sides here! That way we can assign values to multiple variables using just one line. I think I was doing this because I was working on a monitor with rather low resolution and wanted to save space to be able to make a screenshot without having to capture a scrolling window. You may change both back to normal two-lines assignments.
4) RED: This is not an exponentiation like "^ T" but you can get the transpose operator from the menu (Matrix toolbar) or by typing Ctrl + 1. The reason for transposing the result vector is because I think that thats a better way to present the result.
Hope this helps.
Hello Mr. Werner
Thanks a million for your assistance. It worked beautifully.
One thing I did not understand in one your comments that increasing n to 22 mathcad crashed. I did not use any value for epsilon but have tried values of n up to 31 and no problem.
One other comment. As I told Mr. Diaz I am an old person (85+) still learning Mathcad (now you know why I came to frequently for assistance. Your explanations were easy to follow. Now I have to understand the programming part, which I hope to do on my own.
Is Mathcad results limited to 17 digits or is there any way to increase the number of digits?
One last comment. Your patience is commendable. Have you considered teaching as a profession - not much money there but a great deal of satisfaction if you can find students who would like to learn. I am saying this as I myself taught at a university for over 30 years.
Again thanks for all your assistance.
> One thing I did not understand in one your comments that increasing n to 22 mathcad crashed.
I was talking about my second variant of that routine.
In my first version I was doing iterations until the vector is just 2 or 1 rows in length.
In the other version I stopped iterations when the values in the vector are all equal (according to a given tolerance epsilon).
> Is Mathcad results limited to 17 digits or is there any way to increase the number of digits?
As in every software which uses IEEE number formats numerical accuracy is about 16-16 digits.
Only way to get better precision is when you use symbolic evaluation, but you may run into other problems doing so.
> now you know why I came to frequently for assistance.
feel free to come back whenever you have a question or experience any problem. Thats what this forum is all about.
> Have you considered teaching as a profession -
Wouldn't mean much change. My work consists of teaching to a great part - for nearly 30 years now 😉
I implemented your program shanks2 with separate lines for n and s(subscript)O and it worked. But when I try to have both in one line as you have done (n s(subscript) or s. it does not work. How do you introduce space between the two?
You have to insert a 1 x 2 matrix first (Matrix palette or pressing Ctrl-M) and then fill the placeholders. You have to do this on the left and on the right side of the assigning arrow.
Thanks Mr. Watner. Implemented your suggestion and works beautifully.