Skip to content

Commit a1affa0

Browse files
committed
Refactor
1 parent e5ef73e commit a1affa0

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Methods for numerical integration."""
22

33

4-
def simpson(f, b, a, n):
4+
def simpson(f, a, b, n):
55
"""Calculate the integral from 1/3 Simpson's Rule.
66
77
Args:
@@ -29,7 +29,7 @@ def simpson(f, b, a, n):
2929
return [xi]
3030

3131

32-
def trapezoidal(f, b, a, n):
32+
def trapezoidal(f, a, b, n):
3333
"""Calculate the integral from the Trapezoidal Rule.
3434
3535
Args:

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def f(x):
423423
print(f"b = {b}")
424424
print(f"n = {n}")
425425

426-
[xi] = integration.trapezoidal(f, b, a, n)
426+
[xi] = integration.trapezoidal(f, a, b, n)
427427

428428
print("Output:")
429429
print(f"xi = {xi:.5f}")
@@ -462,7 +462,7 @@ def f(x):
462462
print(f"b = {b}")
463463
print(f"n = {n}")
464464

465-
[xi] = integration.simpson(f, b, a, n)
465+
[xi] = integration.simpson(f, a, b, n)
466466

467467
print("Output:")
468468
print(f"xi = {xi:.5f}")

0 commit comments

Comments
 (0)