Skip to main content
12-Amethyst
September 8, 2023
Solved

Summation in if-loop

  • September 8, 2023
  • 2 replies
  • 3549 views

Hi

I want to create a loop that for the next interval add the results in the previous interval etc. I have made an attempt in the following program, but something is wrong. Any help is appreciated.  

 

ksk_10594232_0-1694174133870.png

 

 

 

Best answer by Werner_E

Or you may use a more generic approach

Werner_E_0-1694196049416.png

Werner_E_1-1694196090925.png

 

2 replies

25-Diamond I
September 8, 2023

Maybe this is what you are looking for:

Werner_E_0-1694178945866.png

Because a "return" statement stops a program from running any further, you can also write

Werner_E_1-1694178987828.pngWerner_E_2-1694178995247.png

Prime 9 file attached

 

12-Amethyst
September 8, 2023

Not really, I want the diagram to look like this (Excel).

 

ksk_10594232_0-1694180198317.png

 

12-Amethyst
September 8, 2023

f(0) = 0

f(4,5) = 0 + 4,5x9 = 40,5

f(8,3) = f(4,5) + (8,3 - 4,5) x 7 = 67,1 

f(11,3) = f(8,3) + (11,3 - 8,3) x 8 = 91,1        etc...

 

Hopefully you understand what I'm looking for 🙂

 

 

23-Emerald I
September 11, 2023

Werner's formula is precise and well done!

 

But this is really a simple integration,  Attached Prime 4 Express.

 

(Extension to the second problem, above the water) will require definition of sign conventions.

25-Diamond I
September 11, 2023

But this is really a simple integration,

😉 Its only simple once you found a way to automatically choose the correct gamma-value for every depth, like you did with

Werner_E_0-1694457133869.png