L-19 MCS 320 Monday 10 October 2005
| > | restart; |
1. Taking Antiderivatives
We have an inert version "Int" and the version "int" which actually calculates.
| > | exint := Int((x^2-1)/(x^5+1),x); |
| > | value(exint); |

| > | anti_derivative := int((x^2-1)/(x^5+1),x); |

The second time, the answer came much faster, although there seems to be no remember table:
| > | interface(verboseproc=3); |
| > | op(4,eval(int)); |
| > | print(int); |
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
| > | op(4,eval(`int/int`)); |
![TABLE([([(x^2-1)/(x^5+1), x], 10, _EnvCauchyPrincipalValue, _EnvAllSolutions, _EnvContinuous) = 1/10*5^(1/2)*ln(-2*x^2+x+5^(1/2)*x-2)+arctan((-4*x+1+5^(1/2))/(10-2*5^(1/2))^(1/2))/(10-2*5^(1/2))^(1/2)...](images/lec19_16.gif)
![TABLE([([(x^2-1)/(x^5+1), x], 10, _EnvCauchyPrincipalValue, _EnvAllSolutions, _EnvContinuous) = 1/10*5^(1/2)*ln(-2*x^2+x+5^(1/2)*x-2)+arctan((-4*x+1+5^(1/2))/(10-2*5^(1/2))^(1/2))/(10-2*5^(1/2))^(1/2)...](images/lec19_17.gif)
![TABLE([([(x^2-1)/(x^5+1), x], 10, _EnvCauchyPrincipalValue, _EnvAllSolutions, _EnvContinuous) = 1/10*5^(1/2)*ln(-2*x^2+x+5^(1/2)*x-2)+arctan((-4*x+1+5^(1/2))/(10-2*5^(1/2))^(1/2))/(10-2*5^(1/2))^(1/2)...](images/lec19_18.gif)
![TABLE([([(x^2-1)/(x^5+1), x], 10, _EnvCauchyPrincipalValue, _EnvAllSolutions, _EnvContinuous) = 1/10*5^(1/2)*ln(-2*x^2+x+5^(1/2)*x-2)+arctan((-4*x+1+5^(1/2))/(10-2*5^(1/2))^(1/2))/(10-2*5^(1/2))^(1/2)...](images/lec19_19.gif)
So getting to the remember table is a bit more involved...
The second thing we may want to do is to verify the answer. We can take the derivative of the recently computed antiderivative.
| > | da := diff(anti_derivative,x); |

Why does this seem so different from out original (x^2-1)/(x^5-1)?????
| > | testeq(da=(x^2-1)/(x^5+1)); |
The probability one test, built-in in the "testeq" command returns inconclusive.
| > | f := unapply(da,x): |
| > | g := x -> (x^2-1)/(x^5+1): |
| > | r := evalf(rand()/10^12); |
| > | evalf(f(r) - g(r)); |
So there is not really a difference.
| > | pf := plot(f(x),x=0..100): pg := plot(g(x),x=0..100): |
| > | plots[display](pf,pg); |
![[Plot]](images/lec19_26.gif)
2. Definite Integration
Let us move to definite integration, and verify the fundamental theorem of calculus. We can compute definite integrals via antiderivatives.
| > | f := 1/x^2; |
Let us compute an antiderivative:
| > | ad := int(f,x); |
To compute the integral of f from a to b, we apply the fundamental theorem of calculus:
| > | symbolic_integral := subs(x=b,ad) - subs(x=a,ad); |
For example:
| > | subs(a=-1,b=1,symbolic_integral); |
However:
| > | numerical_integral := int(f,x=-1..1); |
The numerical_integral is right:
| > | plot(f,x=-1..1,view=[-1..1,0..100]); |
![[Plot]](images/lec19_32.gif)
| > |
3. Numerical Integration
In many cases, there is no symbolic antiderivative.
| > | integrand := exp(cos(x)); |
| > | int(integrand,x); |
What we still can compute are definite integrals, but then numerically:
| > | integral := Int(integrand,x=0..1); |
| > | val := evalf(integral); |
Here we see the usefulness of the inert Int command, because it does not make sense to first try a symbolic antiderivative.
| > | macro(numint = evalf@Int); |
| > | numint(integrand,x=0..1); |
A direct numerical integration routine was invoked, without first trying to integrate it symbolically.
4. Integral Transforms
To go from the time domain to the frequency domain, we apply integral transforms.
| > | diffeq := diff(y(t),t$2) + y(t) = sin(2*t); |
| > | inits := y(0) = 2,D(y)(0) = 1; # initial conditions |
| > | inttrans[laplace](diffeq,t,s); |
| > | subs(laplace(y(t),t,s)=Y(s),%); |
| > | subs(inits,%); |
We can solve this equation algebraically, find Y(s) and then go back to the time domain via invlaplace.
5. Integrals with parameters
Maple 7 would have evaluated the following integral:
| > | int(f,x=a..b); |
| > |
which would be wrong if a*b < 0.
| > | int(f,x=a..b) assuming a>0,b>0; |
Equivalently, we can impose a global assumptions on a and b:
| > | assume(a>0,b>0); |
| > | int(f,x=a..b); |
The value of the integral depends on whether a and b have the same sign.
6. Summation
| > | sum('i','i'=0..n); |
| > |
| > |