Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 In this question we want to benchmark the performance of solving linear systems of equations on your computer. To do this create random

image text in transcribed
Question 4 In this question we want to benchmark the performance of solving linear systems of equations on your computer. To do this create random matrices of dimension n with random right-hand sides and use numpy.linalg,solve to solve the corresponding linear systems of equations. 2 1 To time your computation you should use the %timeit magic command from Jupyter notebook You can use it as follows: compute_time %timeit -o np. linalg.solve(A,b) best_time = compute_time. best This runs a number of timing tests and then stores the best result in the variable best_time. Do this for various n and create a figure that plots the compute time against the dimension. For plotting you should use the matplotlib library within the jupyter Notebook. Use a loglog plot to show your result. This should give you an approximate straight line (why?). In the same plot show the graph of the function f(n) = n! Visually compare the graphs and comment. Try to go as high as you can on your machine. Remember to submit your Jupyter Notebook together with the output so that the marker can see your plot. Hint: Your smallest n should be around 100. Can you manage a few thousand for your largest n? Question 4 In this question we want to benchmark the performance of solving linear systems of equations on your computer. To do this create random matrices of dimension n with random right-hand sides and use numpy.linalg,solve to solve the corresponding linear systems of equations. 2 1 To time your computation you should use the %timeit magic command from Jupyter notebook You can use it as follows: compute_time %timeit -o np. linalg.solve(A,b) best_time = compute_time. best This runs a number of timing tests and then stores the best result in the variable best_time. Do this for various n and create a figure that plots the compute time against the dimension. For plotting you should use the matplotlib library within the jupyter Notebook. Use a loglog plot to show your result. This should give you an approximate straight line (why?). In the same plot show the graph of the function f(n) = n! Visually compare the graphs and comment. Try to go as high as you can on your machine. Remember to submit your Jupyter Notebook together with the output so that the marker can see your plot. Hint: Your smallest n should be around 100. Can you manage a few thousand for your largest n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Identify behaviors of leaders;

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago