Mathematica Asked by user1150512 on March 21, 2021
I’ve got a Mathematica script which gets out of memory errors if I evaluate it using a piecewise function, but with a constant function it’s fine. Each part of the integral appears to work fine (eg I can integrate over the Wigner matrix or the exponential, but not both).
MWE:
Wr = 2 Pi 12500;
Ta = 0.001;
Fun1[t_] :=
Piecewise[{{Wr * 7, t < 0.125*0.001 }, {-Wr * 7,
0.125*0.001 <= t < 0.625*0.001 }, {Wr * 7,
0.625*0.001 <= t}, {0, t == 0}}]
Fun2[t_] := Wr * 3.5;
BetaRF[time_, Fn_] =
Integrate[Fn[ti], {ti, 0, time},
Assumptions -> time [Element] Reals];
ScaleFactor[Fn_, l_, m_, lambda_, mu_] =
1/Ta WignerD[{l, 0, m}, 0, 1, 0] Integrate[
WignerD[{lambda, 0, mu}, 0, -BetaRF[t, Fn], 0] Exp[
I * (mu + m * Wr * t)], {t, 0, Ta},
Assumptions -> Ta [Element] Reals];
Abs[ScaleFactor[Fun2, 2, 1, 2, 2]]
Fun1[] is a piecewise time dependent function, which is defined over all space, Fun2[] is a constant value. BetaRF[] and ScaleFactor[] carry out some integrations and rotations.
If I pass Fun2[] (as in the MWE now), it works fine. If I pass Fun1[], it does nothing for a few sections before crashing giving the error
No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.
I’ve seen some previous questions on here with similar out of memory errors, generally when using parallelization or with their code in a functional form where they can fit in some ClearSystemCaches[]. I don’t know how I would do that in this form?
I’ve watched the execution in Top and the WolframKernel process doesn’t appear to go above 200 MB (I’ve got 6 GB) so I don’t think it’s actually ran out of memory?
Is there something wrong with the way I’ve set up this function/does anyone have any idea how I could resolve this issue?
Thank you!
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP