I'm trying to get the exact value from an exponential that gets a very small floating point as input and gives me the result 0.
You can reproduce the problem with the following code:
import numpy as np
from math import sqrt, log, exp, pi
k = np.array([[-746.9292399]])
z = exp(k)
print(z)
The result of this will be 0 , for my pc the result of anything smaller than -743.0 will be 0
I have tried using mpmath to solve this as follows:
import numpy as np
from math import sqrt, log, exp, pi
import mpmath as mp
k = np.array([[-746.9292399]])
z = mp.exp(float(k))
print(z)
det = np.linalg.det([[z,2,3],[2,2,z],[3,6,2]])
print(det)
Which is giving a good answer for the exp() , however i will further need to put that result in a numpy array , and extract the determinant from it , which throws an error in the code i attached because numpy doesn't like mpf numbers in its arrays.
Anybody knows how could i get the result from exp() in a way that i can use it with numpy and its functions?