Ask Your Question

eric_g's profile - activity

2021-05-09 22:12:29 +0200 commented question Geodesics/tangent vector evaluation interpolation error

Since you are dealing with a single chart, why don't you use the method solve() instead of solve_accross_charts() and re

2021-05-09 18:07:40 +0200 commented question Geodesics/tangent vector evaluation interpolation error

The code is still incomplete; m is not defined and the metric is not initialized.

2021-05-09 12:16:01 +0200 commented question Geodesics/tangent vector evaluation interpolation error

Can you share the whole code that you are using, so that one can reproduce your issue? In particular, what are M and ini

2021-05-05 17:24:36 +0200 answered a question Gaussian Curvature of a 2D manifold.

For 2-dimensional Riemannian manifolds, the Gaussian curvature is obtained as half the Ricci scalar: K = M.metric().ric

2021-05-04 16:26:19 +0200 received badge  Nice Answer (source)
2021-05-02 23:22:10 +0200 received badge  Nice Answer (source)
2021-05-02 21:59:27 +0200 answered a question Integrating differential forms

Indeed, integration of differential forms is not implemented yet. Meanwhile, you can pass the symbolic expression repres

2021-05-01 15:24:09 +0200 edited answer Working with tetrads and the spin connection

Spin connections are not implemented yet. However, note that generic tetrads are implemented and that the connection coe

2021-05-01 15:14:02 +0200 answered a question Working with tetrads and the spin connection

Spin connections are not implemented yet. However, note that generic tetrads are implemented and that the connection coe

2021-04-29 00:12:46 +0200 edited answer Differential forms on non-standard spherical coordinates

Simply use the method chart to define your own version of spherical coordinates and then relate them to Sage's default s

2021-04-29 00:11:31 +0200 edited answer Differential forms on non-standard spherical coordinates

Simply use the method chart to define your own version of spherical coordinates and then relate them to Sage's default s

2021-04-28 23:03:48 +0200 commented answer Differential forms on non-standard spherical coordinates

It looks correct to me: in the coordinate basis dr/\dtheta/\dphi there should not be any scaling factor like 1/(r*cos(th

2021-04-28 22:57:20 +0200 edited answer Differential forms on non-standard spherical coordinates

Simply use the method chart to define your own version of spherical coordinates and then relate them to Sage's default s

2021-04-28 22:55:32 +0200 edited answer Differential forms on non-standard spherical coordinates

Simply use the method chart to define your own version of spherical coordinates and then relate them to Sage's default s

2021-04-28 18:23:29 +0200 commented answer Differential forms on non-standard spherical coordinates

It looks correct to me: in the coordinate basis dr/\dtheta/\dphi there should not be any scaling factor like 1/(r*cos(th

2021-04-28 15:35:19 +0200 received badge  Nice Answer (source)
2021-04-28 11:46:44 +0200 answered a question Background for plot should include axes and labels

This answers only the question about the font size: use the option axes_labels_size in plot() to set the relative size b

2021-04-28 11:28:15 +0200 edited answer Differential forms on non-standard spherical coordinates

Simply use the method chart to define your own version of spherical coordinates and then relate them to Sage's default s

2021-04-28 10:50:49 +0200 answered a question Differential forms on non-standard spherical coordinates

Simply use the method chart to define your own version of spherical coordinates and then relate them to Sage's default s

2021-04-15 21:51:03 +0200 edited answer Why `unable to convert (sin(h(x)), cos(h(x))) to a symbolic expression`?

Following @slelievre 's comment, here is a possible answer using maps $\mathbb{R} \to \mathbb{R}^2$ and $\mathbb{R}\to\m

2021-04-15 21:47:57 +0200 edited answer Why `unable to convert (sin(h(x)), cos(h(x))) to a symbolic expression`?

Following @slelievre 's comment, here is a possible answer using maps $\mathbb{R} \to \mathbb{R}^2$ and $\mathbb{R}\to\m

2021-04-15 18:14:14 +0200 received badge  Necromancer (source)
2021-04-15 13:23:06 +0200 answered a question Why `unable to convert (sin(h(x)), cos(h(x))) to a symbolic expression`?

Following @slelievre 's comment, here is a possible answer using maps $\mathbb{R} \to \mathbb{R}^2$ and $\mathbb{R}\to\m

2021-04-12 11:03:54 +0200 commented answer How can I define a submanifold-with-boundary of a Euclidean space in Sage?

There is already a ticket for manifolds with boundaries: Trac 30080, so they might be implemented soon.

2021-04-08 10:03:23 +0200 answered a question Is there a way to define a submanifold of a Euclidean space by providing a list of implicit constraints, instead of by declaring a separate manifold and explicitly defining the embedding?

This is not implemented yet. The current functionalities for submanifolds are described in [1], [2], [3], [4] and [5].

2021-04-08 09:55:39 +0200 answered a question Is there a built-in way to integrate a vector or differential form field on an embedded submanifold of Euclidean space?

Sorry, integration on manifolds is not implemented yet. You are very welcome to contribute to SageMath by implementing i

2021-04-08 09:51:19 +0200 answered a question How can I define a submanifold-with-boundary of a Euclidean space in Sage?

Sorry, manifolds with boundary are not implemented yet. If you would like to implement them in SageMath, please visit ht

2021-04-05 11:14:01 +0200 commented question Evaluating a form field at a point on vectors

Motivated by your question, I've opened the ticket https://trac.sagemath.org/ticket/31609 to add a method vector() in or

2021-04-05 11:13:01 +0200 commented question Evaluating a form field at a point on vectors

Motivated by your question, I've opened the ticket https://trac.sagemath.org/ticket/31606 to add a method vector() in or

2021-04-02 21:30:20 +0200 commented answer Coordinate charts, functions of one coordinate as bounds of another(?)

Could you provide a concrete example of your function r(th)? X.add_restrictions(r>R(th)) should work for any function

2021-04-02 19:28:15 +0200 answered a question Coordinate charts, functions of one coordinate as bounds of another(?)

Use the chart method add_restrictions (type X.add_restrictions? for the documentation). On your example, this gives: sa

2021-04-02 01:57:22 +0200 received badge  Good Answer (source)
2021-02-28 10:13:33 +0200 commented question Ask Sagemath has a new home !

Thank you Thierry!

2021-02-26 14:12:17 +0200 answered a question Differential forms and chain rule

Building on @Emmanuel_Charpentier's comment, the closest thing you can do to use the chain rule with unspecified differential forms is something like

sage: E.<x,y> = EuclideanSpace()                                                                    
sage: z = E.scalar_field(function('Z')(x,y), name='z')                                              
sage: z.display()                                                                                   
z: E^2 --> R
   (x, y) |--> Z(x, y)
sage: diff(z)                                                                                       
1-form dz on the Euclidean plane E^2
sage: diff(z).display()                                                                             
dz = d(Z)/dx dx + d(Z)/dy dy
sage: diff(1/z)                                                                                     
1-form d1/z on the Euclidean plane E^2
sage: diff(1/z).display()                                                                           
d1/z = -d(Z)/dx/Z(x, y)^2 dx - d(Z)/dy/Z(x, y)^2 dy
sage: diff(1/z) == -1/z^2 * diff(z)                                                                 
True
sage: diff(z).wedge(diff(1/z))                                                                      
2-form dz/\d1/z on the Euclidean plane E^2
sage: diff(z).wedge(diff(1/z)).display()                                                            
dz/\d1/z = 0

But as you can see, all computations use the underlying coordinates (x,y), even in assessing coordinate-free statements like in

sage: diff(1/z) == -z^(-2) * diff(z)                                                                
True
2021-02-07 14:24:51 +0200 answered a question Divergence of inverse square

In the current implementation, vector fields are assumed to be smooth functions on their domain. The vector field that you have defined is not (actually, it is not even defined at $r=0$), so I would say this is not a bug.

2021-02-07 11:33:25 +0200 answered a question vector_field.apply_map before and after vector.display (weird behaviour)

Well, I would say that this is caused by a somewhat strange operation that you are asking for. When you write

v = E.vector_field([r_1,0,0], frame=spherf, chart=cart)
v.apply_map(lambda c:c.subs(ph==ph_1, th==th_1))

you are initializing the vector field with components in the frame spherf (orthonormal frame associated with spherical coordinates), while the second line asks for an apply_map in the default frame, which is cartf. But at this stage, such components are not known. Such a substitution is thus not very meaningful. If you add v.display() before v.apply_map, as in your second example, this triggers the computation of the components with respect to cartf, so that the substitution becomes meaningful. If you want to stick to the first example, then you should enforce apply_map to act on the components w.r.t spherf, by adding the argument frame=spherf:

v = E.vector_field([r_1,0,0], frame=spherf, chart=cart)
v.apply_map(lambda c:c.subs(ph==ph_1, th==th_1), frame=spherf)

Then everything is OK.

2021-02-03 15:19:52 +0200 received badge  Nice Answer (source)
2021-02-02 08:59:18 +0200 answered a question Displaying all symbolic expression with ExpressionNice

No, unfortunately it is not possible to make it the default for all symbolic expressions. ExpressionNice is invoked automatically only on manifold objects.

2021-02-02 08:50:57 +0200 answered a question latex_name and derivatives in sagemanifolds

I cannot reproduce the issue with Sage 9.2. Typing the following code

%display latex
var('t')
dq1 = function('dq_1', latex_name=r'\dot{q}_1')(t)
L = function('L')(dq1)
M = manifolds.Minkowski()
L1 = M.scalar_field(L)
L1.derivative().display()

in a Jupyter notebook yields

$\frac{\partial\,L}{\partial \left( \dot{q}_1\left(t\right) \right)} \frac{\partial\dot{q}_1}{\partial t} \mathrm{d} t$

2021-02-01 15:41:48 +0200 commented answer subs in vector field

Yes this is a bug! I was not aware that the method subs() (silently) exists for vector fields! It is actually inherited from Sage's base class Element. I've opened https://trac.sagemath.org/ticket/31316 for this.

2021-02-01 08:07:05 +0200 answered a question subs in vector field

You have to use the method apply_map() in order to perform the substitution on each component of the vector field:

sage: vf.apply_map(lambda cmp: cmp.subs(a==1))                                                      
sage: vf.display()                                                                                  
e_x + x e_y + x*y e_z

See the documentation of apply_map() for more details.

2021-02-01 00:13:08 +0200 answered a question Why doesn't Sage return `True` for `e < 3`?

You have to enforce the check of the inequality by asking for a Boolean:

sage: bool(e<3)                                                                                    
True
sage: bool(pi>4)                                                                                   
False
2021-01-30 12:48:11 +0200 commented question Functions with operation (multiplication) as argument

I don't understand your question; f(X*Y) = ... does not seem to be valid Python syntax. Could you provide the full code of what you are trying to do?

2021-01-30 12:27:46 +0200 answered a question 2 sets of coordinates in EuclideanSpace?

In EuclideanSpace, there are three predefined coordinate charts, which are returned by the methods cartesian_coordinates(), spherical_coordinates() and cylindrical_coordinates():

sage: E.<x,y,z> = EuclideanSpace()                                                                  
sage: E.cartesian_coordinates()                                                                     
Chart (E^3, (x, y, z))
sage: E.spherical_coordinates()                                                                     
Chart (E^3, (r, th, ph))
sage: E.cylindrical_coordinates()                                                                   
Chart (E^3, (rh, ph, z))

But you can define as many charts as you want by means of the method chart(). For instance:

sage: Cartes1.<x1, y1, z1> = E.chart()                                                              
sage: Cartes1                                                                                       
Chart (E^3, (x1, y1, z1))

To complete the construction, you have to specify the transition map from previously defined coordinates:

sage: Cartes_to_Cartes1 = E.cartesian_coordinates().transition_map(Cartes1, [x-2, y+3, z])          
sage: Cartes_to_Cartes1.display()                                                                   
x1 = x - 2
y1 = y + 3
z1 = z

as well as its inverse, either by asking Sage to compute it (method inverse()) or by specifying it by hand (method set_inverse()):

sage: Cartes_to_Cartes1.inverse().display()                                                         
x = x1 + 2
y = y1 - 3
z = z1

Then Sage can compute vector field components in the new coordinate frame:

sage: v = E.vector_field(x+z, y*z, x*y)                                                             
sage: v.display()                                                                                   
(x + z) e_x + y*z e_y + x*y e_z
sage: v.display(Cartes1)                                                                            
(x1 + z1 + 2) d/dx1 + (y1 - 3)*z1 d/dy1 + ((x1 + 2)*y1 - 3*x1 - 6) d/dz1

For more details, see the coordinate chart documentation.

2021-01-29 10:43:08 +0200 answered a question Matrix multiplication with a vector in EuclideanSpace

You have to convert the matrix M to an endomorphism of the Euclidean space and apply the latter to the vector field. Given the canonical identification between endomorphisms and tensors of type (1,1), the conversion is performed as follows:

A = E.tensor_field(1, 1, M)

Here is the full example:

sage: E.<x,y,z> = EuclideanSpace(start_index=0)                                                       
sage: vf = E.vector_field([x*y, x^2, z**2])                                                             
sage: M = Matrix(RR, 3, 3); M[:] = 1                                                                
sage: A = E.tensor_field(1, 1, M)  
sage: A                                                                                             
Tensor field of type (1,1) on the Euclidean space E^3                                  
sage: A[:]                                                                                          
[1 1 1]
[1 1 1]
[1 1 1]
sage: A(vf)                                                                                         
Vector field on the Euclidean space E^3
sage: A(vf).display()                                                                               
(x^2 + x*y + z^2) e_x + (x^2 + x*y + z^2) e_y + (x^2 + x*y + z^2) e_z
sage: A(vf)[:]                                                                                      
[x^2 + x*y + z^2, x^2 + x*y + z^2, x^2 + x*y + z^2]

Note that the action of the endomorphism A onto the vector field vf is obtained by A(vf) and not by A*vf, which would perform a tensor product and would yield a tensor field of type (2, 1).

Note also that if the matrix M is invertible, you may perform the conversion simply as

A = E.automorphism_field(M)
2021-01-27 19:41:08 +0200 commented question Extracting numerator of a Ricci tensor component

See the answer to question 55475