Question: if u can plz use jupyter notebook to write this python code. that's the example code Task I: This task involves plotting functions of a
if u can plz use jupyter notebook to write this python code.

that's the example code


Task I: This task involves plotting functions of a single-variable over an interval. - Plot the function f(x) = x3 2.22 +1 on the interval 2 (-2,3]. - Plot the functions f(1) = et and g(x) = ln x on the interval 2 (1,5). Be sure to label the axes and give each plot a title. In [1]: ###################################################################################################################### ###Load packages from numpy import * #scientific computation import matplotlib.pyplot as plt #plotting from scipy.integrate import odeint #ode solver %matplotlib inline In [2]: ###################################################################################################################### ###plotting functions ###one plot and two functions ################################ ############################ ###plotting x = linspace(-2*pi, 2*pi, 1000) #this command creates grid along x-axis y1 = cos(x) y2 = sin(x) plt.plot(x, yi, 'b-') plt.plot(x, y2, 'r-') plt.xlabel('x') plt.ylabel('') plt.title('Sin(x) and cos(x)') #######################################################################################################################n ###alebraic operations # + addition # - subtraction # * multiplication # / division # ** exponentiation # polynomial 4*x**3 - x**2/5 + 2*x - 10 # exp(x) exponential function # Log(x) natural Logarithmic function # sin(x), cos(x), tan(x), etc. trigonometric functions # cosh(x), sinh(x), 1/cosh(x) = sech(x), etc. hyperbolic functions Out[2]: Text(0.5, 1.0, 'Sin(x) and cos(x)') Sin(x) and Cos(x) 1.00 0.75 0.50 0.25 > 0.00 -0.25 -0.50 -0.75 -1.00 -6 -4 0 2 In [7]: ###################################################################################################################### ###plotting functions ###two plots (subplot) ###################################################################################################################### x = linspace(-pi, pi, 1000) x1 = linspace(-pi, -pi/2-0.01, 1000) #tan(x) discontinuous at -pi/2 and pi/2 x2 = linspace(-pi/2+0.01, pi/2-0.01, 1000) #tan(x) discontinuous at -pi/2 and pi/2 x3 = linspace (pi/2+0.01, pi, 1000) #tan(x) discontinuous at -pi/2 and pi/2 y1 = sin(x) y2 = cos(x) y31 = tan(x1) #tan(x) = sin(x)/cos(x) y32 = tan(x2) y33 = tan(x3) plt.subplot(121) #first plot plt.plot(x, yi, 'b-') plt.plot(x, y2, 'r--') plt.xlabel('x') plt.ylabel('y') plt.title('Sin(x) and Cos(x)') plt.subplot(122) #second plot plt.plot(x1, y31, 'm-') plt.plot(x2, y32, 'm-') plt.plot(x3, y33, 'm-') plt.xlabel('x') plt.ylabel('y') plt.title('Tan(x)') plt.xlim(-pi, pi) #set x-axis range in plot plt.ylim(-10, 10) #set y-axis range in plot plt. tight_layout() Sin(x) and Cos(x) Tan(x) 10.0 1.00 7.5 0.75 0.50 5.0 0.25 2.5 0.00 0.0 -0.25 -2.5 -0.50 -5.0 -0.75 -7.5 -1.00 -10.0 -2 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
