How do you install Symbolic C++ on Visual Studio 2

2019-07-20 05:14发布

I have Symbolic C++ (the version that can integrate with V, there is no documentation on how to install it. I got it from this website and it has examples of how it work:

http://issc.uj.ac.za/symbolic/symbolic.html

Does anyone have any idea on how to install this to use with my projects in Visual Studio?

3条回答
等我变得足够好
2楼-- · 2019-07-20 05:19

Maybe a late answer, but may still be useful for others.

For *nix systems:

There are two versions:

[1] Tarball that do not need to be installed in your system:  

http://issc.uj.ac.za/symbolic/sources/SymbolicC++3-3.35.tar.gz

[2] Library, intended to be installed in your system: 

http://issc.uj.ac.za/symbolic/sources/SymbolicC++3-3.35-ac.tar.gz

Y opted for library. Now, extract the tarball and then, from the README file:

This project attempts to extract the parts of SymbolicC++ that can
be compiled as part of a library and so create the include / library
infrastructure. The src and include directories are populated by
scripts from the SymbolicC++ header files.

== Installation to /usr/local ===============================================

To install to /usr/local:

  ./configure
  make
  make install

To compile a program using SymbolicC++ with GCC:

  g++ -o program program.cpp -lsymbolicc++

To run the program:

  ./program

A brief PDF document describing SymbolicC++ is provided (doc/introsymb.pdf)
and is installed as /usr/local/share/doc/SymbolicC++.pdf.

Here a simple example(from Wikipedia, do work!):

#include <iostream>
#include "symbolicc++.h"
using namespace std;

int main(void)
{
  Symbolic x("x");
  cout << integrate(x+1, x) <<endl;       // => 1/2*x^(2)+x
  Symbolic y("y");
  cout << df(y, x) << endl;               // => 0
  cout << df(y[x], x) << endl;            // => df(y[x],x)
  cout << df(exp(cos(y[x])), x) << endl ; // => -sin(y[x])*df(y[x],x)*e^cos(y[x])
  return 0;
}

Visual studio

There is a special version for VS:

http://issc.uj.ac.za/symbolic/sources/SymbolicC++3-3.35-vc.zip

I hope this helps!

查看更多
Animai°情兽
3楼-- · 2019-07-20 05:32

Directions for Visual Studio 2013

These instructions were tested in Visual Studio 2013.

From this website download "SymbolicC++3 3.35 for Visual C++"".

Unzip the archive.

Double click the file SymbolicC++3\SymbolicC++3.sln. This is the Microsoft Visual Studio Solution.

The Review Project and Solution Changes window will appear. Click OK.

Press CTRL-SHIFT-B to build the solution.

Create an example project

In the Solution Explorer, right click the solution, and select "Add" -> "New Project".

Select "Win32 Console Application".

Name your project "Example". Click OK.

In the "Win32 Application Wizard" click Next. Click Finish.

In the Solution Explorer, right click on the Example project and select "Set as StartUp Project".

In the Solution Explorer, right click on the Example project. Select "Add -> References...". Click the 'Add New Reference' button. Check the "SymbolicC++3" project. Click OK. Click OK.

In the Solution Explorer, right click on the solution, select "Configuration Manager...".

Change the configuration for "Example" to "Release".

Change the configuration for "SymbolicC++3" to "Static".

Click "Close".

In your Example.cpp source file, enter this example program:

#include "stdafx.h"

#include "..\include\symbolicc++.h"

int _tmain(int argc, _TCHAR* argv[])
{
    auto x = Symbolic("x");
    auto y = Symbolic("y");

    auto z = x * 3 * y * 4 * y * x / y;

    cout << "simplified: " << z << endl;

    cout << "numerical value: " << z[x == 1.2, y == 3.4] << endl;

    system("pause");
    return 0;
}

Press 'F5' to run the program.

查看更多
ゆ 、 Hurt°
4楼-- · 2019-07-20 05:46

These instructions were tested in Visual C++ 2010 Express.

From this website download "SymbolicC++3 3.35 for Visual C++"".

Unzip the archive.

Double click the file SymbolicC++3\SymbolicC++3.sln. This is the Microsoft Visual Studio Solution.

The Visual Studio Conversion Wizard will start. Click Next.

At the "Choose Whether To Create Backup" step, click Next.

At the "Ready to Convert" step, click Finish.

At the "Conversion Complete" step, click Close.

Press 'F7' to build the solution.

At this point you might receive many errors in the Output window. If so, edit the file Program Files (x86)\Microsoft Visual Studio 10.0\vc\include\xlocmon and change line 410 from:

_Str2 += '-', ++_Off;

to

{ _Str2 += '-'; ++_Off; }

and press 'F7' to begin the build again. See this StackOverflow question for more discussion about this problem and workaround.

Create an example project

In the Solution Explorer, right click the solution, and select "Add" -> "New Project".

Select "Win32 Console Application".

Name your project "Example".

In the "Win32 Application Wizard" click Next. Click Finish.

In the Solution Explorer, right click on the Example project and select "Set as StartUp Project".

In the Solution Explorer, right click on the Example project. Select "References...". Select "Add New Reference...". The "SymbolicC++3" project should be selected. Click OK.

Click OK.

In the Solution Explorer, right click on the solution, select "Configuration Manager...".

Change the configuration for "Example" to "Release".

Change the configuration for "SymbolicC++3" to "Static".

Click "Close".

In your Example.cpp source file, enter this example program:

#include "stdafx.h"

#include "..\include\symbolicc++.h"

int _tmain(int argc, _TCHAR* argv[])
{
    auto x = Symbolic("x");
    auto y = Symbolic("y");

    auto z = x * 3 * y * 4 * y * x / y;

    cout << "simplified: " << z << endl;

    cout << "numerical value: " << z[x == 1.2, y == 3.4] << endl;

    system("pause");
    return 0;
}

Press 'F5' to run the program.

查看更多
登录 后发表回答