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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

While Statement

rayakannu2
6-Contributor

While Statement

Can someone help me with this program. I am not able to execute the while statement.

 

Thanks

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:rayakannu2)


wrote:

Can someone help me with this program.

Not sure which kind of help you need



I am not able to execute the while statement.


What do you mean by this? When I open your sheet the calculation of Sol at the end shows no error and returns the values 5 and 48. These are your initial values because your loop is never entered. You compare epsilon 1 to epsilon and you do not define epsilon 1 (and epsilon2) before the while statement. So epsilon1 is considered to be 0 and the condition is not fulfilled and so the program ends.

After we initialize those epsilon values the program fails because the values of the epsilons increase rapidly.

I added a counter to be able to stop the iteration after a few steps and as you can see from the screenshot, after the fifth iteration both epsilons are sure not in the neighbourhood of 0.

Guess you will have to check your formulas.

Bild.PNG

View solution in original post

1 REPLY 1
Werner_E
25-Diamond I
(To:rayakannu2)


wrote:

Can someone help me with this program.

Not sure which kind of help you need



I am not able to execute the while statement.


What do you mean by this? When I open your sheet the calculation of Sol at the end shows no error and returns the values 5 and 48. These are your initial values because your loop is never entered. You compare epsilon 1 to epsilon and you do not define epsilon 1 (and epsilon2) before the while statement. So epsilon1 is considered to be 0 and the condition is not fulfilled and so the program ends.

After we initialize those epsilon values the program fails because the values of the epsilons increase rapidly.

I added a counter to be able to stop the iteration after a few steps and as you can see from the screenshot, after the fifth iteration both epsilons are sure not in the neighbourhood of 0.

Guess you will have to check your formulas.

Bild.PNG

Announcements

Top Tags