I need to perform a Fourier Transform on the results of a ParametricNDSolve function as well as on the derivative of one of the coefficients. Now I do this by evaluating the interpolation function. This is awfully slow and I don't know if there is any faster approach. Maybe you can help me out.
This is essentially my current approach with c1 being a coefficient in my NDSolve solution fermiD and c1' its derivative :
x2 = Table[Evaluate[{c1'[2*Pi*0.001][t]} /. fermiD[[1]]], {t, 3000, 1/10}]
In my code I loop it, because I need to evaluate at different frequencies. But I first tried looping one time. The equation are a system of linear differential equations.
fermiD = ParametricNDSolve[{equ, equ1}, {c1, c2, c3, c4}, {t, 0, tn},{wp}]
For[i = 1, i < 1 + 1, i++,
{m = 2Pii0.001,
Print[m],
x1 = Table[Evaluate[{c1[m][t]} /. fermiD[[1]]], {t, 0, 3000, 1/10}],
x2 = 2Table[Evaluate[{c1'[m][t]} /. fermiD[[1]]], {t, 3000, 1/10}],
Print["data2"],
data1 - data2,
Print["data"],
Export[StringJoin[{ToString[m], ".txt"}], data]
}
]
c1[2*Pi*0.001]'[t]instead ofc1'[2*Pi*0.001][t]. – Michael E2 Jan 10 '21 at 19:49c1as a solution of your equation rather than a coefficient. To expand on @Michael's comment,c1'[w][t]is the first derivative ofc1with respect to the parameterw, whereasc1[w]'[t]is the first derivative with respect to your independent variablet. From what we gather, you seem to want the latter. Is that right? Also, 1) avoidForloops altogether; tryTableorMapinstead; 2) you should separate commands with;, instead of enclosing them in braces and separating them with commas. – MarcoB Jan 10 '21 at 21:46