Message Boards Message Boards

0
|
6127 Views
|
46 Replies
|
20 Total Likes
View groups...
Share
Share this post:

Clear all the values associated with a subscripted variable

Posted 1 year ago

See my following code snippet:

In[764]:= xTM
N[x] =.
xTM

Out[764]= {{Subscript[x, 1, 1], Subscript[x, 1, 2], Subscript[x, 1, 
  3]}, {Subscript[x, 2, 1], Subscript[x, 2, 2], Subscript[x, 2, 
  3]}, {Subscript[x, 3, 1], Subscript[x, 3, 2], Subscript[x, 3, 3]}}

During evaluation of In[764]:= Unset::norep: Assignment on x for N[x,{MachinePrecision,MachinePrecision}] not found.

Out[765]= $Failed

Out[766]= {{Subscript[x, 1, 1], Subscript[x, 1, 2], Subscript[x, 1, 
  3]}, {Subscript[x, 2, 1], Subscript[x, 2, 2], Subscript[x, 2, 
  3]}, {Subscript[x, 3, 1], Subscript[x, 3, 2], Subscript[x, 3, 3]}}

I want to clear all the values associated with the subscripted variable, in this case, x. But as you can see, my method failed to do the trick. Any tips for achieving this goal?

Regards,
Zhao

POSTED BY: Hongyi Zhao
46 Replies
Posted 1 year ago

I've roughly browsed the GitHub source code of the project and found that the method used is basically based on database query. There is no too advanced mathematical processing. Therefore, I don't believe that I can learn much from it. However, as you said, maybe I can try to communicate with developers on relevant issues.

POSTED BY: Hongyi Zhao
Posted 1 year ago

Thank you for telling me the MaXrd package and other related information. But my goal is not the same as all of these technologies described and implemented in these packages/literatures.

POSTED BY: Hongyi Zhao

But, as I suggested, the authors of that package are experts in the area and are most likely to be able to answer the original question that you asked…

POSTED BY: Paul Abbott

To answer the original question, the best way to handle subscripted—or indexed—variables is to use Association (via /:). For example,

x /: Subscript[x, 1] = a;
x /: Subscript[x, 2] = n;
x /: Indexed[x, 3] = c;

associates the subscripted or indexed definitions to x rather than to Subscript or Indexed. Then Clear[x] and Remove[x] will clear or remove all these definitions, as required.

(The original code had N[x]=. which would have cleared any NValues associated with x—which is not really relevant here. But defining numerical values this way can sometimes be a very useful trick!).

While there are many useful comments in this thread—I don’t think the fundamental issue has been addressed: the goal for using subscripted variables was to implement certain transformation matrices. But these matrices are already built-in: see, e.g. `RotationMatrix, along with the related functions and associated guides (all in the Documentation Center).

Further, since the goal is to do “crystallographic computing” perhaps the MaXrd package already does what you want—and certainly the authors would be able to answer your questions about space groups based on its generators.

Finally, other relevant packages and articles include Using Mathematica as a platform for crystallographic computing and Symmetry Operations of Crystallographic Point Groups and Space Groups.

POSTED BY: Paul Abbott
Posted 1 year ago

IMHO, all these tips and tricks make this method complicated, cumbersome and impractical.

Generally speaking, the use of variables only occurs in the process of solving a problem, not in the final result. Therefore, there is no need to carry out the complicated processing mentioned in the above discussion.

POSTED BY: Hongyi Zhao
Posted 1 year ago

I think, Zhao, this is an important remark. You are right: One does nor really need to assign values to those symbols at arbitrary indexes. The symbols are needed only for the formulation of symbolic problems, e.g. Solve. Whereas for the concrete solutions just vectors (lists) are used.

Actually, I came around the whole topic only when I was trying to measure the performance of assignments.

POSTED BY: Werner Geiger
Posted 1 year ago

Werner, I will try to show what is happening when assigning values to the list elements:

POSTED BY: Hans Milton
Posted 1 year ago

POSTED BY: Werner Geiger
Posted 1 year ago

Unfortunately, your last piece of code changes the value and definition of the list bs, but not the value nor the definition of symbol b1.

That is not strange. The assignment, Set, is one-way. Changing the source affects the receiver, but not the other way around.

POSTED BY: Hans Milton
Posted 1 year ago

Yes, of course.

But the question is: How to change the value of an indexed (or better: simulated indexed) variable Symbol["b"<>ToString[i]] for arbitrary i?

POSTED BY: Werner Geiger
Posted 1 year ago

Just assign the new value directly to the variable.
Don't go the back route via the receiving list. That would break the link from variable to list.

POSTED BY: Hans Milton
Posted 1 year ago

Just assign the new value directly to the variable.

That's trivial, Hans. Of course, I can write b17=4711.

Obviously, I'm not able to explain my point: How to assign a value to one, say the i-th Symbol bi of the b1, b2, ..., ?

Say you have a vector bs = {b1, b2, ..., b100} of dimension 100. How can you set the value of its i-th component?

(I'm getting tired of that question. Obviously, both of us cannot answer it.)

The only possibility I could find until now, is (see above):

POSTED BY: Werner Geiger
Posted 1 year ago

@Hans I have a strange problem with the symbolic approach, i.e. using b1, b2, ... and collecting them within a list bs = {b1, b2, ...}. I feel ashamed not being able to solve it. I hope, you can help me:

If bs = {b1, b2, b3} is a list of symbols then bs[[1]] =17 changes the first element of list bs but not the value of b1. Actually, it doesn't touch or use b1 at all:

Remove[b1, b2, b3];
Echo[bs = {b1, b2, b3}, "bs: "];
Echo[bs[[1]] = 17, "bs[[1]]=17: "];
Echo[bs, "bs: "];
Echo[{b1, b2, b3}, "{b1,b2,b3}: "];

bs:   {b1,b2,b3}
bs[[1]]=17:   17
bs:   {17,b2,b3}
{b1,b2,b3}:   {b1,b2,b3}

In order to access b1 via bs, you can evaluate bs[[1]] before the assignment to 17. Which is pretty expensive, and you cannot assign the same bs-element twice:

Remove[b1, b2, b3];
Echo[bs = {b1, b2, b3}, "bs: "];
Echo[Evaluate[bs[[1]]] = 17, "bs[[1]]=17: "];
Echo[Evaluate[bs[[1]]] = 18, "bs[[1]]=18: "];
Echo[bs, "bs: "];
Echo[{b1, b2, b3}, "{b1,b2,b3}: "];

bs:   {b1,b2,b3}
bs[[1]]=17:   17
... Set::setraw: Cannot assign to raw object 17.
bs[[1]]=18:   18
bs:   {17,b2,b3}
{b1,b2,b3}:   {17,b2,b3}

I tried many things with Unevaluated, Inactive, Hold and a second list bSyms for the bi-Symbols, but I could not find a reasonable solution.

POSTED BY: Updating Name
Posted 1 year ago

The code you posted has syntax problems

POSTED BY: Hans Milton
Posted 1 year ago

I don't think so. The second part of each code block is the Echo-Output, not Input. Unfortunately, the community editor cannot handle Output, or at least I don't know how to do it. Often, I insert screenshots, but this is tedious.

POSTED BY: Werner Geiger
Posted 1 year ago

Okay Werner. The "syntax problems" were actually the effect of the post editors dysfunctional rendering of code output. But when output formatting is important it can be better to include a notebook directly in the post:

That is "Add Notebook" to the left in the top toolbar. As opposed to the button "Add a file" at the bottom.

POSTED BY: Hans Milton
Posted 1 year ago

Hi Hans,

When I try to use the above tip, I encounter the following very strange problem:

In[174]:= ClearAll[x];
Array[Symbol["x" <> ToString@FromDigits@{##}] &, {3}]

Out[175]= {<|{{-1, -1, -1}, 
    2} -> {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, -1, 1}, 
    2} -> {{2, -1, -1}, {3/2, -(3/2), -(1/2)}, {3/
     2, -(1/2), -(3/2)}}, {{-1, -I, I}, 
    4} -> {{3/2, -(1/2), -(3/2)}, {3/
     2, -(3/2), -(1/2)}, {2, -1, -1}}, {{-1, 1, 1}, 
    2} -> {{2, -1, -1}, {3/2, -(1/2), -(3/2)}, {3/
     2, -(3/2), -(1/2)}}, {{-1, (-1)^(1/3), -(-1)^(2/3)}, 
    6} -> {{1, 1, -2}, {3/2, 1/2, -(3/2)}, {1/2, 3/2, -(3/2)}}, {{-I, 
     I, 1}, 4} -> {{3/2, 1/2, -(3/2)}, {1, 1, -2}, {1/2, 3/
     2, -(3/2)}}, {{1, 1, 1}, 
    1} -> {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{1, -(-1)^(1/3), (-1)^(
     2/3)}, 3} -> {{3/2, -(1/2), -(3/2)}, {2, -1, -1}, {3/
     2, -(3/2), -(1/2)}}|>, <|{{-1, -1, -1}, 
    2} -> {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, -1, 1}, 
    2} -> {{1, 0, 0}, {0, -1, 0}, {0, 0, -1}}, {{-1, -I, I}, 
    4} -> {{0, 1, 0}, {-1, 0, 0}, {0, 0, -1}}, {{-1, 1, 1}, 
    2} -> {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, {{-1, (-1)^(
     1/3), -(-1)^(2/3)}, 
    6} -> {{0, 1, 0}, {0, 0, 1}, {-1, 0, 0}}, {{-I, I, 1}, 
    4} -> {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}}, {{1, 1, 1}, 
    1} -> {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{1, -(-1)^(1/3), (-1)^(
     2/3)}, 3} -> {{0, 1, 0}, {0, 0, 1}, {1, 0, 0}}|>, x3}

As you can see, I've cleared the variable x, however, it still interferes with subsequent assignment operations.

POSTED BY: Hongyi Zhao
Posted 1 year ago

As you can see

No, no, we can't see! Why do you continue doing this? You need to show us the relevant code, otherwise we're just constantly guessing about what's going on. What happened between In[174] and Out[175]? Or for that matter, what happened before In[174]? Or more to the point, why do you even make that part of your question? Why don't you provide a simplified version of your question so that we don't have to understand all of your domain-specific details? Where did these Associations come from? Why should I have to parse the complicated structures you're presenting here when your question seems to be about how to represent subscripted variables? What "subsequent assignment operations" are being interfered with? You do realize that x and x1 are completely different and independent symbols, don't you? Just ask a clear question with clear examples in code, please.

POSTED BY: Eric Rimbey
Posted 1 year ago

I dont believe that. Your Code:

ClearAll[x];
Array[Symbol["x" <> ToString@FromDigits@{##}] &, {3}]
(* ==> {x1,x2,x3} *)

is correct. Maybe:

ClearAll[x];
Array[Symbol["x" <> ToString[#]] &, 3]
(* ==> {x1,x2,x3} *)

is a bit easier to read.

Anyway, as I said above, I would prefer Indexed:

ClearAll[x];
Array[Indexed[x, #] &, 3]
(* ==> {x with subscript i, i=1,..,3 *)

You can access the i-th vector elements by x[i], which is more feasible than with Hans' approach where you have to use Symbol["x"<>ToString[i]]. Or, if you assigned the whole vector to x: x[[i]].

POSTED BY: Werner Geiger
Posted 1 year ago

Werner, there is not much practical difference in using the two methods, yours or mine. See the attached edit of your CalcTrans notebook.

Attachments:
POSTED BY: Hans Milton
Posted 1 year ago

That is true of course, Hans.

I prefer the indexed version only because it is "nearer" to common mathematical notation, and it looks nicer in output.

BTW: As I now did some performance measurement I found: Your symbolic method is pretty faster than the indexed method. Namely the indexed method takes about 1.7 times the time of the symbolic method when randomly assigning one million of values to the elements of a length-1000 vector.

See the attached notebook

Attachments:
POSTED BY: Werner Geiger
Posted 1 year ago

I further checked the most concise and straightforward version as follows:

tTMHM = Array[t, {3, 3}]
bTHM = Array[b, 3]

It turns out that the performance of the following two methods is comparable:

tTMHM = Array[Symbol["t" <> ToString@FromDigits@{##}] &, {3, 3}]
bTHM = Array[Symbol["b" <> ToString[#]] &, 3]

And

tTMHM=Array[t,{3,3}]
bTHM=Array[b,3]
POSTED BY: Hongyi Zhao
Posted 1 year ago

Are you aware, Zhao, that your coding

Array[b,3]

is a bit special (let aside that you need Clear[b] before that)? The first parameter of Array is a function. In your case the constant function b. During evaluation of Array b[1], b[2], ... are called which are undefined, hence you get the function calls themselves. Hence you arrive at

(* ==> {b[1], b[2], b[3]} *)

Your coding is something in between the indexed version:

Array[Indexed[b, #] &, 3]
(* ==> {b indexed with i, ...} *)

and the symbolic version:

Array[Symbol["b" <> ToString[#]] &, 3]
(* ==> {b1, b2, b3} *)
POSTED BY: Werner Geiger
Posted 1 year ago

Are you aware, Zhao, that your coding

Array[b,3]

is a bit special (let aside that you need Clear[b] before that)?

Why don't you also mention my usage below? Are there any essential differences between them?

Array[t,{3,3}]
POSTED BY: Hongyi Zhao
Posted 1 year ago

Because it's the same issue. I did not want to write the same thing twice.

POSTED BY: Werner Geiger
Posted 1 year ago

The first parameter of Array is a function. In your case the constant function b. During evaluation of Array b[1], b[2], ... are called which are undefined, hence you get the function calls themselves. Hence you arrive at

(* ==> {b[1], b[2], b[3]} *)

I think the above description cannot be regarded as a problem that causes unpredictable side effects, at most one behavior. Therefore, this method, a.k.a., something as follows, is still acceptable:

Clear[b,t];
Array[b,3]
Array[t,{3,3}]
POSTED BY: Hongyi Zhao
Posted 1 year ago

Yes, it is acceptable, Zhao. It is even very fast during creation of the Array as you can see from the following comparison code for large vector lengths n:

n = 1000000
Clear[b, bs];
{t, tmp} = AbsoluteTiming[bs = Array[Indexed[b, #] &, n]];
{t // EngineeringForm, bs[[1]]}
Clear[b, bs];
{t, tmp} = AbsoluteTiming[bs = Array[b, n]];
{t // EngineeringForm, bs[[1]]}
Clear[b, bs];
{t, tmp} = AbsoluteTiming[bs = Array[b[#] &, n]];
{t // EngineeringForm, bs[[1]]}
Clear[bs];
{t, tmp} = AbsoluteTiming[bs = Array[Symbol["b" <> ToString[#]] &, n]];
{t // EngineeringForm, bs[[1]]}
(* ==> *)

enter image description here

The unsuccessful call to b[i] seems to be faster than any successful call. The symbolic method (the last one) is comparable slow, which does not surprise since string functions are involved.

POSTED BY: Werner Geiger
Posted 1 year ago

The unsuccessful call to b[i]

I still don't quite understand why you said that. Here, we just create an array and don't do anything else. And it can be called for either its whole content or one of its elements, as follows:

In[35]:= n = 10;
Clear[b, bs];
{t, tmp} = AbsoluteTiming[bs = Array[b, n]];
bs
bs[[1]]

Out[38]= {b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10]}

Out[39]= b[1]
POSTED BY: Hongyi Zhao
Posted 1 year ago

Interesting timing results Werner. But with matrices there is a limitation on my method. If any matrix dimension is larger than 10 it will create duplicates.

m = Array[Symbol["m" <> ToString@FromDigits@{##}] &, {9, 12}];
m // Flatten // Length
m // Flatten // DeleteDuplicates // Length
(* 108 *)
(* 92 *)
POSTED BY: Hans Milton
Posted 1 year ago

Therefore, the final solution is the following approach:

In[121]:= m = Array[m, {9, 12}];
m // Flatten // Length
m // Flatten // DeleteDuplicates // Length

Out[122]= 108

Out[123]= 108
POSTED BY: Hongyi Zhao
Posted 1 year ago

That's clear, Hans, since last indexes with more than two decimal digits will go wrong. One must write:

m = Array[
  Symbol["m" <> StringPadLeft[ToString[#1], 2, "0"] <> 
     StringPadLeft[ToString[#2], 2, "0"]] &, {9, 12}]
m // Flatten // Length
{{m0101, m0102, m0103, m0104, m0105, m0106, m0107, m0108, m0109, 
m0110, m0111, m0112}, {m0201, m0202, m0203, m0204, m0205, m0206, 
m0207, m0208, m0209, m0210, m0211, m0212}, {m0301, m0302, m0303, 
m0304, m0305, m0306, m0307, m0308, m0309, m0310, m0311, 
m0312}, {m0401, m0402, m0403, m0404, m0405, m0406, m0407, m0408, 
m0409, m0410, m0411, m0412}, {m0501, m0502, m0503, m0504, m0505, 
m0506, m0507, m0508, m0509, m0510, m0511, m0512}, {m0601, m0602, 
m0603, m0604, m0605, m0606, m0607, m0608, m0609, m0610, m0611, 
m0612}, {m0701, m0702, m0703, m0704, m0705, m0706, m0707, m0708, 
m0709, m0710, m0711, m0712}, {m0801, m0802, m0803, m0804, m0805, 
m0806, m0807, m0808, m0809, m0810, m0811, m0812}, {m0901, m0902, 
m0903, m0904, m0905, m0906, m0907, m0908, m0909, m0910, m0911, 
m0912}}
108

instead. This will be fine until dimension 99.

I had another problem with the indexed approach and got confused after all our posts here. With:

Clear[b];
bs = Array[Indexed[b, #] &, 3]
b[1] = 17
bs
(* ==> *)
{Indexed[b, {1}], Indexed[b, {2}], Indexed[b, {3}]}
17
{Indexed[b, {1}], Indexed[b, {2}], Indexed[b, {3}]}

I would have expected:

{17, Indexed[b, {2}], Indexed[b, {3}]}

as the last output line. But this is a total misunderstanding. Indexed[b,i] and b[i] are not the same. The statement:

b[1]=17

doesn't change anything within the list bs. Rather, this just creates a new expression b[1] which is replaced by 17 via pattern matching.

POSTED BY: Werner Geiger

As an aside, IntegerString can be used for left-padding integers with zeros.

StringPadLeft[ToString[#1], 2, "0"]

can be replaced by

IntegerString[#1, 10, 2]
POSTED BY: Rohit Namjoshi
Posted 1 year ago

Zhao, from your example code it is obvious that the symbols x1 and x2 has already been given values before you create the matrix. That's why they displays with their contents, not their names.

In[81]:= x2 = {15, 16, 17, 18, 19};
In[82]:= Array[Symbol["x" <> ToString@FromDigits@{##}] &, {3}]
Out[82]= {x1, {15, 16, 17, 18, 19}, x3}

In[83]:= Clear[x2]
In[84]:= Array[Symbol["x" <> ToString@FromDigits@{##}] &, {3}]
Out[84]= {x1, x2, x3}

Clearing x clears the symbol x, not the symbols x1, x2 ...x327 ...

POSTED BY: Hans Milton
Posted 1 year ago

For what it's worth, here is a simple alternative to using Subscript or Indexed:

In[153]:= m = Array[Symbol["m" <> ToString@FromDigits@{##}] &, {3, 3}]
Out[153]= {{m11, m12, m13}, {m21, m22, m23}, {m31, m32, m33}}

Individual elements can be assigned values or they can be cleared:

In[154]:= m22 = 5
Out[154]= 5

In[155]:= m
Out[155]= {{m11, m12, m13}, {m21, 5, m23}, {m31, m32, m33}}

In[156]:= Clear[m22]

In[157]:= m
Out[157]= {{m11, m12, m13}, {m21, m22, m23}, {m31, m32, m33}}
POSTED BY: Hans Milton
Posted 1 year ago

9-26-2022 Hi Dr. Zhang,

My surname is Zhao.

As for your question, this is a very complicated problem and can't be explained clearly in such a discussion. I have been studying this problem for several months, and the progress is good so far, but it hasn't been completely solved.

POSTED BY: Hongyi Zhao

9-26-2022 Hi Dr. Zhang, Very interesting problems. Among the 230 3-D space groups, how many differences ar there between any pair of space groups? Could that formulation be applied to Mathematica, to assist the problems that you raise?

Posted 1 year ago

Somewhat better is to use Indexed.

Do you mean something like the following, as shown by Werner Geiger?

In[1]:= (* The unknown tarnsformation *)
Clear[t, b];
tTM = Array[Indexed[t, {#1, #2}] &, {3, 3}]
bT = Array[Indexed[b, #] &, 3]

Out[2]= {{Indexed[t, {1, 1}], Indexed[t, {1, 2}], 
  Indexed[t, {1, 3}]}, {Indexed[t, {2, 1}], Indexed[t, {2, 2}], 
  Indexed[t, {2, 3}]}, {Indexed[t, {3, 1}], Indexed[t, {3, 2}], 
  Indexed[t, {3, 3}]}}

Out[3]= {Indexed[b, {1}], Indexed[b, {2}], Indexed[b, {3}]}

but if you have a matrix variable,

Yes. That's exactly my case. How about the following usage as a solution to this situation?

In[21]:= Array[X,{3,3}]

Out[21]= {{X[1, 1], X[1, 2], X[1, 3]}, {X[2, 1], X[2, 2], 
  X[2, 3]}, {X[3, 1], X[3, 2], X[3, 3]}}

then there are interesting uses for Indexed.

What do you mean by saying interesting uses for Indexed?

or use DownValues (where the indices are arguments).

Could you please give an example of this trick?

Regards, Zhao

POSTED BY: Hongyi Zhao
Posted 1 year ago

Zhao, of course, Eric means that kind of code I demonstrated within my little notebook CalcTrans.nb. Did it not answer all your questions?

There is nothing special and no tricks around "Indexed". Why don't you just read the documentation?

Since you seem to be a beginner, you need not bother about down- and up-values for the moment.

POSTED BY: Werner Geiger
Posted 1 year ago

What do you mean by saying interesting uses for Indexed?

Look at the last two examples in the documentation for Indexed. So, for example, by asserting that x is an element of the region Rectangle[] one can infer that x is a 2-dimensional vector (aka a 2-element list) and so Indexed[x,1] and Indexed[x,2] can be meaningfully interpreted in the rest of the expression.

Could you please give an example of this trick?

You already started with your example Array[X,{3,3}]. You can use X[1,1] as you would have used Subscript[x,1,1] or Indexed[x,{1,1}]. If you define X[1,1] = ..., then you have DownValues for X instead of for Subscript. And so you can do ClearAll[X] to easily achieve your original task.

POSTED BY: Eric Rimbey
Posted 1 year ago

Zhao, it would be easier to help if you provided clear and complete examples. Putting x and xTM in your question but not showing how they were defined causes confusion. The title of your post was "Clear all the values associated with a subscripted variable", but the only clearing shown is N[x]=.. I'm not sure why you expect that to work--it looks very strange to me since N is a built in symbol.

However, ignoring your code and trying to answer your question in general...

Subscript is a kind of weird symbol and it can lead to headaches if you try to use it for variables. It isn't protected, so you can do things like Subscript[x,1] = 7, but that creates a defintion for Subscript, not for x. If you later do something like x = 5, then you've basically "lost" your definition for the subscripted x. However, you could just do ClearAll[Subscript] to clear all "subscripted variables".

Somewhat better is to use Indexed. Indexed is protected, so you can't use it for assignments, but if you have a matrix variable, then there are interesting uses for Indexed. Clearing all "subscripted variables" is just clearing the matrix variable. Without some more context, I don't know whether Indexed is actually what you need.

I find that Subscript and Indexed introduce too much complication for very little benefit. The benefit is mostly formatting. I tend to either assign an array to a variable and just use Part in the normal way or use DownValues (where the indices are arguments).

POSTED BY: Eric Rimbey
Posted 1 year ago

What is xTM?

It means The transformation matrix defined here. And my code is aimed to solve the linear equation to find the corresponding transformation matrix.

POSTED BY: Hongyi Zhao
Posted 1 year ago

OK. Not such important for the Subscript/Indexed point.

What do you want to solve? Given some point coordinates before and after transformation, find the transformation matrix and shift vector?

This could be done by Solve. See the attached notebook.

Attachments:
POSTED BY: Werner Geiger
Posted 1 year ago

Thank you for your wonderful example. But for my case, in fact, the purpose is to identify a given space group based on its generators. In other words, I have a given affine matrix group, and I want to determine the type of space group that it belongs to, that is, using a transformation like the one you described as an isomorphic mapping, which can associate my matrix group isomorphically with a particular group of 230 space groups in three dimensions.

The difficulties here are as follows:

  1. I don't know the correspondence between the group elements and the elements of a particular space group. If I build all possible combinations to establish the corresponding equations by enumerating, the possible combinations will be astronomical. As a result, I can't construct the coordinate correspondence as you show.
  2. There are 230 3-dimensional space groups, and I need to narrow the range to minimize the amount of calculation.
  3. Space groups have their own specific restrictions and requirements, and only meeting the mapping between a few points does not necessarily guarantee the isomorphism between the two groups.
POSTED BY: Hongyi Zhao
Posted 1 year ago

I am not familiar with space groups and unfortunately cannot help. The question goes far beyond your original question about Subscript.

POSTED BY: Werner Geiger
Posted 1 year ago

I see. Never mind.

POSTED BY: Hongyi Zhao
Posted 1 year ago

I don't understand your code. What is xTM?

If you want to use subscripted variables, instead of Subscript[x,1,2] and the like you should better use Indexed and write:

Clear[x];
{Indexed[x, 1], Indexed[x, {2, 1}]}
(* ==> {x subscripted with 1, x substripted with 12 *)

... assign values:

{x[1], x[1, 2]} = {1, 21};
{x[1], x[1, 2]}
(* ==> {1, 21} *)

... and clear them all:

Clear[x];
{x[1], x[1, 2]}
(* ==> {x[1], x[1, 2]} *)
POSTED BY: Werner Geiger
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract