Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling epsilon throws invalid name error #7

Open
mmikhasenko opened this issue Jan 7, 2022 · 2 comments
Open

Calling epsilon throws invalid name error #7

mmikhasenko opened this issue Jan 7, 2022 · 2 comments

Comments

@mmikhasenko
Copy link

Just started with the packages (thanks for that), and quickly stumbled upon several issues.
Let me drop it here. Maybe I can cover the issues to tests once it is resolved

lorenz = TensorIndexType("lorenz","L",4)
@indices lorenz μ ν σ ρ
ϵ = lorenz.epsilon
ϵ(μ,ν,σ,ρ)

gives the error:

PyError ($(Expr(:escape, :(ccall(#= C:\Users\Mikhasenko\.julia\packages\PyCall\L0fLP\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ValueError'>

ValueError('invalid name')
File "\.julia\conda\3\lib\site-packages\sympy\core\basic.py", line 953, in subs
rv = rv._subs(old, new, **kwargs)
File "\.julia\conda\3\lib\site-packages\sympy\core\cache.py", line 72, in wrapper
retval = cfunc(*args, **kwargs)
File "\.julia\conda\3\lib\site-packages\sympy\core\basic.py", line 1067, in _subs
rv = fallback(self, old, new)
File "C:\Users\Mikhasenko\.julia\conda\3\lib\site-packages\sympy\core\basic.py", line 1044, in fallback
rv = self.func(*args)
File "\.julia\conda\3\lib\site-packages\sympy\tensor\tensor.py", line 1735, in __new__
raise ValueError("invalid name")

pyerr_check@exception.jl:62[inlined]
pyerr_check@exception.jl:66[inlined]
_handle_error(::String)@exception.jl:83
macro expansion@exception.jl:97[inlined]
#107@pyfncall.jl:43[inlined]
disable_sigint@c.jl:458[inlined]
__pycall!@pyfncall.jl:42[inlined]
_pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{SymPy.Sym, SymbolicTensors.TensorIndex}, ::Int64, ::Ptr{Nothing})@pyfncall.jl:29
_pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{SymPy.Sym, SymbolicTensors.TensorIndex}, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})@pyfncall.jl:11
var"#_#114"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::PyCall.PyObject, ::SymPy.Sym, ::Vararg{Any})@pyfncall.jl:86
(::PyCall.PyObject)(::SymPy.Sym, ::Vararg{Any})@pyfncall.jl:86
(::SymPy.Sym)(::SymbolicTensors.TensorIndex, ::Vararg{SymbolicTensors.TensorIndex})@utils.jl:54
top-level scope@Local: 1[inlined]
@rjrosati
Copy link
Owner

Thanks for opening all of these. The package is not very user friendly yet, sorry about that.
I never implemented epsilon from sympy.tensor.tensor, mostly because I don't like how it treats the indices of epsilon and delta (the Kronecker delta) (see #4). They're not real tensors, but raising and lowering indices with the metric can produce objects like this:

julia> contract_metric(lorenz.delta(-μ,-ν) * lorenz.metric(ν,σ), lorenz.metric)
lorenz.delta(-μ,σ)

I usually think of a delta as always representing an identity matrix, but these delta objects with mixed indices don't. The same issue affects epsilon.
Anyway, I could still implement epsilon for now, keeping the same behavior.

@mmikhasenko
Copy link
Author

Thanks for pointing where the problem might be. My project with tensor is paused now, but I hope to come back to it in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants