ScientificFunctions

class fancy_calcy.advanced.ScientificFunctions[source]

A class that provides various scientific functions.

Note

Just illustrating how maths equation can be added in the Python docstrings.

  • Factorial:

\[n! = \prod_{i=1}^{n} i = n * (n-1) * (n-2) * \dots * 1\]

Where n is a non-negative integer.

  • Power: \(x^y\)

Examples

>>> from fancy_calcy.advanced import ScientificFunctions
>>> sf = ScientificFunctions()
>>> sf.factorial(5)
120
>>> sf.power(2, 3)
8.0
>>> sf.logarithm(10, 100)
2.0
>>> sf.sine(45)
0.7071067811865476
>>> sf.cosine(60)
0.5000000000000001
>>> sf.tangent(30)
0.5773502691896257
>>> sf.add_complex(2+3j, 4+5j)
(6+8j)
>>> sf.subtract_complex(4+5j, 2+3j)
(2+2j)

Methods

add_complex(num1, num2)

Add two complex numbers.

cosine(angle)

Calculate the cosine of an angle in degrees.

factorial(num)

Calculate the factorial of a non-negative integer.

logarithm(base, num)

Calculate the logarithm of a number with a given base.

power(base, exponent)

Calculate the power of a number.

sine(angle)

Calculate the sine of an angle in degrees.

subtract_complex(num1, num2)

Subtract two complex numbers.

tangent(angle)

Calculate the tangent of an angle in degrees.