1.2.3 • Published 10 years ago

math-theory v1.2.3

Weekly downloads
-
License
BSD
Repository
-
Last release
10 years ago

Install

npm install math-theory 

How to

var theory = require('math-theory');
theory.rd(10,100,2)  // 随机数 最后一个参数支持小数位数
theory.primeFactorization(100) //分解质因数
theory.partNum(123) //分割数字 [3,2,1]
theory.getPrimes(100,10) //获取一定范围内的质因数  后面一个参数不传是从0开始
theory.checkRepeat(object,object) //查找重复项
theory.diffMedian(3)  //获取各不相同的几位数
theory.gcd(30,75) //两个数的最大公约数
theory.ngcd([30,60,75]) //多个数的最大公约数
theory.lcm(15,25)  //最小公倍数
theory.nlcm([15,25,60])  //多个数的最小公倍数
theory.isPrime(18)  //判断一个数是否为质数
theory.toFactorPowerList([2,2,2,3,5,5,7]) //将一个数组转换成N次方的序列[[2,3],[3,1],[5,2].[7,1]]
theory.permutator([1,2,3]) //排列组合 return[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
theory.getCommonDivisor(8)  //求一个数的约数 return [1,2,4,8]
theory.float2rat(0.3333333333) //将一个小数转换为分数 return string 1/3
theory.getSimpleFraction(4,8)//化简分数 return [1,2] 
theory.str2Fraction('5/2')//将一个分数字符串转换为数组 return [5,2] 
theory.point(x1,y1,x2,y2,n) //矢量与定比分点 return {'x':x,'y':y}
theory.permutations(5)//5*4*3*2*1 排列 retrun 120 
theory.combinations(5,3)//(5*4*3*2*1)/(3*2*1) 组合 return 10 
theory.factorialProcess(5,3)//阶乘中有哪几个数相乘 return [5,4,3] 

Have fun!

Copyright/License

微学记

1.2.3

10 years ago

1.1.5-r

10 years ago

1.1.5

10 years ago

1.1.4-r

10 years ago

1.1.4-b

10 years ago

1.1.4

10 years ago

1.1.3-r

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago