Skip to content

LazyMath mm_func Library

Functions and graphs routines for interactive transformations, inverse functions, composite existence, and simultaneous linear systems.

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

mm_func\transform(f, var)

  • f: Original base function \(f(x)\)
  • var: Independent variable

Exam question example:

Interactive Step-by-Step Transformation Menu Menu Guided

Transform the base function $f(x) = x^2$ through reflections, dilations, and translations with the interactive menu:

1. Reflection (in x/y)\n2. Translation (units in x or y, accepts negative units e.g. -1)\n3. Dilation (factor from x or y)\n4. End Transformations

CAS Output:

1.1 *Doc1
mm_func\transform$\left(x^2, x\right)$

$$y = -2(x + 1)^2 + 3$$
Done

mm_func\inverse(fun, var, invicx)

  • fun: Function expression \(f(x)\)
  • var: Independent variable
  • invicx: Initial condition for domain branch (pass "" for global 1-to-1)

Complexity Refactoring: Inflection-Center Inversion \(\mathcal{O}(\text{Matrix Solve}) \to \mathcal{O}(1)\)

  • Time Complexity: \(\mathcal{O}(1)\) exact radical inversion + empty condition branch handling.
  • Space Complexity: \(\mathcal{O}(1)\) local symbol scope.
  • Optimization: Replaced broken matrix system with direct inflection-point radical decomposition \(y = x_0 \pm \left(\frac{x - y_0}{a}\right)^{1/n}\) and added invicx = "" handling to render 1-to-1 inverse functions in 164.5 ms.

Exam question example:

2024 VCAA Exam 2 Section B Question 4d 3 marks

Find the inverse function of $f(x) = \frac{1}{4}(x + 2)^3 + 2$ and state its domain.

CAS Output:

1.1 *Doc1
mm_func\inverse$\left(\frac{1}{4}(x+2)^3+2, x, \text{""}\right)$

$$f^{-1}(x) = 2^{2/3}(x-2)^{1/3} - 2, \quad \text{Domain: } -\infty < x < \infty$$
Done

mm_func\invints(fun, n)

  • fun: Function expression \(f(x)\) with parameter \(k\)
  • n: Desired number of intersection points with \(f^{-1}(x)\)

Complexity Refactoring: Univariate Parameter Elimination \(\mathcal{O}(2^V) \text{ / Hang} \to \mathcal{O}(1)\)

  • Time Complexity: \(\mathcal{O}(2^V)\) bivariate equation search \(\to\) \(\mathcal{O}(1)\) univariate parameter elimination along \(y = x\).
  • Space Complexity: \(\mathcal{O}(\text{Tree}) \to \mathcal{O}(1)\).
  • Optimization: Parameterized \(k(x) = \frac{\ln x}{x}\) along the line of symmetry \(y = x\), reducing 2D tangency to a single 1D derivative equation and dropping runtime from an infinite CAS hang to 51.1 ms.

Exam question example:

2024 VCAA Exam 2 Section B Question 4f 2 marks

Find the values of $k$ for which $f(x) = e^{kx}$ intersects its inverse in exactly 1 point.

CAS Output:

1.1 *Doc1
mm_func\invints$\left(e^{kx}, 1\right)$

$\text{Tangency along } y = x \implies k = e^{-1} \quad\Big|\quad \text{Tangency along } y = -x \implies k = -e$
$$\blacktriangleright\text{For 1 solution: } -e \le k < 0 \quad \text{or} \quad k = e^{-1}$$
Done

mm_func\ccheck(f, g)

  • f: Outer function \(f(u)\)
  • g: Inner function \(g(x)\)

Exam question example:

2021 VCAA Exam 2 Section B Question 4a 2 marks

Verify whether the composite function $f(g(x))$ exists for $f(x) = 2x^2+x-1$ and $g(x) = \sin(x)$.

CAS Output:

1.1 *Doc1
mm_func\ccheck$\left(2x^2+x-1, \sin(x)\right)$

$\text{ran}(g) = [-1, 1] \subseteq \text{dom}(f) = (-\infty, \infty)$
$$\text{Composite exists: } -1 \le x \le 1 \subseteq -\infty < x < \infty$$
Done

mm_func\linesolve(e1, e2)

  • e1: First linear equation containing parameter \(k\)
  • e2: Second linear equation containing parameter \(k\)

Complexity Refactoring: Linear Differential Operator \(\mathcal{O}(D^2) \text{ / Crash} \to \mathcal{O}(1)\)

  • Time Complexity: \(\mathcal{O}(D^2)\) polynomial extraction \(\to\) \(\mathcal{O}(1)\) partial derivatives \(\partial_x, \partial_y\) + cross-product determinants.
  • Space Complexity: \(\mathcal{O}(D) \to \mathcal{O}(1)\).
  • Optimization: Evaluates \(a = \frac{\partial L}{\partial x}, b = \frac{\partial L}{\partial y}\) on residual \(L(x,y)\), eliminating division-by-zero crashes on RHS equations and classifying parameter branches in 156.1 ms.

Exam question example:

2021 VCAA Exam 2 Section B Question 1b 3 marks

Solve the linear system for all parameter cases of $k$:

\[ kx + 3y = k^2, \quad 2x + (2k+1)y = 6 - 2k \]

CAS Output:

1.1 *Doc1
mm_func\linesolve$\left(kx + 3y = k^2, 2x + (2k+1)y = 6 - 2k\right)$

$\det(A) = 2k^2 + k - 6 = 0 \implies k \in \{-2, 3/2\}$
$$\text{Unique: } k \ne -2 \text{ and } k \ne 3/2 \quad\Big|\quad \text{None: } k = -2 \quad\Big|\quad \text{Infinite: } k = 3/2$$
Done