Reputation: 128
Trying to solve a set of exponential equations but keep getting errors saying that "can't convert float" or "float is not callable"
You may run the code, just replace the variables with any values you'd like.
from sympy.abc import x, y
import numpy as np
import sympy as sp
import math
A0 = 58
G0 = 44
Gmax = 117
tmax = 40
s=[((sp.log(x) - sp.log(y)) - (tmax*(x-y))), (Gmax- G0 - (A0 * x /(y-x))*((sp.exp((-x)*tmax)) - (sp.exp((-y)*tmax))))]
sp.solve(s, x, y)
Upvotes: 0
Views: 2078
Reputation: 5834
remove the math and use sympy for log and exp
from sympy.abc import x, y
import numpy as np
import sympy as sp
Gmax = np.amax(all_training_df.iloc[1])
tmax = np.argmax(all_training_df.iloc[1])
A0 = all_combined_df.iloc[1]['CHO (g)']
G0 = all_combined_df.iloc[1]['mg/dL']
s=[((sp.log(x) - sp.log(y)) - (tmax*(x-y))), (Gmax- G0 - (A0 * x /(y-x))*((sp.exp((-x)*tmax)) - (sp.exp((-y)*tmax))))]
sp.solve_poly_system(s, x, y)
Upvotes: 1