-
Notifications
You must be signed in to change notification settings - Fork 10
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
Kranc does not allow grid functions that start with the letter u #141
Comments
The problem isn't that it starts with the letter u, it's likely that it is a reserved symbol in TensorTools to indicate an upper index "t". So ut is actually TensorIndex["t", "u"] or something. In fact, it looks like Kranc has expanded the index ut into 1, 2, 3, which is where those numbers come from in the error message. That is a little embarrassing! It would be expected if this were a tensor; v[ut] would be expanded into variables v1, v2 and v3 in the group definition. But for some reason, Kranc is expanding a raw index, rather than requiring that the variable is a tensor. |
yup. Inside of |
It is not possible to define variables with the same names as the tensor indices, as those indices are Mathematica variables with values TensorIndex[...]. The only fix would be to catch this usage and give a clear error message. If I were to design it again, I would make the indices inert objects which were recognised inside tensors, but that is not how it works at the moment. |
So that basically means that I cannot use anything like "ua" to "uz" as variable names? And also no single letter variables? Both would be tensor indices by this logic. Basically Kranc claims those 52 variables for its own use it seems. This should be documented. |
You cannot use ua-uz or la-lz as variable names, as they are indices in TensorTools. I cannot think of a reason why single-letter variable names would be a problem for Kranc; what did you have in mind? Yes, it should be documented, but more importantly (since people don't tend to read documentation), it should be caught by Kranc and the error message improved. |
It has been too long since I last used Kranc. I thought hat upper / lower pair was
ie have DefineTensor create a function for the tensor that takes the correct arguments? There is some legwork since one has to manually define the mappings |
So tensor indices would be interpreted every time a tensor expression, e.g. foo[lb] was invoked, rather than having lb as a symbol with a definition. This could probably be made to work. On the other hand, there's really no need for this to happen when foo is "evaluated". Instead, it could happen whenever the entire expression needs to be interpreted as tensorial (i.e. converted into components, or having a covariant derivative taken, etc). Then the user-entered expression would be entirely inert, which I think is a lot more elegant. Either way though, changing something so fundamental is likely to involve quite a lot of work to make sure it is correct, and I don't think it is a high priority. In the bigger picture, I would either completely rewrite the tensor implementation (it was one of my first Mathematica packages, written during my PhD), or just use xAct. I have several times looked at how a new version of TensorTools could work, learning from all the experience gained with the current version. This would be a fun project, but I don't think it's important enough to work on at the moment. |
Taking the http://kranccode.org/SimpleWave.m example and adding
ut
togroups
:produces the following error:
Changing
ut
toUt
removes the error.The text was updated successfully, but these errors were encountered: