# C # character calculator

I somehow needed a c # library that can do symbolic calculations (from time to time I supplement the possibilities with one math program). Any source code in the network can be found in different languages, but something simpler and clearer could not be found. Drew attention to Jasymca (Java Symbolic Calculator) .

To implement an analogue of Mathcad'ovskogo block odesolve in the program SMath Studio needed to solve equations for derivatives. There are no special restrictions on the TAC system being solved. What the user sets in a relatively arbitrary form should be converted to a form convenient for the numerical solution of an ODE. It should look like this:

It was difficult for me to manage the c # language features in the general case. It would not hurt the help of the character engine.

Looked at the source of the applet. It seems not very scary, but you need a Java to c # converter. At the time when I just started doing this, I found one more or less working online resource that I could not recall now. It seems that it was a resource from Tangible Software Solutions, because source code comments are similar to those made by their current converter as a program.

Everything is good, but one is bad. The resource converted for free only a limited source size. True limit on the number of lines. Very strange, I thought, and blinded the entire contents of one file in each file. Then I converted the single-line source code to a c # equivalent and restored the normal appearance in Visual Studio using automatic formatting.

Needless to say, the automatic converter converts for the most part the form, but with the content you need to work more. At that time, I realized that I clearly did not have enough levels in both languages to solve all the problems of compilation. Time passed, read by John Skit. Comrade Skit inspired determination.

In the process of struggle for compilability, I recalled the converter with a kind word. He did almost all the tedious work. He did not master only the mathematical part in some moments. It concerned a large JMath class. In some cases, converting double to hex representation and back rested against the restriction for the BitConverter.Int64BitsToDouble () method, which does not work with some unsigned long constants, for example -0 ( 0x8000000000000000). Here again Comrade Skit came to the rescue, not without the help of whom it was possible to present this value as 1.0 / double.NegativeInfinity. In general, this arithmetic of "infinitely small" still does not give me rest, because I am not sure about the correct interpretation of all that the author Jasymca had in mind.

After fixing some semantic errors, replacing work with types and their instances and adding a console interface, we managed to launch this project. I have long wanted to look at the internal kitchen of such symbolic programs. It's one thing some Symbolic C ++ and quite another - Java or C #. The threshold of entry is much lower.

At the time of this writing, the calculator looks like this: The

executable file is available in the repository. Requires .Net 2.0. There is a dependency on LinqBridge for Linq to work in .Net 2.0 (the library is attached there too).

Almost everything works from the documentation of the author Jasymca. An exception is the work with graphics, i.e. graphing functions. I think it will be easier to write this part again than to port it. Functions that depend on third-party libraries (LAPACK, etc.) are not included. There are also glitches that will eventually be cleaned.

The project was created for lovers of symbolic mathematics. If desired, it can be brought to the library and used in own projects that require simple numerical or symbolic mathematics: working with complex numbers, integrating, differentiating, solving equations, etc. By Jasymca positioned the program as a training tool for those who want to create their own program performing symbolic calculations:

1. Jasymca (Java Symbolic Calculator) .

2. Jasymca sources (zip) .

3. Jasymca 2.0 - Symbolic Calculator for Java (Manual, pdf) .

4. Review of similar Java libraries .

5. Project repository .

### Task

To implement an analogue of Mathcad'ovskogo block odesolve in the program SMath Studio needed to solve equations for derivatives. There are no special restrictions on the TAC system being solved. What the user sets in a relatively arbitrary form should be converted to a form convenient for the numerical solution of an ODE. It should look like this:

It was difficult for me to manage the c # language features in the general case. It would not hurt the help of the character engine.

### Source conversion

Looked at the source of the applet. It seems not very scary, but you need a Java to c # converter. At the time when I just started doing this, I found one more or less working online resource that I could not recall now. It seems that it was a resource from Tangible Software Solutions, because source code comments are similar to those made by their current converter as a program.

Everything is good, but one is bad. The resource converted for free only a limited source size. True limit on the number of lines. Very strange, I thought, and blinded the entire contents of one file in each file. Then I converted the single-line source code to a c # equivalent and restored the normal appearance in Visual Studio using automatic formatting.

### File completion

Needless to say, the automatic converter converts for the most part the form, but with the content you need to work more. At that time, I realized that I clearly did not have enough levels in both languages to solve all the problems of compilation. Time passed, read by John Skit. Comrade Skit inspired determination.

In the process of struggle for compilability, I recalled the converter with a kind word. He did almost all the tedious work. He did not master only the mathematical part in some moments. It concerned a large JMath class. In some cases, converting double to hex representation and back rested against the restriction for the BitConverter.Int64BitsToDouble () method, which does not work with some unsigned long constants, for example -0 ( 0x8000000000000000). Here again Comrade Skit came to the rescue, not without the help of whom it was possible to present this value as 1.0 / double.NegativeInfinity. In general, this arithmetic of "infinitely small" still does not give me rest, because I am not sure about the correct interpretation of all that the author Jasymca had in mind.

After fixing some semantic errors, replacing work with types and their instances and adding a console interface, we managed to launch this project. I have long wanted to look at the internal kitchen of such symbolic programs. It's one thing some Symbolic C ++ and quite another - Java or C #. The threshold of entry is much lower.

At the time of this writing, the calculator looks like this: The

executable file is available in the repository. Requires .Net 2.0. There is a dependency on LinqBridge for Linq to work in .Net 2.0 (the library is attached there too).

Almost everything works from the documentation of the author Jasymca. An exception is the work with graphics, i.e. graphing functions. I think it will be easier to write this part again than to port it. Functions that depend on third-party libraries (LAPACK, etc.) are not included. There are also glitches that will eventually be cleaned.

### Conclusion

The project was created for lovers of symbolic mathematics. If desired, it can be brought to the library and used in own projects that require simple numerical or symbolic mathematics: working with complex numbers, integrating, differentiating, solving equations, etc. By Jasymca positioned the program as a training tool for those who want to create their own program performing symbolic calculations:

It has been especially important to study mathematics. One of the main obstacles are pocket calculators that prevent many students from using computers for math. Pocket calculaters are expensive and portable. It can be equipped with a microprocessor for mobile phones, even for game consoles or internet routers.I hope that the c # source version will be useful in some way to you.

### Links

1. Jasymca (Java Symbolic Calculator) .

2. Jasymca sources (zip) .

3. Jasymca 2.0 - Symbolic Calculator for Java (Manual, pdf) .

4. Review of similar Java libraries .

5. Project repository .