Closed Mat-Ge closed 3 months ago
Bad documentation for [[jsxgraph]]
... Algebraic inputs are fine (as long as you allow them to have floats) when using the provided basic binding functions for points and sliders or lists of them. Those using the stack_jxg.custom_bind
logic can choose between string inputs and algebraic inputs based on their chosen style of serialisation. String inputs are typically needed when you serialise to something that is not directly Maxima syntax, but one can, in most cases, also serialise to Maxima syntax if you pick the syntax sensibly and can thus provide a deserialiser. For example, here is a JSON presentation that needs to use string inputs and a matching Maxima expression that will work with algebraic inputs:
{
"type": "directed_graph",
"nodes": [[1.2,2.3],[3.4,1.0],[2.1,2.2]],
"edges": [[1,2],[2,3],[3,1]]
}
Similar information can be transferred as a Maxima expression like this, and it does not matter whether Maxima actually has a function called directed_graph
. We are simply using it as an inert container:
directed_graph([[1.2,2.3],[3.4,1.0],[2.1,2.2]], [[1,2],[2,3],[3,1]])
With sensible replacements ("directed_graph(" => "["
and ")" => "]"
) before parsing as JSON, one can easily deserialise the latter form on the custom_bind
logic side.
The longer term plans are to add in a dedicate "JSON" input type to store state. Now we have GGB, JSXGraph and the Parsons block all using JSON to store state it makes logical sense to have a dedicated input. This way we can better support this kind of functionality, including test-case construction.
According to the documentation, the answers to questions that use JSXGraph should be saved in a string type input field. This leads to two problems when creating automatic test cases.