Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Cos implements CustomInterface {
- public String getName() {
- return "cos";
- }
- public double getValue(double[] args) {
- return Math.cos(args[0]);
- }
- public Function derivate(Function[] args) {
- Function defFunction = new AddAndMultiply(new Function[][]{{
- new CustomFunction(new Sin(), new Function[]{args[0]})}},
- new boolean[][]{{true}});
- if (args[0] instanceof VariableX) {
- return defFunction;
- }
- return new AddAndMultiply(new Function[][]{{
- args[0].derivate(),
- defFunction
- }});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement