Math::Approx::Symbolic - Symbolic representation of interpolated polynomials


  use Math::Approx::Symbolic;
  # ... use as you would use Math::Approx ...
  my $symbolic = $approximation->symbolic();
  # ... $symbolic is now a Math::Symbolic object.


This module is a thin wrapper around the Math::Approx module. It subclasses Math::Approx and adds the "symbolic" subroutine that returns a Math::Symbolic object representing the calculated approximation.


None. Ever.

symbolic() method

This is the only method added to the ones from Math::Approx. It takes an optional argument indicating the variable name to use for the symbolic representation of the approximation polynomial.

It returns a Math::Symbolic object representing the approximation polynomial.


  use Math::Approx::Symbolic;
  sub poly {
      my($n,$x) = @_;
      return $x ** $n;
  my %x;
  for (1..20) {
      $x{$_} = sin($_/10) * cos($_/30) + 0.3*rand;
  my $approx = new Math::Approx::Symbolic (\&poly, 5, %x);
  print "Fit: ", $approx->fit, "\n\n";
  my $function = $approx->symbolic('x');
  # defaults to using variable 'x' without argument.
  print "$function\n";
  print $function->value(x => $_),"\n" foreach keys %x;
  # Work with the symbolic function now.


(c) 2003 by Steffen Müller

Please send feedback, bug reports, and support requests to the author at approx-symbolic-module at steffen-mueller dot net

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


New versions of this module can be found on or CPAN.



1 POD Error

The following errors were encountered while parsing the POD:

Around line 116:

Non-ASCII character seen before =encoding in 'Müller'. Assuming CP1252