Formula

2021-9-18 About 3 min

# Formula

class Formula(**options)

# How to use?

from whiteCalculator import Formula
Formula.{Formula}.{function}(args)
1
2

# Example

>>> from whiteCalculator import Formula
>>> Formula.PythagorasTheorem.getC(a=3, b=4)
5
1
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

a2+b2=c2a^2 + b^2 = c^2

  • # 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
  • # 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
  • # 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

# LensFormula

1u+1v=1f\frac{1}{u} + \frac{1}{v} = \frac{1}{f}

  • # 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
  • # 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
  • # 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

# LinearMagnificationFormula

m=hiho=vum = \frac{h_{i}}{h_{o}} = \frac{v}{u}

  • # 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
    • # 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
  • # 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
  • # 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
  • # 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
  • # 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
Last update: September 18, 2021 21:04
Contributors: White_Night_awa