Question

In: Computer Science

Print the mean and the first 10 eigenvector images and plot the first 100 eigenvalues using...

Print the mean and the first 10 eigenvector images and plot the first 100 eigenvalues using python.

Solutions

Expert Solution

# install numpy using command : [pip3 install numpy] or [pip install numpy]
# install matplotlib using command : [pip3 install matplotlib] or [pip install matplotlib]
import numpy as np
from matplotlib import pyplot as plt

def perform_op(data):
"""data matrix should be a square matrix with size greate or equal to 100"""
if data.shape[0] >= 100 and data.shape[0]==data.shape[1]:
eig_values, norm_eigen_vec = np.linalg.eig(data)
mean = data.mean()
print("Mean", mean)
for i in range(10):
print("Eigen vector ", i+1, ":")
print(norm_eigen_vec[:, i])

plt.plot(range(100), eig_values[:100])
plt.show()

# size of data should be greater than 100
data = np.random.randint(low=0, high=100, size=(150, 150))
perform_op(data)


Related Solutions

Solve the system using an eigenvalue/eigenvector approach and plot both x(t) and y(t) over a 60...
Solve the system using an eigenvalue/eigenvector approach and plot both x(t) and y(t) over a 60 minute time interval. dx/dt= 8y/200-8x/100 dy/dt=8x/100-8y/100 inital conditions: x=0, y=100, t=0
A) Plot the first five particle in a box wavefunctions for an electron in a 10...
A) Plot the first five particle in a box wavefunctions for an electron in a 10 Å box (starting at n = 1). Choose two of these and plot their probability density. Offer a brief interpretation. B) (10) Calculate the probability you would find the electron in the right-hand . of the box (right-hand meaning larger values of the spatial variable) if the electron were described by your fifth wavefunction (highest energy where n = 5). Calculate the probability you...
Write a program in Python that will print first 100 numbers of the following series: 0,...
Write a program in Python that will print first 100 numbers of the following series: 0, 1, 1, 2, 3, 5, 8……..
Write a C++ Program to print the first letter of your first and last name using...
Write a C++ Program to print the first letter of your first and last name using stars. Note: 1) Using nested For Loop 2) The number of lines is given by user. 3) Using one Outer loop to print your letters. 4) Print the letters beside each other.
Using Python, generate 100 random numbers ranging from 1 to 5, then plot them using matplotlib...
Using Python, generate 100 random numbers ranging from 1 to 5, then plot them using matplotlib or Seaborn as a histogram
2. If the mean of a distribution is 100 with a standard deviation of 10, what...
2. If the mean of a distribution is 100 with a standard deviation of 10, what raw score is associated with a z-score of +2.003. 3. Using the z-score formula, if you have a distribution with a mean of 50 and a standard deviation of 5, what z-score is associated with a raw score of X=43.5? 4. Using the z-score formula, if you have a distribution with a mean of 50 and a standard deviation of 5, what z-score is...
C++ Have the user type in 10 numbers. Then, using STL STACKs print a table showing...
C++ Have the user type in 10 numbers. Then, using STL STACKs print a table showing each number followed by the next large number. For example, if the user types the following 7 5 12 25 The output should be this: Element Next Greater Number 5 --> 7 7 --> 12 12 --> 25 25 --> -1 You can use this functor to sort the vector: #include<iostream> #include<vector> #include<algorithm> using namespace std; struct greater { template<class T> bool operator()(T const...
Part 1: Suppose the mean score on the first exam is a 60 out of 100....
Part 1: Suppose the mean score on the first exam is a 60 out of 100. I would like to curve the exam to force the mean score to be an 80 out of 100. If I added 20 to everyone’s score, would the SD of the exam scores change? How about if I multiplied 4/3 to everyone’s score? Explain. Part 2: Continuing from Part 1, fill out the formulas put below that will always be true. Let a =...
Suppose the mean score on the first exam is a 60 out of 100. I would...
Suppose the mean score on the first exam is a 60 out of 100. I would like to curve the exam to force the mean score to be an 80 out of 100. If I added 20 to everyone’s score, would the SD of the exam scores change? How about if I multiplied 4/3 to everyone’s score? Explain. Part 2: Continuing from Part 1, fill out the formulas put below that will always be true. Let a = constant (-...
A population distribution of score has a mean = 100 and a standard deviation of 10....
A population distribution of score has a mean = 100 and a standard deviation of 10. Researchers plan to take a sample size of N=25. Based on the central limit theorem, 68.26% of all possible means are between the sample means of ______ A) 90 and 100 B) 95 and 100 C) 98 and 102 D) 97 and 103
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT