1 | initial version |
Once, CH
has been computed, changing the values of the forms f[i]
has no effect on CH
, because they have gone from the expression of CH
, which is made only in terms of the symbolic variables g_*
, as pointed out by @rburing 's comment 1. What you want to do is a substitution in CH
. As stressed in @rburing 's comment 2, substitution of symbolic variables will not work if the computation involves any derivative. You must use instead symbolic functions. Here is an example:
sage: M = Manifold(3, 'M')
sage: X.<x,y,z> = M.chart()
sage: f = M.diff_form(2)
sage: f[0,1] = function('F')(x,y,z) # an unspecified function of (x,y,z)
sage: f[1,2] = function('G')(x,y,z)
sage: f.display()
F(x, y, z) dx/\dy + G(x, y, z) dy/\dz
sage: df = f.exterior_derivative()
sage: df.display()
(d(F)/dz + d(G)/dx) dx/\dy/\dz
sage: F0(x,y,z) = x*y*z # a callable symbolic expression
sage: G0(x,y,z) = x^2
sage: df[0,1,2] = df[0,1,2].expr().substitute_function(F, F0) # NB: substitute_function, not subs
sage: df[0,1,2] = df[0,1,2].expr().substitute_function(G, G0)
sage: df.display()
(x*y + 2*x) dx/\dy/\dz