abdulganiy

145 Reputation

6 Badges

9 years, 91 days

MaplePrimes Activity


These are questions asked by abdulganiy

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

 

Can someone help with the simplification of the result of this code? I am sure the "qs" in the final result should not appear.

Thanking you in anticipation of your positive responses

#k=1
restart:
P:=sum(a[k]*x^k, k=0..2):
assume(alpha>0,alpha <= 1):
Q:=fracdiff(P,x,alpha);
e1:=simplify(eval(P, x=q))=y[n]:
e2:=simplify(eval(Q,x=q))=f[n]:
e3:=simplify(eval(Q,x=q+h^alpha))=f[n+1]:
var:=seq(a[i], i=0..2):
M:=e||(1..3):

Cc:=eval(<var>, solve(eval({M}),{var}) ):
for i from 1 to 3 do
	a[i-1]:=Cc[i]:
end do:
Cf:=P:
E:=collect(Cf, [y[n], f[n], f[n+1]], recursive):
print():
#y[n+1]=collect(simplify(simplify(expand(eval(Cf,x=q+h^alpha)),size)), [y[n],f[n],f[n+1]], factor);
y[n+1]=simplify(eval(Cf, x=q+h^alpha)):
collect(%, [y[n], f[n], f[n+1]], recursive);

 

Good day. Please can someone kindly help to reduce the result of this code. Thank you and kind regards

restart:
s:=(sum(a[j]*x^j,j=0..3)+sum(a[j]*exp(-(j-3)*x),j=4..7)):
F:=diff(s,x):
p1:=simplify(eval(s,x=q))=y[n]:
p2:=simplify(eval(F,x=q))=f[n]:
p3:=simplify(eval(F,x=q+h/3))=f[n+1/3]:
p4:=simplify(eval(F,x=q+h))=f[n+1]:
p5:=simplify(eval(F,x=q+5*h/3))=f[n+5/3]:
p6:=simplify(eval(F,x=q+2*h))=f[n+2]:
p7:=simplify(eval(F,x=q+7*h/3))=f[n+7/3]:
p8:=simplify(eval(F,x=q+3*h))=f[n+3]:


vars:= seq(a[i],i=0..7):
Cc:=eval(<vars>, solve({p||(1..8)}, {vars})):
for i from 1 to 8 do
	a[i-1]:=Cc[i]:
end do:
Cf:=s:
L:=collect(simplify(simplify(expand(eval(Cf,x=q+3*h)),size)), [y[n],f[n],f[n+1/3],f[n+1],f[n+5/3],f[n+2],f[n+7/3],f[n+3]], factor):
length(L);
H := ee -> collect(numer(ee),[exp],h->simplify(simplify(h),size))/collect(denom(ee),[exp],h->simplify(simplify(h),size)):
M:=y[n+3]=(H@expand)(L);
length(M);

 

In the following codes I am very sure exp(-3*q) is a factor both at numerator and denominator. However, I dont know how to annihilate this factor. Can someone kindly help to ensure it cancels out? Thanks and kind regards.

restart:
s:=(sum(a[j]*x^j,j=0..2)+sum(a[j]*exp(-(j-2)*x),j=3..4)):
F:=diff(s,x):
p1:=simplify(eval(s,x=q))=y[n]:
p2:=simplify(eval(F,x=q))=f[n]:
p3:=simplify(eval(F,x=q+h))=f[n+1]:
p4:=simplify(eval(F,x=q+3*h/2))=f[n+3/2]:
p5:=simplify(eval(F,x=q+2*h))=f[n+2]:

vars:= seq(a[i],i=0..4):
Cc:=eval(<vars>, solve({p||(1..5)}, {vars})):
for i from 1 to 5 do
	a[i-1]:=Cc[i]:
end do:
Cf:=s:
T:y[n+2]=collect(simplify(eval(Cf,x=q+2*h)), [y[n],f[n],f[n+1],f[n+3/2],f[n+2]], recursive);

 

3 4 5 6 7 8 Page 5 of 8