| > | restart; |
| > | with(student): |
| > | an:=x^n;
bn:=1/n^2; |
| > | A1:=Sum(an,n=1..infinity);
B1:=Sum(bn,n=1..infinity); |
| > | A2:=value(A1);
B2:=value(B1); |
| > | subs(x=1/3,A1=A2); |
| > | S1:=Sum(an*bn,n=1..infinity); |
| > | S2:=value(S1); |
| > | T1:=simplify(diff(S1,x)); |
| > | T2:=expand(x*T1,x); |
| > | T3:=simplify(diff(T2,x)); |
| > | T4:=value(T3); |
| > | #Therefore
Diff(x*Diff(y(x),x),x)=T4; |
| > | #where
y(x)=S1; |
| > | #Now integrate to find y(x)
#BUG: the following integral should work only assuming t<1 T5:=int(T4,x=0..t) assuming t<0; |
| > | T6:=T5/t; |
| > | #Therefore y(x) is given by
T7:=int(T6,t=0..x); |
| > | #The difference between S2 and T7 should be zero
simplify(S2-T7); |
| > | #When x=1/3 they have the same values
evalf(subs(x=1/3,S2)); evalf(subs(x=1/3,T7)); |
| > | #Sum the first 10 terms should make an approximation
S3:=sum(an*bn,n=1..10); |
| > | S4:=subs(x=1/3,S3); |
| > | #Agrees to the first 5 decimals
evalf(S4); |
| > |