Qucs-core  0.0.19
differentiate.h
Go to the documentation of this file.
00001 /*
00002  * differentiate.h - definitions for Qucs equation derivatives
00003  *
00004  * Copyright (C) 2007, 2008 Stefan Jahn <stefan@lkcc.org>
00005  *
00006  * This is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2, or (at your option)
00009  * any later version.
00010  *
00011  * This software is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this package; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  * $Id$
00022  *
00023  */
00024 
00025 #ifndef __DIFFERENTIATE_H__
00026 #define __DIFFERENTIATE_H__
00027 
00028 namespace qucs {
00029 
00030 namespace eqn {
00031 
00032 class constant;
00033 
00034 /* This class is merely a container for the derivatives which can be
00035    applied to equations. */
00036 class differentiate
00037 {
00038  public:
00039   static node * plus_binary  (application *, char *);
00040   static node * plus_unary   (application *, char *);
00041   static node * minus_binary (application *, char *);
00042   static node * minus_unary  (application *, char *);
00043   static node * times        (application *, char *);
00044   static node * over         (application *, char *);
00045   static node * power        (application *, char *);
00046   static node * ln           (application *, char *);
00047   static node * log10        (application *, char *);
00048   static node * log2         (application *, char *);
00049   static node * sqrt         (application *, char *);
00050   static node * exp          (application *, char *);
00051   static node * sinc         (application *, char *);
00052   static node * norm         (application *, char *);
00053   static node * sin          (application *, char *);
00054   static node * cos          (application *, char *);
00055   static node * tan          (application *, char *);
00056   static node * sec          (application *, char *);
00057   static node * cot          (application *, char *);
00058   static node * cosec        (application *, char *);
00059   static node * arcsin       (application *, char *);
00060   static node * square       (application *, char *);
00061   static node * arccos       (application *, char *);
00062   static node * arctan       (application *, char *);
00063   static node * arccot       (application *, char *);
00064   static node * arcsec       (application *, char *);
00065   static node * arccosec     (application *, char *);
00066   static node * abs          (application *, char *);
00067   static node * step         (application *, char *);
00068   static node * sign         (application *, char *);
00069   static node * sinh         (application *, char *);
00070   static node * cosh         (application *, char *);
00071   static node * tanh         (application *, char *);
00072   static node * coth         (application *, char *);
00073   static node * arsinh       (application *, char *);
00074   static node * arcosh       (application *, char *);
00075   static node * artanh       (application *, char *);
00076   static node * arcoth       (application *, char *);
00077   static node * arsech       (application *, char *);
00078   static node * arcosech     (application *, char *);
00079   static node * ifthenelse   (application *, char *);
00080   static node * xhypot       (application *, char *);
00081   static node * limexp       (application *, char *);
00082   static node * vt           (application *, char *);
00083 
00084  private:
00085   static node * plus_reduce  (node *, node *);
00086   static node * minus_reduce (node *, node *);
00087   static node * minus_reduce (node *);
00088   static node * times_reduce (node *, node *);
00089   static node * over_reduce  (node *, node *);
00090   static node * power_reduce (node *, node *);
00091   static node * ln_reduce    (node *);
00092   static node * sqrt_reduce  (node *);
00093   static node * sqr_reduce   (node *);
00094   static node * app_reduce   (const char *, node *, node *);
00095   static node * hypot_reduce (node *, node *);
00096 
00097  private:
00098   static void   over_reduce_adv (node * &, node * &);
00099 };
00100 
00101 // Type of derivative function.
00102 typedef node * (* differentiator_t) (application *, char *);
00103 
00104 // Structure defining an differentiation.
00105 struct differentiation_t
00106 {
00107   const char * application; /* the name of the application         */
00108   differentiator_t derive;  /* the actual differentiation function */
00109   int nargs;                /* number of arguments                 */
00110 };
00111 
00112 extern struct differentiation_t differentiations[];
00113 
00114 } /* namespace eqn */
00115 
00116 } // namespace qucs
00117 
00118 #endif /* __DIFFERENTIATE_H__ */