LogFunction.java
Go to the documentation of this file.00001 package com.graphbuilder.math.func;
00002
00006 public class LogFunction implements Function {
00007
00008 public LogFunction() {}
00009
00015 public double of(double[] d, int numParam) {
00016 if (numParam == 1) {
00017 return java.lang.Math.log(d[0]) / java.lang.Math.log(10);
00018 }
00019 return java.lang.Math.log(d[0]) / java.lang.Math.log(d[1]);
00020 }
00021
00025 public boolean acceptNumParam(int numParam) {
00026 return numParam == 1 || numParam == 2;
00027 }
00028
00029 public String toString() {
00030 return "log(x):log(x, base)";
00031 }
00032 }