Wednesday, May 9, 2018

How to work with trignometric functions in Python 3.7?

You need to import math module to do anything with trigonometric calculations using Python.

Hence the first thing to do trigonometry in Visual Studio is to have this first line in the interactive Python code window. We will use the Python Interactive in Visual Studio 2017 Community described in a previous post.

The above image also shows the basic use of degrees and radian measures. The value of PI, math.radians and math.degrees are most useful as they are the basis.

Here is a list of all trigonometry related functions that you can access in Python 3.7.

You get help in Visual Studio 2017 similar to intellisense as shown here.


Text in red is error message. pi is not defined, only math.pi is defined.

Here are some trigonometric functions evaluated.

There are a few more such as math.hypot().







No comments: