Path

ez components / documentation / api reference / 2007.2 / graph


Graph: ezcGraphPolynom

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcGraphPolynom

Provides a class for generic operations on polynoms [source]

Member Variables

protected array $values
Factors of the polynom

Method Summary

public ezcGraphPolynom __construct( [$values = array()] )
Constructor
public ezcGraphPolynom add( $polynom )
Adds polynom to current polynom
public float evaluate( $x )
Evaluate Polynom with a given value
public float get( $exponent )
Return factor for one exponent
public int getOrder( )
Returns the order of the polynom
public ezcGraphPolynom init( $order )
Initialise a polygon
public ezcGraphPolynom set( $exponent, $factor )
Set the factor for one exponent
public string __toString( )
Returns a string represenation of the polynom

Methods

__construct

ezcGraphPolynom __construct( [ $values = array()] )
Constructor
Constructs a polynom object from given array, where the key is the exponent and the value the factor. An example: Polynom: 2 * x^3 + .5 * x - 3 Array: array ( (int) 3 => (float) 2, (int) 1 => (float) .5, (int) 0 => (float) -3, )

Parameters

Name Type Description
$values array Array with values

add

Adds polynom to current polynom

Parameters

Name Type Description
$polynom ezcGraphPolynom Polynom to add

evaluate

float evaluate( float $x )
Evaluate Polynom with a given value

Parameters

Name Type Description
$x float Value

get

float get( int $exponent )
Return factor for one exponent

Parameters

Name Type Description
$exponent int Exponent

getOrder

int getOrder( )
Returns the order of the polynom

init

ezcGraphPolynom init( int $order )
Initialise a polygon
Initialise a polygon of the given order. Sets all factors to 0.

Parameters

Name Type Description
$order int Order of polygon

set

ezcGraphPolynom set( int $exponent, float $factor )
Set the factor for one exponent

Parameters

Name Type Description
$exponent int Exponent
$factor float Factor

__toString

string __toString( )
Returns a string represenation of the polynom

Last updated: Mon, 17 Dec 2007