Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Sep 16, 2020
10:24 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
10:24 AM

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

Labels:

6 REPLIES 6

Sep 16, 2020
11:33 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
11:33 AM

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

- Tags:
- ts

Sep 16, 2020
12:51 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
12:51 PM

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.

Sep 16, 2020
01:10 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
01:10 PM

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.

Sep 16, 2020
04:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
04:01 PM

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!

Sep 16, 2020
01:08 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
01:08 PM

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

Sep 16, 2020
04:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Sep 16, 2020
04:02 PM

Luc,

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