abdulganiy

140 Reputation

6 Badges

9 years, 348 days

MaplePrimes Activity


These are questions asked by abdulganiy

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);

 

Please I am trying to get a compact result for this code in particular the lines assigne "a" and "b" respectively. I am sure the result shoud not be more than two lines. Can someone be of help? 

restart:
P:=a[0]+(a[1]*x)/(1+(a[2]*x)/(1+(a[3]*x))):
Q:=diff(P,x):
T:=diff(P,x,x):
e1:=simplify(eval(P, x=q))=y[n]:
e2:=simplify(eval(Q,x=q))=f[n]:
e3:=simplify(eval(Q,x=q+h))=f[n+1]:
e4:=simplify(eval(T,x=q+h))=g[n+1]:
var:=seq(a[i], i=0..3):
M:=e||(1..4):
Cc:=eval(<var>, solve(eval({M}),{var}) ):
for i from 1 to 4 do
	a[i-1]:=Cc[i]:
end do:
Cf:=P:
a:=y[n+1]=collect(simplify(eval(Cf, x=q+h)),[y[n], f[n], f[n+1],g[n+1]], recursive):
b:=map(eval@allvalues, [a]);

 

please how can I simplify the results of assigned K cum each of the coefficients further in the following code? the results are too large.

restart:
#k=2:
omega:=u/h:
psi:=v/h:
t:=(sum(a[j]*x^j,j=0..2)+a[3]*sin(omega*x)+a[4]*cos(omega*x)+a[5]*sin(psi*x)+a[6]*cos(psi*x)):
F:=diff(t,x):
G:=diff(t,x,x):
p1:=simplify(eval(t,x=q+h))=y[n+1]:
p2:=simplify(eval(F,x=q))=f[n]:
p3:=simplify(eval(F,x=q+h))=f[n+1]:
p4:=simplify(eval(F,x=q+2*h))=f[n+2]:
p5:=simplify(eval(G,x=q))=g[n]:
p6:=simplify(eval(G,x=q+h))=g[n+1]:
p7:=simplify(eval(G,x=q+2*h))=g[n+2]:
vars:= seq(a[i],i=0..6):
Cc:=eval(<vars>, solve({p||(1..7)}, {vars})):
for i from 1 to 7 do
	a[i-1]:=Cc[i]:
end do:
Cf:=t:

K:= collect(combine(simplify(eval(Cf,x=q+2*h),size),trig),{y[n+1],f[n],f[n+1],f[n+2],g[n],g[n+1],g[n+2]},factor):


alpha[1]=simplify(coeff(K,y[n+1]));
beta[0]=simplify(coeff(K,f[n]),size);
beta[1]=simplify(coeff(K,f[n+1]),size):
beta[2]=simplify(coeff(K,f[n+2]),size):
gamma[0]=simplify(coeff(K,g[n]),size):
gamma[1]=simplify(coeff(K,g[n+1]),size):
gamma[2]=simplify(coeff(K,g[n+2]),size):

 

3 4 5 6 7 Page 5 of 7