differential operators

Christian Bauer Christian.Bauer at Uni-Mainz.DE
Thu Nov 20 16:14:05 CET 2003


Hi!

On Tue, Nov 18, 2003 at 06:20:30PM +0100, Kai Ludwig wrote:
> dF/du = du/du * du/dx + u * d/du du/dx
> 
> thus, formally
> 
> dF/du = du/dx + u * d/dx

Here's something hacked together that achieves the desired effect for
GiNaC 1.2 (treating the dx like a function):

const unsigned TINFO_differential = 0x42420001U;
                                                                                
DECLARE_FUNCTION_1P(dx)

// this is ad-hockery...
static ex dx_deriv(const ex & a, unsigned diff_param) { return dx(1); }

REGISTER_FUNCTION(dx,
  derivative_func(dx_deriv).
  set_return_type(return_types::noncommutative, TINFO_differential))

int main()
{
    symbol u("u", return_types::noncommutative, TINFO_differential);
    ex F = u * dx(u);

    cout << F << endl;
     // "u*dx(u)"
    cout << F.diff(u) << endl;
     // "u*dx(1)+dx(u)"
}

But I don't know if that's general enough for what you have in mind.

Bye,
Christian

-- 
  / Physics is an algorithm
\/ http://www.uni-mainz.de/~bauec002/



More information about the GiNaC-list mailing list