ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 25 Jun 2020 02:16:50 +0200Multiplying a vector to a listhttps://ask.sagemath.org/question/52213/multiplying-a-vector-to-a-list/Let's say I have a list of forms given by
U = Manifold(4, 'U')
X.<x, y, z, w> = U.chart()
f = U.diff_form(3, 'f')
f[0, 1, 2] = x^2
g = U.diff_form(3, 'g')
g[0, 1, 2] = y^2
h = U.diff_form(3, 'g')
h[0, 1, 2] = z^3
List = [f, g, h]
So I have a list of 3 elements, each a 3-form.
Let's assume I have a list of vectors given by
ListofVectors = [(0, 1, 1), (0, 2, 1), (1, 2, 3)]
I want to do a dot product but the problem is Sage won't
let me make `List` into a vector so I can do like
List.dot_product(ListofVectors[i]) for i < len(ListforVectors)
Basically, I want a new list with `[g + h, 2*h + g, f + 2*g + 3*h]`. Is there a way to dot product a list of forms with a list of vectors? Again, I think the main issue is I can't turn List into a vector for the dot product function to make sense.whatupmattThu, 25 Jun 2020 02:16:50 +0200https://ask.sagemath.org/question/52213/Convert from algebra of differential formshttps://ask.sagemath.org/question/41318/convert-from-algebra-of-differential-forms/ I have differential forms of that look like x^2*y or y^3, so, just 0 forms. The parent ring is the algebra of differential forms in the variables x,y, but I was wondering if there was a way to convert the forms to live in a polynomial ring instead. Thanks.victoriamiranWed, 28 Feb 2018 23:14:15 +0100https://ask.sagemath.org/question/41318/how to simplify differential formhttps://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.DifferentialFormcguoWed, 01 Feb 2017 21:01:09 +0100https://ask.sagemath.org/question/36427/Using differential forms---within SageManifoldshttps://ask.sagemath.org/question/34321/using-differential-forms-within-sagemanifolds/ Hi all.
I'm aware of the implementation of `DifferentialForms` within `SageManifolds`, but I'd like to know how could I use this forms with ease.
In the **Sage Reference Manual_Manifolds**, there are examples of `AffineConnection` and the `connection_form`. However, it seems that the last (`connection_form`) does not allow to store the calculations, like for example:
nab = g.connection() ## This works for the usual connection
nab.display()
omega = nab.connection_form() ## DOES NOT work, one needs to specify components
I would like to calculate all the components of the connection form, to be able of compute *covariant exterior derivatives* of other objects.
How can the connection, curvature and torsion forms be stored (as differential forms)?
Thank you, and cheers.DoxWed, 03 Aug 2016 17:57:44 +0200https://ask.sagemath.org/question/34321/R-module/algebra valued differential formshttps://ask.sagemath.org/question/28736/r-modulealgebra-valued-differential-forms/I know one can work with real differential forms using SageManifolds, but what are the chances one can use out of the box code to extend to values in some vector space, or better, algebra? I'm thinking matrix Lie algebras, so one could work quite concretely, rather than over some abstract module.David RobertsFri, 31 Jul 2015 08:50:41 +0200https://ask.sagemath.org/question/28736/Differential forms and tensorshttps://ask.sagemath.org/question/9297/differential-forms-and-tensors/Dear all,
A long time ago I was trying to implement a SAGE code for working with [Differential Forms with values in a certain Lie algebra](http://doxdrum.wordpress.com/2011/02/10/sage-tip-creating-a-class-for-non-abelian-forms/), but due to my lack of programming knowledge, I couldn't.
This kind of objects are important for working with *non-Abelin gauge theories*.
**Question**
Is it possible to define and work with those objects?
So far there is no reference of it in the manual.
Thank you!DoxWed, 05 Sep 2012 15:48:24 +0200https://ask.sagemath.org/question/9297/how to re-order factorshttps://ask.sagemath.org/question/25837/how-to-re-order-factors/ I have
x,y, dx, dy= var("x, y, dx, dy");
def iD(f): return diff(f, x)*dx + diff(f,y)*dy;
`iD(x^3*y^5)` returns
5*dy*x^3*y^4 + 3*dx*x^2*y^5
is there a way to have it return the differentials always at the end as in
5*x^3*y^4*dy + 3*x^2*y^5*dx
thank you
userXSun, 15 Feb 2015 23:41:17 +0100https://ask.sagemath.org/question/25837/Define a differential form recursivelyhttps://ask.sagemath.org/question/10932/define-a-differential-form-recursively/I have the following code:
n=3;
x = list(var('x_%d' % i) for i in (1..2*n));
U = CoordinatePatch(x);
F = DifferentialForms(U);
w = DifferentialForm(F,2);
for j in range(2*n-1):
for k in range(2*n-1):
w[j,k]=j+k;
w;
It's supposed to define a differential form whose (j,k)th member is j+k, but this code just returns the 0 differential form. I've tried many variations using for, while, etc., but none seem to work. I suspect it's because a differential form is stored as a dictionary, but since I'm a beginner in Sage, I have no idea what to do. Any help is appreciated.rfauffarThu, 16 Jan 2014 14:04:02 +0100https://ask.sagemath.org/question/10932/Define differential form in n variableshttps://ask.sagemath.org/question/10917/define-differential-form-in-n-variables/I'd like to define a differential form in n variables (where n is defined beforehand, and I'd like for it to be able to be arbitrarily big. For this reason I'd like to write a code for general n). My first idea is to write something of the sort:
n=var('n');
n=3;
x = list(var('x_%d' % i) for i in (1..n));
U = CoordinatePatch(x);
F = DifferentialForms(U);
w = DifferentialForm(F,2);
[w[i,2]=3 for i in range(0,n-1)]
The value w[i,2]=3 is obviously arbitrary. I don't know why the code doesn't work, it says that there's a syntax error with w[i,2]=3.rfauffarWed, 15 Jan 2014 18:28:42 +0100https://ask.sagemath.org/question/10917/Changing basis on a vector spacehttps://ask.sagemath.org/question/10327/changing-basis-on-a-vector-space/Dear community:
I'd like to know if it is possible use a basis other than the canonical. For example
> sage: V = VectorSpace(SR,3)
> sage: V.basis()
> [ (1, 0, 0),
> (0, 1, 0),
> (0, 0, 1) ]
is the canonical basis of `V`, but I want to use say
> [ (1, 1, 0),
> (1, -1, 0),
> (0, 0, 1)]
How could I do that?
**Edit**
More specifically, I'd like to define two different basis on a vector space. Say, a set of coordinate basis and a non-coordinate basis defined over the same vector space... and finally I'd like to express results in either of them.
I'm interested on a change of basis on Differential Forms, but I guess that if you can help me to understand the general problem I can manage the particular one! ChreesDoxSat, 06 Jul 2013 17:04:31 +0200https://ask.sagemath.org/question/10327/Conversion of Differential Forms to a manipulable symbolic expressionhttps://ask.sagemath.org/question/10090/conversion-of-differential-forms-to-a-manipulable-symbolic-expression/[Sage 5.4.1] Hi, I got the following code that does total differentiation off a Sage blog:
sage: x, y, z = var('x, y, z')
sage: U = CoordinatePatch((x, y, z))
sage: F = DifferentialForms(U)
sage: f = F(x^2 + y + sin(z)); f
(x^2 + y + sin(z))
sage: g = f.diff(); g
cos(z)*dz + 2*x*dx + dy
How do I convert `g` to a symbolic form where `dx`, `dy`, and `dz` are also symbolic variables? I need to assign values to all variables via a for loop. Also, is it possible for `g` to be a 3x3 matrix? Thanks much, mahlon
DionysusSat, 04 May 2013 23:04:16 +0200https://ask.sagemath.org/question/10090/Changing notation in differential formshttps://ask.sagemath.org/question/10204/changing-notation-in-differential-forms/Dear all:
I'm trying to compute the curvature of a Schwarzschild metric using differential forms (Cartan formalism),
sage: reset()
sage: var('t,r,theta,phi')
sage: coords = [t,r,theta, phi]
sage: U = CoordinatePatch((t,r,theta, phi))
sage: Omega = DifferentialForms(U)
sage: X = function('X', r, latex_name=r"\Xi")
sage: f = exp(X)
sage: vi =[]
sage: for i in xrange(len(coords)):
... vi.append(DifferentialForm(Omega,1))
sage: vi[0][0] = f
sage: vi[1][1] = 1/f
sage: vi[2][2] = r
sage: vi[3][3] = r*sin(theta)
sage: dvi=[]
sage: for i in xrange(len(coords)):
... dvi.append(diff(vi[i]))
...
sage: dvi
[-e^X(r)*D[0](X)(r)*dt/\dr, 0, dr/\dtheta, sin(theta)*dr/\dphi + r*cos(theta)*dtheta/\dphi]
I'd like to know if it's possible to manipulate the result in a way that:
- the term `D[0](X)(r)` in the last line could be written as `X'(r)` or just `X'`.
- the `dvi` is expressed in terms of the `vi`-forms instead of the `Omega`-basis.
Any help is thanked.DoxFri, 07 Jun 2013 12:36:47 +0200https://ask.sagemath.org/question/10204/