File: run07.pl

package info (click to toggle)
libmath-symbolic-perl 0.613-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,268 kB
  • sloc: perl: 12,638; makefile: 9
file content (25 lines) | stat: -rwxr-xr-x 523 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
use strict;
use warnings;

use lib '../lib';
use Data::Dumper;

use Math::Symbolic qw/:all/;

my $var = Math::Symbolic::Variable->new();
my $a   = $var->new( 'x' => 2 );

print "Vars: x=" . $a->value() . " (Value is optional)\n\n";

my $op  = Math::Symbolic::Operator->new();
my $umi = $op->new( { type => U_MINUS, operands => [$a] } );

print "Expression: -x\n\n";

print "prefix notation:\n";
print $umi->to_string('prefix') . "\n\n";

print "infix notation:\n";
print $umi->to_string('infix') . "\n\n";