How to use the unaryMinus function from mathjs

Find comprehensive JavaScript mathjs.unaryMinus code examples handpicked from public code repositorys.

100
101
102
103
104
105
106
107
108
109
var c = poly.slice(0, end);


// Remove small leading coefficients that introduce infinities
function calc_d(coeff) {
    return math.unaryMinus(math.divide(coeff, c[0]));
}
var d = c.slice(1, c.length).map(calc_d);
while (!d.every(isFinite)) {
    c = c.slice(1, c.length);
fork icon1
star icon0
watch icon15

5
6
7
8
9
10
11
12
13
14
    1,
    math.add(
      1,
      math.dotPow(
        math.e,
        math.unaryMinus(z)
      )
    )
  )
}
fork icon0
star icon0
watch icon2

85
86
87
88
89
90
91
92
93
94
  let [ base, exp ] = biggify(args)
  return math.pow(base, exp)
},
neg(num) {
  num = math.bignumber(num)
  return math.unaryMinus(num)
},
round(num, digits = 3) {
  num = math.bignumber(num)
  return math.round(num, digits)
fork icon0
star icon0
watch icon1