Ask Your Question
0

latex_name and derivatives in sagemanifolds

asked 2021-02-01 22:00:37 +0100

cav_rt gravatar image

updated 2021-02-02 02:27:16 +0100

Hi,

I think there is a small bug on displaying derivatives of tensors w.r.t a parameter with latex_name.

For symbolic expressions,

from sage.manifolds.utilities import ExpressionNice
var('t')
dq1 = function('dq_1', latex_name=r'\dot{q}_1')(t)
L = function('L')(dq1)
ExpressionNice(diff(L,t))

works nicely. However, when I define the same L as a scalar field (or any tensor),

M = manifolds.Minkowski()
L1 = M.scalar_field(L)
L1.derivative().display()

the latex_name is ignored and dq_1 is used instead. The problem does not occur when there is no index in dq.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-02-02 08:50:57 +0100

eric_g gravatar image

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$

edit flag offensive delete link more

Comments

You are right, probably I was messing up variables and names. Thank you!

cav_rt gravatar imagecav_rt ( 2021-02-02 15:43:07 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-02-01 22:00:37 +0100

Seen: 348 times

Last updated: Feb 02 '21