首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > 通用java数学库

通用java数学库

资 源 简 介

Classes for generic manipulation with mathematic constructs: * numbers * complex numbers * fractions * matrixes * geometry * ... For example, to create a generic sum or coprime function: ``` public static T sum(Collection elements, Arithmetics arit) { T res = arit.zero(); for(T t : elements) res = arit.add(res, t); return res; } public static boolean coprime(T a, T b, IntegralArithmetics arit) { return arit.gcd(a, b).equals(arit.one()); } ``` And calling it: ``` ArrayList integerList; ArrayList doubleList; sum(integerList, IntegerArithmetics.getInstance()); sum(doubleList, DoubleExactArithmetics.getInstance()); coprime(55, 128, IntegerArithmetics.getInstance()); coprime(new BigInteger("55"), new BigInteger("128"), BigIntegerArithmetics.getInstance()); ```
VIP VIP
0.219929s