Mafs

Graphs

Functions of x

import {
  Mafs,
  CartesianCoordinates,
  FunctionGraph,
} from "mafs"

function HelloFx() {
  return (
    <Mafs>
      <CartesianCoordinates subdivisions={4} />
      <FunctionGraph.OfX y={(x) => Math.sin(x)} />
    </Mafs>
  )
}

Parametric functions

import {
  Mafs,
  CartesianCoordinates,
  FunctionGraph,
  Theme,
} from "mafs"

function Parametric() {
  return (
    <Mafs xAxisExtent={[-8, 8]}>
      <CartesianCoordinates />
      <FunctionGraph.Parametric
        xy={(t) => [
          (t / 4) * Math.cos(t * 2 * Math.PI),
          (t / 4) * Math.sin(t * 2 * Math.PI),
        ]}
        t={[0, 8]}
        color={Theme.blue}
      />
    </Mafs>
  )
}