Skip to content

minor issues in doc examples #2902

@tmtron

Description

@tmtron

Here are some minor issues in the doc examples, that I have found.

quantileSeq

quantileSeq([3, -1, 5, 7], [1/3, 2/3])
TypeError: Unexpected type of argument in function quantileSeq

It seems the 2nd argument must not be an array. But accordig to the docs it should work.

to

to(unit('2 inch'), unit(null, 'cm')) # returns Unit 5.08 cm
TypeError: Unexpected type of argument in function unit (expected: number or BigNumber or Fraction or Unit or string or Array or Matrix or Complex or boolean, actual: identifier | null, index: 0)

unit(null, 'cm') is strange. What should this do?

distance

in the final line of the examples the closing ) is missing

distance(  {pointX: 2, pointY: 3, pointZ: 1},  {x0: 1, y0: 1, z0: 2, a: 5, b: 0, c: 1}
SyntaxError: Parenthesis ) expected (char 87)

getMatrixDataType

fractionX = [ [fraction(1, 3)], [fraction(1, 3] ]
SyntaxError: Parenthesis ) expected (char 47)

closing ) of last fraction() missing. This is correct:

fractionX = [ [fraction(1, 3)], [fraction(1, 3)] ]
#                                             ^correct

max

max([[2, 5], [4, 3]], [1, 7], 1) 
#                  ^ wrong
max([[2, 5], [4, 3], [1, 7] ], 1) 
#                           ^correct

subset

  const e: any = [];
  const f = mathJs.subset(e, mathJs.index(0, [0, 2]), [5, 6]);
  /**
   * variable | according to the docs | actual 
   *    e     |          [[5, 0, 6]]  | []
   *    f     |          [[5, 6]]     | [ [ 5, 0, 6 ] ]
   * 
   */

Should e really be changed after calling subset?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions