plotter_5.py 683 B

123456789101112131415161718192021
  1. def getFunction(LHStok, RHStok, eqnVars, graphVars, dim):
  2. """Returns function for plotting
  3. Arguments:
  4. LHStok {list} -- expression tokens
  5. RHStok {list} -- expression tokens
  6. eqnVars {list} -- variables in equation
  7. graphVars {list} -- variables for plotting
  8. dim {int} -- dimenion of plot
  9. Returns:
  10. (LHS - RHS) {numpy.array(2D)/function(3D)} -- equation converted to compatible data type for plotting
  11. """
  12. LHS = getFuncExpr(LHStok, eqnVars, graphVars)
  13. if len(eqnVars) == dim:
  14. RHS = getFuncExpr(RHStok, eqnVars, graphVars)
  15. elif len(eqnVars) == dim - 1:
  16. RHS = graphVars[-1]
  17. return LHS - RHS