1/20/2024 0 Comments Mathematica not equal symbolOnce a symbol is used to identify an object, it cannot be used to identify another object. The capitals E and I are numeric and cannot be used. There is an exception to restriction 5: the capitals C, D, K, N, O are used by Mathematica but are accepted as valid symbols for indices and overloaded (that is, without changing their context), issuing a warning message. The symbol is not protected, readprotected or used by Mathematica. The symbol is not already used by xTensor`, xPerm`, xCore` or ExpressionManipulation`.ĥ. The symbol does not have a Locked attribute.Ĥ. The symbol does not have values (checked with ValueQ).ģ. The symbol is not numeric (checked with NumericQ).Ģ. These restrictions are checked by the xCore function ValidateSymbol, called by all DefType commands:ġ. xTensor` adds a few more restrictions on the symbols that can be used to identify tensors and so on. We shall simply try to write code having the abstract model in mind.Ĭopied from the Mathematica Reference Guide (A.1.2): The name of a symbol must be a sequence of letters, letter-like forms and digits, not starting with a digit. However, this would be slow for pattern matching. It could also seem reasonable to define tensors as abstract types, instead of fixing a particular structure from the very beginning. The only general recommendation is using long names for tensors (like MaxwellF for the electromagnetic Faraday tensor) and short names (a, b, C, etc.) for abstract indices. In xTensor` we do not force any particular solution, leaving the decision to the user. We could use as well TensorA, ManifoldA, IndexA, or perhaps TenA, ManiA, IndA. This simply means using longer names for the objects defined. It could seem reasonable to use contexts to separate Tensor`A from Manifold`A or Index`A. This leads us to introduce a second important decision: symbols with some xTensor` type will always appear in the composite expression at level 0 in other words, the symbol identifying a tensor will be the head of the tensor, and so on: we shall use A rather than, for example, the more natural notation Tensor suggested by Maeder. There is a harsh limitation in Mathematica: an expression can be associated to a symbol if and only if the symbol is present in the expression at levels 0 or 1, but no deeper. At any time we can collect all the information known about a tensor, using Information (the ? command). Information on a tensor is only used by Mathematica when the tensor appears in the expression being evaluated. This decision has also two important advantages: We cannot have two different tensors identified by the same symbol, to avoid conflicting information. Tensors are identified using symbols, and not strings. In xTensor` we take the following important decision: information on a tensor will be associated to a symbol identifying that tensor. Information in Mathematica is associated to symbols only (not to strings, numbers or composite expressions as a whole). What follows in this section refers to tensors, but can also be applied to other xTensor` types of values, to be listed below. Tensors and other types of values must be composite types. Unfortunatlely it is not possible to define new primitive types. There are three primitive types of values in Mathematica: symbols (head Symbol), strings (head String) and numbers (heads Integer, Rational, Real and Complex).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |