ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 01 Feb 2017 15:05:09 -0600how to simplify differential formhttp://ask.sagemath.org/question/36427/how-to-simplify-differential-form/Follow http://doc.sagemath.org/html/en/reference/tensor/sage/tensor/differential_form_element.html
I try the source code:
r,theta=var('r,theta')
U=CoordinatePatch((r,theta))
F=DifferentialForms(U)
x=DifferentialForm(F,0,r*cos(theta))
y=DifferentialForm(F,0,r*sin(theta))
a=x.diff().wedge(y.diff())
the output is: (r*cos(theta)^2 + r*sin(theta)^2)*dr/\dtheta
then I want to simplify_trig to the coefficients. Unfortunately a.simplify_trig() not working and all the map_coefficients and map_item are not defined.
Although in such case I can use: a[0,1]=a[0,1].simplify_trig() to do the job, for general case, maybe a 3 form depends on 6 variables, it is very cumbersome to apply simplify_trig to each coefficients.
One ugly method is: for i in a._components: a[i]=a[i].simplify_trig()
However it depends to real implementation not the interface. I want to ask whether there is an elegant way to do the same job, but just rely on the interface of class sage.tensor.differential_form_element.DifferentialFormWed, 01 Feb 2017 14:01:09 -0600http://ask.sagemath.org/question/36427/how-to-simplify-differential-form/Answer by eric_g for <p>Follow <a href="http://doc.sagemath.org/html/en/reference/tensor/sage/tensor/differential_form_element.html">http://doc.sagemath.org/html/en/refer...</a></p>
<p>I try the source code:</p>
<pre><code>r,theta=var('r,theta')
U=CoordinatePatch((r,theta))
F=DifferentialForms(U)
x=DifferentialForm(F,0,r*cos(theta))
y=DifferentialForm(F,0,r*sin(theta))
a=x.diff().wedge(y.diff())
the output is: (r*cos(theta)^2 + r*sin(theta)^2)*dr/\dtheta
</code></pre>
<p>then I want to simplify_trig to the coefficients. Unfortunately a.simplify_trig() not working and all the map_coefficients and map_item are not defined.</p>
<p>Although in such case I can use: a[0,1]=a[0,1].simplify_trig() to do the job, for general case, maybe a 3 form depends on 6 variables, it is very cumbersome to apply simplify_trig to each coefficients.</p>
<p>One ugly method is: for i in a._components: a[i]=a[i].simplify_trig()</p>
<p>However it depends to real implementation not the interface. I want to ask whether there is an elegant way to do the same job, but just rely on the interface of class sage.tensor.differential_form_element.DifferentialForm</p>
http://ask.sagemath.org/question/36427/how-to-simplify-differential-form/?answer=36429#post-id-36429With Sage 7.5.1, you can use the exterior calculus on manifolds instead of `DifferentialForm`; the advantage is that the simplification is automatic (no need to invoke `simplify_trig` by hand): your example becomes:
sage: U = Manifold(2, 'U')
sage: X.<r, theta> = U.chart(r"r:(0,+oo) theta:(0,2*pi):\theta")
sage: x = U.scalar_field(r*cos(theta))
sage: y = U.scalar_field(r*sin(theta))
sage: a = x.differential().wedge(y.differential())
sage: a
2-form on the 2-dimensional differentiable manifold U
sage: a.display()
r dr/\dtheta
See http://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/differentiable/diff_form.html for more details.Wed, 01 Feb 2017 15:05:09 -0600http://ask.sagemath.org/question/36427/how-to-simplify-differential-form/?answer=36429#post-id-36429