Math::...lculus(3pm)
π Math::Symbolic::MiscCalculus π
okay so bestie, welcome to the Math::...lculus(3pm) page (yes the title is literally cut off mid-word, the filename said "too long", we don't gatekeep, we move on π
). This is the documentation for the module Math::Symbolic::MiscCalculus, and it's genuinely one of my faves because it's calculus but make it vibes. Let's go π¦
β¨ NAME β¨
Math::Symbolic::MiscCalculus β Miscellaneous calculus routines (eg Taylor poly). that's it. that's the whole name. iconic brevity π
πΈ SYNOPSIS πΈ
here's the whole vibe in code form, no notes:
use Math::Symbolic qw/:all/;
use Math::Symbolic::MiscCalculus qw/:all/; # not loaded by Math::Symbolic
$taylor_poly = TaylorPolynomial $function, $degree, $variable;
# or:
$taylor_poly = TaylorPolynomial $function, $degree, $variable, $pos;
$lagrange_error = TaylorErrorLagrange $function, $degree, $variable;
# or:
$lagrange_error = TaylorErrorLagrange $function, $degree, $variable, $pos;
# or:
$lagrange_error = TaylorErrorLagrange $function, $degree, $variable, $pos,
$name_for_range_variable;
# This has the same syntax variations as the Lagrange error:
$cauchy_error = TaylorErrorLagrange $function, $degree, $variable;
heads up babes π β that last line in the original synopsis literally saysTaylorErrorLagrange, notTaylorErrorCauchy. I am simply the messenger, not the editor. I keep it exactly as written, no cap. π«Ά
also the plot twist: Math::Symbolic::MiscCalculus is not loaded by Math::Symbolic itself, so you gotta use it separate, bestie.
π DESCRIPTION π
This module hands you a little collection of subroutines that do calculus-adjacent things β specifically computing Taylor polynomials and the errors associated with them, all built out of Math::Symbolic trees. the way it just does that for you?? obsessed π
Please note (and I'm just relaying this, don't come for me): the code in here may or may not be refactored into the OO-interface of the Math::Symbolic module at some point in the future. so like, enjoy it while it's in this shape π
π EXPORT π
None by default. as in, you get nothing for free, you have to ask β very demure, very mindful.
You may choose to have any of these routines exported into your calling namespace. The :all tag exports every single one of the following:
TaylorPolynomial
TaylorErrorLagrange
TaylorErrorCauchy
so go ahead and manifest them into your namespace π«
π SUBROUTINES π
π TaylorPolynomial
This function (symbolically) computes the n-th-degree Taylor Polynomial of a given function. Broadly speaking: the Taylor Polynomial is an n-th degree polynomial that approximates the original function, and it does that approximation especially well in the neighbourhood of a particular point x0. (And since the author says their mathematical English jargon is lacking, they strongly suggest you read up on what this actually is in a book. realest disclaimer ever honestly π)
Mathematically speaking, the Taylor Polynomial of the function f(x) looks exactly like this:
Tn(f, x, x0) =
sum_from_k=0_to_n(
n-th_total_derivative(f)(x0) / k! * (x-x0)^k
)
Now the arguments, one by one, because order matters and we don't do chaos here:
- first argument β the function to approximate. It can be a string to be parsed, or a valid
Math::Symbolictree. either one, your choice, slay. - second argument β an integer saying which degree to approximate to.
- third argument β the last required one. It's the variable to use for the approximation, given either as a string (name) or as a
Math::Symbolic::Variableobject. That's the'x'up in the formula. π - fourth argument β optional! It's the name of the variable to introduce as the point of approximation. Can also be a variable object. That's the
'x0'. If you don't specify it, this variable's name is assumed to be the function variable's name (the'x') with'_0'appended. cute, automatic, self-sufficient β¨
β οΈ also important: this routine is for functions of one variable only. if you need two variables, there's an equivalent in the Math::Symbolic::VectorCalculus package. go get her π
π¦ TaylorErrorLagrange
TaylorErrorLagrange computes and returns the formula for the Taylor Polynomial's approximation error after Lagrange. (Again β the author's English terminology is lacking, their words, not mine.) It looks similar to this:
Rn(f, x, x0) =
n+1-th_total_derivative(f)( x0 + theta * (x-x0) ) / (n+1)! * (x-x0)^(n+1)
Please refer to your favourite book on the topic π also: 'theta' may be any number between 0 and 1.
The calling conventions for TaylorErrorLagrange are similar to those of TaylorPolynomial, with one glow-up: TaylorErrorLagrange takes an extra optional argument specifying the name of 'theta'. If it isn't specified explicitly, the variable will just be named 'theta', exactly like in the formula above. default behaviour ate, no notes π
πΈ TaylorErrorCauchy
TaylorErrorCauchy computes and returns the formula for the Taylor Polynomial's approximation error after (guess who!) Cauchy. (And yes β again, the author's English terminology is lacking. we love a recurring bit π) It looks similar to this:
Rn(f, x, x0) = TaylorErrorLagrange(...) * (1 - theta)^n
Please refer to your favourite book on the topic, plus the documentation for TaylorErrorLagrange. 'theta' may be any number between 0 and 1.
The calling conventions for TaylorErrorCauchy are identical to those of TaylorErrorLagrange. twin behaviour, matching energy, periodt. π«Ά
π AUTHOR π
Please send feedback, bug reports, and support requests to the Math::Symbolic support mailing list: math-symbolic-support at lists dot sourceforge dot net. Also β and this is so sweet β please consider letting them know how you use Math::Symbolic. Thank you!! π₯Ί
If you're interested in helping with development or extending the module's functionality, hit up the developers' mailing list: math-symbolic-develop at lists dot sourceforge dot net. come join the group chat bestie π¬
List of contributors:
Steffen MΓΌller, symbolic-module at steffen-mueller dot net
Stray Toaster, mwk at users dot sourceforge dot net
Oliver EbenhΓΆh
the way three whole icons carried this module on their backs ππ
π SEE ALSO π
New versions of this module can be found at http://steffen-mueller.net or on CPAN. Module development happens on Sourceforge at http://sourceforge.net/projects/math-symbolic/ β go lurk, go contribute, go be the main character π
Math::Symbolic(the moment you need it, it's right there)
and that's the whole page, bestie!! no crumbs left, every flag and formula preserved exactly as the universe intended πβ¨
little sign-off before you go: this has beenperl v5.40.0, dated2024-09-16π π«Ά bye babes, go approximate something responsibly!! ππ¦πΈ
π¦ where this page comes from
- ubuntu resolute: libmath-symbolic-perl 0.613-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmath-symbolic-perl 0.613-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms