Ask Your Question

nosneros's profile - activity

2018-03-27 11:31:09 +0100 received badge  Student (source)
2014-06-29 21:36:24 +0100 received badge  Notable Question (source)
2014-06-29 21:36:24 +0100 received badge  Famous Question (source)
2014-06-29 21:36:24 +0100 received badge  Popular Question (source)
2013-06-14 17:45:42 +0100 commented question Lazy evaluation of derivatives of an unknown function

That is what I'm doing for now, but I was thinking it would be convenient to be able to construct the system of pdes with an arbitrary unknown function and then substitute in the trial solutions to check them. I will play with it a bit more and see if I can come up with a better example use case. Thanks!

2013-06-10 12:28:27 +0100 received badge  Supporter (source)
2013-06-10 12:27:40 +0100 asked a question Lazy evaluation of derivatives of an unknown function

Hi,

I am using Sage to check some solutions to partial differential equations. I am wondering if a have an unknown function f, can I somehow form the PDE in terms of its derivatives and then substitute in the assumed solution and evaluate the derivatives after the fact?

Here is what I tried so far:

var('x y')
f = function('f', x, y)
g = derivative(f, x, y) 

print(g) 

D[0, 1](f)(x, y)
h = D[0, 1](f)(x, y)
print(h) 

Traceback (click to the left of this block for traceback)
...
TypeError: 'sage.symbolic.expression.Expression' object has no
attribute '__getitem__'

I figured out that D[0, 1] represents the derivatives with respect to the ith indepent variable of the function (is this a Maxima expression?), but I'm not sure then how to use these types of expressions when I finally want to substitute in the known form of f. I.e., since the output of the expression for g is in terms of D[], and when I try to reuse that expression as h, I get an error (since D is actually some other type of object). Any help would be appreciated. Let me know if my question is not clear.

Many thanks!