MCS 320 Wednesday 2 November 2005
| > | restart; |
#4 on review
| > | dvd := proc(f)
local s,n; s := op(procname); # get index to dvd, the sequence n := nops([s]); # the number of elements in s if n = 1 then # base case in the recursion return f(s); else # general case return (dvd[seq(s[k],k=2..n)](f) - dvd[seq(s[k],k=1..n-1)](f))/(s[1] - s[n]); end if; end proc: |
| > | dvd[a](f); |
| > | dvd[a,b,c,d](f); |
| > | dvd[a,b,c](f); |
# 10
| > | f := t -> int((1-exp(x)),x=0..t); # notice the x |
| > | D(f)(0.001); |
| > | D(f)(0); |
# 11
| > | g := (1-t^2)/(1-2*x*t+t^2); |
(a)
| > | ty := taylor(g,t=0,10); |
![]()
![]()
![]()
![]()
| > | ty8 := coeff(ty,t,8); |
| > | ch8 := orthopoly[T](8,x); |
| > | df := ty8/2 - ch8; |
| > | simplify(df); |
The difference between our polynomial and the Chebyshev polynomials is that our polynomial is twice the Chebyshev polynomial.
(b)
The coefficient of the Taylor series of g about t = 0 are the Chebyshev polynomials, up to a constant.
| > | cp := n -> coeftayl(g,t=0,n)/2; |
| > | cp(8); |
| > | orthopoly[T](8,x); |
| > | cp(0); |
| > | orthopoly[T](0,x); |
| > | ccp := n -> piecewise(n=0,1,cp(n)); |
| > | ccp(0); ccp(8); |
# 17
| > | s := [4+2*x+2*y+z+x*y,4+2*x+2*y+2*z+4*y^2,x+y+x^2]; |
(a)
| > | gb := Groebner[Basis](s,plex(x,y,z)); |
![]()
| > | degree(gb[1],z)*degree(gb[2],y)*degree(gb[3],x); |
There are four complex solutions.
(b)
| > | vz := fsolve(gb[1],z,complex); |
| > | eqy := seq(subs(z=vz[k],gb[2]),k=1..4); |
![]()
| > | eqx := seq(subs(z=vz[k],gb[3]),k=1..4); |
![]()
| > | vy := map(eq -> fsolve(eq,y,complex),[eqy]); |
| > | vx := map(eq -> fsolve(eq,x,complex),[eqx]); |
| > | sols2 := zip((x,y) -> [x,y],vx,vy); |
![]()
![]()
| > | sols := zip((xy,z) -> [op(xy),z],sols2,[vz]); |
![]()
![]()
![]()
| > | nops(sols); |
(c) To find only the real solutions we leave off the complex of the fsolve command.
To find only the rational solutions, we use solve instead of fsolve.
# 12
| > | p := 5*x^2*a^2 + 61*x^2*a + 66*x^2 + 10*x*a^2 + 121*x*a + 121*x + a^2 +15*a + 44; |
(a)
| > | solve(p,x); |
(b)
Only if the denominator of the solution is nonzero are the solutions valid.
(c)
| > | collect(p,x); |
We have fewer than two solutions if the leading coefficient of p in x vanishes:
| > | p2 := coeff(p,x,2); |
| > | special_a := solve(p2,a); |
| > | eq1 := subs(a=special_a[1],p); |
| > | subs(a=special_a[2],p); |
For the first special value we have one solution.
| > | solve(eq1,x); |
For the second special value, the polynomial p equals zero for this second special value we have infinitely many solutions for x.
#13
| > | p := -42*sin(x)^11 + 88*sin(x)^8 - 76*sin(x)^7 - 65*sin(x)^5 + 25*sin(x)^3 + 28; |
| > | solve(p,sin(x)); |
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
The best way is to solve for sin(x). We see that there are 11 possible values.
| > | ps := subs(sin(x)=y,p); |
| > | v := fsolve(ps,y); |
| > | fsolve(ps,y,complex); |
![]()
![]()
![]()
There is only one real solution, and 10 complex conjugate solutions. If we are only interested in the real solutions, then there is only value to take.
| > | _EnvAllSolutions := true; |
| > | solve(sin(x)=v,x); |