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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Simple iteration process over range: n

tokland
1-Newbie

Simple iteration process over range: n

Hi,

I have (what I think) is a simple mathcad problem. I only have very basis knowledge in mathcad. Not sure if I put this post in the correct discussion board

I need to solve the equation below with n=[4......10]. The range, n ,may variy from time to time so next time it could be n=[5.......25]. I have set it up and I can find Pc by just entering e.x n=6 but I would be nice to have a automatic iteration process.

I want Pc to return values for:

Pc[n=4] = ?

Pc[n=5] = ?

.

.

.

.

Pc[n=10] = ?

How can i set this up properly in mathcad. I have version 15. Is there a simple way? Keep in mind that I am a very basic user of mathcad

Thomas

5 REPLIES 5

If you convert your expression to a function

Instead of

      Pc :=

Write Pc(n):=

Then Mathcad will evaluate Pc(2)= to be the value if n were 2,

     and Pc(3)=   will evaluate for n = 3,

And so on.

-MFra-
21-Topaz II
(To:tokland)

Hi Thomas,

see picture:

for Thomas.jpg

MJG
18-Opal
18-Opal
(To:tokland)

You need n to be a vector.  As you've currently defined it (n:=4..10), it is a range variable.  The simplest way to convert it from a range to a vector is to use an in-line evaluation:

Alternatively, you could do something like this (note that "k" is a range variable, and n is a vector):

Once you have n defined as a vector, you can enter your Pc equation exactly like you did before, except it needs a "vectorize" operator over the whole equation:

StuartBruff
23-Emerald II
(To:tokland)

Thomas Okland wrote:

Hi,

I have (what I think) is a simple mathcad problem. I only have very basis knowledge in mathcad. Not sure if I put this post in the correct discussion board

I need to solve the equation below with n=[4......10]. The range, n ,may variy from time to time so next time it could be n=[5.......25]. I have set it up and I can find Pc by just entering e.x n=6 but I would be nice to have a automatic iteration process.

I want Pc to return values for:

Pc[n=4] = ?

Pc[n=5] = ?

.

.

.

.

Pc[n=10] = ?

How can i set this up properly in mathcad. I have version 15. Is there a simple way? Keep in mind that I am a very basic user of mathcad

Here are a few other techniques, for tackling this kind of problem, that you might find useful as you develop your Mathcad skills.

(I've attached the worksheet that I used for this)

Range Variable

Function

Program

Stuart

Hi all.

Thanks for all the help. I looks complicate, but  is probably a simple problem and I will dig into and try it myself. As you, StuartBruff, correctly observed is that n has to be larger than Z. All the other variables are "fixed" and n is the only variable that has a range.

For your information I basically need to find the "correct" Pc value for a given n.  Its easy to set up in excel and for the example below the Pc value I am after is at n=10. This could be different in my next calculation/project. 

Top Tags