Changeset 9de0abd in git for Singular/LIB


Ignore:
Timestamp:
Oct 14, 2010, 8:30:42 PM (14 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
47d83a1a12f99e384d92eba3cd8bc435b7666c94
Parents:
8059d4af6d5b03c3046b05aedbc4b76e360f1488
Message:
*levandov: more theory, explanations, example enhanced

git-svn-id: file:///usr/local/Singular/svn/trunk@13496 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/findifs.lib

    r8059d4 r9de0abd  
    44info="
    55LIBRARY: findifs.lib  Tools for the finite difference schemes
    6 AUTHORS: Viktor Levandovskyy,     levandov@risc.uni-linz.ac.at
    7 
    8 THEORY: We provide the presentation of difference operators in a polynomial,
     6AUTHORS: Viktor Levandovskyy,     levandov@math.rwth-aachen.de
     7
     8OVERVIEW:
     9        We provide the presentation of difference operators in a polynomial,
    910        semi-factorized and a nodal form. Running @code{findifs_example();}
    10         will show how we generate finite difference schemes of linear PDE's
    11         from given approximations.
     11        will demonstrate, how we generate finite difference schemes of linear PDEs
     12        from given approximations.
     13
     14Theory: The method we use have been developed by V. Levandovskyy and Bernd Martin. The
     15computation of a finite difference scheme of a given single linear partial
     16differential equation with constant coefficients with a given approximation
     17rules boils down to the computation of a Groebner basis of a submodule of
     18a free module with respect to the ordering, eliminating module components.
     19
     20
     21Support: SpezialForschungsBereich F1301 of the Austrian FWF
    1222
    1323PROCEDURES:
     24findifs_example();  containes a guided explanation of our approach
    1425decoef(P,n);  decompose polynomial P into summands with respect to the number n
    1526difpoly2tex(S,P[,Q]); present the difference scheme in the nodal form
    1627
    17 AUXILIARY PROCEDURES:
    18 findifs_example();  containes a guided explanation of our approach
     28
    1929exp2pt(P[,L]); convert a polynomial M into the TeX format, in nodal form
    20 mon2pt(P[,L]); convert a monomial M into the TeX format, in nodal form
    2130texcoef(n);  converts the number n into TeX
    2231npar(n); search for 'n' among the parameters and returns its number
    2332magnitude(P); compute the square of the magnitude of a complex expression
    2433replace(s,what,with);  replace in s all the substrings with a given string
    25 xchange(w,a,b); exchange two substrings of a string
    26 par2tex(s);     convert special characters to TeX in s
     34xchange(w,a,b); exchange two substrings in a given string
     35
     36SEE ALSO: latex_lib, findiff_lib
    2737";
    2838
     
    3040LIB "latex.lib";
    3141LIB "poly.lib";
     42
     43proc tst_findif()
     44{
     45  example decoef;
     46  example difpoly2tex;
     47  example exp2pt;
     48  example texcoef;
     49  example npar;
     50  example magnitude;
     51  example replace;
     52  example xchange;
     53}
     54
     55// static procs:
     56// par2tex(s);     convert special characters to TeX in s
     57// mon2pt(P[,L]); convert a monomial M into the TeX format, in nodal form
     58
    3259
    3360// 1. GLOBAL ASSUME: in the ring we have first Tx, then Tt: [FIXED, not needed anymore]!
     
    6390}
    6491
    65 proc par2tex(string s)
     92static proc par2tex(string s)
    6693"USAGE:  par2tex(s);  s a string
    6794RETURN:  string
     
    73100EXAMPLE: example par2tex; shows examples
    74101"{
     102  // can be done with the help of latex_lib
     103
    75104// s is a tex string with a poly
    76105// replace theta with \theta
     
    220249}
    221250
    222 proc mon2pt(poly M, string V)
     251static proc mon2pt(poly M, string V)
    223252"USAGE:  mon2pt(M,V);  M poly, V a string
    224253RETURN:  string
     
    334363RETURN:  ideal
    335364PURPOSE:  decompose polynomial P into summands with respect
    336 to the  presence of a number n in the coefficients
     365to the  presence of the number n in the coefficients
    337366NOTE:    n is usually a parameter with no power
    338367EXAMPLE: example decoef; shows examples
     
    395424RETURN:  string
    396425PURPOSE:  converts the number n into TeX format
    397 NOTE: if n is a polynomial, texcoef adds extra brackets.
    398 @* Performs some space substitutions
     426NOTE: if n is a polynomial, texcoef adds extra brackets and performs some space substitutions
    399427EXAMPLE: example texcoef; shows examples
    400428"{
     
    464492RETURN:  string
    465493PURPOSE: present the difference scheme in the nodal form
    466 ASSUME: ideal S is the result of 'decoef' procedure
     494ASSUME: ideal S is the result of @code{decoef} procedure
    467495NOTE: a list P may be empty or may contain parameters, which will not
    468496appear in denominators
     
    611639"
    612640{
    613   // check whether i is present among the vars TODO
    614   // assume i^2+1=0;
     641  // check whether i is present among the vars
     642  list L = ringlist(basering)[2]; // vars
     643  int j; int cnt = 0;
     644  for(j=size(L);j>0;j--)
     645  {
     646    if (L[j] == "i")
     647    {
     648      cnt = 1; break;
     649    }
     650  }
     651  if (!cnt)
     652  {
     653    ERROR("a variable called i is expected in basering");
     654  }
     655  // i is present, check that i^2+1=0;
     656//   if (NF(i^2+1,std(0)) != 0)
     657//   {
     658//     "Warning: i^2+1=0 does not hold. Reduce the output manually";
     659//   }
    615660  poly re = subst(P,i,0);
    616661  poly im = (P - re)/i;
     
    621666  "EXAMPLE:"; echo=2;
    622667  ring r = (0,d),(g,i,sin,cos),dp;
    623   poly P = d*i*sin - g*cos +d^2;
    624   magnitude(P);
     668  poly P = d*i*sin - g*cos +d^2*i;
     669  NF( magnitude(P), std(i^2+1) );
    625670}
    626671
     
    637682  return(t);
    638683}
    639 
    640 static proc ElimModComp(module M, int num)
    641 {
    642   // experimental, todo
    643   // check whether a curr.ord is elim-comp
    644   string s = ordstr(basering);
    645   int ns = size(s);
    646   //  s[ns] = "c", "C";
    647   if (s[1]="c")
    648   {
    649     // num last components
    650   }
    651   if (s[1]="C")
    652   {
    653     // num first components
    654   }
    655 }
    656 
    657684
    658685static proc simfrac(poly up, poly down)
     
    713740 " module R = transpose(M);";
    714741 " module S = std(R);";
    715  " poly   p = S[4,1];" ;
    716742 module R = transpose(M);
    717743 module S = std(R);
     744 " * See the result of Groebner bases: generators are columns";
     745 " print(S);";
     746 print(S);
     747 " * So, only the first column has its nonzero element in the last component";
     748 " * Hence, this polynomial is the scheme";
     749 " poly   p = S[4,1];" ;
    718750 poly   p = S[4,1]; // by elimination of module components
     751 " print(p); ";
     752 print(p);
    719753 list L; L[1]=A;L[2] = B;
    720754 ideal I = decoef(p,dt); // make splitting w.r.t. the appearance of dt
Note: See TracChangeset for help on using the changeset viewer.