Factory for creating an ExpressionNode representing '^'.
More...
|
| makeNode ($leftOperand, $rightOperand) |
| Create a Node representing '$leftOperand^$rightOperand'. More...
|
|
Factory for creating an ExpressionNode representing '^'.
Some basic simplification is applied to the resulting Node.
MathParser\Parsing\Nodes\Factories\ExponentiationNodeFactory::doubleExponentiation |
( |
|
$leftOperand, |
|
|
|
$rightOperand |
|
) |
| |
|
private |
Simplify (x^a)^b when a and b are both numeric.
- Parameters
-
- Return values
-
MathParser\Parsing\Nodes\Factories\ExponentiationNodeFactory::makeNode |
( |
|
$leftOperand, |
|
|
|
$rightOperand |
|
) |
| |
Create a Node representing '$leftOperand^$rightOperand'.
Using some simplification rules, create a NumberNode or ExpressionNode giving an AST correctly representing '$leftOperand^$rightOperand'.
Simplification rules:
- To simplify the use of the function, convert integer params to NumberNodes
- If $leftOperand and $rightOperand are both NumberNodes, return a single NumberNode containing x^y
- If $rightOperand is a NumberNode representing 0, return '1'
- If $rightOperand is a NumberNode representing 1, return $leftOperand
- If $leftOperand is already a power x=a^b and $rightOperand is a NumberNode, return a^(b*y)
- Parameters
-
Node | int | $leftOperand | Minuend |
Node | int | $rightOperand | Subtrahend |
- Return values
-
Implements MathParser\Parsing\Nodes\Interfaces\ExpressionNodeFactory.
MathParser\Parsing\Nodes\Factories\ExponentiationNodeFactory::numericExponent |
( |
|
$leftOperand, |
|
|
|
$rightOperand |
|
) |
| |
|
private |
Simplify an expression x^y, when y is numeric.
- Parameters
-
- Return values
-
The documentation for this class was generated from the following file:
- src/MathParser/Parsing/Nodes/Factories/ExponentiationNodeFactory.php