Skip to content

MathJSON not correct when writing operations on matrices #251

@cgrisar

Description

@cgrisar

Description

In a matfield, entered 2 matrices to perform an operation (1 2) +(3 4).
Latex is returned correctly
mathJSON returns errors

Steps to Reproduce

const expr = ce.parse('\\begin{bmatrix}1 & 2\\end{bmatrix}+\\begin{bmatrix}3 & 4\\end{bmatrix}')
expr.toMathJson()

Actual Result

MathJSON is

[
  "Add",
  [
    "Error",
    [
      "ErrorCode",
      "'incompatible-type'",
      "number",
      "'list<number>'"
    ]
  ],
  [
    "Error",
    [
      "ErrorCode",
      "'incompatible-type'",
      "number",
      "'list<number>'"
    ]
  ]
]

Expected Result

mathJSON

[
  "Add",
  [
    "Matrix",
    [
      "List",
      [
        "List",
        1,
        2
      ]
    ]
  ],
  [
    "Matrix",
    [
      "List",
      [
        "List",
        1,
        2
      ]
    ]
  ]
]

Environment

0.30.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Off-templateIssue does not follow template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions