Index « Previous Next ». Write a program to compute cosine of x.The user should supply x and a positive integer n. We compute the cosine of x using the series and the computation should use all terms in the series up through the term involving x n. Cos x = 1 - x 2 /2!
Python Advanced Tutorial
Python Useful Resources
Selected Reading
Description
Python number method exp() returns returns exponential of x: ex.
Syntax
Following is the syntax for exp() method −
Note − This function is not accessible directly, so we need to import math module and then we need to call this function using math static object.
Parameters
x − This is a numeric expression.
Return Value
This method returns exponential of x: ex.
Example
The following example shows the usage of exp() method.
When we run above program, it produces following result −