I can't translate a formula from Mathcad to Python. Stuck on "a". Here's what I was able to do:
from matplotlib import pyplot as plt
import numpy as np
k1 = 1
b = 1.51
D = (1/b) * (np.sqrt(k1/np.pi))
x0 = 10 * b
myArray = np.arange(0, 24, 0.1)
for t in myArray:
S1_t = (k1) / (1 np.e ** (-(D * myArray - 5)))
S1_deistv = S1_t.real
plt.plot(myArray, S1_deistv, color="black")
plt.show()
CodePudding user response:
As you can see, MathCad is going to:
- create an expression containing the symbolic derivative of
S1
. - finding the root of that expression.
In Python, we have to use different libraries to achieve the same result. In this particular case it is a little bit more convoluted (requires more steps). In particular: