eQuate It — VCE Maths Methods 3&4 CAS UDF Pack (TI-Nspire CAS) https://equateit.com.au/vce-cas-calculator-programs/ ================================================================ eQuate It CAS UDFs — Calculus (TI-Nspire CAS) =============================================== 1. avgroc(f, x, lo, hi) — Average rate of change ------------------------------------------------------- Define avgroc(f, x, lo, hi) = Prgm Local result result := (f | x = hi) - (f | x = lo)) / (hi - lo) Disp "Average ROC on [", lo, ",", hi, "]: ", result EndPrgm 2. avgval(f, x, lo, hi) — Average value of a function ------------------------------------------------------- Define avgval(f, x, lo, hi) = Prgm Local result result := (1/(hi - lo)) * ∫(f, x, lo, hi) Disp "Average value on [", lo, ",", hi, "]: ", result EndPrgm 3. boundarea(f1, f2, x) — Area between two curves ------------------------------------------------------- Define boundarea(f1, f2, x) = Prgm Local pts, area, i, lo, hi pts := solve(f1 = f2, x) area := 0 Disp "Intersection points: ", pts If dim(pts) >= 2 Then For i, 1, dim(pts) - 1 lo := pts[i] hi := pts[i + 1] area := area + abs(∫(f1 - f2, x, lo, hi)) EndFor EndIf Disp "Total bound area: ", area EndPrgm 4. boundaread(f1, f2, x, lo, hi) — Area between curves in domain ------------------------------------------------------- Define boundaread(f1, f2, x, lo, hi) = Prgm Local area area := abs(∫(f1 - f2, x, lo, hi)) Disp "Bound area on [", lo, ",", hi, "]: ", area EndPrgm 5. intguess — Integral multiple choice solver ------------------------------------------------------- (Case 1: One integral given, find transformed integral) Define intguess(known, trans, target) = Prgm Local l1, u1, v1, l2, u2, result l1 := known[1] u1 := known[2] v1 := known[3] l2 := target[1] u2 := target[2] Disp "Known: integral from ", l1, " to ", u1, " = ", v1 Disp "Transformations: ", trans Disp "Target: integral from ", l2, " to ", u2 Disp "Use substitution and transformation rules" Disp "to determine the target integral value." EndPrgm 6. newtons(f, x, x0, n) — Newton's method ------------------------------------------------------- Define newtons(f, x, x0, n) = Prgm Local xi, i, fp xi := x0 fp := d(f, x) For i, 1, n xi := xi - (f | x = xi) / (fp | x = xi) Disp "Iteration ", i, ": x = ", approx(xi) EndFor Disp "Root approx: ", approx(xi) EndPrgm 7. nroot(poly, x, k, n) — Parameter values for n roots ------------------------------------------------------- Define nroot(poly, x, k, n) = Prgm Local disc, result Disp "Finding k for ", n, " roots" disc := discrim(poly, x) If n = 2 Then result := solve(disc > 0, k) ElseIf n = 1 Then result := solve(disc = 0, k) ElseIf n = 0 Then result := solve(disc < 0, k) EndIf Disp "k values: ", result EndPrgm 8. nstp(poly, x, k, n) — Parameter values for n stationary points ------------------------------------------------------- Define nstp(poly, x, k, n) = Prgm Local fp, disc, result fp := d(poly, x) Disp "f'(x) = ", fp disc := discrim(fp, x) If n = 2 Then result := solve(disc > 0, k) ElseIf n = 1 Then result := solve(disc = 0, k) ElseIf n = 0 Then result := solve(disc < 0, k) EndIf Disp "k for ", n, " stationary points: ", result EndPrgm 9. npoi(poly, x, k, n) — Parameter values for n points of inflection ------------------------------------------------------- Define npoi(poly, x, k, n) = Prgm Local fpp, disc, result fpp := d(d(poly, x), x) Disp "f''(x) = ", fpp disc := discrim(fpp, x) If n = 2 Then result := solve(disc > 0, k) ElseIf n = 1 Then result := solve(disc = 0, k) ElseIf n = 0 Then result := solve(disc < 0, k) EndIf Disp "k for ", n, " POI: ", result EndPrgm 10. pois(f, x) — Points of inflection ------------------------------------------------------- Define pois(f, x) = Prgm Local fpp, xvals, i, y fpp := d(d(f, x), x) xvals := solve(fpp = 0, x) Disp "f''(x) = ", fpp Disp "Points of inflection:" For i, 1, dim(xvals) y := f | x = xvals[i] Disp "(", xvals[i], ", ", y, ")" EndFor EndPrgm 11. signtab(f, x) — Sign table for stationary points ------------------------------------------------------- Define signtab(f, x) = Prgm Local fp, xvals, i, left, right, nature fp := d(f, x) xvals := solve(fp = 0, x) Disp "f'(x) = ", fp Disp "Stationary points at x = ", xvals For i, 1, dim(xvals) left := sign(fp | x = xvals[i] - 0.001) right := sign(fp | x = xvals[i] + 0.001) If left > 0 and right < 0 Then nature := "Local maximum" ElseIf left < 0 and right > 0 Then nature := "Local minimum" Else nature := "Stationary point of inflection" EndIf Disp "x = ", xvals[i], ": ", nature EndFor EndPrgm 12. stps(f, x) — Stationary points ------------------------------------------------------- Define stps(f, x) = Prgm Local fp, xvals, i, y fp := d(f, x) xvals := solve(fp = 0, x) Disp "f'(x) = ", fp Disp "Stationary points:" For i, 1, dim(xvals) y := f | x = xvals[i] Disp "(", xvals[i], ", ", y, ")" EndFor EndPrgm 13. tangsolve(f, x, x0, y0) — Tangent lines through a point ------------------------------------------------------- Define tangsolve(f, x, x0, y0) = Prgm Local fp, m, tang, eq, tvals fp := d(f, x) Disp "Finding tangent lines to f through (", x0, ",", y0, ")" tvals := solve(y0 - (f | x = t) = (fp | x = t) * (x0 - t), t) Disp "Tangent points at x = ", tvals For i, 1, dim(tvals) m := fp | x = tvals[i] tang := m * (x - tvals[i]) + (f | x = tvals[i]) Disp "y = ", tang EndFor EndPrgm 14. trapapprox(f, x, lo, hi, n) — Trapezoidal approximation ------------------------------------------------------- Define trapapprox(f, x, lo, hi, n) = Prgm Local h, s, i, xi h := (hi - lo)/n s := (f | x = lo) + (f | x = hi) For i, 1, n - 1 xi := lo + i*h s := s + 2*(f | x = xi) EndFor s := (h/2)*s Disp "h = ", h Disp "Trapezoid approx (", n, " strips): ", approx(s) Disp "Exact integral: ", approx(∫(f, x, lo, hi)) EndPrgm eQuate It CAS UDFs — Continuous Probability (TI-Nspire CAS) ============================================================= 1. ccondpr — Continuous conditional probability ------------------------------------------------------- (PDF version) Define ccondpr(pdf, lo, hi) = Prgm Local pA, pAB Disp "P(lo < X < hi | condition)" pAB := ∫(pdf, x, lo, hi) Disp "P(A ∩ B) = ", pAB EndPrgm (Normal distribution version) Define ccondpr(dummy, mu, sigma, c1, c2) = Prgm Local pC1, pC2, pBoth, result pC2 := normCdf(-∞, c2, mu, sigma) pC1 := normCdf(-∞, c1, mu, sigma) pBoth := normCdf(c1, c2, mu, sigma) If c1 < c2 Then result := pBoth / pC2 Else result := pBoth / pC1 EndIf Disp "P(condition1 | condition2) = ", approx(result) EndPrgm 2. confint(n, phat, conf) — Confidence interval ------------------------------------------------------- Define confint(n, phat, conf) = Prgm Local z, se, me, lo, hi z := invNorm((1 + conf)/2, 0, 1) se := sqrt(phat*(1 - phat)/n) me := z * se lo := phat - me hi := phat + me Disp "z-score: ", approx(z) Disp "Std error: ", approx(se) Disp "Margin of error: ", approx(me) Disp "CI: (", approx(lo), ", ", approx(hi), ")" EndPrgm 3. confintsolve(lo, hi, unknown) — Solve for CI parameter ------------------------------------------------------- Define confintsolve(lo, hi, unknown) = Prgm Local phat, me, z, se, n, conf phat := (lo + hi)/2 me := (hi - lo)/2 Disp "p-hat: ", approx(phat) Disp "Margin of error: ", approx(me) If string(unknown) = "n" Then Disp "Solving for sample size..." se := me / invNorm(0.975, 0, 1) n := ceiling(phat*(1 - phat)/se^2) Disp "n = ", n ElseIf string(unknown) = "conf" Then Disp "Solving for confidence level..." Else Disp "Unknown parameter: provide n, se, or conf" EndIf EndPrgm 4. continfo(f, x, lo, hi) — Continuous distribution information ------------------------------------------------------- Define continfo(f, x, lo, hi) = Prgm Local ev, var, sd ev := ∫(x*f, x, lo, hi) var := ∫(x^2*f, x, lo, hi) - ev^2 sd := sqrt(var) Disp "E(X) = ", approx(ev) Disp "Var(X) = ", approx(var) Disp "SD(X) = ", approx(sd) Disp "Verification ∫f = ", approx(∫(f, x, lo, hi)) EndPrgm 5. invnormvals(mu, sigma, p) — Inverse normal (left, right, centre) ------------------------------------------------------- Define invnormvals(mu, sigma, p) = Prgm Local left, right, clo, chi left := invNorm(p, mu, sigma) right := invNorm(1 - p, mu, sigma) clo := invNorm((1 - p)/2, mu, sigma) chi := invNorm((1 + p)/2, mu, sigma) Disp "P(X < a) = ", p Disp " Left: a = ", approx(left) Disp "P(X > a) = ", p Disp " Right: a = ", approx(right) Disp "P(lo < X < hi) = ", p Disp " Centre: (", approx(clo), ", ", approx(chi), ")" EndPrgm 6. normsolve — Solve for mu and sigma ------------------------------------------------------- (Case 1: Both lower and upper given) Define normsolve(lo, plo, hi, phi) = Prgm Local mu, sigma, result result := solve(normCdf(-∞, lo, mu, sigma) = plo and normCdf(-∞, hi, mu, sigma) = phi, {mu, sigma}) Disp "mu = ", result[1] Disp "sigma = ", result[2] EndPrgm eQuate It CAS UDFs — Discrete Probability (TI-Nspire CAS) ============================================================ 1. binomsolve(k, p, threshold) — Trials for target probability ------------------------------------------------------- Define binomsolve(k, p, threshold) = Prgm Local n, prob n := k While true prob := binomCdf(n, p, k, n) If prob >= threshold Then Disp "n = ", n Disp "P(X >= ", k, ") = ", approx(prob) Return n EndIf n := n + 1 If n > 10000 Then Disp "No solution found within 10000 trials" Return -1 EndIf EndWhile EndPrgm 2. dcondpr — Discrete conditional probability ------------------------------------------------------- (Binomial version) Define dcondpr(n, p, c1, c2) = Prgm Local pC1, pC2, pBoth, result Disp "P(C1 | C2) for Binomial(", n, ",", p, ")" pC2 := binomCdf(n, p, 0, c2) pBoth := binomCdf(n, p, 0, min(c1, c2)) result := pBoth / pC2 Disp "Result = ", approx(result) EndPrgm 3. binominfo(n, p) — Binomial distribution information ------------------------------------------------------- Define binominfo(n, p) = Prgm Local ev, var, sd, sev, ssd ev := n * p var := n * p * (1 - p) sd := sqrt(var) sev := p ssd := sqrt(p * (1 - p) / n) Disp "E(X) = ", ev Disp "Var(X) = ", var Disp "SD(X) = ", approx(sd) Disp "Sample E(p-hat) = ", sev Disp "Sample SD(p-hat) = ", approx(ssd) EndPrgm 4. hypergeocdf(n, N, K, lo, hi) — Hypergeometric CDF ------------------------------------------------------- Define hypergeocdf(n, bigN, bigK, lo, hi) = Prgm Local prob, i, p prob := 0 For i, lo, hi p := nCr(bigK, i) * nCr(bigN - bigK, n - i) / nCr(bigN, n) prob := prob + p EndFor Disp "P(", lo, " <= X <= ", hi, ") = ", approx(prob) EndPrgm 5. hypergeopdf(n, N, K, k) — Hypergeometric PMF ------------------------------------------------------- Define hypergeopdf(n, bigN, bigK, k) = Prgm Local prob prob := nCr(bigK, k) * nCr(bigN - bigK, n - k) / nCr(bigN, n) Disp "P(X = ", k, ") = ", approx(prob) EndPrgm 6. invbinomial(n, p, prob) — Inverse binomial ------------------------------------------------------- Define invbinomial(n, p, prob) = Prgm Local k, cumprob k := 0 cumprob := 0 While cumprob < prob cumprob := cumprob + binomPdf(n, p, k) If cumprob >= prob Then Disp "k = ", k Disp "P(X <= ", k, ") = ", approx(cumprob) Return k EndIf k := k + 1 EndWhile EndPrgm 7. prtable(outcomes, probs) — Probability table statistics ------------------------------------------------------- Define prtable(outcomes, probs) = Prgm Local ev, ex2, var, sd, i ev := 0 ex2 := 0 For i, 1, dim(outcomes) ev := ev + outcomes[i] * probs[i] ex2 := ex2 + outcomes[i]^2 * probs[i] EndFor var := ex2 - ev^2 sd := sqrt(var) Disp "E(X) = ", ev Disp "E(X^2) = ", ex2 Disp "Var(X) = ", var Disp "SD(X) = ", approx(sd) EndPrgm 8. samplebinom(n, p) — Sample distribution for binomial ------------------------------------------------------- Define samplebinom(n, p) = Prgm Local ev, sd ev := p sd := sqrt(p * (1 - p) / n) Disp "Sample proportion distribution:" Disp "E(p-hat) = ", ev Disp "SD(p-hat) = ", approx(sd) Disp "Approx Normal(", ev, ", ", approx(sd^2), ")" EndPrgm 9. samplebinompr(n, p, lo, hi) — Sample binomial probability ------------------------------------------------------- Define samplebinompr(n, p, lo, hi) = Prgm Local sd, result sd := sqrt(p * (1 - p) / n) result := normCdf(lo, hi, p, sd) Disp "P(", lo, " < p-hat < ", hi, ") = ", approx(result) EndPrgm 10. samplehypergeo(n, N, K) — Sample hypergeometric distribution ------------------------------------------------------- Define samplehypergeo(n, bigN, bigK) = Prgm Local p, ev, var, sd p := bigK / bigN ev := p var := (p * (1 - p) / n) * ((bigN - n) / (bigN - 1)) sd := sqrt(var) Disp "p = K/N = ", approx(p) Disp "E(p-hat) = ", approx(ev) Disp "Var(p-hat) = ", approx(var) Disp "SD(p-hat) = ", approx(sd) EndPrgm 11. samplehyppr(n, N, K, lo, hi) — Sample hypergeometric probability ------------------------------------------------------- Define samplehyppr(n, bigN, bigK, lo, hi) = Prgm Local p, sd, fpc, result p := bigK / bigN fpc := sqrt((bigN - n) / (bigN - 1)) sd := sqrt(p * (1 - p) / n) * fpc result := normCdf(lo, hi, p, sd) Disp "P(", lo, " < p-hat < ", hi, ") = ", approx(result) EndPrgm eQuate It CAS UDFs — Functions (TI-Nspire CAS) ================================================ 1. asymp(f, x) — Vertical and horizontal asymptotes ------------------------------------------------------- Define asymp(f, x) = Prgm Local va, ha, denom_expr, num_expr, lp, ln va := {} ha := {} denom_expr := getDenom(f) If denom_expr ≠ 1 Then va := solve(denom_expr = 0, x) EndIf lp := limit(f, x, ∞) ln := limit(f, x, -∞) If lp ≠ ∞ and lp ≠ -∞ and lp ≠ undef Then ha := augment(ha, {lp}) EndIf If ln ≠ ∞ and ln ≠ -∞ and ln ≠ undef and ln ≠ lp Then ha := augment(ha, {ln}) EndIf Disp "Vertical: ", va Disp "Horizontal: ", ha EndPrgm 2. ccheck(f, g) — Composite function check ------------------------------------------------------- Define ccheck(f, g) = Prgm Local dom_f, ran_g, result Disp "f(g(x)) composite check" result := f(g(x)) If result ≠ undef Then Disp "Composite exists: ", result Else Disp "Composite does not exist over full domain" Disp "Restrict domain of g so range(g) ⊆ domain(f)" EndIf EndPrgm 3. discrim(expr, x, dp) — Discriminant of a quadratic ------------------------------------------------------- Define discrim(expr, x, dp) = Prgm Local a, b, c, d a := polyCoeffs(expr, x)[1] b := polyCoeffs(expr, x)[2] c := polyCoeffs(expr, x)[3] d := b^2 - 4*a*c Disp "a = ", a Disp "b = ", b Disp "c = ", c Disp "Discriminant = ", round(d, dp) If d > 0 Then Disp "Two distinct real roots" ElseIf d = 0 Then Disp "One repeated real root" Else Disp "No real roots" EndIf EndPrgm 4. domrang(f, x) — Domain and range ------------------------------------------------------- Define domrang(f, x) = Prgm Local dom, ran dom := domain(f, x) ran := range(f, x) Disp "Domain: ", dom Disp "Range: ", ran EndPrgm 5. intercepts(f, x) — X and Y intercepts ------------------------------------------------------- Define intercepts(f, x) = Prgm Local xi, yi xi := solve(f = 0, x) yi := f | x = 0 Disp "x-intercepts: ", xi Disp "y-intercept: ", yi EndPrgm 6. intersects(f1, f2, x) — Points of intersection ------------------------------------------------------- Define intersects(f1, f2, x) = Prgm Local pts, xvals, i xvals := solve(f1 = f2, x) Disp "Intersection x-values: ", xvals Disp "Points:" For i, 1, dim(xvals) Disp "(", xvals[i], ", ", f1 | x = xvals[i], ")" EndFor EndPrgm 7. intersectsd(f1, f2, x, lo, hi) — Intersections in restricted domain ------------------------------------------------------- Define intersectsd(f1, f2, x, lo, hi) = Prgm Local xvals xvals := solve(f1 = f2, x) | lo ≤ x ≤ hi Disp "Intersections in [", lo, ",", hi, "]:" Disp xvals EndPrgm 8. inverse(f, x, x0) — Inverse function ------------------------------------------------------- Define inverse(f, x, x0) = Prgm Local y, inv_expr inv_expr := solve(y = f, x) Disp "Inverse: x = ", inv_expr If x0 ≠ undef Then Disp "At x =", x0, ": ", inv_expr | y = x0 EndIf EndPrgm 9. invints(f, n) — Inverse intersections with parameter k ------------------------------------------------------- Define invints(f, n) = Prgm Local inv_f, eq, result Disp "Finding k for ", n, " intersections with inverse" inv_f := solve(y = f, x) eq := solve(f = inv_f, x) Disp "Solve for parameter to get ", n, " solutions" Disp eq EndPrgm 10. lineang(l1, l2, x) — Angle between two lines ------------------------------------------------------- Define lineang(l1, l2, x) = Prgm Local m1, m2, theta m1 := d(l1, x) m2 := d(l2, x) theta := arctan(abs((m1 - m2)/(1 + m1*m2))) Disp "Gradient 1: ", m1 Disp "Gradient 2: ", m2 Disp "Angle (rad): ", theta Disp "Angle (exact): ", theta EndPrgm 11. linesolve(eq1, eq2) — Unique/None/Infinite solutions ------------------------------------------------------- Define linesolve(eq1, eq2) = Prgm Local result result := solve(eq1 and eq2, {x, y}) If dim(result) = 0 Then Disp "No solution (inconsistent)" ElseIf string(result) contains "=" Then Disp "Unique solution: ", result Else Disp "Infinitely many solutions" Disp result EndIf EndPrgm 12. pcheck(f, x, lhs, rhs) — Property check ------------------------------------------------------- Define pcheck(f, x, lhs, rhs) = Prgm Local test test := expand(lhs - rhs) If test = 0 Then Disp "Property satisfied: TRUE" Else Disp "Property NOT satisfied" Disp "LHS - RHS = ", test EndIf EndPrgm 13. pointinfo(x1, y1, x2, y2) — Complete line information ------------------------------------------------------- Define pointinfo(x1, y1, x2, y2) = Prgm Local m, mp, eq, xi, yi, mid, dist m := (y2 - y1)/(x2 - x1) mp := -1/m eq := m*(x - x1) + y1 xi := solve(eq = 0, x) yi := eq | x = 0 mid := {(x1 + x2)/2, (y1 + y2)/2} dist := sqrt((x2 - x1)^2 + (y2 - y1)^2) Disp "Gradient: ", m Disp "Perp gradient: ", mp Disp "Equation: y = ", eq Disp "x-intercept: ", xi Disp "y-intercept: ", yi Disp "Midpoint: ", mid Disp "Distance: ", dist EndPrgm 14. polyfit(pts) — Polynomial through points ------------------------------------------------------- Define polyfit(pts) = Prgm Local n, i, xv, yv, coeffs, poly, vars n := dim(pts)/2 xv := seq(pts[2*i - 1], i, 1, n) yv := seq(pts[2*i], i, 1, n) coeffs := seq(a[i], i, 0, n - 1) poly := sum(seq(coeffs[i + 1]*x^i, i, 0, n - 1)) vars := seq(a[i], i, 0, n - 1) result := solve(seq(poly | x = xv[i]) = yv[i], i, 1, n), vars) Disp "Polynomial: ", poly | result EndPrgm 15. transform(f, trans) — Apply transformations ------------------------------------------------------- Define transform(f, trans) = Prgm Local result, i, t result := f For i, 1, dim(trans) t := trans[i] result := result | x = t EndFor Disp "Transformed: ", result EndPrgm 16. transolve(orig, image, x) — Find transformations ------------------------------------------------------- Define transolve(orig, image, x) = Prgm Local a, b, c, d, result Disp "Finding transformations: original -> image" result := solve(a*orig(b*x + c) + d = image, {a, b, c, d}) Disp "Transformations: ", result EndPrgm 17. bisec(f, x, lo, hi, n) — Bisection method ------------------------------------------------------- Define bisec(f, x, lo, hi, n) = Prgm Local a, b, mid, i, fa, fb, fm a := lo b := hi For i, 1, n mid := (a + b)/2 fa := f | x = a fm := f | x = mid If fa * fm < 0 Then b := mid Else a := mid EndIf Disp "Iteration ", i, ": x = ", approx(mid) EndFor Disp "Root approx: ", approx((a + b)/2) EndPrgm eQuate It CAS UDFs — Miscellaneous (TI-Nspire CAS) ===================================================== 1. ca(ans, vars) — Column augment to matrix form ------------------------------------------------------- Define ca(ans, vars) = Prgm Local n, i, row, mat n := dim(vars) Disp "Converting to matrix form:" mat := newMat(dim(ans), n) For i, 1, dim(ans) For j, 1, n mat[i, j] := ans[i] | vars[j] EndFor EndFor Disp mat EndPrgm 2. dsolve(eq, x, lo, hi) — Solve equation in restricted domain ------------------------------------------------------- Define dsolve(eq, x, lo, hi) = Prgm Local result result := solve(eq, x) | lo <= x and x <= hi Disp "Solutions in [", lo, ",", hi, "]:" Disp result EndPrgm 3. graphinfo — Complete graph information ------------------------------------------------------- (Maximal domain) Define graphinfo(f, x, lo, hi) = Prgm Local fp, fpp, xi, yi, stp, poi, ep fp := d(f, x) fpp := d(fp, x) xi := solve(f = 0, x) yi := f | x = 0 stp := solve(fp = 0, x) poi := solve(fpp = 0, x) Disp "x-intercepts: ", xi Disp "y-intercept: ", yi Disp "Stationary points at x = ", stp For i, 1, dim(stp) Disp " (", stp[i], ", ", f | x = stp[i], ")" EndFor Disp "POI at x = ", poi For i, 1, dim(poi) Disp " (", poi[i], ", ", f | x = poi[i], ")" EndFor If lo ≠ " " Then Disp "Endpoints:" Disp " (", lo, ", ", f | x = lo, ")" Disp " (", hi, ", ", f | x = hi, ")" EndIf EndPrgm 4. trigsolve(eq, x, lo, hi) — Exact trig equation solver ------------------------------------------------------- Define trigsolve(eq, x, lo, hi) = Prgm Local result, approx_result, exact, i result := solve(eq, x) | lo <= x and x <= hi Disp "Solutions in [", lo, ",", hi, "]:" Disp result EndPrgm 5. triginfo(f, x, lo, hi) — Trigonometric function information ------------------------------------------------------- Define triginfo(f, x, lo, hi) = Prgm Local fp, maxv, minv, amp, period, mid, xi, yi, stp, asym fp := d(f, x) Disp "Analysing trig function on [", lo, ",", hi, "]" maxv := fMax(f, x) | lo <= x <= hi minv := fMin(f, x) | lo <= x <= hi amp := (maxv - minv) / 2 mid := (maxv + minv) / 2 xi := solve(f = 0, x) | lo <= x <= hi yi := f | x = 0 stp := solve(fp = 0, x) | lo <= x <= hi Disp "Amplitude: ", amp Disp "Middle value: ", mid Disp "Max: ", maxv, " Min: ", minv Disp "x-intercepts: ", xi Disp "y-intercept: ", yi Disp "Turning points at x = ", stp Disp "Endpoints:" Disp " (", lo, ", ", f | x = lo, ")" Disp " (", hi, ", ", f | x = hi, ")" EndPrgm