use Math::Calculus::NewtonRaphson; use strict; use warnings; my $exp = Math::Calculus::NewtonRaphson->new(); $exp->addVariable('x'); # our variable in the equations $exp->setExpression('x+3*x-x^2'); if( $exp->getError() ){ print "got error, ".$exp->getError()."\n"; exit(1) } my $result = $exp->newtonRaphson('x', 0); print "result: ".$result."\n";