Skip to content
Advertisement

How to use while loop to check difference between calculation output , convergence calculation

I am writing a code that carry outs the calculation:

JavaScript

I want to pass incremental n_value value starting from 2 then +0.10 each time it iterates.

For the iteration I am writing while loop counter however, codes does not work.

JavaScript
JavaScript

However the code does not iterate and I am kind of struggling how to create the iterative loop. I want to achieve difference between calculated_pel and changed_calculated_pel at minimum as stated by epsilon value 0.00001. once that is achieved, code should break and give the converged value. However, lack of my coding ability has created further issues. So, today I have come to you for help. Any suggestion would be appreciated.

Thank You !

Advertisement

Answer

For anyone who might stumble in similar situation: I have managed to solve the issue.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement