Ask Your Question

conjugate of scalar field

asked 2022-02-25 13:30:46 +0200

AstroG gravatar image

updated 2022-02-25 18:54:29 +0200

slelievre gravatar image

I'm new to SageMath.

I was wondering how to form the conjugate of a complex scalar function on a Lorentzian manifold. This is useful for calculating Newman Penrose spin coefficients. According to the SageMath documentation, one can apply standard math functions (eg abs()) but as far as I can see there is no conjugate, real or imaginary part capability for scalar fields. For example trying conjugate(f) leads to:

TypeError: cannot coerce arguments: no canonical
coercion from Algebra of differentiable scalar fields on
the 4-dimensional Lorentzian manifold M to Symbolic Ring

On the other hand using SageManifolds to differentiate abs(f(t)) where f(t) is a scalar function leads to:

dabs(f) = 1/2*(conjugate(d(f)/dt)*f(t) + conjugate(f(t))*d(f)/dt)/abs(f(t)) dt

I'm not sure if this is a misunderstanding on my part or a missing feature.

edit retag flag offensive close merge delete


Thank you eric_g much appreciated.

AstroG gravatar imageAstroG ( 2022-02-27 23:34:50 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-25 22:19:12 +0200

eric_g gravatar image

The conjugate operator is not implemented because scalar fields on a real manifold are supposed to be real-valued functions. You can however bypass this limitation and implement it yourself by declaring the following Python function:

def conj(f):
    name, latex_name = f._function_name("conj", r"\,\mathrm{conj}")
    cf = type(f)(f.parent(), name=name, latex_name=latex_name)
    for chart, func in f._express.items():
        cf._express[chart] = chart.function(func.expr().conjugate())
    return cf

This is modeled from the abs function, see the Python code returned by f.__abs__??.

edit flag offensive delete link more

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


Asked: 2022-02-25 13:30:46 +0200

Seen: 417 times

Last updated: Feb 25 '22