abdulganiy

140 Reputation

6 Badges

9 years, 349 days

MaplePrimes Activity


These are questions asked by abdulganiy

Dear All.

I hope we are all staying safe.

Please I want to solve Sine Gordon Equation using a numerical method I constructed (non-classical), I need to compare the result of the method with the exact solution to generate the errors. However, since the exact solution has two variables, x, and t, I really don't know how to accommodate the two in my coding.

Can someone be of help in this regard?

Thank you and kind regards

 


Download Discretization_of_Sine_Gordon_Equation.mw

Download Sine_Gordon_Implementation_Trial.mw

 

Dear All.

Please kindly help to correct the attached code on discretization of fourth order PDE using method of line.
Thank you and kind regards.

restart

``

``

Discretization of parabolic equation with method of line

diff(u(x, t), t) = -2*(diff(diff(u(x, t), x), x))-(diff(diff(diff(diff(u(x, t), x), x), x), x))-u(x, t)*(diff(u(x, t), x))

u(x, t)

u(x, t)

u(x, 0) = 0.3e-1*sin(x)

8

``

``

``

Convert the BC to finite difference

(1/2)*(u[m+1](t)-u[m-1](t))/h

(u[m-1](t)-2*u[m](t)+u[m+1](t))/h^2

(u[m-2](t)-4*u[m-1](t)+6*u[m](t)-4*u[m+1](t)+u[m+2](t))/h^4

````

Convert the governing equation to finite difference form

Error, invalid input: diff received 2*h, which is not valid for its 2nd argument

Error, invalid input: diff received 2*h, which is not valid for its 2nd argument

Error, invalid input: LinearAlgebra:-GenerateMatrix expects its 1st argument, eqns, to be of type ({list, set})({`=`, algebraic}), but received eqs

A

``


 

Download Discretization_of_PDE_Order_4.mw

Dear Experts,

Please how do I carry out the differentiation of 

y[1](t)*y[2](t)*(y[1](t)+y[2](t))^3

with respect to y[1] using maple? I know how to use maple if the derivative is with respect to t.
Thank you in anticipation

Please I found out that the MatrixInverse on the assignment statement P3 does not run for about three days now. Please kindly help to simplify the code. Thank you and kind regards.

restart; omega := v/h;
r := a[0]+a[1]*x+a[2]*sinh(omega*x)+a[3]*cosh(omega*x)+a[4]*cos(omega*x)+a[5]*sin(omega*x);
b := diff(r, x);

c := eval(b, x = q) = f[n];
d := eval(r, x = q+3*h) = y[n+3]; e := eval(b, x = q+3*h) = f[n+3];
g := eval(b, x = q+2*h) = f[n+2];
i := eval(b, x = q+h) = f[n+1];
j := eval(b, x = q+4*h) = f[n+4];
k := solve({c, d, e, g, i, j}, {a[0], a[1], a[2], a[3], a[4], a[5]});
Warning,  computation interrupted
assign(k);
cf := r;
s4 := y[n+4] = simplify(eval(cf, x = q+4*h));
s3 := y[n+2] = simplify(eval(cf, x = q+2*h));
s2 := y[n+1] = simplify(eval(cf, x = q+h));
s1 := y[n] = simplify(eval(cf, x = q));

with(LinearAlgebra);
with(plots);
h := 1;
YN_1 := seq(y[n+k], k = 1 .. 4);
A1, a0 := GenerateMatrix([s1, s2, s3, s4], [YN_1]);
eval(A1);
YN := seq(y[n-k], k = 3 .. 0, -1);
A0, b1 := GenerateMatrix([s1, s2, s3, s4], [YN]);
eval(A0);
FN_1 := seq(f[n+k], k = 1 .. 4);
B1, b2 := GenerateMatrix([s1, s2, s3, s4], [FN_1]);
eval(B1);
FN := seq(f[n-k], k = 3 .. 0, -1);
B0, b3 := GenerateMatrix([s1, s2, s3, s4], [FN]);
eval(B0);
ScalarMultiply(R, A1)-A0;
det := Determinant(ScalarMultiply(R, A1)-A0);
P1 := A1-ScalarMultiply(B1, z);
P2 := combine(simplify(P1, size), trig);
P3 := MatrixInverse(P2);
P4 := A0-ScalarMultiply(B0, z);
P5 := MatrixMatrixMultiply(P3, P4);
P6 := Eigenvalues(P5);
f := P6[4];
T := unapply(f, z);
implicitplot(f, z = -5 .. 5, v = -5 .. 5, filled = true, grid = [5, 5], gridrefine = 8, labels = [z, v], coloring = [blue, white]);

 

1. y''(x)+10y(x)=99sin(x), y(0)=1, y'(0)=11 in the interval [0,100]

the exact solution is y(x)=cos(10x)+sin(10x)+sin(x)

 

2. y'=z, y(0)=1

    z'=-y(x)+x, z(0)=2

    the exact solutions are y(x)=cos(x)+sin(x)+x, z(x)=cos(x)-sin(10x)+1

 

2 3 4 5 6 7 Page 4 of 7