Due: Thursday, May 26 by 11:30pm.
|
|
Instructions: Do all the following 3 problems. You may have to explore the Sage documentation to figure out how to do some of these problems (that's part of the point of the problem). The lecture notes from class should also be very helpful.
|
|
Problem 1: Symbolic Calculus.
-sin(x)*sin(sin(x))*cos(x)*arctan(x) + 2*x*e^(x^2*cos(y))*cos(y) + cos(x)*cos(sin(x))*arctan(x) + sin(x)*cos(sin(x))/(x^2 + 1) -sin(x)*sin(sin(x))*cos(x)*arctan(x) + 2*x*e^(x^2*cos(y))*cos(y) + cos(x)*cos(sin(x))*arctan(x) + sin(x)*cos(sin(x))/(x^2 + 1) |
-1/5*e^x*sin(2*x) - 1/10*e^x*cos(2*x) + 1/2*e^x -1/5*e^x*sin(2*x) - 1/10*e^x*cos(2*x) + 1/2*e^x |
|
|
0 0 |
|
|
|
|
|
|
Problem 2: Fast Expression Evaluation.
|
|
|
|
625 loops, best of 3: 210 µs per loop 625 loops, best of 3: 319 ns per loop 625 loops, best of 3: 210 µs per loop 625 loops, best of 3: 319 ns per loop |
|
|
625 loops, best of 3: 221 ns per loop 625 loops, best of 3: 221 ns per loop |
|
|
|
|
Optimization terminated successfully.
Current function value: 0.000000
Iterations: 28
Function evaluations: 51
array([-1.56596338, -0.0030895 ])
Optimization terminated successfully.
Current function value: 0.000000
Iterations: 28
Function evaluations: 51
array([-1.56596338, -0.0030895 ])
|
5 loops, best of 3: 41.7 ms per loop 5 loops, best of 3: 41.7 ms per loop |
125 loops, best of 3: 4.2 ms per loop 125 loops, best of 3: 4.2 ms per loop |
125 loops, best of 3: 4.12 ms per loop 125 loops, best of 3: 4.12 ms per loop |
|
|
|
|
|
|

|
|
Click to the left again to hide and once more to show the dynamic interactive window |
|
|
|
|
|
|
Problem 3. Matrices
[1 2 5 0 7 6 7 0] [3 5 9 5 3 3 5 9] [7 0 5 2 1 2 5 0] [3 7 3 1 1 3 7 3] [1 6 3 2 3 6 1 8] [1 7 5 5 7 1 7 5] [3 0 9 0 3 8 5 4] [7 5 5 7 1 7 5 5] [1 2 5 0 7 6 7 0] [3 5 9 5 3 3 5 9] [7 0 5 2 1 2 5 0] [3 7 3 1 1 3 7 3] [1 6 3 2 3 6 1 8] [1 7 5 5 7 1 7 5] [3 0 9 0 3 8 5 4] [7 5 5 7 1 7 5 5] |
|
|
0 0 |
7 7 |
1 1 |
Free module of degree 8 and rank 1 over Integer Ring Echelon basis matrix: [ 1 1 0 0 0 -1 -1 0] Free module of degree 8 and rank 1 over Integer Ring Echelon basis matrix: [ 1 1 0 0 0 -1 -1 0] |
x^8 - 26*x^7 - 178*x^6 - 872*x^5 - 1820*x^4 - 27400*x^3 - 370000*x^2 - 760000*x x^8 - 26*x^7 - 178*x^6 - 872*x^5 - 1820*x^4 - 27400*x^3 - 370000*x^2 - 760000*x |
|
|
[1.0 2.0 5.0 0.0 7.0 6.0 7.0 0.0] [3.0 5.0 9.0 5.0 3.0 3.0 5.0 9.0] [7.0 0.0 5.0 2.0 1.0 2.0 5.0 0.0] [3.0 7.0 3.0 1.0 1.0 3.0 7.0 3.0] [1.0 6.0 3.0 2.0 3.0 6.0 1.0 8.0] [1.0 7.0 5.0 5.0 7.0 1.0 7.0 5.0] [3.0 0.0 9.0 0.0 3.0 8.0 5.0 4.0] [7.0 5.0 5.0 7.0 1.0 7.0 5.0 5.0] [1.0 2.0 5.0 0.0 7.0 6.0 7.0 0.0] [3.0 5.0 9.0 5.0 3.0 3.0 5.0 9.0] [7.0 0.0 5.0 2.0 1.0 2.0 5.0 0.0] [3.0 7.0 3.0 1.0 1.0 3.0 7.0 3.0] [1.0 6.0 3.0 2.0 3.0 6.0 1.0 8.0] [1.0 7.0 5.0 5.0 7.0 1.0 7.0 5.0] [3.0 0.0 9.0 0.0 3.0 8.0 5.0 4.0] [7.0 5.0 5.0 7.0 1.0 7.0 5.0 5.0] |
-1.68753899743e-10 -1.68753899743e-10 |
8 8 |
0 0 |
Vector space of degree 8 and dimension 1 over Real Double Field Basis matrix: [ 1.0 1.0 0.0 0.0 0.0 -1.0 -1.0 0.0] Vector space of degree 8 and dimension 1 over Real Double Field Basis matrix: [ 1.0 1.0 0.0 0.0 0.0 -1.0 -1.0 0.0] |
x^8 - 26.0*x^7 - 178.0*x^6 - 872.0*x^5 - 1820.0*x^4 - 27400.0*x^3 - 370000.0*x^2 - 760000.0*x x^8 - 26.0*x^7 - 178.0*x^6 - 872.0*x^5 - 1820.0*x^4 - 27400.0*x^3 - 370000.0*x^2 - 760000.0*x |
|
|
|
|
|
|