Skip to main content
1-Visitor
September 23, 2014
Question

I have some questions about 'LOOP'

  • September 23, 2014
  • 3 replies
  • 3836 views

I am a korean so I can't write well about my questions. But I will try to write.

I want to express 'Loop'.

Let's we suppose two equations. One is X=Y^2+2Y+3. The last is Y=X^2+3X+5.

I can find adequate value by finding convergence between X and Y.

But I can't express in MATHCAD.

I think I need to use 'While' to express..

How can I express it to use 'while'?

3 replies

25-Diamond I
September 23, 2014

jinsuk Lee wrote:

I am a korean so I can't write well about my questions. But I will try to write.

I want to express 'Loop'.

Let's we suppose two equations. One is X=Y^2+2Y+3. The last is Y=X^2+3X+5.

I can find adequate value by finding convergence between X and Y.

But I can't express in MATHCAD.

I think I need to use 'While' to express..

How can I express it to use 'while'?

I am not sure what you want to do with loops here.

You have a system of equations and this system has no real solution. You can see this if you substitute the second equation in the first,get an equation of fourth order and plot it.

Mathcad offers a way to minimize the error, maybe thats what you ar looking for:

1.png

For future questions always please attach a worksheet with the expressions in question.

1-Visitor
September 23, 2014

As Werner, I am also a little unsure what you want to do here.

Please provide a worksheet and expected results for us to work with.

jlee-21-VisitorAuthor
1-Visitor
September 24, 2014

Thank you for consideration.

I attached my file. I want to find a2 value when I randomly input a1 values.

But I don't know how I can express 'loop' to solve this problem.

25-Diamond I
September 24, 2014

jinsuk Lee wrote:

Thank you for consideration.

I attached my file. I want to find a2 value when I randomly input a1 values.

You have already achieved exactly that in the file you posted!

But I don't know how I can express 'loop' to solve this problem.

For the problem you described above you don't need any loops at all - you have already solved it. So it seems to me you are looking for something completely different. I am not sure if its the peak value as I suspected in my other reply below today.

In the program fragment you provide you don't use a2(a) at all. It looks like you are searching a value of a so that a=f(a) ???

I already asked you in a reply yesterday if you are looking for a=a2(a) and also provided the solution.

So for us to be able to help you must tell us what you are looking for (and not how you think you can achieve that goal). What should the result look like and what should be its characteristics?

BTW, if you write f(a) <-- a in a program you define a local function and you don't assign any values.

jlee-21-VisitorAuthor
1-Visitor
September 24, 2014

K-36.png

I am sorry that I made you feel difficult when you saw my post.

I want to know a2 value. To know a2 value, I must know f(a1) value and I also must know a1 value to know f(a1).

it means that I must know a1 value first. so If I assume that a1 value is 0<a1<1, I can know f(a1) by doing iteration. I can know a2 value by comparing a1 value that I input.

But I can't express my thinking in mathcad.

< N=3, lamda_design=7.5 >

25-Diamond I
September 24, 2014

As Mike and myself already have writen - attach your worksheet, not just a picture. The willingness to retype what you have already typed is very limited.

Whats the goal of your iteration? When will it stop? Are you searching for a1=a2? This would result in a=0.333333333307379......

Otherwise a2 simply is a function of a1 and you can calculate a2 very easily if you switch the order of the two expressions and use a normal assignment instead of a local one.

jlee-21-VisitorAuthor
1-Visitor
September 24, 2014

I attach my file.

I want to know a1=a2 when I input randomly a1 values to do convergence.

Thank you for your help

< you can see my question in tap of practice2