Skip to main content
1-Visitor
September 7, 2016
Question

Simple iteration process over range: n

  • September 7, 2016
  • 5 replies
  • 2051 views

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

23-Emerald I
September 7, 2016

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.

21-Topaz II
September 7, 2016

Hi Thomas,

see picture:

for Thomas.jpg

1-Visitor
September 7, 2016

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:

23-Emerald V
September 7, 2016

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

tokland1-VisitorAuthor
1-Visitor
September 7, 2016

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.