Files
pplus-library/modules/numerics/trapezoid/ref/mojo/plain.mojo
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

6 lines
195 B
Mojo

def trapezoid(y: List[Float64], h: Float64) -> Float64:
var total: Float64 = (y[0] + y[len(y) - 1]) / 2.0
for i in range(1, len(y) - 1):
total = total + y[i]
return total * h