Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

numpy
function
python
communitycreator

# What is the numpy.sinc() function in NumPy? Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

## Overview

In NumPy, the numpy.sinc() function is used to compute the normalized sinc function.

Mathematically:

Sinc(x)= $\frac{sin(x)}{x}$

### Syntax

numpy.sinc(x)
Syntax for the numpy.sinc() function

### Parameter

This function takes a single parameter value, x, which is the input array of values to be calculated.

### Return value

This function returns an array of the same shape as the input array holding the results for each of the elements.

### Example

import numpy as np

# creating a evenly spaced numbers
x = np.linspace(-2, 2, 20)

# implementing the numpy.sinc function  element-wise
myarray = np.sinc(x)

print(myarray)
Implementing the numpy.sinc() function

### Explanation

• Line 1: We import the numpy module.
• Line 4: We create a variable, x , containing input values starting from -2 to 2 with an interval of 20 using the linspace() function.
• Line 7: We implement the numpy.sinc() function on the input values. The result is assigned to a variable myarray.
• Line 9: We print the variable myarray to the console.

RELATED TAGS

numpy
function
python
communitycreator

CONTRIBUTOR Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Learn in-demand tech skills in half the time 