1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-17 08:03:09 -08:00

Add arccos.

This commit is contained in:
Arthur Drobot 2017-08-09 15:08:54 -07:00
parent ca6d8d2ba2
commit efe76a6fdc

View File

@ -453,7 +453,6 @@ public class StandardPlugin extends Plugin {
/**
* The arcsin function (return type in radians).
* @param manager
*/
public final Function functionArcsin = new Function() {
@Override
@ -485,6 +484,22 @@ public class StandardPlugin extends Plugin {
}
};
/**
* The arccos function.
*/
public final Function functionArccos = new Function() {
@Override
protected boolean matchesParams(NumberInterface[] params) {
return params.length == 1 && FUNCTION_ABS.apply(params[0]).compareTo(fromInt(params[0].getClass(), 1)) <= 0;
}
@Override
protected NumberInterface applyInternal(NumberInterface[] params) {
return piFor(params[0].getClass()).divide(fromInt(params[0].getClass(), 2))
.subtract(functionArcsin.apply(params));
}
};
public StandardPlugin(PluginManager manager) {
super(manager);
}
@ -603,6 +618,7 @@ public class StandardPlugin extends Plugin {
registerFunction("csc", functionCsc);
registerFunction("cot", functionCot);
registerFunction("arcsin", functionArcsin);
registerFunction("arccos", functionArccos);
}
@Override