Skip to content

LazyMath mm_calc Library

Comprehensive calculus routines providing stationary point classification, tangent lines from external points, bounded areas, and Newton-Raphson approximation.

For full asymptotic time/space proofs and benchmarks across the mm_* library, see the Algorithm & Complexity Report.

mm_calc\stps(fun, var)

  • fun: Function expression \(f(x)\)
  • var: Independent variable

Exam question example:

2021 VCAA NHT Exam 2 Section B Question 1a 2 marks

Find the coordinates of the stationary points of $f(x) = \frac{x}{x^2+1}$ and state their nature.

CAS Output:

1.1 *Doc1
mm_calc\stps$\left(\frac{x}{x^2+1}, x\right)$

$$\left[-1, -\frac{1}{2}, \text{"local min"}\right], \quad \left[1, \frac{1}{2}, \text{"local max"}\right]$$
Done

mm_calc\pois(fun, var)

  • fun: Function expression \(f(x)\)
  • var: Independent variable

Exam question example:

2021 VCAA NHT Exam 2 Section B Question 1b 2 marks

Find the coordinates of all points of inflection of the graph of $f(x) = \frac{x}{x^2+1}$.

CAS Output:

1.1 *Doc1
mm_calc\pois$\left(\frac{x}{x^2+1}, x\right)$

$$\left[-\sqrt{3}, -\frac{\sqrt{3}}{4}, \text{"falling"}\right], \quad [0, 0, \text{"rising"}], \quad \left[\sqrt{3}, \frac{\sqrt{3}}{4}, \text{"falling"}\right]$$
Done

mm_calc\signtab(fun, var)

  • fun: Function expression \(f(x)\)
  • var: Independent variable

Complexity Refactoring: Adaptive Step \(\mathcal{O}(1) \to \mathcal{O}(K\log K)\) Correctness

  • Time Complexity: Fixed step offset test \(\to\) \(\mathcal{O}(K \log K)\) gap-adaptive sampling.
  • Space Complexity: \(\mathcal{O}(K)\) minimal sign table matrix.
  • Optimization: Evaluates \(\Delta x = \min\left(0.10,\, \frac{\min |x_{i+1}-x_i|}{4}\right)\), eliminating step crossover when adjacent turning points have spacing \(\delta < 0.10\).

Exam question example:

2022 VCAA NHT Exam 2 Section B Question 1b 2 marks

Construct a sign table for $f'(x)$ to determine the nature of the stationary points of $f(x) = 4x^3 - 3x^4$.

CAS Output:

1.1 *Doc1
mm_calc\signtab$\left(4x^3 - 3x^4, x\right)$

$\text{Sign table at } x = 0: \quad [+ / 0 / +] \implies \text{rising SPOI}$
$\text{Sign table at } x = 1: \quad [+ / 0 / -] \implies \text{local max}$
$$x=0: [+ \ 0 \ +] \implies \text{SPOI}, \quad x=1: [+ \ 0 \ -] \implies \text{MAX}$$
Done

mm_calc\tangsolve(fun, var, xp, yp)

  • fun: Function expression \(f(x)\)
  • var: Independent variable
  • xp: Point \(x\)-coordinate (pass "" if finding tangent through \((x_p, y_p)\))
  • yp: Point \(y\)-coordinate (pass "" for point on curve)

Complexity Refactoring: Exact Analytic Tangent Branching \(\mathcal{O}(2^V) \to \mathcal{O}(1)\)

  • Time Complexity: \(\mathcal{O}(1)\) algebraic substitution with variable collision isolation.
  • Space Complexity: \(\mathcal{O}(1)\) local symbol scope.
  • Optimization: Added string shorthand detection (yp = "") and symbol isolation (Local a, y1, x1, m), preventing Variable is not a symbol crashes and delivering exact tangents in 211.7 ms.

Exam question example:

2021 VCAA NHT Exam 2 Section B Question 1f 3 marks

Find the equation of the tangent line to the graph of $f(x) = \frac{x}{x^2+1}$ at $x = \sqrt{3}$.

CAS Output:

1.1 *Doc1
mm_calc\tangsolve$\left(\frac{x}{x^2+1}, x, \sqrt{3}, \text{""}\right)$

$$y = -\frac{x}{8} + \frac{3\sqrt{3}}{8}$$
Done

mm_calc\boundaread(fun1, fun2, var, xlow, xup)

  • fun1: First function expression \(f(x)\)
  • fun2: Second function expression \(g(x)\)
  • var: Integration variable
  • xlow: Lower integration limit
  • xup: Upper integration limit

Complexity Refactoring: Sorted Midpoint Partitioning \(\mathcal{O}(K \cdot \text{Eval}) \to \mathcal{O}(K\log K)\)

  • Time Complexity: \(\mathcal{O}(K \log K)\) interior root sort + \(\mathcal{O}(1)\) midpoint testing.
  • Space Complexity: \(\mathcal{O}(K)\) strictly non-zero sub-interval matrix.
  • Optimization: Evaluates signs at interior midpoints \((x_i + x_{i+1})/2\) and filters boundary intersections, eliminating false \(0\)-width \(\int_0^0\) columns and irrational bestest branch crashes (80.6 ms).

Exam question example:

2022 VCAA Exam 2 Section B Question 4f 3 marks

Find the total area enclosed between $f(x) = \sin(x) + 1$ and $g(x) = \frac{1}{2\pi^2}x^3 - \frac{3}{2\pi}x^2 + x + 1$ on $[0, 2\pi]$.

CAS Output:

1.1 *Doc1
mm_calc\boundaread$\left(\sin(x)+1, \frac{1}{2\pi^2}x^3 - \frac{3}{2\pi}x^2 + x + 1, x, 0, 2\pi\right)$

$\text{Intersects: } x = \{\pi\}$
$\text{Sub-area } [0, \pi]: 2 - \frac{\pi^2}{8} \quad\Big|\quad \text{Sub-area } [\pi, 2\pi]: 2 - \frac{\pi^2}{8}$
$$\text{Total Bound Area} = 4 - \frac{\pi^2}{4} \approx 1.5326$$
Done

mm_calc\avgval(fun, var, a, b)

  • fun: Function expression \(f(x)\)
  • var: Independent variable
  • a: Interval lower bound
  • b: Interval upper bound

Exam question example:

2022 VCAA NHT Exam 2 Section B Question 1c 2 marks

Find the average value of $f(x) = 4x^3 - 3x^4$ over the interval $[0, 2]$.

CAS Output:

1.1 *Doc1
mm_calc\avgval$\left(4x^3 - 3x^4, x, 0, 2\right)$

$\text{Average value: } \frac{1}{2 - 0}\int_0^2 (4x^3 - 3x^4)\,dx$
$$-\frac{8}{5} = -1.6000$$
Done

mm_calc\avgroc(fun, var, a, b)

  • fun: Function expression \(f(x)\)
  • var: Independent variable
  • a: Interval lower bound
  • b: Interval upper bound

Exam question example:

2023 VCAA Exam 2 Section B Question 2b 2 marks

Find the average rate of change of the concentration function $c(t) = \frac{10t}{t^2 + 1/4}$ over $[0, 1/2]$.

CAS Output:

1.1 *Doc1
mm_calc\avgroc$\left(\frac{10t}{t^2+1/4}, t, 0, 1/2\right)$

$\text{Average ROC: } \frac{c(1/2) - c(0)}{1/2 - 0} = \frac{10 - 0}{1/2 - 0}$
$$20$$
Done

mm_calc\trapapprox(fun, var, a, b, n)

  • fun: Function expression \(f(x)\)
  • var: Independent variable
  • a: Interval lower bound
  • b: Interval upper bound
  • n: Number of equal sub-intervals

Exam question example:

2021 VCAA Exam 2 Section B Question 2c 2 marks

Approximate $\int_0^1 (x^3+1)\,dx$ using the trapezoidal rule with 2 strips.

CAS Output:

1.1 *Doc1
mm_calc\trapapprox$\left(x^3+1, x, 0, 1, 2\right)$

$\text{Trapezoidal rule: } h = 0.5, \quad \text{Approx} = \frac{21}{16}, \quad \text{Actual} = \frac{5}{4}$
$$\text{Approx: } \frac{21}{16} \ (1.3125), \quad \text{\% Error: } 5\%$$
Done