All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.accelad.math.nilgiri.autodiff.Inverse Maven / Gradle / Ivy

The newest version!
package com.accelad.math.nilgiri.autodiff;

import java.util.List;

import com.accelad.math.nilgiri.Field;


public class Inverse> extends AbstractUnaryFunction {


    public Inverse(DifferentialFunction i_v) {
        super(i_v);
    }

    @Override
    public X getValue() {
        return arg().getValue().inverse();
    }

    @Override
    public double getReal() {
        return 1d / arg().getReal();
    }

    @Override
    public DifferentialFunction diff(Variable i_v) {
        return new PolynomialTerm(-1L, arg(), -2).mul(arg().diff(i_v));
    }

    @Override
    public String toString() {
        return "(" + arg().toString() + ")^(-1)";
    }

    @Override
    public String getFormula(List> variables) {
        return "( 1d / " + arg().getFormula(variables) + ")";
    }

    @Override
    public DifferentialFunction inverse() {
        return arg();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy