wenzi
Posts: 3
Joined: Tue Dec 08, 2015 9:08 pm

Problem with equation solving in Mathematica 10.3

Tue Dec 08, 2015 9:15 pm

The following code run more than one day without a result. It was blocked at step3. How to improve the code and get a result in a limited peroid? Is my way Okay? Thanks in advance.

Step1:
q2n1[te,ne,n2_]=n1/.Solve[q2[te,ne,n2,n1]==0,n1] q2n1[te,ne,n2][[3]]

Output: {0. -(8.248081032+1.428611033 I) te0.6 (-((2.0634310^-76 n2 ne)/te^1.2)+(1.3216110^-80 n2 ne)/te^0.2+1.9229510^-82 n2 ne te^0.8-3.5756310^-86 n2 ne te^1.8+3.0360710^-90 n2 ne te^2.8-1.5140110^-94 n2 ne te^3.8+4.8583410^-99 n2 ne te^4.8-1.0438310^-103 n2 ne te^5.8+1.5189810^-108 n2 ne te^6.8-1.478810^-113 n2 ne te^7.8+9.2273210^-119 n2 ne te^8.8-3.3366810^-124 n2 ne te^9.8+5.3174*10^-130 n2 ne te^10.8)1/3, 0. -(8.248081032-1.428611033 I) te0.6 (-((2.0634310^-76 n2 ne)/te^1.2)+(1.3216110^-80 n2 ne)/te^0.2+1.9229510^-82 n2 ne te^0.8-3.5756310^-86 n2 ne te^1.8+3.0360710^-90 n2 ne te^2.8-1.5140110^-94 n2 ne te^3.8+4.8583410^-99 n2 ne te^4.8-1.0438310^-103 n2 ne te^5.8+1.5189810^-108 n2 ne te^6.8-1.478810^-113 n2 ne te^7.8+9.2273210^-119 n2 ne te^8.8-3.3366810^-124 n2 ne te^9.8+5.3174*10^-130 n2 ne te^10.8)1/3, 0. +1.649621033 te0.6 (-((2.0634310^-76 n2 ne)/te^1.2)+(1.3216110^-80 n2 ne)/te^0.2+1.9229510^-82 n2 ne te^0.8-3.5756310^-86 n2 ne te^1.8+3.0360710^-90 n2 ne te^2.8-1.5140110^-94 n2 ne te^3.8+4.8583410^-99 n2 ne te^4.8-1.0438310^-103 n2 ne te^5.8+1.5189810^-108 n2 ne te^6.8-1.478810^-113 n2 ne te^7.8+9.2273210^-119 n2 ne te^8.8-3.3366810^-124 n2 ne te^9.8+5.317410^-130 n2 ne te^10.8)1/3} 1.+1.649621033 te0.6 (-((2.0634310^-76 n2 ne)/te^1.2)+(1.3216110^-80 n2 ne)/te^0.2+1.9229510^-82 n2 ne te^0.8-3.5756310^-86 n2 ne te^1.8+3.0360710^-90 n2 ne te^2.8-1.5140110^-94 n2 ne te^3.8+4.8583410^-99 n2 ne te^4.8-1.0438310^-103 n2 ne te^5.8+1.5189810^-108 n2 ne te^6.8-1.478810^-113 n2 ne te^7.8+9.2273210^-119 n2 ne te^8.8-3.3366810^-124 n2 ne te^9.8+5.317410^-130 n2 ne te^10.8)1/3

Step2:
q3n2p[te,ne,n2_]=n2p/.Solve[q3[te,ne,n2,n2p]==0,n2p]

Output: {-((0.000125664 n2 ne (-1.3035110-14-5.1693310-18 te+2.6112410-21 te2-2.4204210-25 te3+7.6108710-30 te4-7.51110-35 te5+2.4844110-40 te6))/(-2.21828109 -0.000125664 ne (-3.5184610-14+1.4304210-17 te-9.9606710-22 te2-5.0405110-27 te3+1.4206910-30 te4-1.8130910-35 te5+6.77204*10-41 te6)))}

Step3:
q1ne[te,n2]=ne/.Solve[q1[te,ne,n2,q2n1[te,ne,n2][[3]],q3n2p[te,ne,n2]]==0,ne]

jb63
Posts: 116
Joined: Mon May 11, 2015 6:41 pm

Re: Problem with equation solving in Mathematica 10.3

Tue Dec 08, 2015 10:21 pm

My 'best' advice is to run this first on a 'full' computer (not RP) and debug the code. At this stage it is difficult to know why the code won't run ... numerical exception, memory issue, or else. Hard to tell from just looking at the code itself. Might also want to break the calculation into several steps, and store intermediate results to the SD card.

wenzi
Posts: 3
Joined: Tue Dec 08, 2015 9:08 pm

Re: Problem with equation solving in Mathematica 10.3

Wed Dec 09, 2015 4:29 pm

Thanks for the reply. Now I put the code in https://www.dropbox.com/sh/ulu3sprw6spy ... YZbLa?dl=0.

"1Plasma chmaber.nb" runs firstly, then "5Rate Constants.nb", then "61Patical Balance Equations.nb"´and run "62Patical Balance Equations.nb" at last. The Problem ist that it is blocked at "nen[te_, n2_]= ne/.Nsolve[nq1ne(te, n2] == 0, ne]" in "62Patical Balance Equations.nb".
Hope for any ideas. Thanks a lot.

wenzi
Posts: 3
Joined: Tue Dec 08, 2015 9:08 pm

Re: Problem with equation solving in Mathematica 10.3

Wed Dec 09, 2015 4:43 pm

I am new to mathematica, it is blocked at the line "nen[te_, n2_]= ne/.Nsolve[nq1ne(te, n2] == 0, ne]".
Can I debug this line? Do I need to use some evaluate functions of mathematica?

jb63
Posts: 116
Joined: Mon May 11, 2015 6:41 pm

Re: Problem with equation solving in Mathematica 10.3

Wed Dec 09, 2015 8:48 pm

I think we still have not decided if it was an error in the code, or if you've somehow reached a limitation of the RPI. It might be best to ask the same question in a Wolfram/Mathematica forum (No Raspberry), where there are many experts there who can help. I have done very little myself with Mathematica as I use primarily Matlab.

Return to “Mathematica”

Who is online

Users browsing this forum: No registered users and 1 guest