Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

While Loop in Mathcad

Status
Not open for further replies.

nvsuryan

Mechanical
Joined
May 22, 2010
Messages
7
Location
US
When I try to use nested while loops I run into problems. Sometimes the program freezes with a green bar around the program.
 
Usually, that means you did something wrong in the program, You have to break it up and run the individual segments and debug it.

TTFN

FAQ731-376
 
It looks like the condition for the while loop to end is never met, so it keeps on executing. Turn on debugging and the trace window and add trace(something) to your loop.
 
I am trying a simple program to sum all the integers, say, from 1 to 10 twice. I am trying to use two while loops, the inner one (while i less than or equal to ie) to sum from i = 1 to 10 and outer one from n = 1 to ne. But I fail to get the correct result of 110 when I set ne = 2. It just gives the sum as 55 whatever value of ne I set. Unfortunately I cannot copy the program statements here. Any suggestions?
 
There is, at the bottom of each posting box, the link to Engineering.com's file upload. Preferrably, you should post in Mathcad 11 format for those of us that don't use M14.

TTFN

FAQ731-376
 
I hope the file whileuse has been uploaded.
 
As I was not sure if the file whileuse in mathcad 11 was uploaded, I am uploading it again. Sorry for the trouble.
 
Occupant:
Thanks for your help. It not only helped in the particular small program that I sent but also in a much bigger program requiring iterative computations to solve a differential equation numerically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top