SSJ
V. 2.6.

## umontreal.iro.lecuyer.functions Class SquareMathFunction

```java.lang.Object
umontreal.iro.lecuyer.functions.SquareMathFunction
```
All Implemented Interfaces:
MathFunction, MathFunctionWithFirstDerivative

`public class SquareMathFunctionextends Objectimplements MathFunctionWithFirstDerivative`

Represents a function computing (af (x) + b)2 for a user-defined function f (x).

Constructor Summary
`SquareMathFunction(MathFunction func)`
Constructs a new square function for function func.
```SquareMathFunction(MathFunction func, double a, double b)```
Constructs a new power function for function func, and constants a and b.

Method Summary
` double` `derivative(double x)`
Computes (or estimates) the first derivative of the function at point x.
` double` `evaluate(double x)`
Returns the value of the function evaluated at x.
` double` `getA()`
Returns the value of a.
` double` `getB()`
Returns the value of b.
` MathFunction` `getFunction()`
Returns the function f (x).

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SquareMathFunction

`public SquareMathFunction(MathFunction func)`
Constructs a new square function for function func. The values of the constants are a = 1 and b = 0.

Parameters:
`func` - the function f (x).

### SquareMathFunction

```public SquareMathFunction(MathFunction func,
double a,
double b)```
Constructs a new power function for function func, and constants a and b.

Parameters:
`func` - the function f (x).
`a` - < #30#>the multiplicative constant.
`b` - the additive constant.
Method Detail

### getFunction

`public MathFunction getFunction()`
Returns the function f (x).

Returns:
the function.

### getA

`public double getA()`
Returns the value of a.

Returns:
the value of a.

### getB

`public double getB()`
Returns the value of b.

Returns:
the value of b.

### evaluate

`public double evaluate(double x)`
Description copied from interface: `MathFunction`
Returns the value of the function evaluated at x.

Specified by:
`evaluate` in interface `MathFunction`
Parameters:
`x` - value at which the function is evaluated
Returns:
function evaluated at x

### derivative

`public double derivative(double x)`
Description copied from interface: `MathFunctionWithFirstDerivative`
Computes (or estimates) the first derivative of the function at point x.

Specified by:
`derivative` in interface `MathFunctionWithFirstDerivative`
Parameters:
`x` - the point to evaluate the derivative to.
Returns:
the value of the derivative.

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.