Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello,
I’m quite new to Mathcad and Mathcad Prime. I already looked for a solution in this forum and in the help files, but did not find anything suitable. Here’s my problem:
I defined a function f_next_s: Input s_n (current) -> Output s_n+1 (next).
Now I want to repeat this procedure n times, starting with s_1(given):
Step INPUT (s_cur) OUTPUT (s_pre)
1 s_1 s_2
2 s_2 s_3
3 s_3 …
… … …
n s_n s_n+1
AND
I want to store the values of s_1, s_2, … s_n+1 so that I can go on calculating with them.
Here is what I tried, but it doesn't work (it only gives out the first result, which is s_2):
Here ( http://communities.ptc.com/message/157701#157701 ) it says I should write the values in an array. But I can’t figure out how this works…
Can you please help me?
Best regards
Sebastian
Solved! Go to Solution.
I don't have Prime in front of me right now, but I think the answer to your problem is that you're not making an array in your program. I've enclosed a short file in version 14 that illustrates.
I hope this helps.
Can you upload the worksheet?
Mike
I thought it mitght be too confusing. But here it is.
There problem is situated at sheet 5 and 6.
Best regards
Sebastian
I'm confused. The program you showed in your first post is not the same in your worksheet
Can you clearly indicate which function has the problem and list the expected results, sorry I am mad busy today and haven't got much spare time
Mike
OK, sorry. Let me explain:
The pogram in the mathcade file is the original one. It does the same as the programs in the pictures I posted.
All I did was to change the names of the variables before posting the pictures - I thought it would be easier to understand like that...
I can't adapt the worksheet right now. I will upload a better explained version tomorrow, if there is no solution by then.
Thank you anyway for your effort.
Sebastian
I don't have Prime in front of me right now, but I think the answer to your problem is that you're not making an array in your program. I've enclosed a short file in version 14 that illustrates.
I hope this helps.
Hello again.
Fred, thank you for your detailled explanation. I think this is exactly what I need!
But now there is another problem:
I can not create a subscripted "i-1" like this
All I get in Mathcad Prime is a subscripted "i" minus the value 1
How can I fix this?
-------------------- EDIT --------------
OK, I got it.
I can use the shortcut key "[" to define the matrix.
That's it!
Thank you all very much
Message was edited by: Sebastian Distler
The last line should just be "s". If you return s[j then it will return only the element of s that corresponds to the current value of j (which is of course the last value).