The use of functions is very useful to carry out tasks. For instance, we might want to define a function which, for any input x, is equal to sin(x)/x. First we need to pick a name for this function – let’s try calling it sinex. Now we need to create a procedure called sinex within Python, and here is what goes inside it (in pseudocode format): (a) Set up the sinex function. Evaluate it at x = 0, and at x = π. What values do you expect there? Make a table of its values from -2 to 2 in increments of 0.25. (b) Plot the sinex function over the domain of -10 to 10

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter10: Application Development
Section: Chapter Questions
Problem 6VE
icon
Related questions
Question

The use of functions is very useful to carry out tasks. For instance, we might want to define a function which, for any input x, is equal to sin(x)/x. First we need to pick a name for this function – let’s try calling it sinex. Now we need to create a procedure called sinex within Python, and here is what goes inside it (in pseudocode format):

(a) Set up the sinex function. Evaluate it at x = 0, and at x = π. What values do you expect there? Make a table of its values from -2 to 2 in increments of 0.25.

(b) Plot the sinex function over the domain of -10 to 10.

Algorithm 2 SINEX(x)
Ensure: function result = sinex(x)
1: if x = 0 then
2:
result = 1
%3D
3: else
4:
result = sin(x)/x
5: end if
Transcribed Image Text:Algorithm 2 SINEX(x) Ensure: function result = sinex(x) 1: if x = 0 then 2: result = 1 %3D 3: else 4: result = sin(x)/x 5: end if
Expert Solution
Given data and asked question

To Plot graph for user defined function sinex. 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr