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

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.