Math::Symbolic::Custom::Equation
================================
This class implements methods for equating two Math::Symbolic expressions, and performing various operations on that equation.
Please note that the methods/interfaces documented below are subject to change in later versions.
use strict;
use Math::Symbolic qw(:all);
use Math::Symbolic::Custom::Equation;
# we have two symbolic expressions
my $expr1 = parse_from_string('a - n');
my $expr2 = parse_from_string('(a + 2) / n');
# equate them
my $eq = Math::Symbolic::Custom::Equation->new($expr1, $expr2);
print $eq->to_string(), "\n"; # a - n = (a + 2) / n
# We want an expression for a
my ($a_eq, $type) = $eq->isolate('a');
unless ( defined($a_eq) && ($type == 1) ) {
die "Could not isolate 'a'!\n";
}
print $a_eq->to_string(), "\n"; # a = (2 + (n ^ 2)) / (n - 1)
# we want values of a for various values of n
my $expr3 = $a_eq->RHS();
foreach my $n (2..5) {
my $a_val = $expr3->value({'n' => $n});
# check these values on original equation
if ( $eq->holds({'a' => $a_val, 'n' => $n}) ) {
print "At n = $n, a = $a_val\n";
}
else {
print "Error for n = $n, a = $a_val\n";
}
}
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make install
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.
perldoc Math::Symbolic::Custom::Equation
You can also look for information at:
RT, CPAN's request tracker (report bugs here)
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
This software is copyright (c) 2025 by Matt Johnson.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.