Steffen Müller > Math-Approx-Symbolic-0.100 > Math::Approx::Symbolic

Download:
Math-Approx-Symbolic-0.100.tar.gz

Dependencies

Annotate this POD

Related Modules

Math::Approx
AI::Fuzzy
Math::ematica
more...
By perlmonks.org
View/Report Bugs
Module Version: 0.100   Source  

NAME ^

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

SYNOPSIS ^

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

DESCRIPTION ^

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.

EXPORT

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.

EXAMPLE ^

  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);
  $approx->print;
  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.

AUTHOR ^

(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.

SEE ALSO ^

New versions of this module can be found on http://steffen-mueller.net or CPAN.

Math::Approx

Math::Symbolic

syntax highlighting: