/** * Evaluate. * * @param arg1 the arg 1 * @param arg2 the arg 2 * @return the complex */ @Override public Complex evaluate( Complex arg1, Complex arg2 ) { return arg1.multiply( arg2 ); }
public Complex evaluate(Complex arg1, Complex arg2) { return arg1.multiply(arg2); }
/** * Returns of value of this complex number raised to the power of * <code>x</code>. Implements the formula: * * <pre> * <code> y<sup>x</sup> = exp(x·log(y))</code> * </pre> * * where <code>exp</code> and <code>log</code> are {@link #exp} and * {@link #log}, respectively. * * Returns {@link org.matheclipse.parser.client.math.Complex#NaN} if either * real or imaginary part of the input argument is <code>NaN</code> or * infinite, or if <code>y</code> equals * {@link org.matheclipse.parser.client.math.Complex#ZERO}. * * @param x the exponent. * @return <code>this</code><sup><code>x</code></sup> * @throws java.lang.NullPointerException if x is null * @since 1.2 */ public Complex pow( Complex x ) { if ( x == null ) { throw new NullPointerException(); } return this.log().multiply( x ).exp(); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top"> * inverse sine</a> of this complex number. Implements the formula: * * <pre> * <code> asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz)) </code> * </pre> * * Returns {@link org.matheclipse.parser.client.math.Complex#NaN} if either * real or imaginary part of the input argument is <code>NaN</code> or * infinite. * * @return the inverse sine of this complex number. * @since 1.2 */ public Complex asin() { if ( isNaN() ) { return Complex.NaN; } return sqrt1z().add( this.multiply( Complex.I ) ).log().multiply( Complex.I.negate() ); }
/** * Compute the <a href="http://mathworld.wolfram.com/InverseSine.html" * TARGET="_top"> inverse sine</a> of this complex number. * <p> * Implements the formula: * * <pre> * <code> asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz)) </code> * </pre> * * </p> * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the input * argument is <code>NaN</code> or infinite. * </p> * * @return the inverse sine of this complex number. * @since 1.2 */ public Complex asin() { if (isNaN()) { return Complex.NaN; } return sqrt1z().add(this.multiply(Complex.I)).log().multiply(Complex.I.negate()); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top"> * inverse cosine</a> of this complex number. Implements the formula: * * <pre> * <code> acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))</code> * </pre> * * Returns {@link org.matheclipse.parser.client.math.Complex#NaN} if either * real or imaginary part of the input argument is <code>NaN</code> or * infinite. * * @return the inverse cosine of this complex number * @since 1.2 */ public Complex acos() { if ( isNaN() ) { return Complex.NaN; } return this.add( this.sqrt1z().multiply( Complex.I ) ).log().multiply( Complex.I.negate() ); }
/** * Compute the <a href="http://mathworld.wolfram.com/InverseCosine.html" * TARGET="_top"> inverse cosine</a> of this complex number. * <p> * Implements the formula: * * <pre> * <code> acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))</code> * </pre> * * </p> * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the input * argument is <code>NaN</code> or infinite. * </p> * * @return the inverse cosine of this complex number * @since 1.2 */ public Complex acos() { if (isNaN()) { return Complex.NaN; } return this.add(this.sqrt1z().multiply(Complex.I)).log().multiply(Complex.I.negate()); }
/** * Compute the * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top"> * square root</a> of 1 - <code>this</code><sup>2</sup> for this complex * number. Computes the result directly as * <code>sqrt(Complex.ONE.subtract(z.multiply(z)))</code>. * * Returns {@link org.matheclipse.parser.client.math.Complex#NaN} if either * real or imaginary part of the input argument is <code>NaN</code>. * * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * * @return the square root of 1 - <code>this</code><sup>2</sup> * @since 1.2 */ public Complex sqrt1z() { return createComplex( 1.0, 0.0 ).subtract( this.multiply( this ) ).sqrt(); }
public Complex evaluate(IEvaluator<Complex, ComplexVariable> engine, FunctionNode function) { Complex result = new Complex(1.0, 0.0); for (int i = 1; i < function.size(); i++) { result = result.multiply(engine.evaluateNode(function.getNode(i))); } return result; } }
/** * Compute the <a href="http://mathworld.wolfram.com/SquareRoot.html" * TARGET="_top"> square root</a> of 1 - <code>this</code><sup>2</sup> for * this complex number. * <p> * Computes the result directly as * <code>sqrt(Complex.ONE.subtract(z.multiply(z)))</code>. * </p> * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the input * argument is <code>NaN</code>. * </p> * <p> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * </p> * * @return the square root of 1 - <code>this</code><sup>2</sup> * @since 1.2 */ public Complex sqrt1z() { return createComplex(1.0, 0.0).subtract(this.multiply(this)).sqrt(); }
return this.log().multiply(x).exp();
/** * Evaluate. * * @param engine the engine * @param function the function * @return the complex */ @Override public Complex evaluate( IEvaluator<Complex, ComplexVariable> engine, FunctionNode function ) { Complex result = new Complex( 1.0, 0.0 ); for ( int i = 1; i < function.size(); i++ ) { result = result.multiply( engine.evaluateNode( function.getNode( i ) ) ); } return result; } }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top"> * inverse tangent</a> of this complex number. Implements the formula: * * <pre> * <code> atan(z) = (i/2) log((i + z)/(i - z)) </code> * </pre> * * Returns {@link org.matheclipse.parser.client.math.Complex#NaN} if either * real or imaginary part of the input argument is <code>NaN</code> or * infinite. * * @return the inverse tangent of this complex number * @since 1.2 */ public Complex atan() { if ( isNaN() ) { return Complex.NaN; } return this.add( Complex.I ).divide( Complex.I.subtract( this ) ).log().multiply( Complex.I.divide( createComplex( 2.0, 0.0 ) ) ); }
/** * Compute the <a href="http://mathworld.wolfram.com/InverseTangent.html" * TARGET="_top"> inverse tangent</a> of this complex number. * <p> * Implements the formula: * * <pre> * <code> atan(z) = (i/2) log((i + z)/(i - z)) </code> * </pre> * * </p> * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the input * argument is <code>NaN</code> or infinite. * </p> * * @return the inverse tangent of this complex number * @since 1.2 */ public Complex atan() { if (isNaN()) { return Complex.NaN; } return this.add(Complex.I).divide(Complex.I.subtract(this)).log().multiply(Complex.I.divide(createComplex(2.0, 0.0))); }