Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi all,
I must preface this by saying that I am brand-new to MathCAD and know not much.
I tried a few different things to tackle this issue myself. However, it seems like I need a new perspective.
The bold portion is the rough program. I have
n=0,1,...
t(n) := t(n-1)+c
while t(n)<6*R
F(n)=F(n-1)+....[other system parameters that don't involve 'n']
'c' is a constant and not a matter of worry. 'n' will keep incrementing until t(n)=11*R [R is another constant, but will be changed according to the system parameters. So, R=1 in one case and R=300 in other cases; user-defined]
I am not sure how to define 'n' and t(n). They are interdependent and the few things I tried have been unsuccessful so far.
Any help is appreciated.
Thank you in advance.
--
Thanks and regards
Its not clear what you want to achieve. What should be the result you are looking for?
Is it just the last value for F(n) you arrived at?
Or do you need a vector of all F and t values?
Or are you trying to define a function which returns the value of F for any given n ?
BTW, you may write t(n):=t0+n*c
There is no need for recursion and you sure need a start value t0. Similar applies to F
Thank you for your response.
I need all the values of t(n) and F(n).
The 'c' here is from another function and will not work if I use n*c. I have defined t(n=0)=0 and F(n=0)=0 as well.
How can I define n and t(n)?
Since the end of n's range should be when t(n) reaches a certain value (11*R), how do I declare n with this condition?
I appreciate you taking the time to help me.
I don't see why it should be a problem if c is the result of a function.
It would help if you could show the full problem, preferably by posting a worksheet.
Here is an approach which sticks to the recursive definitions as you proposed it, but the same results sure could be obtained in a simpler, non-recursive way, too.
This works perfectly for the sample I am working on. I am positive I can escalate this to the actual model too. Thank you. I appreciate your help with this!
Welcome to this forum.
You should always post the worksheet, showing the attempt that you have. Not only will it help to not having to retype stuff, but it will also show if you're using (real) Mathcad, or Prime, and which version.
Seems to me like you need t to increment with c also inside the while loop.
What you are looking for are all values of t and F, so they better be arrays (vectors).
Here's an example:
Success!
Luc
Luc,
This is wonderful. It worked out perfectly for my question. Thank you for helping me out. I appreciate it 🙂