#hw3.txt, 30 January 2014 #Sowmya Srinivasan #Some examples from pages 60 to 90 #Differential equations f:='f' : y:=f(x); dy:=diff(y,x); ddy:= diff(%,x); dsolve(ddy+5*dy+6*y = sin(x)*exp(-3*x),y); #plots plot(sec(x),x=-Pi..2*Pi,y=-5..5); with(plots): p1:=plot(sqrt(x),x=0..400): p2:=plot(3*log(x),x=0..400,title='Square root and log functions'): display(p1,p2); plot3d(exp(-(x^2+y^2-1)^2),x=-2..2,y=-2..2); spaceplot([cos(t),sin(t),t],t=0..8*Pi,numpoints=400); #Linear Algebra with(linalg); A:=matrix(2,3,[[a,b,c],[d,e,f]]); gausselim(A); gaussjord(A); #dangers of floating point calculations #Digits:=75 gives a fairly good agreement for Hil(50): #1.393\times 10^{-1466} for evalf(det(Hil(50))) #and 1.380 \times 10^{-1466} for det(evalf(Hil(50))) #After repeating Hil(n) for n=10,20,30,... we see that a rough relation might be #Digits = (n/10)*15 #counting the number of inversions of a permutation p #by modifying s1(p) inv1:=proc(p) local i,j,n,s,k: s:=1: n:=nops(p): k:=0: for i from 1 to n do for j from i+1 to n do if p[i] > p[j] then s:=-s: k:=k+1: fi: od: od: #s: k: end: #gf(n,q) computes the sum of q^inv1(p) over all permutations of length n with(combinat); gf:=proc(n,q) local X,i,p,S : X:=permute(n): i:=1: S:=0: for i from 1 to n! do p:=X[i]: S:=S+q^inv1(p): od: S: end: