프롬프트> octave -qi
octave:1> # Let's find roots of the equation x^2 - 5 = 0.
octave:1> c = [1, 0, -5];       # 다항식의 계수들
octave:2> roots(c)
ans =

  -2.2361
   2.2361

octave:3> x = roots(c);
octave:4> x(1)
ans = -2.2361
octave:5> x(2)
ans =  2.2361
octave:6> sqrt(5)
ans =  2.2361
octave:7> format long
octave:8> x
x =

  -2.23606797749979
   2.23606797749979


octave:9> x(1), x(2)
ans = -2.23606797749979
ans =  2.23606797749979
octave:10> sqrt(5)
ans =  2.23606797749979

 

Posted by Scripter
,

프롬프트> octave -qi
octave:1> a = [1, 2, 3];
octave:2> b = [5, 3, 4, 3];
octave:3> union(a, b)      # 합집합
ans =

   1   2   3   4   5

octave:4> intersect(a, b)      # 공통집합
ans =  3
octave:5> setdiff(a, b)        # 차집합
ans =

   1   2

octave:6> setdiff(b, a)        # 차집합
ans =

   4   5

octave:7> setxor(a, b)        # 대칭차(symmetric difference)
ans =

   1   2   4   5

octave:8> unique(b)         # 중복 허용 않는 집합
ans =

   3   4   5

octave:9> ismember(a, b)       # 원소 확인
ans =

   0   0   1

octave:10> ismember(b, a)       # 원소 확인
ans =

   0   1   0   1

octave:11> ismember(unique(b), a)       # 원소 확인
ans =

   1   0   0

 

 

Posted by Scripter
,

Cygwin 의 터미널에서

$ xinit

하여 X 터미널을 열고, X 터미널의 쉘 프롬프트에서

$ octave -qi

하여 Octave 를 시작하여 다음 Octave 명령들을 입력한다. (saveas() 명령으로 그림을 파일로 저장할 수 있다.)

 

octave:1> t = linspace(0, 2*pi, 500);
octave:2> x = cos(t).**3;
octave:3> y = sin(t).**3;
octave:4> plot(x, y);     # => error!
octave:5> setenv("GNUTERM", "X11");     # 윈도우즈에서는 graphics_toolkit gnuplot;
octave:6> plot(x, y);
octave:7> saveas(1, "figure_asterisk.jpg", "jpg");
octave:8> close;

 

* X 터미널에서 Octave 를 실행 중인 모습

 

 * 위의 saveas() 명령으로 저장된 jpg 파일

 

 

이제 위의 작업을 Octave 대신 Gnuplot 으로 해보자.

먼저 Cygwin 의 쉘 프롬프트에서 

xinit
gnuplot> plot [0:2*pi] (cos(t))**3, (sin9t))**3

한 후, X 터미널이 뜨면 X 터미널의 쉘 프롬프트에서

gnuplot

하여 Gbuplot 을 실행시킨다. 그리고 다음 Gnuplot 명령들을 입력한다.

 

gnuplot> set term 11
gnuplot> set parametric
gnuplot> set size square
gnuplot> set size ratio -1
gnuplot> set grid
gnuplot> plot [0:2*pi] (cos(t))**3, (sin(t))**3

 

그러면 아래와 같이 매개변수 평면곡선이 X 터미널에 그려진다.

 

 

그림 창을 닫을려면 Guplot 프롬프트에서 다음 영령을 입역한다.


gnuplot> set term x11 close

 

이제 장금 그려졌던 그림을 jpg 파일로 저장해보자.


gnuplot> set term jpeg size 400,400
gnuplot> set output "asterisk_by_gnuplot.jpg"
gnuplot> replot

 

위의 replot 열령 하나만 하면 반금 X 터미널에 보여졌단 그래픽을 파일로 저장할 수 있다. 그러나 아직 그림 파일은 열려 있으며 완정되지 않았다. Gnuplot 이; 여정히 파일 핸들을 붇잡고 있어서 다른 에플리케이션이 이 이미지 파일에 접근 불가능하다. 그렇다고 Gnuplot 을 그냥 종료하면 그림ㄴ이 정상정으로 저장되기 전에 종료해 버리게 되므로 그림 파일을 제대을 얻지 못한다. Gnuplot  프롬프트에서 반드시 다음 명령을 해야만 완성된 그림 파일을 얻을 수 있다.


gnuplot> set output


 

 

 

* Gnuplot 에서 저장한 jpg 그림 파일


 

윈도우용 Gnuplot 을 설치한 경우

wgnuplot 을 실행시켜서 다음을 한 줄씩 입력하면서 진행 과정을 관찰해본다.

 

gnuplot> set para
gnuplot> set size square
gnuplot> set size ratio -1
gnuplot> plot [0:2*pi] (cos(t))**3, (sin(t))**3
gnuplot> set grid
gnuplot> replot
gnuplot> set term wind close
gnuplot> set term jpeg size 500,500 
gnuplot> set output "asterisk_by_wgnuplot.jpg" 
gnuplot> replot
gnuplot> set output 

 

Posted by Scripter
,

다음 연립 미분방정식과 초기조건 x(0) = 1, y(0) = 2 를 만족하는 두 함수  x = x(t), y = y(t)  의 그래프를 그려보자.

dx/dt = r*x*(1 -x/k) -a*x*y/(1 + b*x)
dy/dt = c*a*x*y/(1 + b*x) - d*y

단, 여기서 r = 0.25
               k = 1.4
               a = 1.5
               b = 0.16
               c = 0.9

이다.

즉,

dx/dt = 0.25*x*(1 -x/1.4) - 1.5*x*y/(1 + 0.16*x)
dy/dt = 3*1.5*x*y/(1 + 0.16*x) - 0.8*y

 

[Octave 소스파일: f.m]--------------------------------
function xdot = f (x, t)

  r = 0.25;
  k = 1.4;
  a = 1.5;
  b = 0.16;
  c = 0.9;
  d = 0.8;

  xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1));
  xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2);
endfunction

graphics_toolkit gnuplot
x0 = [1; 2];
t = linspace (0, 50, 200)';
x = lsode ("f", x0, t);
plot (t, x)

--------------------------------------------------------------
 

 

Posted by Scripter
,

plot 명령을 내리기 전에 graphics_toolkit gnuplot 명령을 먼저 내린다.

 

명령 프롬프트> octave -qi
octave:1> graphics_toolkit gnuplot
octave:2> x = linspace(0,1,400);
octave:3> y = x.^2;
octave:4> plot(x,y)

  

* 위의 코드로 그래프 창이 나타나지 않을 경우 다음 코드를 시도한다.

명령 프롬프트> octave -qi
octave:1> graphics_toolkit gnuplot
octave:2> setenv('GNUTERM','wx');
octave:3>x = linspace(0,1,400);
octave:4>y = x.^2;
octave:5> plot(x,y)

 

 

 

Cygwin 의 X 터미널에서 Octave 를 실행할 경우:

$ startx

또는

$ xinit

한 후 Octave 를 실행시켜서,

plot 명령을 내리기 전에 setenv("GNUTERM", "X11") 명령을 먼저 내린다.

 

쉘 프롬프트$ octave -qi
octave:1> x = linspace(0,1,400);
octave:2> y = x.^2;
octave:3> setenv("GNUTERM", "X11");
octave:4> plot(x,y);

 

 

이번에는 세 함수

    y = cos 2x,   y = sin 4x,  y = 2sin x

의 그래프를 한 좌표평면에 그려보자.

$ xinit

한 후, X 터미널에서

$ octave -qi
octave:1> x = linspace(0, 2*pi);
octave:2> a = cos(2*x);
octave:3> b = sin(4*x);
octave:4> c = 2*sin(x);
octave:5> setenv("GNUTERM", "X11");
octave:6> figure;
octave:7> hold off;
octave:8> plot(x, a, x, b, x, c);
octave:9> close all

 

 

Posted by Scripter
,

EditPlus3 의 메뉴에서

   도구(T) -----> 기본 설정(P) ...

을 택하고 기본 설정 창에서 아래와 같이 "사용자 도구" 항목을 지정한다.

 

 

 Python3 용 소스 파일 helloPython3.py 를 아래 처럼 작성하고 저장한 후 Ctrl+1 (숫지 1) 키를 누른다. (파일 저장시에는 BOM 없는 UTF-8 인코딩으로 지정한다.)

 

 

Posted by Scripter
,

JetBrasins 사의 인텔리제이 IDE 는 매우 유명한 자바 IDE 중 하나이다.

상용과 커뮤니티 용이 있는데 인텔리제이 IDE 내려받기에서 내려받으면 된다.

IDEA 를 처음 실행할 때 Java 홈 디렉토리와 Groovy 홈 디렉토리를 지정하고,

IDEA 창에서는 약간의 아이콘 메뉴를 지정한다.

새 Project 를 생성하고 src 폴더에 Groovy 클래스 GroovyHello 를 생성하여 아래와 같이 작성한다.

(Java 소스와 거의 유사한 Groovy 소스이다.)

윈도우즈의 파일 인코딩이 MS949 라 하더라도 IDEA 는 UTF-8 이 디폴트 인코딩이다.

Build 메뉴에서 빌드한 후, Run 메뉴에서 실행한다.

 

빌드하여 생성된 GroovyHello.class 를 명령창에서 java 커맨드로 직접 실행하려면 -cp 옵션으로 jar 라이브러리가 있는 곳을 지정해주면 된다.

프롬프트> java -cp .;C:\Groovy221\embeddable\groovy-all-2.2.1.jar GroovyHello
안녕? 나는 Groovy 입니다.
나는 Intelligent IDEA 도구를 이용하여 작성되었습니다.

 

Posted by Scripter
,

소스 파일 Hello.java 는 (BOM 마크 없는) UTF-8 인코딩으로 저장되어 있다.

디폴트 인코딩이 한글 윈도우 8.1 은 MS949 이고, Cygwin64 는 UTF-8 이다.

(Cygwin64 의 LANG 환경변수는 컴파일과 실행에 별로 상관 없는 듯 하다.)

Cygwin64 에는 자바가 설치되어 있지 않고 윈도우의 C:\Java7 폴더에 자바가 설치된 것으로 간주한다.

 

$ export PATH=/cygdrive/c/Java7/bin:$PATH

$ export JAVA_HOME=/cygdrive/c/Java7

$ echo $JAVA_HOME
/cygdrive/c/Java7

$ which java
/cygdrive/c/Java7/bin

$ which javac
/cygdrive/c/Java7/bin

 

/*
 * Filename: Hello.java
 *
 * For Cygwin64 on Windows8.1
 *
 * export LANG=ko_KR.EUC-KR
 * Or
 * export LANG=ko_KR.UTF-8
 *
 * Compile: javac -encoding UTF-8 Hello.java
 *
 * Execute: java -Dfile.encoding=UTF-8 Hello
 * Output:
 *        Hello, world!
 *        안녕하세요?
 */

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
        System.out.println("안녕하세요?");
    }
}

 

 

 



 

Posted by Scripter
,

SymbolicC++  는 GiNaC 처럼 심볼 처리 수학식 계산을 지원하지만, 리눅스 계열 뿐만 아니라 윈도우 환경에서도 Visual C++ 나 MinGW 의 g++ 와 함께 사용할 수 있는 수학 심볼 처리 라이브러리이다.

 

* SymbolicC++  내려받기

* Wikipedia 에서 설명하는 SymbolicC++

 

* MinGW 의 g++ 를 위한 SymbolicC++  라이브러리 만들기

모든 작업은 MinGW\msys\1.0 폴더에 있는 msys.bat 파일을 실행하여 msys 창에서 한다.

$ ./configure

$ make

$ make install

$ make clean

생성된 라이브러리 파일 libsymbolicc++.a 와 libsymbolicc++.la 는 /usr/local/lib 폴더에 존재하고, 헤더 파일 symbolicc++.h 는 /usr/local/include 폴더에 존재한다.

 

* 간단한 인터프리터 소스

/*
    SymbolicC++ : An object oriented computer algebra system written in C++

    Copyright (C) 2008 Yorick Hardy and Willi-Hans Steeb

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


// interpreter.cpp

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <cstdlib>
#include <cmath>
#include "symbolicc++.h"
using namespace std;

double error(string s)
{ cerr << "Error: " << s << ", using 0." << endl; return 0.0; }

class token
{
  private:
   int is_value;
   Symbolic v;
   string t;
   static map<string,Symbolic> values;
  public:
   token() : is_value(0), v(0), t("") {};
   token(const Symbolic &s) : is_value(1), v(s), t("") {};
   token(const string &s) : is_value(0), v(0), t(s)  {};
   Symbolic value();
   string name() { return t; }
   int isvalue() { return is_value; }
   Symbolic set(const Symbolic &d) { return values[t]=d; }
   int operator==(string s) { return (!is_value) && (t == s); }
   friend ostream& operator << (ostream&,token);
};

map<string,Symbolic> token::values;

Symbolic token::value()
{
  if(is_value) return v;
  char *end;
  int vali=(int)strtol(t.c_str(),&end,10);
  if(*end == '\0') return Symbolic(vali);
  double vald=strtod(t.c_str(),&end);
  if(*end == '\0') return Symbolic(vald);
  if(values.count(t)>0) return values[t];
  return Symbolic(t);
}

ostream& operator << (ostream& o,token t)
{ if(t.is_value) o << t.v; else o << t.t; return o;}

vector<token>
get_tokens(string s,string separator[],string ignore[])
{
  int i = 0, j, istoken = 0;
  vector<token> v;
  string value = "";
  while(i<(int)s.length())
  {
   istoken = 0;
   for(j=0;ignore[j] != "" && i<(int)s.length();j++)
    if(s.substr(i,ignore[j].length()) == ignore[j])
     i += ignore[j].length(), j = -1, istoken = 1;
   for(j=0;separator[j] != "" && !istoken;j++)
    if(s.substr(i,separator[j].length()) == separator[j])
    {
     if(value != "") { v.push_back(token(value)); value = ""; }
     v.push_back(token(separator[j]));
     i += separator[j].length();
     istoken = 1;
    }
   if(!istoken) value += s[i++];
   else if(value!="") { v.push_back(token(value)); value = ""; }
  }
  if(value != "") v.push_back(token(value));
  return v;
}

Symbolic spow(const Symbolic &x,const Symbolic &y) { return (x^y); }
Symbolic smul(const Symbolic &x,const Symbolic &y) { return x*y;   }
Symbolic sdiv(const Symbolic &x,const Symbolic &y) { return x/y;   }
Symbolic sadd(const Symbolic &x,const Symbolic &y) { return x+y;   }
Symbolic ssub(const Symbolic &x,const Symbolic &y) { return x-y;   }

Symbolic ssqrt(const vector<Symbolic> &x)  { return sqrt(x[0]);           }
Symbolic scos(const vector<Symbolic> &x)   { return cos(x[0]);            }
Symbolic ssin(const vector<Symbolic> &x)   { return sin(x[0]);            }
Symbolic stan(const vector<Symbolic> &x)   { return tan(x[0]);            }
Symbolic sexp(const vector<Symbolic> &x)   { return exp(x[0]);            }
Symbolic sln(const vector<Symbolic> &x)    { return ln(x[0]);             }
Symbolic slog(const vector<Symbolic> &x)   { return log(x[0],x[1]);       }
Symbolic sdf(const vector<Symbolic> &x)    { return df(x[0],x[1]);        }
Symbolic ssubst(const vector<Symbolic> &x) { return x[0].subst(x[1],x[2]);}
Symbolic sfunc(const vector<Symbolic> &x)  { return x[0][x[1]];           }

Symbolic evaluate(token t);

struct function {
 string name;
 int    args;
 Symbolic (*impl)(const vector<Symbolic>&);
};

Symbolic evaluate_tokens(vector<token> v)
{
  vector<token> v2, v3;
  int parenthesis, i, j, k;
  // function names, arity, and their implementation
  function functions[] = {
   { "sqrt",     1, ssqrt  },
   { "cos",      1, scos   },
   { "sin",      1, ssin   },
   { "tan",      1, stan   },
   { "exp",      1, sexp   },
   { "ln",       1, sln    },
   { "log",      2, slog   },
   { "df",       2, sdf    },
   { "subst",    3, ssubst },
   { "function", 2, sfunc  },
   { "" } };

  // default left operands for binary operators
  double initleft[] = { 1.0, 1.0, 0.0 };
  // binary operators and their implementation
  string opnames[][4] = { { "^", "" }, { "*", "/", "" }, { "+", "-", "" } };
  Symbolic (*opimpl[][3])(const Symbolic&,const Symbolic&) =
     { { spow }, { smul, sdiv }, { sadd, ssub } };

  // check for the assignment statement
  if(v.size()>2 && v[1] == "=") {
    for(j=2;j<(int)v.size();j++) v2.push_back(v[j]);
    return v[0].set(evaluate_tokens(v2));
  }

  // evaluate parenthesis first
  for(j=0;j<(int)v.size();j++)
  {
   if(v[j] == ")") return error("unbalanced parenthesis");
   else if(v[j] == "(")
   {
    for(parenthesis=1,j++;parenthesis && j<(int)v.size();j++)
    {
     if(v[j] == "(") parenthesis++;
     if(v[j] == ")") parenthesis--;
     // artificially end the parenthesized expression
     if(v[j] == "," && parenthesis == 1)
     {
      v2.push_back(token(evaluate_tokens(v3)));
      v3.clear();
     }
     else if(parenthesis) v3.push_back(v[j]);
    }
    if(parenthesis) return error("unbalanced parenthesis");
    v2.push_back(token(evaluate_tokens(v3)));
    v3.clear(); j--;
   }
   else v2.push_back(v[j]);
  }

  // evaluate functions
  for(j=0,v.clear();j<(int)v2.size();j++)
  {
   for(i=0;functions[i].name!="";i++)
   if(v2[j] == functions[i].name)
   {
    if(j+functions[i].args<(int)v2.size())
    {
      vector<Symbolic> args;
      for(k=1;k<=functions[i].args;k++)
       args.push_back(evaluate(v2[j+k]));
      v.push_back(token(functions[i].impl(args)));
      j+=functions[i].args;
    }
    else return error(functions[i].name           +
                      " without "                 +
                      char('0'+functions[i].args) +
                      " arguments");
    break;
   }
   if(functions[i].name=="") v.push_back(v2[j]);
  }
  // evaluate operators in order of precedence
  for(k=0,v2.clear();k<3;k++,v = v2,v2.clear())
  {
   token left(initleft[k]);
   for(j=0;j<(int)v.size();j++)
   {
    for(i=0;opnames[k][i]!="";i++)
    if(v[j] == opnames[k][i])
    {
     if(v2.size()) v2.pop_back();
     if(j+1<(int)v.size())
      v2.push_back(token(opimpl[k][i](evaluate(left),
                                      evaluate(v[++j]))));
     else return error(opnames[k][i]+" without second argument");
     break;
    }
    if(opnames[k][i]=="") v2.push_back(v[j]);
    left = v2.back();
   }
  }
  // check that evaluation gave a single result
  if(v.size() != 1)
  {
   for(j=0;j<(int)v.size();j++)
    cerr << "token " << j+1 << " : " << v[j] << endl;
   return error("could not evaluate expression");
  }
  return v[0].value();
}

Symbolic evaluate(token t)
{ vector<token> v; v.push_back(t); return evaluate_tokens(v); }

Symbolic evaluateformula(istream &s)
{
  char c;
  string expression;
  static string ws[] = { " ", "\t", "\n", "\r", "" };
  static string separator[] = { "=", "+", "-", "*", "/",
                                "^", "(", ")", ",", "" };
  do if((c = s.get()) != ';' && !s.eof()) expression += c;
  while(c != ';' && !s.eof());
  if(c != ';') return error("formula not terminated");
  vector<token> v = get_tokens(expression,separator,ws);
  return evaluate_tokens(v);
}

int main(void)
{
  while(!cin.eof())
  cout << " -> " << evaluateformula(cin) << endl;
  return 0;
}

 

* 컴파일 및 실행 (인터프리터를 실행하면 세미콜론(;)으로 끝나는 구문을 계산해준다.)

$ g++ -o interpreter interpreter.cpp -lsymbolicc++

$ ./interpreter
(x - 1)^3;
 -> x^(3)-3*x^(2)+3*x-1
2^3 - 2*3 + 5;
 -> 7
(x^2 - x + 1)*(x^2 + x + 1) ;
 -> x^(4)+x^(2)+1
2^10;
 -> 1024


 

Posted by Scripter
,

SymbolicC++  는 GiNaC 처럼 심볼 처리 수학식 계산을 지원하지만, 리눅스 계열 뿐만 아니라 윈도우 환경에서도 Visual C++ 나 MinGW 의 g++ 와 함께 사용할 수 있는 수학 심볼 처리 라이브러리이다.

 

* SymbolicC++  내려받기

* Wikipedia 에서 설명하는 SymbolicC++

 

* Visual C++ 를 위한 SymbolicC++  라이브러리 만들기

Visual Studio 에서 솔루션 파일 SymbolicC++3.sin 을 열고 아래 그림 처럼 메뉴 탭에서 Dynamic 이라고 설정된 곳을 Static 으로 변경하고 빌드한다.

그러면 에러와 경고가 몇 개 쏟아질 것이다.

 

* 에러 해결하기

SymbolicC++ 를 빌드하는 과정에서 C:\Program Files (x86)\Microsoft Visual Studio 10\VC\include 폴더에 있는 파일 xlocmon 410 째 줄에서 에러가 걸린다. 이 줄을

                 _Str2 += '-', ++_Off;   ------>    _Str2 += '-'; ++_Off;

처럼 수정(즉 콤마를 세미콜론으로 수정)하여 다시 저장한다.

그러면 에러는 해결되고 경고(warning) 몇 개가 남는다.

 

* 몇 가지 경고(warning) 해결하기

1) SymbolicC++ 의 소스 파일 중에 integrate.cpp 파일에서 "변수 se 가 선언되었지만 사용되지 않았다"는 경고가 몇 곳 나온다.  이런 경고를 해결하려면, integrate.cpp 파일에서

        } catch(const SymbolicError &se) {}

처럼 된 중을 모두 찾아

        } catch(const SymbolicError &se) { std::cout << se.message() << std::endl; }

처럼 수정하고, 이 파일의 선두 부분에 include 문

        #include <iostream>

을 추가한다..

 

2) equation.cpp 파일의 95 째 줄

        { return lhs.compare(rhs); }


        { return (lhs.compare(rhs) == 0) ? false : true; }

로 수정한다.

 

3) sum.cpp 파일의 373 째 줄

        if(j != matchpart.end()); matchpart.erase(j);


         (j != matchpart.end()) matchpart.erase(j);

로 수정한다. (세미콜론 하나 제거)

 

* SymbolicC++ 를 이용하는 간단한 부정적분 예제

/*
    SymbolicC++ : An object oriented computer algebra system written in C++

    Copyright (C) 2008 Yorick Hardy and Willi-Hans Steeb

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


// integration.cpp

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

int main(void)
{
  Symbolic x("x"), c("c"), z("z"), y;

  z = z[x];
  y = (1-x)*(1-x)+cos(x)+x*exp(x)+c+z;

  cout << "y = " << y << endl;

  for(int i=0;i<3;i++)
  {
   y = integrate(y,x);
   y = y[integrate(x*exp(x),x) == x*exp(x) - exp(x)];
   cout << "y = " << y << endl;
  }

  return 0;
}

 

 

* 위의 예제 소스 컴파일하기 (컴파일 옵션 /MD 가 중요)

프롬프트> cl /EHsc /I SymbolicC++3-3.35-vc\include integration.cpp SymbolicC++3.lib /MD

 

* 실행하기

프롬프트> integration
y = x^(2)-2*x+cos(x)+x*e^x+c+z[x]+1
y = 1/3*x^(3)-x^(2)+sin(x)+x*e^x-e^x+c*x+int(z[x],x)+x
y = 1/12*x^(4)-1/3*x^(3)-cos(x)+x*e^x-2*e^x+1/2*c*x^(2)+int(z[x],x,x)+1/2*x^(2)
y = 1/60*x^(5)-1/12*x^(4)-sin(x)+x*e^x-3*e^x+1/6*c*x^(3)+int(z[x],x,x,x)+1/6*x^(3)

 

 

Posted by Scripter
,