Skip to content

Commit 8f47bd8

Browse files
更新README
1 parent a08d5d8 commit 8f47bd8

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,39 @@ We start from an imitation of Mathematica. We try to make it more connected to C
2323

2424
* `NMath` module offers better performance on numerical tasks. Numerical linear algebra will be strongly supported. It is under developing. We have already implemented `Assembler`. `MathObejct` can be converted to `NFunction` which takes the variables in the expression as parameters. This would support those cases like plotting, numerical integrating when massive computing is needed.
2525

26-
* Convert `MathObject` to LaTex format string.
26+
* Convert `MathObject` to **LaTex** format string.
27+
28+
```C++
29+
std::cout << Parse("4*Sin(x^2+PI/2)+Sum<<i|Cos(Log(i))>>({1,12})").GetLaTexString() << std::endl;
30+
31+
/***Output******
32+
\sum_{i}^{\left\{1,12\right\}}\cos{\log{i}}+4\,\sin{\left(x+\frac{PI}{2}\right)}
33+
***************/
34+
```
35+
36+
Rendered in markdown or LaTex:
37+
$$
38+
4\,\sin{\left(x^{2}+\frac{\pi}{2}\right)}+\sum_{i}^{\left\{1,12\right\}}\cos{\log{i}}
39+
$$
40+
2741

2842
* As an C++ library, you can enjoy its features in C++ freely. We use lambda expression to convert `MathObject` to `std::function` so that you can use it freely in your program.
2943

3044
```C++
3145
Assembler assembler;
3246
auto f = assembler.assemble(Parse("Sin(x^2)-y/2"),{"x","y"});
3347
std::cout << f({1.2, 1.3}) << std::endl;
34-
/*
35-
Output:
36-
0.3414583
37-
*/
48+
49+
/******Output*******
50+
0.3414583
51+
*******************/
3852
```
3953
4054
4155
42-
43-
4456
## A powerful calculator in 9 line
4557
46-
The follow program with **mathS** is a calculator that supports various and vector and matrix.
58+
The simplest application with **mathS** is a calculator. The follow program is a calculator that supports various operations, vector and matrix.
4759
4860
```c++
4961
#include <iostream>
@@ -65,7 +77,7 @@ int main() {
6577
std::vector<std::string> params = {}; // No variables in the expression in a calculator program.
6678
6779
auto f = assembler.Assemble(mobj, params); // Get NFunction
68-
std::cout << "Answer = " << f({})->GetString() << std::endl;
80+
std::cout << " = " << f({})->GetString() << std::endl;
6981
7082
return 0;
7183
}
@@ -75,21 +87,27 @@ Sample input and output
7587

7688
```
7789
E^3+9.1*(3-2.1)
78-
Answer = 28.275537
90+
= 28.275537
7991
8092
Floor(1.34+3)
81-
Answer = 4.000000
93+
= 4.000000
8294
8395
{3,6,9}/3
84-
Answer = {1.000000,2.000000,3.000000}
96+
= {1.000000,2.000000,3.000000}
8597
8698
{3.1,3.2,{6,2,1}}*{1.1,2.2,{3.1,3.2,4.3}}
87-
Answer = {3.410000,7.040000,{18.600000,6.400000,4.300000}}
99+
= {3.410000,7.040000,{18.600000,6.400000,4.300000}}
88100
89101
sin({1,PI/6,PI/2})
90-
Answer = {0.841471,0.500000,1.000000}
102+
= {0.841471,0.500000,1.000000}
91103
```
92104

105+
## Build
106+
107+
TODO.
108+
109+
110+
93111
## What's to be done
94112

95113
This is our timeline. We are now at medium term of *step 2*.

0 commit comments

Comments
 (0)