save_figs = F # Problem 1: # pr = polyroot( c( 1, -2, 1 ) ) print(pr) # Problem 3: # pr = polyroot( c( -3, -4, 4 ) ) print(pr) # Problem 4: # pr = polyroot( c( 9, 12, 4 ) ) print(pr) # Problem 5: # pr = polyroot( c( 10, -2, 1 ) ) print(pr) # Problem 7: # pr = polyroot( c( 4, 17, 4 ) ) print(pr) # Problem 8: # pr = polyroot( c( 9, 24, 16 ) ) print(pr) # Problem 9: # pr = polyroot( c( 4, -20, 25 ) ) print(pr) # Problem 10: # pr = polyroot( c( 1, 2, 2 ) ) print(pr) # Problem 11: # pr = polyroot( c( 4, -12, 9 ) ) print(pr) # Problem 13: # pr = polyroot( c( 82, 6, 9 ) ) print(pr) # Problem 14: # A = matrix( c( exp(2), -exp(2), -2*exp(2), 3*exp(2) ), nrow=2, ncol=2, byrow=T ) b = c( 2, 1 ) x = solve( A, b ) print(x) print( c( 7, 5 ) * exp(-2) ) # Problem 15: # polyroot( c( 9, 12, 4 ) ) ts = seq( 0, 5, length.out=100 ) ys = exp(-(3/2)*ts) - (5/2)*ts*exp(-(3/2)*ts) plot(ts, ys, type='l', xlab='t', ylab='y(t)') abline(v=c( 2/5, 16/15 ), col='gray') grid() # Problem 17: # polyroot( c( 1, 4, 4) ) ts = seq( 0, 5, length.out=100 ) ys = exp(-(1/2)*ts) + (5/2)*ts*exp(-(1/2)*ts) plot(ts, ys, type='l', xlab='t', ylab='y(t)') abline(v=8/5, col='gray') grid() # Problem 18: # polyroot( c( 4, 12, 9 ) ) ts = seq( 0, 5, length.out=100 ) ys = exp(-(1/2)*ts) + (5/2)*ts*exp(-(1/2)*ts) plot(ts, ys, type='l', xlab='t', ylab='y(t)') abline(v=8/5, col='gray') grid()