Here's my python code:
import numpy as np
from scipy.integrate import quad
a = 0.15
def A(z):
return -a * z**2
def integrand(x, z, B):
return np.sqrt(-(2/x)*(3*x*A(x).derivative(n=2) - 3*x*(A(x).derivative(n=1))**2 + 6*A(x).derivative(n=1) + 2*B**4*x**3 + 2*B**2*x))
def Phi(z, B):
result, _ = quad(integrand, 0, z, args=(z, B))
return result
phi_values = [Phi(z, 0) for z in range(101)]
I am getting a "ZeroDivisionError: float division by zero"
How to resolve this issue?
I tried using sympy but to no avail.
Fixing your other breakage re. derivatives with some wild guessing, and adding an epsilon as your lower integration bound,
But the saner thing to do is analytically divide out
x:which yields the same results.