Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import CODE FROM PREVIOUS EXERCISE numpy as np # return the value of h(x) def h(x): return np.exp( -0.5 * x * x ) /

image text in transcribedimport

CODE FROM PREVIOUS EXERCISE

numpy as np # return the value of h(x) def h(x): return np.exp( -0.5 * x * x ) / np.sqrt( 2 * np.pi ) # x = [ -4 , 4 ] with 41 uniformly spaced coordinates xarray = np.linspace( -4 , 4 , num = 41 ) harray = h(xarray) # create array with same length as xarray harray = np.linspace( -4 , 4 , num = 41 ) # calculate h(x) for i in range( 0 , len(xarray) ): harray[i] = h( xarray[i] ) print(' x h(x)') for i in range( 0 , len(xarray)): print(xarray[i] , ' ', harray[i])

b 3T] Plot a function - Cx C e https://relate.cs. Ilinois.edu/course/cs101-sp18/flow-session/391421/2 Plot a function 1 point Make a plot of the function h from the previous exercise over the range -4,4 You will need to: plot the data using blue circles (NOT dots) change the plot range to match the specification above (use the plt.xlim( a,b ) function, where you provide a and b) . add a title to your plot, 'Formula Plot' add axes labels to your plot, 'x' and 'h(x) Your submission should include a plot. Make sure to import matplotlib.pyplot as plt. Use plt.plot but not plt.show in your submission. You will need to include the code from the previous exercise in order to calculate the values to be plotted. While there are several ways to specify colors and markers (linecolor- 'red' ), for CS 101 homework assignments and exams, please use the 'rx -style short-format specification. Keep in mind throughout that NumPy arrays require NumPy functions, not those from math This assignment is based on Langtangen Exercise 5.4.)

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

Step: 3

blur-text-image

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

Common Stockholders' Profitability Analysis

Answered: 1 week ago

Question

Detailed note on the contributions of F.W.Taylor

Answered: 1 week ago