exec-mathexpress

1.0.15 • Public • Published

##js解析数学公式

const execMathExpress=require('exec-mathexpress');

console.log(execMathExpress('(1/2)*(2/3)/((1/2)*(2/3)+(1/2)*(2/3)))'))

//贝叶斯 条件概率 SW=WS*S/(WS*S+WH*H);(只用于二分类)
console.log(execMathExpress('WS*S/(WS*S+WH*H)',{
    WS:'1/2',
    S:'1/4',
    WH:'1/2',
    H:'3/4'
}))
//->Fraction { num: 1, den: 4 }

//贝叶斯联合概率(只用于二分类)
console.log(execMathExpress('P0*P1*P2/(P0*P1*P2+(1-P0)*(1-P1)*(1-P2))',
    { P0: '1/2', P1: '2/3', P2: '3/4' }
))
//->Fraction { num: 6, den: 7 }

Package Sidebar

Install

npm i exec-mathexpress

Weekly Downloads

2

Version

1.0.15

License

ISC

Unpacked Size

3.29 kB

Total Files

4

Last publish

Collaborators

  • caoke90