Class FieldSqrt
- java.lang.Object
-
- com.singularsys.jep.functions.PostfixMathCommand
-
- com.singularsys.jep.functions.UnaryFunction
-
- com.singularsys.extensions.field.functions.FieldSqrt
-
- All Implemented Interfaces:
PostfixMathCommandI,java.io.Serializable
public class FieldSqrt extends UnaryFunction
Calculate the square root of a number using any field. Uses the Babylonian method with the iterative formulax_{n+1} = (x_n + S / x_n) / 2whereSis the input number scaled to lie between 1/16 and 16. Algorithm will stop until convergence or the maximum number of iterations is reached.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objecteval(java.lang.Object arg)intgetNum_itts()voidsetNum_itts(int num_itts)java.lang.StringtoString()-
Methods inherited from class com.singularsys.jep.functions.UnaryFunction
instanceOf, instanceOf, run
-
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString
-
-
-
-
Constructor Detail
-
FieldSqrt
public FieldSqrt(FieldI f, int num_itts)
Constructor- Parameters:
f- the field for all computationsnum_itts- maximum number of iterations
-
-
Method Detail
-
eval
public java.lang.Object eval(java.lang.Object arg) throws EvaluationException- Specified by:
evalin classUnaryFunction- Throws:
EvaluationException
-
getNum_itts
public int getNum_itts()
-
setNum_itts
public void setNum_itts(int num_itts)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classPostfixMathCommand
-
-