Douglas Weathers
Douglas Weathers

Reputation: 131

How to explicitly write the derivatives of a symbolic function?

I have

u = function('u',x)

and I'm interested in what happens when powers of some scalar a are eigenvalues of the differentiation operator (i.e. D^n u = a^n*u). For n=1,2 elementary function examples exist (De^(a*x) = a*e^(a*x), sin and cos for a=i and n=2) but for higher powers I need to go abstract.

My question is, how do you assign derivatives to u symbolically? One option is to write a function that differentiates everything normally but sends u to a*u, but what if I just want D^3u = a^3*u?

In other words, if I want every derivative of u to just be "the derivative of u" (D[...](u)(x)) except for the third, which I want to be a^3*u for some scalar a. How could I implement that?

Upvotes: 3

Views: 171

Answers (1)

Fred Senese
Fred Senese

Reputation: 670

What's wrong with the solution you propose in your second paragraph? e. g. in Maxima,

D[n](u, x) := if n=3 then a^3*u(x) else diff(u(x),x,n)$

gives you what you want, doesn't it?

Maxima lets you assign first derivatives symbolically with gradef, but I don't know of any way to assign higher-order derivatives that way.

Upvotes: 1

Related Questions