Matplotlib#
Create a plot where on the x-axis there are all integers between -4 and 4 and on the y-axis, there is \(g(x) = 2 x^2\). Add labels for the x-axis and the y-axis. Use dots to indicate the data points and connect these dots with lines. Choose a color of the line and the dots.
Create a two-panel plot with the contents of the above plot in the first panel and a linear function \(h(x) = 3x + 1\) in the other panel.
Create a plot similar to the first one, but also add the linear function \(h(x)\) to the same panel as \(g(x)\). Add a legend indicating which line represents which data.
Depending how you solved the first assignment (with stateful or with the object oriented approach), implement the other approach here. Discuss the advantages / disadvantages of both approaches.
Write a graphical test for the linear congruential generator from the last assignment. For this, we create two sequences of
n
random numbers (one forx
and one fory
) and use thescatter()
function to visualize them.