Main > Free Download Search >

Free math questions software for linux

math questions

Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 545
Math::String 1.27

Math::String 1.27


Math::String module contains arbitrary sized integers having arbitrary charsets to calculate with key rooms. more>>
Math::String module contains arbitrary sized integers having arbitrary charsets to calculate with key rooms.

SYNOPSIS

use Math::String;
use Math::String::Charset;

$a = new Math::String cafebabe; # default a-z
$b = new Math::String deadbeef; # a-z
print $a + $b; # Math::String ""

$a = new Math::String aa; # default a-z
$b = $a;
$b++;
print "$b > $a" if ($b > $a); # prove that ++ makes it greater
$b--;
print "$b == $a" if ($b == $a); # and that ++ and -- are reverse

$d = Math::String->bzero( [0...9] ); # like Math::Bigint
$d += Math::String->new ( 9999, [ 0..9 ] );
# Math::String "9999"

print "$dn"; # string "00000n"
print $d->as_number(),"n"; # Math::BigInt "+11111"
print $d->last(5),"n"; # string "99999"
print $d->first(3),"n"; # string "111"
print $d->length(),"n"; # faster than length("$d");

$d = Math::String->new ( , Math::String::Charset->new ( {
minlen => 2, start => [ a..z ], } );

print $d->minlen(),"n"; # print 2
print ++$d,"n"; # print aa

<<less
Download (0.060MB)
Added: 2007-06-30 License: Perl Artistic License Price:
846 downloads
KMathsTest 0.2

KMathsTest 0.2


KMathsTest is a program who randomly generates maths questions for you to answer. more>>
KMathsTest is a program who randomly generates maths questions for you to answer.

Equations: dont you just love them? Well, youll find as many as you like in KMathsTest, which will generate random arithmetic sums, linear or simultaneous equations for your solving delight.

OK, so maybe you dont delight in it, but if you have a maths exam coming up, this is essential stuff, and therefore, this is essential software to make sure youve learnt it! KMathsTest has the interface of a KDE application.

This program randomly generates maths questions for you to answer. It keeps a basic log of your scores and allows you to change the minimum and maximum values for the numbers.

Currently, these questions are available:

- Addition;
- Subtraction;
- Multiplication;
- Division;
- Linear equations;
- Simultaneous equations.

Explanations are also provided on how to solve individual linear equations.
<<less
Download (0.21MB)
Added: 2005-06-01 License: GPL (GNU General Public License) Price:
1606 downloads
MathStudio 0.7.2-1

MathStudio 0.7.2-1


MathStudio project is an interactive equation editor and step-by-step solver. more>>
MathStudio project is an interactive equation editor and step-by-step solver.
MathStudio is a project aimed at making math-typing, plotting, and symbolic math easier.
Its user can easily input, plot, and save/load math data in various formats (e.g., MathML). Step-by-step resolution makes this a powerful learning tool.
Main features:
- Open Source
- Cross-platform
- Compiler support
- Easy to use
- Simple, extensible
- Intermediate steps
<<less
Download (4.0MB)
Added: 2006-10-31 License: GPL (GNU General Public License) Price:
1089 downloads
Math::Fraction 0.53b

Math::Fraction 0.53b


Math::Fraction is a Perl module to manipulate exact fractions. more>>
Math::Fraction is a Perl module to manipulate exact fractions.
SYNOPSIS
use Math::Fraction;
$a = frac(1,2); $b = frac(6,7);
print "$a + $b = ", $a + $b, "$a * $b = ", $a * $b;
print $a->num;
Main features:
- Being able to add, subtract, multiply, and divide, among other things just like you would normal numbers thats to the overload module.
- Being able to convert a decimal, including repeating ones, into a fraction. For example, 1.142857142857 would become 8/7.
- Being able to control how the fraction is displayed. For example 8/7 verses 1 1/7
- Being able to use arbitrary size numbers in the numerator and the denominator.
- Being able to covert between SMALL (using normal floats/integers) and BIG (using arbitrary size floats/integers) as needed so you do not have to worry about it. (New as of ver .4a)
- Being able to have multiple default sets so that a function can modify the defaults with out effecting other functions (New as of ver .4a)
<<less
Download (0.016MB)
Added: 2007-07-20 License: Perl Artistic License Price:
828 downloads
Math::String::Charset 1.27

Math::String::Charset 1.27


Math::String::Charset is a simple charset for Math::String objects. more>>
Math::String::Charset is a simple charset for Math::String objects.

SYNOPSIS

use Math::String::Charset;

$a = new Math::String::Charset; # default a-z
$b = new Math::String::Charset [a..z]; # same
$c = new Math::String::Charset
{ start => [a..z], sep => }; # with between chars

print $b->length(); # a-z => 26

# construct a charset from bigram table, and an initial set (containing
# valid start-characters)
# Note: After an a, either an b, c or a can follow, in this order
# After an d only an a can follow
$bi = new Math::String::Charset ( {
start => a..d,
bi => {
a => [ b, c, a ],
b => [ c, b ],
c => [ a, c ],
d => [ a, ],
q => [ ], # q will be automatically in end
}
end => [ a, b, ],
} );
print $bi->length(); # a,b => 2 (cross of end and start)
print scalar $bi->class(2); # count of combinations with 2 letters
# will be 3+2+2+1 => 8

$d = new Math::String::Charset ( { start => [a..z],
minlen => 2, maxlen => 4, } );

print $d->first(0),"n"; # undef, too short
print $d->first(1),"n"; # undef, to short
print $d->first(2),"n"; # aa

$d = new Math::String::Charset ( { start => [a..z] } );

print $d->first(0),"n"; #
print $d->first(1),"n"; # a
print $d->last(1),"n"; # z
print $d->first(2),"n"; # aa

This module lets you create an charset object, which is used to contruct Math::String objects. This object knows how to handle simple charsets as well as complex onex consisting of bi-grams (later tri and more).

In case of more complex charsets, a reference to a Math::String::Charset::Nested or Math::String::Charset::grouped will be returned.

The default charset is the set containing "abcdefghijklmnopqrstuvwxyz" (thus producing always lower case output).

<<less
Download (0.060MB)
Added: 2006-06-16 License: GPL (GNU General Public License) Price:
1226 downloads
Math::FresnelZone 0.03

Math::FresnelZone 0.03


Math::FresnelZone is a Perl extension for calculating the Fresnel Zone Radius of a given distance and frequency. more>>


SYNOPSIS

use Math::FresnelZone;
use Math::FresnelZone qw(fresnel fresnelMi fresnelKm);

The arguments are:

0 - distance in kilometers or miles (default is 1),
1 - frequency in GHz (defualt 2.4),
2 - set to true to specify that the distance you are inputting is in miles and that the results should be in in feet (default is 0 - IE kilometers/meters)
fresnel()

my $fresnel_zone_radius_in_meters = fresnel(); # fresnel zone radius in meters for 1 kilometer at 2.4 GHz

my $fzr_in_meters = fresnel(5); # fresnel zone radius in meters for 5 kilometers at 2.4 GHz

my $fzr_in_meters = fresnel(5,4.8); # fresnel zone radius in meters for 5 kilometers at 4.8 GHz

my $fzr_in_feet = fresnel(3,9.6,1); # fresnel zone in feet for 3 miles at 9.6 GHz

If you are inputting Kilometers the result is in meters (these 3 calls have identical results):

fresnel($Km,$GHz);
fresnelKm($Km,$GHz); # see documentaion below for info about fresnelKm()
fresnel($Km,$GHz,0);

If you are inputting Miles (by specifying a true value as the 3rd argument) the result is in feet (these 2 calls have identical results)

fresnel($Mi,$GHz,1);
fresnelMi($Mi,$GHz); # see documentaion below for info about fresnelMi()

fresnelKm()

You can use this to make it easier to avoid ambiguity if are working in kilometers/meters. It takes the first two arguments only: distance in kilometers and frequency in GigaHertz

my $fzr_in_meters = fresnelKm($Km,$GHz);

fresnelMi()

You can use this to make it easier to avoid ambiguity if are working in miles/feet. It takes the first two arguments only: distance in miles and frequency in GigaHertz

my $fzr_in_feet = fresnelMi($Mi,$GHz);

<<less
Download (0.003MB)
Added: 2006-12-04 License: Perl Artistic License Price:
1056 downloads
Math Objects 0.1.3

Math Objects 0.1.3


Math Objects is a math template library for C++ using generic programming techniques. more>>
Math Objects is a math template library written in C++ using generic programming techniques. In order to use the "Math Objects" library, the user only has to include the header files he needs (e.g. Matrix.h, Polynomial.h etc.).
In order to compile the library the user needs an ISO/IEC 14882:1998 standard compliant C++ compiler (e.g. one that supports partial template specializations).
The math library has math objects like matrices, polynomials, rational functions, extended precision numbers, complex numbers etc. that can be handled in a similar way like basic numerical types (e.g. integers or floating point numbers).
One can access properties of a mathematical type through a (partial) specialization of a traits class for that type (AlgebraicTraits). Having the traits classes to expose properties of mathematical objects, one can define for example matrices of polynomials having extended precision complex coefficients and apply to them basic linear algebra algorithms using normal C++ syntax.
This library also implements two functions using two deterministic algorithms that compute the Smith form for polynomial matrices, and the Smith-McMillan form of a transfer functions matrix also keeping track of the transformation matrices.
These algorithms can be used to describe a MIMO (multi input-multi output) system by means of its zeros and poles and also give the MFD (matrix fraction description) of the system.
Enhancements:
- Recoded the LongInt class aiming for better runtime efficiency.
<<less
Download (0.28MB)
Added: 2006-02-21 License: GPL (GNU General Public License) Price:
1343 downloads
IMathAS 1beta16

IMathAS 1beta16


IMathAS project is a Web-based math testing and homework system. more>>
IMathAS project is a Web-based math testing and homework system.
IMathAS (Internet Mathematics Assessment System) is a Web-based math testing and homework system.
It is a light course/learning management system and testing system, similar to and inspired by WebWork and WIMS, and similar to textbook-bundled systems like iLrn and MathXL.
It requires a browser with MathML and SVG support such as Firefox 1.5 or IE6 with plugins.
Main features:
- Math: The system was designed for Math assessment; no effort was made for the system to be multi-purpose.
- Sharing: The system was setup to encourage sharing of questions within a system and outside. Questions are grouped into question libraries, and are not tied directly to a specific assessment. Unless marked Private, questions can be used by anyone on the system, or used as a template for writing new questions. Export and Import allows the sharing of question sets between systems. Also, macro libraries allow for the expansion of IMathASs question language. Users with expertise in a field can develop macro extensions, and share them with other users.
- Ease of Install: The system uses standard PHP and MySQL. It requires no special compilation options or installation of external programs
- Display:
- Rich Math and Graph display, using standards-based MathML and SVG, powered by Peter Jipsens ASCIIsvg and ASCIIMathML
- Rich Text Editor with built-in Math and Graph support for text items displayed in a course
- Alternate display options for screenreaders and browsers without needed support
- Assessment:
- Question types including:
- Functions, with answers like "sin(x)"
- Numbers, compared to a given tolerance
- Calculated Numbers, like 5/3 or 2^5
- Multiple-Choice
- Multiple-Answer
- Matching
- String
- Numerical Matrix
- Calculated Matrix
- Multipart
- Multiple display options and assessment settings, including an option for practice sets, and due date exceptions for individual students
- Algorithmically generated questions, with a relatively simple-to-use question language (loosely based on PHP) with many built-in randomizers and display macros
- Expandable question language, by installing additional macros
- Other Course Features
- Post text items, uploaded files, or web links to the classroom
- Basic Discussion Forums
- Administration:
- Flexible administration: IMathAS can be centrally administered, or teachers can be given rights to create their own courses
- Courses can have one or more teachers
<<less
Download (0.46MB)
Added: 2006-11-02 License: GPL (GNU General Public License) Price:
1091 downloads
Math::Cephes::Matrix 0.44

Math::Cephes::Matrix 0.44


Math::Cephes::Matrix is a Perl interface to the cephes matrix routines. more>>
Math::Cephes::Matrix is a Perl interface to the cephes matrix routines.

SYNOPSIS

use Math::Cephes::Matrix qw(mat);
# mat is a shortcut for Math::Cephes::Matrix->new
my $M = mat([ [1, 2, -1], [2, -3, 1], [1, 0, 3]]);
my $C = mat([ [1, 2, 4], [2, 9, 2], [6, 2, 7]]);
my $D = $M->add($C); # D = M + C
my $Dc = $D->coef;
for (my $i=0; $inew($arr_ref);

where $arr_ref is a reference to an array of arrays, as in the following example:

$arr_ref = [ [1, 2, -1], [2, -3, 1], [1, 0, 3] ]

which represents
/ 1 2 -1
| 2 -3 1 |
1 0 3 /

A copy of a Math::Cephes::Matrix object may be done as

my $M_copy = $M->new();

Methods

coef: get coefficients of the matrix

SYNOPSIS:

my $c = $M->coef;

DESCRIPTION:

This returns an reference to an array of arrays containing the coefficients of the matrix.
clr: set all coefficients equal to a value.

SYNOPSIS:

$M->clr($n);

DESCRIPTION:

This sets all the coefficients of the matrix identically to $n. If $n is not given, a default of 0 is used.
add: add two matrices

SYNOPSIS:

$P = $M->add($N);

DESCRIPTION:

This sets $P equal to $M + $N.
sub: subtract two matrices

SYNOPSIS:

$P = $M->sub($N);

DESCRIPTION:

This sets $P equal to $M - $N.
mul: multiply two matrices or a matrix and a vector

SYNOPSIS:

$P = $M->mul($N);

DESCRIPTION:

This sets $P equal to $M * $N. This method can handle matrix multiplication, when $N is a matrix, as well as matrix-vector multiplication, where $N is an array reference representing a column vector.
div: divide two matrices

SYNOPSIS:

$P = $M->div($N);

DESCRIPTION:

This sets $P equal to $M * ($N)^(-1).
inv: invert a matrix

SYNOPSIS:

$I = $M->inv();

DESCRIPTION:

This sets $I equal to ($M)^(-1).
transp: transpose a matrix

SYNOPSIS:

$T = $M->transp();

DESCRIPTION:

This sets $T equal to the transpose of $M.
simq: solve simultaneous equations

SYNOPSIS:

my $M = Math::Cephes::Matrix->new([ [1, 2, -1], [2, -3, 1], [1, 0, 3]]);
my $B = [2, -1, 10];
my $X = $M->simq($B);
for (my $i=0; $inew([ [1, 2, 3], [2, 2, 3], [3, 3, 4]]);
my ($E, $EV1) = $S->eigens();
my $EV = $EV1->coef;
for (my $i=0; $i[$i]->[$j];
}
print "The eigenvector is @$vn";
}

where $M is a Math::Cephes::Matrix object representing a real symmetric matrix. $E is an array reference containing the eigenvalues of $M, and $EV is a Math::Cephes::Matrix object representing the eigenvalues, the ith row corresponding to the ith eigenvalue.

DESCRIPTION:

If M is an N x N real symmetric matrix, and X is an N component column vector, the eigenvalue problem

M X = lambda X

will in general have N solutions, with X the eigenvectors and lambda the eigenvalues.

<<less
Download (0.29MB)
Added: 2007-07-20 License: Perl Artistic License Price:
826 downloads
Math::Roman 1.07

Math::Roman 1.07


Math::Roman contains arbitrary sized Roman numbers and conversion from and to Arabic. more>>
Math::Roman contains arbitrary sized Roman numbers and conversion from and to Arabic.

SYNOPSIS

use Math::Roman qw(roman);

$a = new Math::Roman MCMLXXIII; # 1973
$b = roman(MCMLXI); # 1961
print $a - $b,"n"; # prints XII

$d = Math::Roman->bzero(); #
$d++; # I
$d += 1998; # MCMXCIX
$d -= MCM; # XCIX

print "$dn"; # string "MCMIC"
print $d->as_number(),"n"; # Math::BigInt "+1999"

<<less
Download (0.010MB)
Added: 2007-08-08 License: Perl Artistic License Price:
808 downloads
Math::Matrix 0.5

Math::Matrix 0.5


Math::Matrix can multiply and invert Matrices. more>>
Math::Matrix can multiply and invert Matrices.

The following methods are available:

new

Constructor arguments are a list of references to arrays of the same length. The arrays are copied. The method returns undef in case of error.

$a = new Math::Matrix ([rand,rand,rand],
[rand,rand,rand],
[rand,rand,rand]);

If you call new as method, a zero filled matrix with identical deminsions is returned.

clone

You can clone a matrix by calling:

$b = $a->clone;

size

You can determine the dimensions of a matrix by calling:

($m, $n) = $a->size;

concat

Concatenates two matrices of same row count. The result is a new matrix or undef in case of error.

$b = new Math::Matrix ([rand],[rand],[rand]);
$c = $a->concat($b);

transpose

Returns the transposed matrix. This is the matrix where colums and rows of the argument matrix are swaped.

multiply

Multiplies two matrices where the length of the rows in the first matrix is the same as the length of the columns in the second matrix. Returns the product or undef in case of error.

solve

Solves a equation system given by the matrix. The number of colums must be greater than the number of rows. If variables are dependent from each other, the second and all further of the dependent coefficients are 0. This means the method can handle such systems. The method returns a matrix containing the solutions in its columns or undef in case of error.

invert

Invert a Matrix using solve.

multiply_scalar

Multiplies a matrix and a scalar resulting in a matrix of the same dimensions with each element scaled with the scalar.

$a->multiply_scalar(2); scale matrix by factor 2

add

Add two matrices of the same dimensions.

substract

Shorthand for add($other->negative)

equal

Decide if two matrices are equal. The criterion is, that each pair of elements differs less than $Math::Matrix::eps.

slice

Extract columns:

a->slice(1,3,5);

determinant

Compute the determinant of a matrix.

dot_product

Compute the dot product of two vectors.

absolute

Compute the absolute value of a vector.

normalizing

Normalize a vector.

cross_product

Compute the cross-product of vectors.

print

Prints the matrix on STDOUT. If the method has additional parameters, these are printed before the matrix is printed.

pinvert

Compute the pseudo-inverse of the matrix: ((AA)^-1)A

EXAMPLE

use Math::Matrix;

srand(time);
$a = new Math::Matrix ([rand,rand,rand],
[rand,rand,rand],
[rand,rand,rand]);
$x = new Math::Matrix ([rand,rand,rand]);
$a->print("An");
$E = $a->concat($x->transpose);
$E->print("Equation systemn");
$s = $E->solve;
$s->print("Solutions sn");
$a->multiply($s)->print("A*sn");

<<less
Download (0.006MB)
Added: 2007-08-08 License: Perl Artistic License Price:
810 downloads
Math::Group::Thompson 0.96

Math::Group::Thompson 0.96


Math::Group::Thompson module contains OO methods that calculates the cardinality of the ball of radius n of Thompson group F. more>>
Math::Group::Thompson Perl module contains OO methods that calculates the cardinality of the ball of radius n of Thompson group F.

SYNOPSIS

use Math::Group::Thompson;

my $F = Math::Group::Thompson->new( VERBOSE => 0 );
my $card = $F->cardBn(3,);

print "#B(3) = $cardn";

The Math::Group::Thompson module provides objetct oriented methods that calculates the cardinality of the ball of radius n of Thompson group F.

This module uses the presentation of F

F = < A,B | [AB^(-1),A^(-1)BA] = [AB^(-1),A^(-2)BA^2] = e >

where A,B are formal symbols, [x,y] is the usual commutator and e is the identity element of F.

[x,y] = xyx^(-1)y^(-1)

This means that for every g in F, g can be written as word

g = a_{1}a_{2} ... a_{n}

where all the a_{i} are A,B,A^(-1) or B^(-1) for all i r br Usage: my $F = new-Math::Group::Thompson( VERBOSE => $v );
Verbose argument tells Math::Group::Thompson whether print every word generated ($v == 1) or not ($v == 0), or store them in a file, where $v is the name of the file (obviously different to 0 or 1). If the verbose file exists it is replaced, so you have to check for its integrity.

NOTE:
Its not recommend to store the words on a file because for
very small values of n, #B(n) or #gB(n)-B(n) are very very large.
For example for n = 19, #B(n) ~ 3^n = 1162261467 ~ 1.1 Giga, but
the space ocupped by the file will be (in bytes):

#B(1) + sum(i=2 to 19){i*(#B(i) - #B(i-1))} =
cardBn

This method calculates #B(n) or #(gB(n) - B(n)) depending on if the argument passed to the first call of cardBn is or not.

Usage: my $c = $F->cardBn($radius,$g);

where

$radius is an integer number >= 0 and $g is an element of F (word written with A,B,C or D).

If the first time cardBn is called $g is not equal to , then cardBn returns the cardinality of the set

gB(n) - B(n) = { w in F | w in gB(n) and w not in B(n) }

If the firs time cardBn is callen $g is equal to , then cardBn returns #B(n).

This algorithm runs on exponential time because F is of exponential growth (more "exactly", this algorithm is O(3^n) ).

reset

Resets the counter used on cardBn method, set the FIRST_ELEMENT property at , and the FIRST_CALL proporty to 1.

Usage: $F->reset;

multiply

Multiplication between two words of F. This method considers the inverse relations stored in the attribute INV.

Usage: my $mul = $F->multiply($g,$w);

where $g and $w are elements of F, and $mul is the result of $g$w.

rotate

This module receives as argument a word in F and puts the last letter on word in its first place.

Usage: $w = ABC; $W = $self->rotate($w); # $W is now equal to CBA

inverse

This method receives a word in F and returns its inverse.

Usage: $w = ABC; $W = $self->inverse($w); # $W == ADC

divide

This method receives a word in F and returns a 2-dimensional array where the first element is the first half of the word, and the second is the inverse of the second half of the word.

Usage: $w = AABC; ($w1,$w2) = $self->divide($w); # Now $w1 == AA and $w2 == AD

get_inv

This method return the hash of inverse relations between the generators elements of F.

note

This method prints in STDERR the string received or puts it on the correspondent file.

Usage: $F->note(AA); # Print AA."n" or store it on a file.

<<less
Download (0.006MB)
Added: 2007-06-28 License: Perl Artistic License Price:
848 downloads
MathTables 0.3.4

MathTables 0.3.4


MathTables is a program that helps parents teach their children how to use the four basic math operations. more>>
MathTables is a program that helps parents teach their children how to use the four basic math operations, multiplication, substraction, addition and division.

With MathTables parents can print sheets full of math operations for their children to answer. They can also print corresponding sheets with the solutions so that either them, or the children themselves, can work on the corrections.

This program arose from the actual need to print math tables almost daily for my children, as requested by their school.

MathTables is written in Python using the PyGTK toolkit.

<<less
Download (0.038MB)
Added: 2006-02-17 License: GPL (GNU General Public License) Price:
1344 downloads
Math::MagicSquare 2.04

Math::MagicSquare 2.04


Math::MagicSquare is a Magic Square Checker and Designer. more>>
Math::MagicSquare is a Magic Square Checker and Designer.

SYNOPSIS

use Math::MagicSquare;

$a= Math::MagicSquare -> new ([num,...,num],
...,
[num,...,num]);
$a->print("string");
$a->printhtml();
$a->printimage();
$a->check();
$a->rotation();
$a->reflection();

The following methods are available:

new

Constructor arguments are a list of references to arrays of the same length.

$a = Math::MagicSquare -> new ([num,...,num],
...,
[num,...,num]);

check

This function can return 4 value

0: the Square is not Magic
1: the Square is a Semimagic Square (the sum of the rows and the columns is equal)
2: the Square is a Magic Square (the sum of the rows, the columns and the diagonals is equal)
3: the Square ia Panmagic Square (the sum of the rows, the columns, the diagonals and the broken diagonals is equal)

print

Prints the Square on STDOUT. If the method has additional parameters, these are printed before the Magic Square is printed.

printhtml

Prints the Square on STDOUT in an HTML format (exactly a inside a TABLE)

printimage

Prints the Square on STDOUT in png format.

rotation

Rotates the Magic Square of 90 degree clockwise

reflection

Reflect the Magic Square

<<less
Download (0.007MB)
Added: 2007-07-02 License: Perl Artistic License Price:
845 downloads
Math::BigInt 1.87

Math::BigInt 1.87


Math::BigInt is an arbitrary size integer/float math package. more>>
Math::BigInt is an arbitrary size integer/float math package.

SYNOPSIS

use Math::BigInt;

# or make it faster: install (optional) Math::BigInt::GMP
# and always use (it will fall back to pure Perl if the
# GMP library is not installed):

# will warn if Math::BigInt::GMP cannot be found
use Math::BigInt lib => GMP;

# to supress the warning use this:
# use Math::BigInt try => GMP;

my $str = 1234567890;
my @values = (64,74,18);
my $n = 1; my $sign = -;

# Number creation
my $x = Math::BigInt->new($str); # defaults to 0
my $y = $x->copy(); # make a true copy
my $nan = Math::BigInt->bnan(); # create a NotANumber
my $zero = Math::BigInt->bzero(); # create a +0
my $inf = Math::BigInt->binf(); # create a +inf
my $inf = Math::BigInt->binf(-); # create a -inf
my $one = Math::BigInt->bone(); # create a +1
my $mone = Math::BigInt->bone(-); # create a -1

my $pi = Math::BigInt->bpi(); # returns 3
# see Math::BigFloat::bpi()

$h = Math::BigInt->new(0x123); # from hexadecimal
$b = Math::BigInt->new(0b101); # from binary
$o = Math::BigInt->from_oct(0101); # from octal

# Testing (dont modify their arguments)
# (return true if the condition is met, otherwise false)

$x->is_zero(); # if $x is +0
$x->is_nan(); # if $x is NaN
$x->is_one(); # if $x is +1
$x->is_one(-); # if $x is -1
$x->is_odd(); # if $x is odd
$x->is_even(); # if $x is even
$x->is_pos(); # if $x >= 0
$x->is_neg(); # if $x < 0
$x->is_inf($sign); # if $x is +inf, or -inf (sign is default +)
$x->is_int(); # if $x is an integer (not a float)

# comparing and digit/sign extraction
$x->bcmp($y); # compare numbers (undef,0)
$x->bacmp($y); # compare absolutely (undef,0)
$x->sign(); # return the sign, either +,- or NaN
$x->digit($n); # return the nth digit, counting from right
$x->digit(-$n); # return the nth digit, counting from left

# The following all modify their first argument. If you want to preserve
# $x, use $z = $x->copy()->bXXX($y); See under L for why this is
# necessary when mixing $a = $b assignments with non-overloaded math.

$x->bzero(); # set $x to 0
$x->bnan(); # set $x to NaN
$x->bone(); # set $x to +1
$x->bone(-); # set $x to -1
$x->binf(); # set $x to inf
$x->binf(-); # set $x to -inf

$x->bneg(); # negation
$x->babs(); # absolute value
$x->bnorm(); # normalize (no-op in BigInt)
$x->bnot(); # twos complement (bit wise not)
$x->binc(); # increment $x by 1
$x->bdec(); # decrement $x by 1

$x->badd($y); # addition (add $y to $x)
$x->bsub($y); # subtraction (subtract $y from $x)
$x->bmul($y); # multiplication (multiply $x by $y)
$x->bdiv($y); # divide, set $x to quotient
# return (quo,rem) or quo if scalar

$x->bmuladd($y,$z); # $x = $x * $y + $z

$x->bmod($y); # modulus (x % y)
$x->bmodpow($exp,$mod); # modular exponentation (($num**$exp) % $mod))
$x->bmodinv($mod); # the inverse of $x in the given modulus $mod

$x->bpow($y); # power of arguments (x ** y)
$x->blsft($y); # left shift in base 2
$x->brsft($y); # right shift in base 2
# returns (quo,rem) or quo if in scalar context
$x->blsft($y,$n); # left shift by $y places in base $n
$x->brsft($y,$n); # right shift by $y places in base $n
# returns (quo,rem) or quo if in scalar context

$x->band($y); # bitwise and
$x->bior($y); # bitwise inclusive or
$x->bxor($y); # bitwise exclusive or
$x->bnot(); # bitwise not (twos complement)

$x->bsqrt(); # calculate square-root
$x->broot($y); # $yth root of $x (e.g. $y == 3 => cubic root)
$x->bfac(); # factorial of $x (1*2*3*4*..$x)

$x->bnok($y); # x over y (binomial coefficient n over k)

$x->blog(); # logarithm of $x to base e (Eulers number)
$x->blog($base); # logarithm of $x to base $base (f.i. 2)
$x->bexp(); # calculate e ** $x where e is Eulers number

$x->round($A,$P,$mode); # round to accuracy or precision using mode $mode
$x->bround($n); # accuracy: preserve $n digits
$x->bfround($n); # round to $nth digit, no-op for BigInts

# The following do not modify their arguments in BigInt (are no-ops),
# but do so in BigFloat:

$x->bfloor(); # return integer less or equal than $x
$x->bceil(); # return integer greater or equal than $x

# The following do not modify their arguments:

# greatest common divisor (no OO style)
my $gcd = Math::BigInt::bgcd(@values);
# lowest common multiplicator (no OO style)
my $lcm = Math::BigInt::blcm(@values);

$x->length(); # return number of digits in number
($xl,$f) = $x->length(); # length of number and length of fraction part,
# latter is always 0 digits long for BigInts

$x->exponent(); # return exponent as BigInt
$x->mantissa(); # return (signed) mantissa as BigInt
$x->parts(); # return (mantissa,exponent) as BigInt
$x->copy(); # make a true copy of $x (unlike $y = $x;)
$x->as_int(); # return as BigInt (in BigInt: same as copy())
$x->numify(); # return as scalar (might overflow!)

# conversation to string (do not modify their argument)
$x->bstr(); # normalized string (e.g. 3)
$x->bsstr(); # norm. string in scientific notation (e.g. 3E0)
$x->as_hex(); # as signed hexadecimal string with prefixed 0x
$x->as_bin(); # as signed binary string with prefixed 0b
$x->as_oct(); # as signed octal string with prefixed 0


# precision and accuracy (see section about rounding for more)
$x->precision(); # return P of $x (or global, if P of $x undef)
$x->precision($n); # set P of $x to $n
$x->accuracy(); # return A of $x (or global, if A of $x undef)
$x->accuracy($n); # set A $x to $n

# Global methods
Math::BigInt->precision(); # get/set global P for all BigInt objects
Math::BigInt->accuracy(); # get/set global A for all BigInt objects
Math::BigInt->round_mode(); # get/set global round mode, one of
# even, odd, +inf, -inf, zero, trunc or common
Math::BigInt->config(); # return hash containing configuration

<<less
Download (0.19MB)
Added: 2007-07-11 License: Perl Artistic License Price:
840 downloads
Secleted [ 0 ] software to compare
  • Page: 1 of 5
  • 1
  • 2
  • 3
  • 4
  • 5