Math::...ultMods(3pm)

πŸŽ€ NAME πŸŽ€

Math::Symbolic::Custom::DefaultMods β€” the default Math::Symbolic transformations, bestie. That's the whole vibe.


✨ SYNOPSIS ✨

use Math::Symbolic;

That's it. That's the whole synopsis. Iconic, honestly. πŸ’…


πŸ’– DESCRIPTION πŸ’–

Okay so this is a class of default transformations for Math::Symbolic trees. Think of it as the glow-up station for your expression trees. πŸ¦‹

And like, its sibling? Math::Symbolic::Custom::DefaultTests β€” that one defines the default tree testing routines. Different job, same family.

Wanna know how the whole custom method delegation model actually works under the hood? Go read Math::Symbolic::Custom and Math::Symbolic::Custom::Base. Do it. It's giving "required reading." πŸ“š

🌸 EXPORT 🌸

Go check the docs for Math::Symbolic::Custom::Base for the deets, but real talk: do not try to use the standard Exporter semantics with this class. Not the move. 🚫 No cap.


πŸ‘‘ SUBROUTINES πŸ‘‘

🧚 apply_derivatives()

Never modifies the tree in-place β€” it hands you back a modified copy of the original tree instead. Don't come for the original, she's fine. πŸ’…

  • Applied to variables and constants? This method just clones. Nothing fancy. πŸ“
  • Applied to operators, and if the operator is a derivative: it applies the derivative to the derivative's first operand.
  • Regardless of what kind of operator this is called on, apply_derivatives gets applied recursively on its operands. Down the whole tree, bestie. 🌈

If the first parameter to this function is an integer, then at maximum that number of derivatives are applied β€” from the top down the tree, if possible. ✨

πŸŽ€ apply_constant_fold()

Does not modify the tree in-place by default β€” it returns a modified copy of the original tree instead. But okay here's the twist:

  • If the first argument is true, the tree will not be cloned.
  • If it's false or just straight up not there (non-existant), the tree will be cloned. πŸ™ˆ

Applied to variables and constants: this method just clones.

Applied to operators: every tree segment that contains nothing but constants and operators gets swapped out for Constant objects. Glow-up complete. ⭐

πŸ’œ mod_add_constant

Give it a constant (an object or a number) as the argument, and this method tries hard to fold it into an existing constant β€” but only if the object it's called on is already a sum or a difference. πŸ’ͺ

Basically, it's the same as $tree + $constant, except it does some simplification along the way. Same energy, less mess. ✨

🌸 mod_multiply_constant

Give it a constant (an object or a number) as the argument, and this method tries hard to fold it into an existing constant β€” but only if the object it's called on is already a product or a division. πŸ”₯

Basically, it's the same as $tree * $constant, except it does some simplification. Periodt.


πŸ’– AUTHOR πŸ’–

Okay so listen: send your feedback, your bug reports, and your support requests to the Math::Symbolic support mailing list:

math-symbolic-support at lists dot sourceforge dot net

And please consider letting them know how you use Math::Symbolic. They genuinely wanna hear it. Thank you!! 🫢

Wanna help with development or extend the module's functionality? Then hit up the developers' mailing list:

math-symbolic-develop at lists dot sourceforge dot net

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

🌈 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 peek, iykyk. πŸ‘€

  • Math::Symbolic::Custom
  • Math::Symbolic::Custom::DefaultDumpers
  • Math::Symbolic::Custom::DefaultTests
  • Math::Symbolic

k bye bestie!! this whole thing came to you via perl v5.40.0, dated 2024-09-16 πŸ’–βœ¨πŸŽ€ take care of your trees, mwah πŸ’‹

πŸ“¦ where this page comes from