Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
69 lines (57 loc) · 2.08 KB
/
Copy pathProgram.cs
File metadata and controls
69 lines (57 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Copyright (c) 2019-2022 Angouri.
// AngouriMath is licensed under MIT.
// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
// Website: https://am.angouri.org.
//
using static System.Console;
using AngouriMath.Extensions;
using static AngouriMath.MathS;
using AngouriMath;
using static AngouriMath.Entity.Number;
// Hello world in AM
WriteLine("Alright, let's start from a hello world");
WriteLine("2 + 3 is " + "2 + 3".EvalNumerical().Stringize());
WriteLine();
// Simplify
WriteLine("x + 3 + 4 + x + 2x + 23 + a".Simplify().Stringize());
WriteLine();
// Build expressions
var x = Var("x");
var expr = Sin(x) + Sqrt(x) + Integral(Sin(Sin(x)), x);
WriteLine(expr.Stringize());
WriteLine();
// Derive
WriteLine(expr.Differentiate(x).Simplify().Stringize());
WriteLine();
// Solve a simple equation
WriteLine("x2 = 3".Solve("x").Stringize());
WriteLine();
// Solve a complicated statement
WriteLine("(x - 2)(x - 3) = 0 and (x - 1)(x - 2) = 0".Solve("x").InnerSimplified.Stringize());
WriteLine("sin(a x)2 + c sin(2 a x) = c".Solve("x"));
WriteLine("(x - 6)(x + 9) >= 0".Solve("x").Latexize());
WriteLine();
// Work with sets
WriteLine("{ 1, 2 }".Latexize());
WriteLine("[3; +oo)".Latexize());
WriteLine("RR".Latexize());
WriteLine("{ x : x8 + a x < 0 }".Latexize());
WriteLine(@"A \/ B".Latexize());
WriteLine(@"A /\ B".Latexize());
WriteLine(@"A \ B".Latexize());
WriteLine(@"{ 1, 2, 3 } \/ { 3, 5 }".Simplify());
WriteLine(@"[a; b) \/ { b }".Simplify());
WriteLine();
// Differentiate, integrate, find limits
WriteLine("x2 + a x".Differentiate("x").InnerSimplified);
WriteLine("x2 + a x".Integrate("x").InnerSimplified.Latexize());
WriteLine("(a x2 + b x) / (e x - h x2 - 3)".Limit("x", "+oo").InnerSimplified);
WriteLine();
// Boolean
WriteLine("true and false implies true".Simplify());
WriteLine(string.Join(" ", new[] { "a", "b", "c", "F" }));
WriteLine(MathS.Boolean.BuildTruthTable("a and b implies c", "a", "b", "c"));
WriteLine();
// LaTeX
WriteLine("x ^ y + sqrt(x) + integral(sqrt(x) / a, x) + derivative(sqrt(x) / a, x, 1) + limit(sqrt(x) / a, x, +oo)".Latexize());