Package jmathexpr.arithmetic.func

Source Code of jmathexpr.arithmetic.func.Ln

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jmathexpr.arithmetic.func;

import jmathexpr.Expression;
import jmathexpr.arithmetic.ANumber;
import jmathexpr.arithmetic.real.RealNumber;
import jmathexpr.arithmetic.real.Reals;

/**
* The natural logarithm function: ln(x).
*
* @author Elemér Furka
*/
public class Ln extends UnivariateNumberFunction {
   
    public Ln(Expression arg) {
        super("ln", arg);
    }

    @Override
    public Expression evaluate() {
        Expression x = arg.evaluate();
       
        if (x instanceof ANumber) {
            if (x instanceof RealNumber) {
                return Reals.getInstance().functions().ln((RealNumber) x);
            }
        }

        return new Ln(x);
    }

    @Override
    protected UnivariateNumberFunction create(Expression arg) {
        return new Ln(arg);
    }
}
TOP

Related Classes of jmathexpr.arithmetic.func.Ln

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.