Documentation ¶
Overview ¶
Example ¶
input := "-1+(-a)+(+5)+(+2+3+1)" fmt.Fprintf(os.Stdout, "Input : %s\n\n", input) eq, err := Sexpr(os.Stdout, input) if err != nil { panic(err) } fmt.Fprintf(os.Stdout, "Output : %s\n", eq)
Output: Input : -1+(-a)+(+5)+(+2+3+1) -1.000 - a + 5.000 + (2.000 + 3 + 1) 4.000 + -a + (2.000 + 3 + 1) 4.000 - a + (2.000 + 3 + 1) 4.000 - a + (2.000 + 3.000 + 1) 4.000 - a + (5.000 + 1) 4.000 - a + (5.000 + 1.000) 4.000 - a + 6.000 10.000 + -a 10.000 - a Output : 10.000 - a
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FloatFormat int = 3
FloatFormat is format of float value, for more precision calculation use value equal 12.
View Source
var MaxIteration int64 = 1000000
Functions ¶
func Sexpr ¶
Sexpr - simplification of expression. Example:
expr : "b*(2+3-1+8*a)", out : "4.000*b + 8.000*(a*b)", expr: "d(2*pow(x,a),x);constant(a);variable(x);", out: "2.000*(a*pow(x,a - 1.000))", expr: "b*(2+8*a)*a; constant(a); constant(b)", out: "2.000*(a*b) + 8.000*(a*(a*b))", expr: "(a + b) * (c - d - s); constant(a,b,c,d,s)", out: "a*c-a*d-a*s+(b*c-b*d-b*s)", expr: "pow(a,5-3+1)", out: "a * (a * a)", expr: "pow(a+1,2)", out: "1.000+2.000*a+a*a", expr: "b*d(a*x,x);constant(a);variable(x);", out: "a * b", expr: "d(2*pow(x,a),x);constant(a);variable(x);", out: "2.000*(a*pow(x,-1.000+a))", expr: "d(u + v,x);function(u,x);function(v,x);", out: "d(u,x) + d(v,x)", expr: "(a/b)/(c/d)", out: "a * d / (b * c)", expr: "matrix(2+5,1,1)", out: "matrix(7.000,1.000,1.000)", expr: "matrix(2+5,9,3, 5-1+0-0,2,2)*matrix(1-2,+5,2,1)", out: "matrix(38.000,17.000,2.000,1.000)", expr: "integral(1,x,0,1);variable(x)", out: "1.000", expr: "integral(1,x,2,4)*a;variable(x)", out: "2.000*a", expr: "det(matrix(-1,1.5,1,-1,2,2))", out: "-0.500", expr: "inverse(matrix(1,2,3,0,1,4,5,6,0,3,3))", out: "matrix(-24.000,18.000,5.000,20.000,-15.000,-4.000,-5.000,4.000,1.000,3.000,3.000)",
Keywords:
constant(a); for constants variables(a); for variables function(a,x,y,z,...); for function a(x,y,z)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.