Get Help

Turn on suggestions

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Programming help - iterating through multiple equa...

Options

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

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

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-10-2012
03:59 PM

04-10-2012
03:59 PM

Hello,

I've attached a mathcad document explaining what I am trying to achieve.

To simply for explanation purposes, I have have a few intial givens:

a b c d

the first equation calculates a number based on the givens.

the second equation calculates the next number based on the first equation

the third equation calculates the next number based on the second equation

the number in the third equation is added to a few of the givens, and the cycle repeats itself.

Could somebody help me write this program?

The mathcad document explains it in more detail.

Thanks!!!!!

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2012
11:17 AM

04-11-2012
11:17 AM

I was adding twice, corrected attached.

Fred showed the use of range variable, and Andy improved upon that. If you only want one solution, Andy's is pretty clear and concise.

I showed a different method using a program. It's a little longer, but self contained and can be used to study different conditions a little easier, or used in other functions.

By the way, if a0 and c0 are equal, then I think ci=ai, you only need to calculate ai, so I assume you want to study different inital values.

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-10-2012
04:58 PM

04-10-2012
04:58 PM

Re: Programming help - iterating through multiple equations.

Set up for step-by step iteration. Probably could set up for ODE solvers.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-10-2012
05:27 PM

04-10-2012
05:27 PM

Re: Programming help - iterating through multiple equations.

Fred,

Thanks for the help, however I don't believe the sheet is working correctly. I may be able to fix it myself though - not sure.

da/dN at a phi of 90° should be added to a

da/dN at phi of 0° should be added to c.

I checked it against the attached spreadsheet, and it diverges as the cycles are increased.

What I am trying to do is replicate the attached worksheet, where I can just fill down the row's and it will work just fine.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-10-2012
05:59 PM

04-10-2012
05:59 PM

Re: Programming help - iterating through multiple equations.

Another way, using programs

But Fred and I get different results, so on of us goofed, maybe both.

Not the most efficient program, but you can follow the steps as you stated them (I think )

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-10-2012
06:45 PM

04-10-2012
06:45 PM

Re: Programming help - iterating through multiple equations.

Wayne,

Thanks for your help, but it looks like there is a few minor errors in your spreadsheet. The first E equation is a square root. Also, it looks like you are adding a0+a1+da/dn. a and c are doubling as they go down, but they should only go up a little bit, like:

0.500

0.501

0.503

0.506

etc.

I'll try to debugg it but I'm not sure I follow it.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2012
04:57 AM

04-11-2012
04:57 AM

Re: Programming help - iterating through multiple equations.

Here's another method.

Initial equations reworked to be functions, then quite simple to use a range variable to iterate through to the required depth

Regards

Andy

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2012
11:17 AM

04-11-2012
11:17 AM

I was adding twice, corrected attached.

Fred showed the use of range variable, and Andy improved upon that. If you only want one solution, Andy's is pretty clear and concise.

I showed a different method using a program. It's a little longer, but self contained and can be used to study different conditions a little easier, or used in other functions.

By the way, if a0 and c0 are equal, then I think ci=ai, you only need to calculate ai, so I assume you want to study different inital values.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2012
12:26 PM

04-11-2012
12:26 PM

Re: Programming help - iterating through multiple equations.

Wayne,

This works great - thanks! There was one thing that needed to be fixed, and that was turning 90° into Pi/2, but other than that it is perfect.

Thanks again!

Top Tags