Ask Your Question

Revision history [back]

Here is the answer of @dan_fulea adapted to the manifold version of differential forms:

sage: U = Manifold(3, 'U')
sage: X.<x,y,z> = U.chart()
sage: f = U.diff_form(1)   # a shortcut is f = U.one_form()
sage: f[:] = (y*z + exp(y) + x^2, 
....:         z^2 + x*z + x*exp(y) + y^3,
....:         exp(z) +2*y*z + x*y)
sage: f.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: g = f
sage: G0 = U.scalar_field(integral(g[0].expr(), X[0]))
sage: g = g - G0.differential()
sage: G1 = U.scalar_field(integral(g[1].expr(), X[1]))
sage: g = g - G1.differential()
sage: G2 = U.scalar_field(integral(g[2].expr(), X[2]))
sage: G = G0 + G1 + G2
sage: G.display()
U --> R
(x, y, z) |--> 1/4*y^4 + 1/3*x^3 + x*y*z + y*z^2 + x*e^y + e^z
sage: dG = G.differential(); dG
1-form on the 3-dimensional differentiable manifold U
sage: dG.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: dG == f
True

Here is the answer of @dan_fulea adapted to the manifold version of differential forms:

sage: U = Manifold(3, 'U')
sage: X.<x,y,z> = U.chart()
sage: f = U.diff_form(1)   # a shortcut is f = U.one_form()
sage: f[:] = (y*z + exp(y) + x^2, 
....:         z^2 + x*z + x*exp(y) + y^3,
....:         exp(z) +2*y*z + x*y)
sage: f.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: f.exterior_derivative()
2-form on the 3-dimensional differentiable manifold U
sage: f.exterior_derivative() == 0  # checking that f is exact
True
sage: g = f
sage: G0 = U.scalar_field(integral(g[0].expr(), X[0]))
sage: g = g - G0.differential()
sage: G1 = U.scalar_field(integral(g[1].expr(), X[1]))
sage: g = g - G1.differential()
sage: G2 = U.scalar_field(integral(g[2].expr(), X[2]))
sage: G = G0 + G1 + G2
sage: G.display()
U --> R
(x, y, z) |--> 1/4*y^4 + 1/3*x^3 + x*y*z + y*z^2 + x*e^y + e^z
sage: dG = G.differential(); dG
1-form on the 3-dimensional differentiable manifold U
sage: dG.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: dG == f
True

Here is the answer of @dan_fulea adapted to the manifold version version of differential forms:

sage: U = Manifold(3, 'U')
sage: X.<x,y,z> = U.chart()
sage: f = U.diff_form(1)   # a shortcut is f = U.one_form()
sage: f[:] = (y*z + exp(y) + x^2, 
....:         z^2 + x*z + x*exp(y) + y^3,
....:         exp(z) +2*y*z + x*y)
sage: f.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: f.exterior_derivative()
2-form on the 3-dimensional differentiable manifold U
sage: f.exterior_derivative() == 0  # checking that f is exact
True
sage: g = f
sage: G0 = U.scalar_field(integral(g[0].expr(), X[0]))
sage: g = g - G0.differential()
sage: G1 = U.scalar_field(integral(g[1].expr(), X[1]))
sage: g = g - G1.differential()
sage: G2 = U.scalar_field(integral(g[2].expr(), X[2]))
sage: G = G0 + G1 + G2
sage: G.display()
U --> R
(x, y, z) |--> 1/4*y^4 + 1/3*x^3 + x*y*z + y*z^2 + x*e^y + e^z
sage: dG = G.differential(); dG
1-form on the 3-dimensional differentiable manifold U
sage: dG.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: dG == f
True

Here is the answer of @dan_fulea adapted to the manifold version of differential forms:

sage: U = Manifold(3, 'U')
sage: X.<x,y,z> = U.chart()
sage: f = U.diff_form(1)   # a shortcut is f = U.one_form()
sage: f[:] = (y*z + exp(y) + x^2, 
....:         z^2 + x*z + x*exp(y) + y^3,
....:         exp(z) +2*y*z + x*y)
sage: f.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: f.exterior_derivative()
2-form on the 3-dimensional differentiable manifold U
sage: f.exterior_derivative() == 0  # checking that f is exact
True
sage: g = f
sage: G0 = U.scalar_field(integral(g[0].expr(), X[0]))
sage: g = g - G0.differential()
sage: G1 = U.scalar_field(integral(g[1].expr(), X[1]))
sage: g = g - G1.differential()
sage: G2 = U.scalar_field(integral(g[2].expr(), X[2]))
sage: G = G0 + G1 + G2
sage: G.display()
U --> R
(x, y, z) |--> 1/4*y^4 + 1/3*x^3 + x*y*z + y*z^2 + x*e^y + e^z
sage: dG = G.differential(); dG
1-form on the 3-dimensional differentiable manifold U
sage: dG.display()
(x^2 + y*z + e^y) dx + (y^3 + x*z + z^2 + x*e^y) dy + (x*y + 2*y*z + e^z) dz
sage: dG == f
True

Note that you may equivalently declare the scalar fields G0, G1 and G2 as differential forms of degree 0, but then you have to set their values in a second stage, by means of the method set_expr. In other words, you can replaceG0 = U.scalar_field(integral(g[0].expr(), X[0])) by

sage: G0 = U.diff_form(0)
sage: G0.set_expr(integral(g[0].expr(), X[0]))