Skip to content

Commit 4588c20

Browse files
committed
area_curves.py - Rename f1x to f and f2x to g
1 parent b463ab9 commit 4588c20

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

chapter7/solutions/area_curves.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66

77
from sympy import Integral, Symbol, SympifyError, sympify
88

9-
def find_area(f1x, f2x, var, a, b):
10-
a = Integral(f1x-f2x, (var, a, b)).doit()
9+
def find_area(f, g, var, a, b):
10+
a = Integral(f-g, (var, a, b)).doit()
1111
return a
1212

1313
if __name__ == '__main__':
14-
f1x = input('Enter the upper function in one variable: ')
15-
f2x = input('Enter the lower upper function in one variable: ')
14+
f = input('Enter the upper function in one variable: ')
15+
g = input('Enter the lower upper function in one variable: ')
1616
var = input('Enter the variable: ')
1717
l = float(input('Enter the lower bound of the enclosed region: '))
1818
u = float(input('Enter the upper bound of the enclosed region: '))
1919

2020
try:
21-
f1x = sympify(f1x)
22-
f2x = sympify(f2x)
21+
f = sympify(f)
22+
g = sympify(g)
2323
except SympifyError:
2424
print('One of the functions entered is invalid')
2525
else:
2626
var = Symbol(var)
27-
print('Area enclosed by {0} and {1} is: {2} '.format(f1x, f2x, find_area(f1x, f2x, var, l, u)))
27+
print('Area enclosed by {0} and {1} is: {2} '.format(f, g, find_area(f, g, var, l, u)))

0 commit comments

Comments
 (0)