numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
199 stars 118 forks source link

Functions implementation #926

Closed Baleksas closed 2 years ago

Baleksas commented 2 years ago

Implementation of functions to combine matrices: horizontally, vertically and diagonally.

Spacing of factors function correction.

We were not sure how to implement jme builtin functions with matrix arguments so it is likely to be wrong. Functions in math.js seem to be working; although we did not focus on the efficiency too much.

christianp commented 2 years ago

I've pushed to the branch pull-926, merging in with the current master branch and adding some more tests that currently fail.

You need to make sure that the object returned by the functions in matrixmath has rows and columns properties.

The returned object must be entirely separate from the inputs: the rows need to be new arrays, created from scratch or by slicing the input arrays.

In the definitions of the JME functions, it looks like you do need to wrap the returned values in TMatrix in order for them to be interpreted as the matrix type. See any of the definitions of the matrix function for an example.

christianp commented 2 years ago

You should also make sure that you're up to date with the current master branch before making a pull request.

Baleksas commented 2 years ago

Got it, will do that next