I am evaluation a MeijerG function in mpmath, the result is a complex. i would like to separate real and imaginary parts to save them in a dataframe and subsequently plot them. I get an error
TypeError: cannot create mpf from array followed by a series of complex numbers.
anybody would have a clean approach to separate and save those data so the user can plot them in any format.
from mpmath import *
import sympy
import numpy as np
import cmath
import math
import pandas as pd
import matplotlib.pyplot as plt
mp.dps = 5; mp.pretty = True
a = mpf(0.25)
b = mpf(0.25)
z = mpc(0.75)
frequency = np.arange(1, 1e4, 100)
def q():
return (-j/frequency)*meijerg([[1, 3/2], []], [[1, 1], [1/2, 0]], j*frequency)
T=q()
Re_q = np.real.T
Im_q = np.imag.T
print(Re_q)
print(Im_q)
data = pd.DataFrame({
'Frequency (Hz)': frequency,
'Re': Re_q,
'Im': Im_q
}
)
data.to_csv('C:\\Users\\T.csv')
this way it separates real and imaginary parts.