Aixleft math

120 Reputation

5 Badges

1 years, 35 days
Singapore

MaplePrimes Activity


These are replies submitted by Aixleft math

@acer All good suggestion, noted and thank you again.

@acer Thank you very much for your valuable answer and help. And again, I apologize for uploading the screenshots. I only did this once when the network was slow. I am a novice and don't know the rules. I will upload the worksheet and describe the problem in more detail later. Moreover, I have no secrets. My questions are also for everyone to better apply maple to solve problems. For example, in this question: for maple users, it is more convenient to use 3D graphs to compare exact solutions and numerical solutions.

@WD0HHU Thanks for your help!

@acer I am sorry for causing you misunderstanding and trouble. I apologize to you. When I posted the question, I was in the library with laggy network and my laptop was very outdated. It is a Dell office laptop from five years ago. So when I uploaded the worksheet, I refreshed the webpage but could not submit it. Now I am back home, change desktop PC and I will upload it again. This is not a secret. y1 and y2 are the numerical solutions of the second-order ODE of this system. They are composed of a series of points. I want to integrate them into a 3D box and compare them with the exact solution. And I want the x-axis range of this 3Dbox to be 0 to 100 (I tried but failed, it seems to be because the range of the x-axis is B/h? That is, the endpoint/step size), and the y-axis range is -5 to 5. And color is yellow and green (the same as exact solution), but I use color=[yellow,green] doesn't work. At last, it seem the points exceed it limitation?

@acer Thank you! It does work! And could you teach me more? I want the second file effect (it sucesses maybe because I copy and paste it to another file?) But I don't wanna copy it, I wanna give the command based on the original file (the first file). But it fails.

@SUN ZHUOYU sorry , it has x,y,z axis, but font size too small, in the case of enhancing the quality, how to amplify the font size? thanks all guyssss

this is the 5000 * 5000 figure, no x,y,z axis, the above is original figure with x,y,z axis but lower quality.

NULL;

restart;
with(plottools);
with(plots);
plotsetup(png, plotoutput = "plot.png", plotoptions = "width=5000,height=5000");
Digits := 60;
F1 := (x, y1, y2) -> 2498*y1 + 4998*y2;
F2 := (x, y1, y2) -> -2499*y1 - 4999*y2;
GG1 := (x, y1, y2, z1, z2) -> 2498*z1 + 4998*z2;
GG2 := (x, y1, y2, z1, z2) -> -2499*z1 - 4999*z2;
f1[0] := -2;
f2[0] := 1;
x[0] := 0;
y1[0] := 2;
z1[0] := 0;
y2[0] := -1;
z2[0] := 0;
h := 0.025;
W := 1;
B := 100;
v := W*h;
c[1] := 0;
c[2] := evalf(1/2 + 1/10*sqrt(5));
c[3] := evalf(1/2 - 1/10*sqrt(5));
a[21] := evalf(1/30 + sqrt(5)/75);
a[31] := evalf(-1288/452405);
a[32] := evalf(98209/2714430 - sqrt(5)/75);
A[21] := evalf(3/20 + sqrt(5)/20);
A[31] := 0;
A[32] := evalf(3/20 - sqrt(5)/20);
b[1] := 1/24;
b[2] := evalf(-sqrt(5)/48 + 1/16);
b[3] := evalf(sqrt(5)/48 + 1/16);
bp[1] := 1/12;
bp[2] := evalf(-sqrt(5)/24 + 5/24);
bp[3] := evalf(sqrt(5)/24 + 5/24);
G[2] := evalf(1);
G[3] := evalf(1);
g[2] := evalf(1);
g[3] := evalf(1);

st := time[real]();
for i from 0 to B/h do
    k1[1] := GG1(x[i], y1[i], y2[i], z1[i], z2[i]);
    k2[1] := GG2(x[i], y1[i], y2[i], z1[i], z2[i]);
    k1[2] := GG1(h*c[2] + x[i], y1[i]*g[2] + h*z1[i]*c[2] + h^2/2*c[2]^2*f1[i] + h^3*a[21]*k1[1], y2[i]*g[2] + h*z2[i]*c[2] + h^2/2*c[2]^2*f2[i] + h^3*a[21]*k2[1], h^2*A[21]*k1[1] + h*G[2]*c[2]*f1[i] + z1[i], h^2*A[21]*k2[1] + h*G[2]*c[2]*f2[i] + z2[i]);
    k2[2] := GG2(h*c[2] + x[i], y1[i]*g[2] + h*z1[i]*c[2] + h^2/2*c[2]^2*f1[i] + h^3*a[21]*k1[1], y2[i]*g[2] + h*z2[i]*c[2] + h^2/2*c[2]^2*f2[i] + h^3*a[21]*k2[1], h^2*A[21]*k1[1] + h*G[2]*c[2]*f1[i] + z1[i], h^2*A[21]*k2[1] + h*G[2]*c[2]*f2[i] + z2[i]);
    k1[3] := GG1(h*c[3] + x[i], y1[i]*g[3] + h*z1[i]*c[3] + h^2/2*c[3]^2*f1[i] + h^3*(a[31]*k1[1] + a[32]*k1[2]), y2[i]*g[3] + h*z2[i]*c[3] + h^2/2*c[3]^2*f2[i] + h^3*(a[31]*k2[1] + a[32]*k2[2]), z1[i] + h*c[3]*f1[i]*G[3] + h^2*(A[31]*k1[1] + A[32]*k1[2]), z2[i] + h*c[3]*f2[i]*G[3] + h^2*(A[31]*k2[1] + A[32]*k2[2]));
    k2[3] := GG2(h*c[3] + x[i], y1[i]*g[3] + h*z1[i]*c[3] + h^2/2*c[3]^2*f1[i] + h^3*(a[31]*k1[1] + a[32]*k1[2]), y2[i]*g[3] + h*z2[i]*c[3] + h^2/2*c[3]^2*f2[i] + h^3*(a[31]*k2[1] + a[32]*k2[2]), z1[i] + h*c[3]*f1[i]*G[3] + h^2*(A[31]*k1[1] + A[32]*k1[2]), z2[i] + h*c[3]*f2[i]*G[3] + h^2*(A[31]*k2[1] + A[32]*k2[2]));
    y1[i + 1] := y1[i] + h*z1[i] + h^2/2*f1[i] + h^3*(b[1]*k1[1] + b[2]*k1[2] + b[3]*k1[3]);
    y2[i + 1] := y2[i] + h*z2[i] + h^2/2*f2[i] + h^3*(b[1]*k2[1] + b[2]*k2[2] + b[3]*k2[3]);
    z1[i + 1] := z1[i] + h*f1[i] + h^2*(bp[1]*k1[1] + bp[2]*k1[2] + bp[3]*k1[3]);
    z2[i + 1] := z2[i] + h*f2[i] + h^2*(bp[1]*k2[1] + bp[2]*k2[2] + bp[3]*k2[3]);
    f1[i + 1] := subs(x = h*(i + 1), y1 = y1[i + 1], y2 = y2[i + 1], F1(x, y1, y2));
    f2[i + 1] := subs(x = h*(i + 1), y1 = y1[i + 1], y2 = y2[i + 1], F2(x, y1, y2));
    x[i + 1] := x[i] + h;
end do;
time[real]() - st;
MAX := 0;
for j from 0 to B/h do
    E1[j] := abs(2*cos(x[j]) - y1[j]);
    E2[j] := abs(-cos(x[j]) - y2[j]);
    E[j] := max(2*cos(x[j]) - y1[j], -cos(x[j]) - y2[j]);
    if MAX < abs(E[j]) then
        MAX := abs(E[j]);
    end if;
end do;
;
points1 := {seq([x[j], y1[j]], j = 0 .. B/h)};
points2 := {seq([x[j], y2[j]], j = 0 .. B/h)};
p := pointplot(points1, color = yellow);
q := pointplot(points2, color = green);
f := transform((x, z) -> [x, aa, z]);
display([extrude(q, -5 .. 5, (x, y, z) -> [x, z, y], style = pointline)], [extrude(p, -5 .. 5, (x, y, z) -> [x, z, y], style = pointline)]);

_EnvExplicit:=true: sols := solve({e1,e2}):

> evalf(sols);

it is ok.

@acer yes ! I want the last one, thank you so much! this is the first time for me to use mapleprime, cause many concrete examples can't be seen in the maple help. Good luck the first time !


 

with(plottools); with(plots); points1 := {[0, 1], [0.4e-1, .99920], [0.8e-1, .99680], [.12, .99280], [.16, .98722], [.20, .98006], [.24, .97133], [.28, .96104], [.32, .94922], [.36, .93588], [.40, .92104], [.44, .90472], [.48, .88696], [.52, .86779], [.56, .84723], [.60, .82531], [.64, .80207], [.68, .77755], [.72, .75179], [.76, .72482], [.80, .69669], [.84, .66744], [.88, .63713], [.92, .60580], [.96, .57350], [1.00, .54028], [1.04, .50620], [1.08, .47130], [1.12, .43565], [1.16, .39930], [1.20, .36231], [1.24, .32474], [1.28, .28665], [1.32, .24811], [1.36, .20917], [1.40, .16989], [1.44, .13034], [1.48, 0.90585e-1], [1.52, 0.50685e-1], [1.56, 0.10703e-1], [1.60, -0.29295e-1], [1.64, -0.69245e-1], [1.68, -.10908], [1.72, -.14874], [1.76, -.18817], [1.80, -.22730], [1.84, -.26606], [1.88, -.30440], [1.92, -.34225], [1.96, -.37955], [2.00, -.41625], [2.04, -.45228], [2.08, -.48758], [2.12, -.52210], [2.16, -.55578], [2.20, -.58858], [2.24, -.62043], [2.28, -.65129], [2.32, -.68111], [2.36, -.70983], [2.40, -.73742], [2.44, -.76383], [2.48, -.78902], [2.52, -.81294], [2.56, -.83556], [2.60, -.85684], [2.64, -.87674], [2.68, -.89525], [2.72, -.91233], [2.76, -.92795], [2.80, -.94208], [2.84, -.95471], [2.88, -.96581], [2.92, -.97536], [2.96, -.98334], [3.00, -.98975], [3.04, -.99458], [3.08, -.99781], [3.12, -.99940], [3.16, -.99940], [3.20, -.99783], [3.24, -.99466], [3.28, -.98989], [3.32, -.98354], [3.36, -.97561], [3.40, -.96612], [3.44, -.95509], [3.48, -.94252], [3.52, -.92844], [3.56, -.91288], [3.60, -.89585], [3.64, -.87738], [3.68, -.85752], [3.72, -.83628], [3.76, -.81370], [3.80, -.78982], [3.84, -.76468], [3.88, -.73831], [3.92, -.71076], [3.96, -.68206], [4.00, -.65227], [4.04, -.62144], [4.08, -.58961], [4.12, -.55684], [4.16, -.52317], [4.20, -.48866], [4.24, -.45337], [4.28, -.41736], [4.32, -.38068], [4.36, -.34338], [4.40, -.30553], [4.44, -.26720], [4.48, -.22844], [4.52, -.18931], [4.56, -.14988], [4.60, -.11020], [4.64, -0.70347e-1], [4.68, -0.30381e-1], [4.72, 0.96326e-2], [4.76, 0.49630e-1], [4.80, 0.89547e-1], [4.84, .12932], [4.88, .16889], [4.92, .20818], [4.96, .24714], [5.00, .28571]}

{[0, 1], [0.4e-1, .99920], [0.8e-1, .99680], [.12, .99280], [.16, .98722], [.20, .98006], [.24, .97133], [.28, .96104], [.32, .94922], [.36, .93588], [.40, .92104], [.44, .90472], [.48, .88696], [.52, .86779], [.56, .84723], [.60, .82531], [.64, .80207], [.68, .77755], [.72, .75179], [.76, .72482], [.80, .69669], [.84, .66744], [.88, .63713], [.92, .60580], [.96, .57350], [1.00, .54028], [1.04, .50620], [1.08, .47130], [1.12, .43565], [1.16, .39930], [1.20, .36231], [1.24, .32474], [1.28, .28665], [1.32, .24811], [1.36, .20917], [1.40, .16989], [1.44, .13034], [1.48, 0.90585e-1], [1.52, 0.50685e-1], [1.56, 0.10703e-1], [1.60, -0.29295e-1], [1.64, -0.69245e-1], [1.68, -.10908], [1.72, -.14874], [1.76, -.18817], [1.80, -.22730], [1.84, -.26606], [1.88, -.30440], [1.92, -.34225], [1.96, -.37955], [2.00, -.41625], [2.04, -.45228], [2.08, -.48758], [2.12, -.52210], [2.16, -.55578], [2.20, -.58858], [2.24, -.62043], [2.28, -.65129], [2.32, -.68111], [2.36, -.70983], [2.40, -.73742], [2.44, -.76383], [2.48, -.78902], [2.52, -.81294], [2.56, -.83556], [2.60, -.85684], [2.64, -.87674], [2.68, -.89525], [2.72, -.91233], [2.76, -.92795], [2.80, -.94208], [2.84, -.95471], [2.88, -.96581], [2.92, -.97536], [2.96, -.98334], [3.00, -.98975], [3.04, -.99458], [3.08, -.99781], [3.12, -.99940], [3.16, -.99940], [3.20, -.99783], [3.24, -.99466], [3.28, -.98989], [3.32, -.98354], [3.36, -.97561], [3.40, -.96612], [3.44, -.95509], [3.48, -.94252], [3.52, -.92844], [3.56, -.91288], [3.60, -.89585], [3.64, -.87738], [3.68, -.85752], [3.72, -.83628], [3.76, -.81370], [3.80, -.78982], [3.84, -.76468], [3.88, -.73831], [3.92, -.71076], [3.96, -.68206], [4.00, -.65227], [4.04, -.62144], [4.08, -.58961], [4.12, -.55684], [4.16, -.52317], [4.20, -.48866], [4.24, -.45337], [4.28, -.41736], [4.32, -.38068], [4.36, -.34338], [4.40, -.30553], [4.44, -.26720], [4.48, -.22844], [4.52, -.18931], [4.56, -.14988], [4.60, -.11020], [4.64, -0.70347e-1], [4.68, -0.30381e-1], [4.72, 0.96326e-2], [4.76, 0.49630e-1], [4.80, 0.89547e-1], [4.84, .12932], [4.88, .16889], [4.92, .20818], [4.96, .24714], [5.00, .28571]}

(1)

p := pointplot(points1)

 

``

NULL


 

Download 2d_to_3d_try.mw

1 2 3 4 5 Page 5 of 5