MaplePrimes Questions

Is this something known or should be fixed? I check it is exists also in V 2022 for same input.

restart;

expr:=40/9*(43/32*2^(1/3)*(2*exp(16*c[2])*y^15-46/43*exp(11*c[2])*y^10+1/86*exp(6*c[2
])*y^5)*y*16^(2/3)*(exp(c[2])^7*y^7)^(2/3)-5/4*2^(2/3)*(2*exp(20*c[2])*y^20-169
/40*exp(15*c[2])*y^15+1/5*exp(10*c[2])*y^10)*16^(1/3)*(exp(c[2])^7*y^7)^(1/3)+(
2*exp(24*c[2])*y^20-53/2*exp(19*c[2])*y^15+17/4*exp(14*c[2])*y^10)*y^4)*exp(3*c
[2])/y^3/exp(5*c[2])/(1/9*(-1/4-exp(10*c[2])*y^10+8*exp(5*c[2])*y^5)*16^(2/3)*(
exp(c[2])^7*y^7)^(2/3)+(-2/3*(11/4*exp(9*c[2])*y^5-1/2*exp(4*c[2]))*2^(1/3)*y*
16^(1/3)*(exp(c[2])^7*y^7)^(1/3)+2^(2/3)*(2*exp(13*c[2])*y^10-2*exp(8*c[2])*y^5
))*y^3)/(-3/8*2^(2/3)*16^(2/3)*(exp(c[2])^7*y^7)^(2/3)*exp(c[2])*y+(exp(5*c[2])
*y^5-1/4)*16^(1/3)*(exp(c[2])^7*y^7)^(1/3)+3/2*2^(1/3)*exp(4*c[2])*y^4):


int(expr,y);

Error, (in convert/parfrac) cannot convert to partial fraction form

But for some reason I do not now understand, I am able to actually trap this error, which makes it much less serious for me, as the program can continue.

In all other cases where Maple generated such internal exceptions, it was not cought by try/catch.

So I am able to bypass this problem, but thought to check if someone can shed more light on this and why it happens.

interface(version)

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

restart;

138508

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

expr:=40/9*(43/32*2^(1/3)*(2*exp(16*c[2])*y^15-46/43*exp(11*c[2])*y^10+1/86*exp(6*c[2
])*y^5)*y*16^(2/3)*(exp(c[2])^7*y^7)^(2/3)-5/4*2^(2/3)*(2*exp(20*c[2])*y^20-169
/40*exp(15*c[2])*y^15+1/5*exp(10*c[2])*y^10)*16^(1/3)*(exp(c[2])^7*y^7)^(1/3)+(
2*exp(24*c[2])*y^20-53/2*exp(19*c[2])*y^15+17/4*exp(14*c[2])*y^10)*y^4)*exp(3*c
[2])/y^3/exp(5*c[2])/(1/9*(-1/4-exp(10*c[2])*y^10+8*exp(5*c[2])*y^5)*16^(2/3)*(
exp(c[2])^7*y^7)^(2/3)+(-2/3*(11/4*exp(9*c[2])*y^5-1/2*exp(4*c[2]))*2^(1/3)*y*
16^(1/3)*(exp(c[2])^7*y^7)^(1/3)+2^(2/3)*(2*exp(13*c[2])*y^10-2*exp(8*c[2])*y^5
))*y^3)/(-3/8*2^(2/3)*16^(2/3)*(exp(c[2])^7*y^7)^(2/3)*exp(c[2])*y+(exp(5*c[2])
*y^5-1/4)*16^(1/3)*(exp(c[2])^7*y^7)^(1/3)+3/2*2^(1/3)*exp(4*c[2])*y^4);

(40/9)*((43/32)*2^(1/3)*(2*exp(16*c[2])*y^15-(46/43)*exp(11*c[2])*y^10+(1/86)*exp(6*c[2])*y^5)*y*16^(2/3)*((exp(c[2]))^7*y^7)^(2/3)-(5/4)*2^(2/3)*(2*exp(20*c[2])*y^20-(169/40)*exp(15*c[2])*y^15+(1/5)*exp(10*c[2])*y^10)*16^(1/3)*((exp(c[2]))^7*y^7)^(1/3)+(2*exp(24*c[2])*y^20-(53/2)*exp(19*c[2])*y^15+(17/4)*exp(14*c[2])*y^10)*y^4)*exp(3*c[2])/(y^3*exp(5*c[2])*((1/9)*(-1/4-exp(10*c[2])*y^10+8*exp(5*c[2])*y^5)*16^(2/3)*((exp(c[2]))^7*y^7)^(2/3)+(-(2/3)*((11/4)*exp(9*c[2])*y^5-(1/2)*exp(4*c[2]))*2^(1/3)*y*16^(1/3)*((exp(c[2]))^7*y^7)^(1/3)+2^(2/3)*(2*exp(13*c[2])*y^10-2*exp(8*c[2])*y^5))*y^3)*(-(3/8)*2^(2/3)*16^(2/3)*((exp(c[2]))^7*y^7)^(2/3)*exp(c[2])*y+(exp(5*c[2])*y^5-1/4)*16^(1/3)*((exp(c[2]))^7*y^7)^(1/3)+(3/2)*2^(1/3)*exp(4*c[2])*y^4))

try
   int(expr,y);
catch:
   print("error");
end try;

"error"

int(expr,y);

Error, (in convert/parfrac) cannot convert to partial fraction form

int(simplify(expr),y);

Error, (in convert/parfrac) cannot convert to partial fraction form

 

Download int_error_may_29_2023.mw

Hi Maple friends,

I want to use Maple to solve a motion equation problem by using Lagrange 2 method. For that I for example have to calculate the derivative of the lagrange function by one of the generalized coordinates.

So let L for example be: L = diff(q1(t), t) + 2*diff(q2(t), t) + 3*q1(t)        // I`m sorry the insert Maple Math doesn`t work for me...

I now want to calculate diff(L,q1(t)) which leads to the error Message: "Error, invalid input: diff received q1(t), which is not valid for its 2nd argument".

The correct answer to this should be: diff(L, q1(t)) = 3

I`ve now tried a few different differentiate commands but none of them seems to work...

Would be great if someone could give me a hint or the right code.

Thanks in advance!

I am trying to put an annotation  (dimension of a distance) into a plot.

Any hints about what would the best way to do that?

 i’ve run the coding. The result is almost my expectation. However, why is the previous value not be substituted into the next one? As example, f4 should be submitted into f5 to evaluate its value

restart:

m := [80, 79, 83, 92, 74, 80, 87, 77, 103, 84, 87, 77, 88, 86, 83, 80, 79, 80, 93, 68, 106, 76, 103]

[80, 79, 83, 92, 74, 80, 87, 77, 103, 84, 87, 77, 88, 86, 83, 80, 79, 80, 93, 68, 106, 76, 103]

(1)

 

F := k -> `if`(
                k::even,
                2/3*m[k] + 2/3*f[k-1] - 1/3*f[k-2],
                2/11*f[k-3] - 9/11*f[k-2] + 12/11*f[k-1] + 6/11*m[k]
                ):


f[2] := m[2];
f[3] := m[3];
for i from 4 to 23 do
  F(i):
end do;

79

 

83

 

271/3

 

-145/11+(12/11)*f[4]

 

160/3+(2/3)*f[5]-(1/3)*f[4]

 

(2/11)*f[4]-(9/11)*f[5]+(12/11)*f[6]+522/11

 

154/3+(2/3)*f[7]-(1/3)*f[6]

 

(2/11)*f[6]-(9/11)*f[7]+(12/11)*f[8]+618/11

 

56+(2/3)*f[9]-(1/3)*f[8]

 

(2/11)*f[8]-(9/11)*f[9]+(12/11)*f[10]+522/11

 

154/3+(2/3)*f[11]-(1/3)*f[10]

 

(2/11)*f[10]-(9/11)*f[11]+(12/11)*f[12]+48

 

172/3+(2/3)*f[13]-(1/3)*f[12]

 

(2/11)*f[12]-(9/11)*f[13]+(12/11)*f[14]+498/11

 

160/3+(2/3)*f[15]-(1/3)*f[14]

 

(2/11)*f[14]-(9/11)*f[15]+(12/11)*f[16]+474/11

 

160/3+(2/3)*f[17]-(1/3)*f[16]

 

(2/11)*f[16]-(9/11)*f[17]+(12/11)*f[18]+558/11

 

136/3+(2/3)*f[19]-(1/3)*f[18]

 

(2/11)*f[18]-(9/11)*f[19]+(12/11)*f[20]+636/11

 

152/3+(2/3)*f[21]-(1/3)*f[20]

 

(2/11)*f[20]-(9/11)*f[21]+(12/11)*f[22]+618/11

(2)

 

Download bbdf.mw

I do not know if this is new error in 2023. But solve gives this strange error first time it is called. Second time the error goes away.

Any workaround possible and why does it happen? It happens when kernelopts('assertlevel'=2): is set. But I need to have this set all the time.     Same problem when using PDEtools:-Solve. I can't even trap this error since it is internal. So program crash and no way to continue.

restart;
interface(warnlevel=4):
kernelopts('assertlevel'=2):
eq:=exp(x)*sin(y(x))-3*x^2+(exp(x)*cos(y(x))+1/3/y(x)^(2/3)) = 0;
solve(eq,y(x));

Error, (in SolveTools:-CancelInverses) assertion failed, simplify should not leak _Z variables out from RootOfs
 

1331348

interface(version);

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

restart;

1331348

interface(warnlevel=4):
kernelopts('assertlevel'=2):
eq:=exp(x)*sin(y(x))-3*x^2+(exp(x)*cos(y(x))+1/3/y(x)^(2/3)) = 0;
solve(eq,y(x));

exp(x)*sin(y(x))-3*x^2+exp(x)*cos(y(x))+(1/3)/y(x)^(2/3) = 0

Error, (in SolveTools:-CancelInverses) assertion failed, simplify should not leak _Z variables out from RootOfs

solve(eq,y(x)); #second time no error. Very strange.

RootOf(3*exp(x)*sin(_Z)*_Z^(2/3)+3*exp(x)*cos(_Z)*_Z^(2/3)-9*x^2*_Z^(2/3)+1)

 


Download problem_in_solve_may_29_2023.mw

Finding too many problems in Version 2023 :(

Update

This seems new problem in V 2023? I just tried it on V 2022 on same PC and no error there. First time used no error.  Here is V 2022 worksheet. So this seems like regression.

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;

interface(warnlevel=4):
kernelopts('assertlevel'=2):
eq:=exp(x)*sin(y(x))-3*x^2+(exp(x)*cos(y(x))+1/3/y(x)^(2/3)) = 0;
solve(eq,y(x));

exp(x)*sin(y(x))-3*x^2+exp(x)*cos(y(x))+(1/3)/y(x)^(2/3) = 0

RootOf(-3*exp(x)*sin(_Z)*_Z^(2/3)-3*exp(x)*cos(_Z)*_Z^(2/3)+9*x^2*_Z^(2/3)-1)

 


Download solve_may_29_2023_V2022.mw

my program which reads random problems, read one large one. This cause plot to fail with internal error. 

I this known issue?

The expression is too large to post here, so I will only attach worksheet without displaying the actual ff function.

V 2023 on windows 10.

bug_plot_may_29_2023.mw

is this known limitation?

restart;
s:="regular";
MmaTranslator:-FromMma(s);
MmaTranslator:-Mma:-LeafCount(s);

Error, (in MmaTranslator:-Mma:-LeafCount) too many levels of recursion

V 2023 on windows.

1021448

restart;

1021448

s:="regular";
MmaTranslator:-FromMma(s);

"regular"

regular

MmaTranslator:-Mma:-LeafCount(s);

Error, (in MmaTranslator:-Mma:-LeafCount) too many levels of recursion

 

Download crash_leafcount_may_29_2023.mw

For reference, it should have leafcount of 1

Update

Here is another way to cause this error 

124672

expr:=Sum((n+r)*a[n]*x^(n+r-1),n = 0 .. infinity)+(-1-1/x)*Sum(a[n]*x^(n+r),n = 0 .. infinity) = 0;
MmaTranslator:-Mma:-LeafCount(expr);
length(expr);

Sum((n+r)*a[n]*x^(n+r-1), n = 0 .. infinity)+(-1-1/x)*(Sum(a[n]*x^(n+r), n = 0 .. infinity)) = 0

41

148

expr:=Typesetting:-mrow(Typesetting:-mo("&uminus0;"),Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mn("1"),Typesetting:-mo("⋅"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑",Typesetting:-msemantics = "inert")),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("="),Typesetting:-mn("0")),Typesetting:-mi("∞")),Typesetting:-mo("⁡"),Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"),Typesetting:-mi("n")),Typesetting:-mo("⁢"),Typesetting:-msup(Typesetting:-mi("x"),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("+"),Typesetting:-mi("r"))))))),Typesetting:-_Hold([1 %* Sum(a[n]*x^(n+r),n = 0 .. infinity)])),Typesetting:-mo("−"),Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn("1"),Typesetting:-mi("x")),Typesetting:-mo("⋅"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑",Typesetting:-msemantics = "inert")),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("="),Typesetting:-mn("0")),Typesetting:-mi("∞")),Typesetting:-mo("⁡"),Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"),Typesetting:-mi("n")),Typesetting:-mo("⁢"),Typesetting:-msup(Typesetting:-mi("x"),Typesetting:-mrow(Typesetting:-mi("n"),Typesetting:-mo("+"),Typesetting:-mi("r"))))))),Typesetting:-_Hold([(1/x) %* Sum(a[n]*x^(n+r),n = 0 .. infinity)])));

Typesetting:-mrow(Typesetting:-mo("&uminus0;"), Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mn("1"), Typesetting:-mo("⋅"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑", Typesetting:-msemantics = "inert")), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("="), Typesetting:-mn("0")), Typesetting:-mi("∞")), Typesetting:-mo("⁡"), Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"), Typesetting:-mi("n")), Typesetting:-mo("⁢"), Typesetting:-msup(Typesetting:-mi("x"), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("+"), Typesetting:-mi("r"))))))), Typesetting:-_Hold([`%*`(1, Sum(a[n]*x^(n+r), n = 0 .. infinity))])), Typesetting:-mo("−"), Typesetting:-mcomplete(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn("1"), Typesetting:-mi("x")), Typesetting:-mo("⋅"), Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-munderover(Typesetting:-mstyle(Typesetting:-mo("∑", Typesetting:-msemantics = "inert")), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("="), Typesetting:-mn("0")), Typesetting:-mi("∞")), Typesetting:-mo("⁡"), Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi("a"), Typesetting:-mi("n")), Typesetting:-mo("⁢"), Typesetting:-msup(Typesetting:-mi("x"), Typesetting:-mrow(Typesetting:-mi("n"), Typesetting:-mo("+"), Typesetting:-mi("r"))))))), Typesetting:-_Hold([`%*`(1/x, Sum(a[n]*x^(n+r), n = 0 .. infinity))])))

MmaTranslator:-Mma:-LeafCount(expr);

Error, (in MmaTranslator:-Mma:-LeafCount) too many levels of recursion

length(expr)

863

 

Download crash_leafcount_V2_may_29_2023.mw

in V 2023 on windows, I can get server.exe to crash each time on this call. Do others see the same problem? I have not tried this on V 2022 to see if this new bug or not.

make sure to save ALL your work before trying this. I found Maple itself hangs also after the server.exe crash, so might not be able to save any work you have in your worksheets that are open at the time. 

I do not know if there is a workaround this. Does the program need to check for something to make sure it will not crash Maple before using this function? try/catch does not help with this. So now my program simply crash each time when it reads this problem.

restart;


expr:=1/(3*2^(2/3)*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)+3*(1/(1+(256*u^3+1)^(1/2))^(1/3)*((8*2^(1/6)*u-2^(1/2)*(1+(256*u^3+1)^(1/2))^(2/3))*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)-4*2^(1/6)*(1+(256*u^3+1)^(1/2))^(1/3))/((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2))^(1/2)*2^(7/12)-16*u);


rationalize(expr);

Attached worksheet.
 

433648

interface(version);

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

restart;

433648

expr:=1/(3*2^(2/3)*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)+3*(1/(1+(256*u^3+1)^(1/2))^(1/3)*((8*2^(1/6)*u-2^(1/2)*(1+(256*u^3+1)^(1/2))^(2/3))*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)-4*2^(1/6)*(1+(256*u^3+1)^(1/2))^(1/3))/((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2))^(1/2)*2^(7/12)-16*u);

1/(3*2^(2/3)*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)+3*(((8*2^(1/6)*u-2^(1/2)*(1+(256*u^3+1)^(1/2))^(2/3))*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)-4*2^(1/6)*(1+(256*u^3+1)^(1/2))^(1/3))/((1+(256*u^3+1)^(1/2))^(1/3)*((2^(1/3)*(1+(256*u^3+1)^(1/2))^(2/3)-8*u)/(1+(256*u^3+1)^(1/2))^(1/3))^(1/2)))^(1/2)*2^(7/12)-16*u)

rationalize(expr);

Download crash_may_28_2023.mw

 hi,

 Does anyone know why my code is not running?

 eqs.mw

I am using this command: plotsetup(png, plotoutput = "titleofmylistofplots", plotoptions = "width=1920,height=1080")

in the execution block right before a sequence of split execution blocks, each made of plots:-display( seq( plot( [$ 20], series1of8[1..20,j], color=cols1[j]), j=1..3)); (I have 8 series: series1of8, series2of8, series3of8 and so on...)

When I open the output .png file, it only contains the last plot, that is the plot of series8of8. I want my file to contain all 8 plots. How to change the plotsetup() command accordingly?

My program simply keeps hanging.

It takes me 5 days to complete something which should take 2-3 hrs, since Maple keeps hanging, and I have to keep terminating server.exe and start again. Sometimes when I start again it does not hang where it was. I do this dozens of time per day.

even though I use timelimit on every possible Maple call. The problem also is that when timelimit works, it takes 10-20 times more time than asked. I ask for 10 second timeout, sometimes it timesout after 3-10 minutes if I am lucky.

So I keep trying to make workarounds and I am tired of all of this. Just waste of time. This is getting worst with each new Maple release not better.

Here is an example

restart;
expr:=-1/3*2^(2/3)/((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)*((-1/2*a^2*p-1/2*p^2*a+1/2*p*((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)*a-3)*(-p^2*(-((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)+a+p))^(2/3)+2^(2/3)*(-(a+3/2*p)*p*((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)+a^2*p+5/2*p^2*a+3/2*p^3+3)*p)/(-((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)+a+p)/(-1/2*2^(2/3)*(-p^2*(-((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)+a+p))^(2/3)+p*(p*(-p^2*(-((a^2*p+2*a*p^2+p^3+4)/p)^(1/2)+a+p))^(1/3)+2^(1/3)))/p^2;

try 
    t0:=time[real]();
    timelimit(20,int(expr,p));
catch:
    print("time used ",time[real]()-t0,"seconds");
    print("timed out");
end try;

in Maple 2023, with 128 GB RAM and very fast PC and nothing else is running, it hangs. I could leave it for hrs, the server.exe  is running at full CPU and timelimit is ignored. Timelimit in Maple is useless.

I do not know what else to do. if someone can suggest something, I am willing to try anything before I finally give up.

 

Hi everyone, I am seeking help regarding the graphs for analytic and numeric solutions and their errors separately?

graph_for_error_.mw

I Have drawn a contour graph for my problem. I am looking for help on how to change the colours between every two lines according to desire. Or how can I use different colours like rainbow etc? 

Countour_colouring_help.mw

I am looking for help regrading change of colours between contours lines, means if there is 10 countour lines, then the gap between two line have different colour then other. Atleast repeat  colours scheme after 7 colours like rainbow combination.....As e reference please check this picture

For the function coulditbe it says

The environment variable _EnvTry can be used to specify the intensity of the testing by the is and coulditbe routines. Currently _EnvTry can be set to normal (the default) or hard. If _EnvTry is set to hard, is and coulditbe calls can take exponential time.

But how does one know the current value of _EnvTry which is supposed to be set to normal.? If I do   _EnvTry it does not show any value.  And when I do 

anames('environment');
anames('environment','active');

I do not see _EnvTry even listed.  I wanted to make sure I am setting it correctly.

Is it enough to do this?

 

foo:=proc()
 _EnvTry:='hard';
  #now use coulditbe, it should use hard value?
  #coulditbe(....)
end proc;

foo();

Would the above actually tell coulditbe to try hard? I wanted to use this inside a proc without affecting any global setting it might have. It is not possible to tell by just calling it if it actually using the hard option or not.

I do not think I am setting this right, I just tried

foo:=proc()
 _EnvTry:='hard';
 _EnvTry:='XXXX';
  #now use coulditbe, it should use hard value?
  coulditbe(1=2)
end proc;

And it did not complain or anything. Any value I put seems to work. I must be not setting this correctly as coulditbe does not complain.

I wish help would give example usages. But Maple help is not good at all as it has no usage examples to help users.

btw, I think the use of environment variables is bad in programming.

Each function should instead accept options as argument and one should set an option explictly.  So coulditbe should have an explicit optional argument to pass it. This makes the code more clear when looking at the call also.

Programming environment variables are just like global variables.

Bad way to program as in large program one can lose track of these settings.

Hello 

I have implemented FDM for  nonlinear coupled equation 

I that I have to plot U versus Y=i*h and C versus Y 

As well Theta(T) versus Y 

And I want to calculate U(0.5) T(0.5) and C(0.5)

For different values of M 

Like M=1,2,3

Please give me command for the plot and table value of U ,T,&C (0.5)

restart;
# Parameter values:
 Pr:=1:E:=1:A:=0.1:Sc:=0.01: K:=0.5:

a := 0: b := 1: N := 9:
h := (b-a)/(N+1): k := (b-a)/(N+1):

 lambda:= 1/h^2:  lambda1:= 1/k^2:
# Initial conditions
for i from 0 to N do
  U[i, 0] := h*i+1:
end do:

for i from 0 to N do
  T[i, 0] := h*i+1:
end do:
for i from 0 to N do
  C[i, 0] := h*i+1:
end do:

# Boundary conditions
for j from 0 to N+1 do
  U[0, j] := exp(A*j*lambda);
  U[N+1, j] := 0;
  T[0, j] := j*lambda1;
  T[N+1, j] := 0;
  C[0, j] := j*lambda1;
  C[N+1, j] := 0
end do:

#Discretization Scheme
for i to N do
  for j from 0 to N do
    eq1[i, j]:= lambda1*(U[i, j+1]-U[i, j]) = (Gr/2)*(T[i, j+1]+T[i,j])+(Gr/2)*(C[i, j+1]+C[i,j])+(lambda^2/2)*(U[i-1,j+1]-2*U[i,j+1]+U[i+1,j+1]+U[i-1,j]-2*U[i,j]+U[i+1,j])-(M/2)*(U[i,j+1]+U[i,j]) ;
    eq2[i, j]:= lambda1*(T[i, j+1]-T[i, j]) = (1/Pr)*(lambda^2/2)*(T[i,j+1]-2*T[i,j+1]+T[i+1,j+1]+T[i-1,j]-2*T[i,j]+T[i+1,j])+(E*lambda^2)*((U[i+1,j]-U[i,j])^2);
    eq3[i, j]:= lambda1*(C[i, j+1]-C[i, j]) = (1/Sc)*(lambda^2/2)*(C[i,j+1]-2*C[i,j+1]+C[i+1,j+1]+C[i-1,j]-2*C[i,j]+C[i+1,j])+(K/2)*((C[i,j+1]+C[i,j]))  
  end do
end do:
 

  `union`(  seq(seq( indets( eq1[i,j], name), i=1..N), j=0..N),
            seq(seq( indets( eq2[i,j], name), i=1..N), j=0..N),
            seq(seq( indets( eq3[i,j], name), i=1..N), j=0..N)
          );

   numelems(%):

  numelems(eq1)+numelems(eq2)+numelems(eq3);

{Gr, M, C[1, 1], C[1, 2], C[1, 3], C[1, 4], C[1, 5], C[1, 6], C[1, 7], C[1, 8], C[1, 9], C[1, 10], C[2, 1], C[2, 2], C[2, 3], C[2, 4], C[2, 5], C[2, 6], C[2, 7], C[2, 8], C[2, 9], C[2, 10], C[3, 1], C[3, 2], C[3, 3], C[3, 4], C[3, 5], C[3, 6], C[3, 7], C[3, 8], C[3, 9], C[3, 10], C[4, 1], C[4, 2], C[4, 3], C[4, 4], C[4, 5], C[4, 6], C[4, 7], C[4, 8], C[4, 9], C[4, 10], C[5, 1], C[5, 2], C[5, 3], C[5, 4], C[5, 5], C[5, 6], C[5, 7], C[5, 8], C[5, 9], C[5, 10], C[6, 1], C[6, 2], C[6, 3], C[6, 4], C[6, 5], C[6, 6], C[6, 7], C[6, 8], C[6, 9], C[6, 10], C[7, 1], C[7, 2], C[7, 3], C[7, 4], C[7, 5], C[7, 6], C[7, 7], C[7, 8], C[7, 9], C[7, 10], C[8, 1], C[8, 2], C[8, 3], C[8, 4], C[8, 5], C[8, 6], C[8, 7], C[8, 8], C[8, 9], C[8, 10], C[9, 1], C[9, 2], C[9, 3], C[9, 4], C[9, 5], C[9, 6], C[9, 7], C[9, 8], C[9, 9], C[9, 10], T[1, 1], T[1, 2], T[1, 3], T[1, 4], T[1, 5], T[1, 6], T[1, 7], T[1, 8], T[1, 9], T[1, 10], T[2, 1], T[2, 2], T[2, 3], T[2, 4], T[2, 5], T[2, 6], T[2, 7], T[2, 8], T[2, 9], T[2, 10], T[3, 1], T[3, 2], T[3, 3], T[3, 4], T[3, 5], T[3, 6], T[3, 7], T[3, 8], T[3, 9], T[3, 10], T[4, 1], T[4, 2], T[4, 3], T[4, 4], T[4, 5], T[4, 6], T[4, 7], T[4, 8], T[4, 9], T[4, 10], T[5, 1], T[5, 2], T[5, 3], T[5, 4], T[5, 5], T[5, 6], T[5, 7], T[5, 8], T[5, 9], T[5, 10], T[6, 1], T[6, 2], T[6, 3], T[6, 4], T[6, 5], T[6, 6], T[6, 7], T[6, 8], T[6, 9], T[6, 10], T[7, 1], T[7, 2], T[7, 3], T[7, 4], T[7, 5], T[7, 6], T[7, 7], T[7, 8], T[7, 9], T[7, 10], T[8, 1], T[8, 2], T[8, 3], T[8, 4], T[8, 5], T[8, 6], T[8, 7], T[8, 8], T[8, 9], T[8, 10], T[9, 1], T[9, 2], T[9, 3], T[9, 4], T[9, 5], T[9, 6], T[9, 7], T[9, 8], T[9, 9], T[9, 10], U[1, 1], U[1, 2], U[1, 3], U[1, 4], U[1, 5], U[1, 6], U[1, 7], U[1, 8], U[1, 9], U[1, 10], U[2, 1], U[2, 2], U[2, 3], U[2, 4], U[2, 5], U[2, 6], U[2, 7], U[2, 8], U[2, 9], U[2, 10], U[3, 1], U[3, 2], U[3, 3], U[3, 4], U[3, 5], U[3, 6], U[3, 7], U[3, 8], U[3, 9], U[3, 10], U[4, 1], U[4, 2], U[4, 3], U[4, 4], U[4, 5], U[4, 6], U[4, 7], U[4, 8], U[4, 9], U[4, 10], U[5, 1], U[5, 2], U[5, 3], U[5, 4], U[5, 5], U[5, 6], U[5, 7], U[5, 8], U[5, 9], U[5, 10], U[6, 1], U[6, 2], U[6, 3], U[6, 4], U[6, 5], U[6, 6], U[6, 7], U[6, 8], U[6, 9], U[6, 10], U[7, 1], U[7, 2], U[7, 3], U[7, 4], U[7, 5], U[7, 6], U[7, 7], U[7, 8], U[7, 9], U[7, 10], U[8, 1], U[8, 2], U[8, 3], U[8, 4], U[8, 5], U[8, 6], U[8, 7], U[8, 8], U[8, 9], U[8, 10], U[9, 1], U[9, 2], U[9, 3], U[9, 4], U[9, 5], U[9, 6], U[9, 7], U[9, 8], U[9, 9], U[9, 10]}

 

270

(1)

  fsolve( eval( [ seq(seq(eq1[i,j], i=1..N),j=0..N),
                  seq(seq(eq2[i,j], i=1..N),j=0..N),
                  seq(seq(eq3[i,j], i=1..N),j=0..N)
                ],
                [Gr=1.0, M=2]
              )
        );

plot(eval([seq([i*h, U])],thickness = 4, axes = boxed, labels = [U, y], color = red, title = "FDM"));

NULL

Download FDM_nonlinear_ode.mw

2 3 4 5 6 7 8 Last Page 4 of 2236