0
$\begingroup$

I am trying to run this code:

> iSmed = List[F3[[r]], F4[[r]], F5[[r]], F6[[r]]];
> \[Beta]med = Table[iSmed[[j]]/\!\(\*SubsuperscriptBox[\(\[Sum]\), \(i = 
1\), \(4\)]\(iSmed[[i]]\)\), {j, 1, 4}];
> \[Lambda]m =  List[(*7F3*)\[Lambda]3[[r]]*10^-9,(*7F4*)\ 
[Lambda]4[[r]]*10^-9,(*7F5*)\[Lambda]5[[r]]*10^-9,(*7F6*)\ 
[Lambda]6[[r]]*10^-9];

> J = 4; \[Epsilon]o = 8.85418*10^-12; h = 6.626*10^-34; e = 1.60218*10^-19; 
>c= 2.9979 10^8 ;  me = 9.10938*10^-31; 

> n[i_] := List[1.9, 1.9, 1.9, 1.9][[i]];

> \[Chi]ED[i_] := (n[i]^2 (n[i]^2 + 2)^2)/9; \[Chi]MD[i_] := n[i]^3;

> U = ( {
   {0.0137, 0.0010, 0.0007},
   {0.0003, 0.0019, 0.0015},
   {0.0139, 0.0010, 0.0026},
   {0.0007, 0.0013, 0.0011}
  } ); 

> Aoe[i_] := (16 \[Pi]^3 e^2)/( 3 \[Epsilon]o h \[Lambda]m[[i]]^3) \ 
[Chi]ED[i]/ (2 J + 1) ; 
> Amd[i_, k1_, k2_] := (\[Pi] h e^2)/( 3 \[Epsilon]o (me^2) (c^2) (\ 
[Lambda]m[[i]]^3) ) \[Chi]MD[i]/ (2 J + 1) LgS[k1, k2][[i]];
> LgS[k1_, k2_] := List[0, 0, k2, k1];

> M11 = Aoe[1] U[[1]][[1]]; M12 = Aoe[1] U[[1]][[2]]; M13 = Aoe[1] U[[1]] 
 [[3]];
> M21 = Aoe[2] U[[2]][[1]]; M22 = Aoe[2] U[[2]][[2]]; M23 = Aoe[2] U[[2]] 
[[3]];
> M31 = Aoe[3] U[[3]][[1]]; M32 = Aoe[3] U[[3]][[2]]; M33 = Aoe[3] U[[3]] 
[[3]];
> M41 = Aoe[4] U[[4]][[1]]; M42 = Aoe[4] U[[4]][[2]]; M43 = Aoe[4] U[[4]] 
[[3]];

(*Matrix elements of b*)
>b1[y_, k1_, k2_] := (\[Beta]med[[1]]/(y*0.001)) - Amd[1, k1, k2];
>b2[y_, k1_, k2_] := (\[Beta]med[[2]]/(y*0.001)) - Amd[2, k1, k2];
>b3[y_, k1_, k2_] := (\[Beta]med[[3]]/(y*0.001)) - Amd[3, k1, k2];
>b4[y_, k1_, k2_] := (\[Beta]med[[4]]/(y*0.001)) - Amd[4, k1, k2];

(*Matrix representation*)
> M = ( {{M11, M12, M13}, {M21, M22, M23}, {M31, M32, M33}, {M41, M42, M43}
  } );
> b[y_, k1_, k2_] := ( { {b1[y, k1, k2]}, {b2[y, k1, k2]}, {b3[y, k1, k2]},
   {b4[y, k1, k2]} } ); 
(*least squares*)
> Op[bb_, y_, k1_, k2_] := Flatten[LeastSquares[M, b[y, k1, k2]]];

This code worked with no problem in an early version Mathematica 8.0. However, now the message SystemException["MemoryAllocationFailure"] came up. Please help me to solve this problem, what is going on?

$\endgroup$
  • $\begingroup$ I cannot reproduce this behavior with version 11.3 for macOS. Are you sure that it is only this code and nothing else that produces the error? $\endgroup$ – Henrik Schumacher Jul 17 '18 at 20:24
  • $\begingroup$ Yes, I think the code is ok because it compiled and ran with mathematica 8.0. My problem started when I actualized the software $\endgroup$ – Ameli Jul 17 '18 at 20:37
  • $\begingroup$ Hi @Ameli and welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$ – rhermans Jul 17 '18 at 21:37
  • 1
    $\begingroup$ Can you please edit your question and paste the code in InputForm (Use Sum and not SubsuperscriptBox) and without the > characters? Here its considered helpful to show your code in a well formatted form so we can quickly Copy&Paste your code, test it, and see the problem you are facing. $\endgroup$ – rhermans Jul 17 '18 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.