GraphCalcApp is a simple graphing calculator demonstration using myphysicslab.

Recipe for Graphing

  • make a LabCanvas with a SimView, connected to an HTML canvas
  • make a VarsList with 2 variables.
  • make a GraphLine which collects data from the VarsList
  • make a DisplayGraph to show the GraphLine
  • add DisplayGraph to SimView
  • add DisplayAxes to SimView
  • put the expression you want to graph into a string variable, it is a function of x.
  • in a loop, from x=0 to 10, by increment of 0.05: put x into vars[0]; evaluate the expression to get y, put it into vars[1]; call graph.memorize()
  • call canvas.paint()

TO DO add AutoScale, so that full range is shown

TO DO add pan-zoom controls

Constructors

Properties

x

Methods

Constructors

Properties

x: number = 0

The expression evaluating process uses Terminal.expand() to access the 'x' variable which is a property of GraphCalcApp.

Methods

  • Define short-cut name replacement rules. For example 'x' is replaced by 'myApp.x' when myName is 'myApp'.

    Parameters

    • myName: string

      the name of this object, valid in global Javascript context.

    Returns void

  • Parameters

    • script: string
    • output: boolean = true

      whether to print the result to the output text area and add the script to session history; default is true

    Returns any

    the result of evaluating the string

  • Parameters

    • expr: string
    • Optional range1: number
    • Optional range2: number
    • Optional numPts: number

    Returns void

Generated using TypeDoc