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
- :
- Re: I need help in Looping or any other technique ...

Options

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

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

Showing results for

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

03-28-2021
05:09 PM

03-28-2021
05:09 PM

I need help in Looping or any other technique in four equations

Hi,

I am still learning Mathcad. I need help with making some of the formulas easier, with looping or any other technique.

My spreadsheet is full of some equations with toms of variables, each one is calculated previously 12 times,

I appreciate it if someone can provide a shorter format for each of the following four equations, and I will try to apply the same technique in all of them...

Thanks a lot

Labels:

13 REPLIES 13

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

03-28-2021
05:27 PM

03-28-2021
05:27 PM

Re: I need help in Looping or any other technique in four equations

Make sure W and Ws are vectors, then you can use summation:

And be sure to attach your worksheet for further help, not just a picture.

Success!

Luc

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

03-28-2021
07:00 PM

03-28-2021
07:00 PM

Re: I need help in Looping or any other technique in four equations

Thanks @LucMeekes

I do not think that this is what I need.I apologize if I was not clear enough.

I already have W1, W2, W3, .... etc defined before. Similarly for all the variables on the right-hand side such as M1sm2, M1sm3, etc,

I want to rewrite the four equations: Wcsw, Wssw, Mrmw, and WTw in a shorter form instead of repeating all the variables, getting an advantage of the looping technique...Thanks again

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

03-29-2021
01:23 AM

03-29-2021
01:23 AM

Re: I need help in Looping or any other technique in four equations

Hi,

Example you use M[1 to define the variables. They then make a vector that can be summed.

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

03-29-2021
02:29 AM

03-29-2021
02:29 AM

Re: I need help in Looping or any other technique in four equations

From your picture (It's really more helpful if you attach your Prime worksheet!) I see you have your variables named all independently, using literal subscripts. With that approach there is no way you can use loops or whatever to simply the operations you want to do.

So, You need to define your variables in the form of vectors, matrices or the like. Those you can index and that allows looping.

Success!

Luc

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

03-28-2021
11:04 PM

03-28-2021
11:04 PM

Re: I need help in Looping or any other technique in four equations

Hi,

Please enclose your worksheet and we can show you how to use indexing.

Cheers

Terry

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

03-29-2021
10:36 AM

03-29-2021
10:36 AM

Re: I need help in Looping or any other technique in four equations

Thanks LucMeekes and terryhendicott for the help...

As requested, I am attaching a simplified sample of the worksheet containing the bone of the calculations Please note that many variables are currently in a hidden range that you can expand. The actual sheet is over 40 pages for repetitions!, but if I learn how to do it I think I would be able to apply everywhere...

I will experiment with some techniques as I learned above, but I appreciate if someone can provide some insight considering the bigger picture as I enclosed here..

@LucMeekes

@terryhendicott

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

03-29-2021
11:05 AM

03-29-2021
11:05 AM

Re: I need help in Looping or any other technique in four equations

Here's the proposed approach:

See attached Prime6 file.

With this you don't need the variable NM anymore, and also the first row of your Module matrix is obsolete, or you can change it to titles:

If you want to calculate more than 3 items, just add them to Mod. You don't need to change the other formulae, the definition of m takes care of the number of items. Example:

Next thing is, you need to make sure that all your calculation can deal with the vectors.

Hmm. I see that your further formulae use ORIGIN=0 (the default) . Maybe better keep ORIGIN=0.

Just delete the 'ORIGIN :=1' definition and all is well.

Success!

Luc

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

03-29-2021
09:18 PM

03-29-2021
09:18 PM

Re: I need help in Looping or any other technique in four equations

Hi,

Have taken some time with your worksheet.

I have created the values as vectors and used two ranges "i" 1 to 12 and "j" 2 to 12 to do this.

You reference a value in a vector (or matrix) using the square bracket for instance V[3 gets you a value from the V.

By default the indices start at zero and you can change that. At the top of the sheet I reset ORIGIN = 1 to set the first element to be position 1 for better understanding of the formulas.

I have left some subscripted expressions for you to change they are highlighted in red and are easy to change.

I have left them so you can see the very subtle difference between a subscripted variable and an indexed variable. The index is a little lower compared to the subscript.

Hope this all helps.

Enclosed worksheet

Cheers

Terry

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

03-29-2021
10:46 PM

03-29-2021
10:46 PM

Re: I need help in Looping or any other technique in four equations

Hi,

spotted a small error. Corrected in Version 2.

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

04-02-2021
12:52 PM

04-02-2021
12:52 PM

Re: I need help in Looping or any other technique in four equations

Thanks @terryhendicott & @LucMeekes for your help

I am experimenting with your solutions and still learning...

I am not sure why the attached does not read the variables, although I think I have followed the steps?

Thanks again!

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

04-02-2021
01:50 PM

04-02-2021
01:50 PM

Re: I need help in Looping or any other technique in four equations

See attached sheet for comments and suggestions.

Success!

Luc

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

04-02-2021
02:59 PM

04-02-2021
02:59 PM

Re: I need help in Looping or any other technique in four equations

@LucMeekes

Thanks a lot for the great info. I added some comments/ responses to your comments in "red" in the attached.

I am getting there!! Thanks again for this great learning experience

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

04-03-2021
08:05 AM

04-03-2021
08:05 AM

Re: I need help in Looping or any other technique in four equations

Added a few remarks...

Success!

Luc