Skip to content

Basic operations

WhiteBlackGoose edited this page Feb 15, 2023 · 1 revision

Many of functions are MathS' methods where MathS is a public static class. All its methods are documented in the code.

MathS

It is the main static class for functions. Some of them create new nodes, like MathS.Sin, MathS.Var, and others. Functions like MathS.Hyperbolic.Sinh create an expression according to its symbolic definition.

Method FromString parses a string and returns an expression. For example,

using static AngouriMath.MathS;
var expr = FromString("x + 2");

Would return the same result as

Entity expr = "x + 2";

Method FromString uses caching by string. If you need to save memory or confident that expressions will never repeat, then you may want to disable it like this:

var expr = FromString("a + x", useCache: false);

Then it will not look up for cache neither it will cache the result. The implicit operator from string does use the cache. Note, that this method, as well as the implicit operator, will not simplify the result.

Method ToString returns a mathematical representation of the given expression. Although in most cases it will return an expression that can be parsed from string back into an Entity, there is no guarantee so far that it will not change. Example:

Entity expr = "a x + b";
Console.WriteLine(expr);

Output:

a * x + b

Method Latexise returns a LaTeX code that can be then rendered into an image. Example:

Entity expr = "a / b + sqrt(c)";
Console.WriteLine(expr.Latexise());

Output:

\frac{a}{b}+\sqrt{c}

Extensions: string.Latexise(), string.ToEntity().

Clone this wiki locally