Hi PF!(adsbygoogle = window.adsbygoogle || []).push({});

I am using the following code in MathematicaThen when I want to compute something simple, sayCode (Text):

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}]];

It takes Mathematica a very long time to compute. However, if I first doCode (Text):Integrate[f[x]^2, {x, -1, 1}]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?Code (Text):f[x]//N

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Mathematica Mathematica Computation Time

Have something to add?

Draft saved
Draft deleted

Loading...

Similar Threads - Mathematica Computation | Date |
---|---|

How to compute the Riemann tensor using RGTC mathematica? | Apr 25, 2017 |

Understanding this Computer program | Feb 26, 2015 |

Mathematica: Speed up NIntegrate | Jan 4, 2015 |

Matlab vs Mathematica for computing derivatives | Sep 4, 2014 |

How to compute a tri-coherence | Jun 30, 2014 |

**Physics Forums - The Fusion of Science and Community**