Skip to content

Instantly share code, notes, and snippets.

@thinkbigthings
Last active December 13, 2015 21:58
Show Gist options
  • Save thinkbigthings/4980681 to your computer and use it in GitHub Desktop.
Save thinkbigthings/4980681 to your computer and use it in GitHub Desktop.
Map<String,String> eqs = new HashMap<String,String>();
eqs.put("piApprox(k)","8*cumsum(ChebyshevTerm(k))");
eqs.put("ChebyshevTerm(k)","( (-1)^k * (sqrt(2)-1)^(2*k+1)) / (2*k+1)");
eqs.put("absError(k)", "abs(pi-piApprox)");
EquationProcessor k = new EquationProcessor(eqs);
Map<String,String> defs = new HashMap<String,String>();
defs.put("k","[0:20]");
List<String> cols = Arrays.asList("k", "ChebyshevTerm", "piApprox", "absError");
List<double[]> output = k.evaluate(defs,cols);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment