extf.py

Created by ews31415

Created on February 05, 2021

530 Bytes

Extended Functions - Demonstration of how to create a python file to be used as a module.


# create a custom module
# 2021-02-03 EWS

import math

# functions code

def radius(a,b):
  return math.sqrt(a**2+b**2)

def angle(a,b):
  t=math.acos(a/math.sqrt(a**2+b**2))
  t=t*180/math.pi
  if b<0:
    t=-t
  return t

def pchg(a,b):
  return (b-a)/a*100

def taxplus(a,b):
  return a*(1+.01*b)

def pvaf(a,b):  
  return (1-(1+.01*b)**(-a))/(.01*b)
  
def fvaf(a,b):
  return ((1+.01*b)**a-1)/(.01*b)

def rsum(a,b):
  return 1/(1/a+1/b)

# constants
# gravity of Earth
g=9.80665  
# speed of light
c=299792458