cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Nested conditions on MathCAD

ML_9632709
5-Regular Member

Nested conditions on MathCAD

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

6 REPLIES 6
Werner_E
25-Diamond I
(To:ML_9632709)

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

ML_9632709
5-Regular Member
(To:Werner_E)

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.

 

 

Werner_E
25-Diamond I
(To:ML_9632709)

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.

Werner_E_0-1600276198707.png

 

ML_9632709
5-Regular Member
(To:Werner_E)

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!

 

LucMeekes
23-Emerald III
(To:ML_9632709)

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:

LucMeekes_1-1600276055847.png

Success!
Luc

 

ML_9632709
5-Regular Member
(To:LucMeekes)

Luc,

 

This is wonderful. It worked out perfectly for my question. Thank you for helping me out. I appreciate it 🙂

Announcements

Top Tags