- #1
member 428835
Hi PF!
I am using the following code in Mathematica
Then when I want to compute something simple, say
It takes Mathematica a very long time to compute. However, if I first do
and then redefine ##f## in terms of the result mathematica prints and ask for the integral, Mathematica computes the integration in much less time. Does anyone know how to define ##f## to begin with in this "numeric" fashion to decrease run time?
I am using the following code in Mathematica
Code:
mat = {{1, Cos[2], Cos[4], Sin[2],
Sin[4}, {1, 1, 1, 0, 0}};
Li[x_] :=
Transpose[
NullSpace[
mat].{{1}, {Cos[x}, {Cos[
2 x]}, {Sin[x]}, {Sin[2 x]}}];
Li1[x_] := Li[x].{{1}, {0}, {0}};
f[x_] :=
Li1[x]/Sqrt[Integrate[Li1[s]^2, {s, -1, 1}]];
Code:
Integrate[f[x]^2, {x, -1, 1}]
Code:
f[x]//N