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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.1: Introduction To C++
Problem 1E: (Practice) State whether the following are valid function names and if so, whether they’re mnemonic...
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr