Documentation

jbf 14 avril 2019 à 12h30

  MATH.JS 

Math.js est une librairie qui permet d'explorer le monde plus ou moins infini des mathématiques. On retrouve le site ici :
https://mathjs.org/docs/reference/functions.html

et le github de Jos de Jong :
https://github.com/josdejong



Approches

Matt Lauber a aussi exploré ce sujet dans Tiddlywiki :
https://mklauber.github.io/tiddly-mathjs/

On voit bien que l'approche technique est très différente : la mienne consiste à charger la librairie via un tag $:/tags/RawMarkup et exploiter la fonction javascript eval() alors qu'il a réalisé un travail bien plus remarquable en écrivant une fonction spécifique (wrapper).

Ses travaux sont à découvrir ici : https://github.com/mklauber?tab=repositories

Un truc technique que j'ai exploité est d'afficher le résultat dans un <div> identifié. Par exemple ici :

function tell(w='<br>',sel='#cntmath3') {
      var cnt = document.querySelector(sel);
      cnt.innerHTML += w;
 }

Math

jbf 14 avril 2019 à 8h25

Math

0.75
4
2i
[[7, 0], [0, 7]]
2 * x + 1
4
5 inch
3 + 2i
"determinant -7"
340
"e=2.718"

Fractions

jbf 14 avril 2019 à 8h26

Fractions

pi=157/50
e=1359/500

Units

jbf 14 avril 2019 à 8h26

Units



53.34 cm

"50mm"

0.70710678118655

25 m / s

Random

jbf 14 avril 2019 à 8h23

Random

1:
143 -> prime? false

2: 695.5657778289274

Matrices

jbf 14 avril 2019 à 8h24

Matrices

Soit la matrice : [1, 4, 9, 16, 25]
[[1, 1, 1], [1, 1, 1]]
[2, 3]
[1, 4, 9, 16, 25]
clone : [1, 4, 9, 16, 25]
[[1, 0, 0], [0, 2, 0], [0, 0, 3]]
[[2, 0], [0, 3]]

[[[0, 0], [0, 0]], [[0, 0], [0, 0]]]
[2, 2, 2]
[[0, 0], [0, 0]]
[2, 2]

[1, 2, 3, 4, 5]
[0, 3, 6, 9, 12, 15]
[2, 1, 0, -1, -2]
[1, 2, 6, 24, 120]

Sparses Matrices

jbf 14 avril 2019 à 8h26

Sparse Matrices

creating a 1000x1000 sparse matrix...
doing some operations on the sparse matrix...
size(e)=1000,1000
already done
now try this with a dense matrix :)

Equations

jbf 14 avril 2019 à 12h22

Equations

equation 1 :"2 * x ^ 2 + x + 3"

"y ^ 2 - 3 * y"


9 * x=36

Math.js