Question: Problem 4 . Function Visualization python Write in a program p 4 _ . . . . . py a function called plot _ function
Problem Function Visualization python
Write in a program ppy a function called plotfunction that takes as arguments a string funstr a
mathematical function definition that uses symbol x as a parameter, eg x a tuple domain
defining the functions domain eg a float tuple xmin xmax like and a number of
samples ns an integer, eg and then:
computes a list xs with ns sample points evenly dividing the xminxmax interval;
computes a list ys with the results of applying the function definition in string funstr with x
traversing the elements from list xs;
displays a nice table with the xs and ys values, as shown in the figure below, using the format string
method;
displays with module matplotlib.pyplot the figure with the chart of the function defined in funstr
using domain samples in list xs the corresponding range values in list ys
After the function definition write code that reads from the terminal a function expression, the domain
interval xmin xmax the number of samples ns and then calls plotfunction function with these
actual arguments.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
