davidedc / Algebrite

Computer Algebra System in Javascript (Typescript)
http://algebrite.org
MIT License
966 stars 59 forks source link

Missing documentation for Algebrite functions #36

Open lorenzos opened 7 years ago

lorenzos commented 7 years ago

I can't find the documentation of the functions in the Algebrite object, I mean the ones that are not available in the scripting language and therefore already documented in the functions reference here. Maybe is somewhere I can't find.

For example, run(), eval() and clear() functions are not documented. I guessed that run() is equivalent to eval(...).toString(), and I found myself the existence of the clear() function, which is pretty needful I think.

More, it is not documented if there's a way to numerically solve expression by assigning values to symbols, and I accidentally found that I can pass additional expressions to eval() or run() to do that:

Algebrite.run('x^2+y^2', 'x=2', 'y=3')  // => 13

It'll be great if it can be done also like math.js do:

Algebrite.run('x^2+y^2', { x: 2, y: 3 })
davidedc commented 7 years ago

documentation work is ongoing. Will open separate issue for the "assigning values" request.

lorenzos commented 7 years ago

Thank you!

bloc97 commented 7 years ago

You can also use the Eigenmath manual for math functions. http://www.rejoicealways.net/lcu-semesters/fall2010/mat1302/Eigenmath.pdf

rafaelferreiraql commented 7 years ago

Notice that d() does not exist in Algebrite but it's documented there. I supposed it should read as derivative() which is in the package.

pabloahb commented 6 years ago

Related:

The arguments of some functions have changed:

old: for(i,j,k,a,b,...) new: for(do(a,b,...),i,j,k)

old: sum(i,j,k,f) new: sum(f,i,j,k)

old: product(i,j,k,f) new: product(f,i,j,k)

davidedc commented 6 years ago

I've added the changes to for/sum/product documentation for the latest version (1.2.0) here: http://algebrite.org/docs/1.2.0/reference.html . The JS documentation is still under work, I'll try to get that done in the coming week.

DIS-Connect commented 6 years ago

how can i eval a function with algebrite??

davidedc commented 6 years ago

@DIS-Connect using the internal scripting:

f(x) = 3*x
f(10)
> 30

Using JS:

Algebrite.run("f(x) = 3x+1");
Algebrite.run("f(10)"); // if you want the result as a string
> "31"
Algebrite.eval("f(10)"); // if you want the result as an Algebrite "atom" object
> U {cons: {…}, q: rational, k: 1}