CombinFunction.java
Go to the documentation of this file.00001 package com.graphbuilder.math.func;
00002
00003 import com.graphbuilder.math.PascalsTriangle;
00004
00010 public class CombinFunction implements Function {
00011
00012 public CombinFunction() {}
00013
00018 public double of(double[] d, int numParam) {
00019 int n = (int) d[0];
00020 int r = (int) d[1];
00021 return PascalsTriangle.nCr(n, r);
00022 }
00023
00027 public boolean acceptNumParam(int numParam) {
00028 return numParam == 2;
00029 }
00030
00031 public String toString() {
00032 return "choose(n, r)";
00033 }
00034 }