Formula
2021-9-18 About 3 min
# Formula
class Formula(**options)
# How to use?
from whiteCalculator import Formula
Formula.{Formula}.{function}(args)
1
2
2
# Example
>>> from whiteCalculator import Formula
>>> Formula.PythagorasTheorem.getC(a=3, b=4)
5
1
2
3
2
3
# Attributes
# .skipError
Decide should this calculator use Exception to traceback error. Same and see more at Calculator().skipError
# .useEval
Decide should this calculator use eval (opens new window) to calculate. Same and see more at Calculator().useEval
# .showEquation
Decide should this calculator print equation when calculated. Same and see more at Calculator().showEquation
# Class(Formulas)
# PythagorasTheorem
# getA (b, c)
- Parameters
- b (int or float or str(equation)) - length of perpendicular
- c (int or float or str(equation)) - length of hypotenuse
- Returns
- length of base
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getB (a, c)
- Parameters
- a (int or float or str(equation)) - length of base
- c (int or float or str(equation)) - length of hypotenuse
- Returns
- length of perpendicular
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getC (a, b)
- Parameters
- a (int or float or str(equation)) - length of base
- b (int or float or str(equation)) - length of perpendicular
- Returns
- length of hypotenuse
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# LensFormula
# getU (v, f)
- Parameters
- v (int or float or str(equation)) - images distance
- f (int or float or str(equation)) - focus length
- Returns
- object distance
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getV (u, f)
- Parameters
- u (int or float or str(equation)) - object distance
- f (int or float or str(equation)) - focus length
- Returns
- images distance
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getF (u, v)
- Parameters
- u (int or float or str(equation)) - object distance
- v (int or float or str(equation)) - images distance
- Returns
- focus length
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# LinearMagnificationFormula
# getM
# byHeight (i, o)
- Parameters
- i (int or float or str(equation)) - height of images
- o (int or float or str(equation)) - height of object
- Returns
- Magnification of lens
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# byDistance (v, u)
- Parameters
- v (int or float or str(equation)) - images distance
- u (int or float or str(equation)) - object distance
- Returns
- Magnification of lens
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getO (m, i)
- Parameters
- m (int or float or str(equation)) - Magnification of lens
- i (int or float or str(equation)) - height of images
- Returns
- height of object
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getI (m, o)
- Parameters
- m (int or float or str(equation)) - Magnification of lens
- o (int or float or str(equation)) - height of object
- Returns
- height of images
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getV (m, u)
- Parameters
- m (int or float or str(equation)) - Magnification of lens
- u (int or float or str(equation)) - object distance
- Returns
- images distance
- Return Type
- .ans or str (opens new window)(errors)
- Parameters
# getU (m, v)
- Parameters
- m (int or float or str(equation)) - Magnification of lens
- v (int or float or str(equation)) - images distance
- Returns
- object distance
- Return Type
- .ans or str (opens new window)(errors)
- Parameters