| 1 | initial version |
Consider the definition
phi = M.scalar_field(function('phi')(*coord), name='phi')
There are three layers here:
phi itself,function('phi')(*coord),function('phi').If you want to call substitute_function on an expression, you should pass two functions.
To access the function inside phi you need to peel off the layers: phi.expr().operator().
So, you can do what you want as follows:
E[0,0].expr().substitute_function(phi.expr().operator(), F1.expr().operator())
You can also assign the function inside phi to a variable (before defining phi), so you can use that instead.
| 2 | No.2 Revision |
Consider the definition
phi = M.scalar_field(function('phi')(*coord), name='phi')
There are three layers here:
phi itself,function('phi')(*coord),function('phi').If you want to call substitute_function on an expression, you should pass two functions.
To access the function inside phi you need to peel off the layers: phi.expr().operator().
So, you can do what you want as follows:
E[0,0].expr().substitute_function(phi.expr().operator(), F1.expr().operator())
You can also assign the function inside phi to a variable (before defining phi), so you can use that instead.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.