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

Add arcsec. Adjust some comments.

This commit is contained in:
Arthur Drobot 2017-08-09 16:04:26 -07:00
parent 1f0e6a7ce4
commit 4226df72f5

View File

@ -452,7 +452,7 @@ public class StandardPlugin extends Plugin {
}; };
/** /**
* The arcsin function (return type in radians). * The arcsine function (return type in radians).
*/ */
public final Function functionArcsin = new Function() { public final Function functionArcsin = new Function() {
@Override @Override
@ -485,7 +485,7 @@ public class StandardPlugin extends Plugin {
}; };
/** /**
* The arccos function. * The arccosine function.
*/ */
public final Function functionArccos = new Function() { public final Function functionArccos = new Function() {
@Override @Override
@ -501,7 +501,7 @@ public class StandardPlugin extends Plugin {
}; };
/** /**
* The arccsc function. * The arccosecant function.
*/ */
public final Function functionArccsc = new Function() { public final Function functionArccsc = new Function() {
@Override @Override
@ -516,6 +516,22 @@ public class StandardPlugin extends Plugin {
} }
}; };
/**
* The arcsecant function.
*/
public final Function functionArcsec = 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) {
NumberInterface[] reciprocalParamArr = {fromInt(params[0].getClass(), 1).divide(params[0])};
return functionArccos.apply(reciprocalParamArr);
}
};
public StandardPlugin(PluginManager manager) { public StandardPlugin(PluginManager manager) {
super(manager); super(manager);
} }
@ -636,6 +652,7 @@ public class StandardPlugin extends Plugin {
registerFunction("arcsin", functionArcsin); registerFunction("arcsin", functionArcsin);
registerFunction("arccos", functionArccos); registerFunction("arccos", functionArccos);
registerFunction("arccsc", functionArccsc); registerFunction("arccsc", functionArccsc);
registerFunction("arcsec", functionArcsec);
} }
@Override @Override