Here are some warm up questions for python.
1. Import numpy and matplotlib.pyplot.
2. Create an array of x-values from 0 to 1 evenly split into N = 10 spaces.
3. Create an array of values V = x2 that is the same length as x array.
4. Plot x vs. V.
5. Traverse the list of V values and set them all equal to zero except when x greater than 0.5.
6. Make a 6x6 matrix with the diagonal elements equal to 4. Give it the name M.
7. Add an off diagonal to the matrix with values -2 and add it to M.
8. Add a lower off diagonal to the matrix M with values -2.
9. Print 2 eigenvalues for the matrix M.
10. Print the first eigenvector for M.
11. Recreate the vector M and make it 99 x 99. Plot the first two eigenvectors.
12. Make an array called y from 0 to 1 with 20 spaces. Print the list without the first or last element.
12 окт 2023