Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.1K Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:

Pattern matching with subscript

Posted 1 year ago

MyCode

Hi! I get confused about using phase matching with the case of subscript. In the picture, I want to make

Subscript[H,any expr]

multiple

Subscript[H,any expr]==0

However,it doesn't work. Thanks for your help!

POSTED BY: Hao Pang
3 Replies
Posted 1 year ago

Mathematica automatically simplifies b*c*b*a to a*b^2*c but you did not tell Simplify that b^2==0 or that the product of a subscripted variable times the square of a subscripted variable equals zero.

Add one more rule for squares

Simplify[Subscript[A,sn]*Subscript[A,sp]*Subscript[A,sn]*Subscript[d,11], 
   {Subscript[A,x_]*Subscript[A,y_]==0,Subscript[A,z_]^2==0}]

returns

0

Now think if there is a*b*a*c*a == a^3*b*c

Simplify[Subscript[A,sn]*Subscript[A,sp]*Subscript[A,sn]*Subscript[A,sq]*Subscript[A,sn], 
   {Subscript[A,x_]*Subscript[A,y_]==0,Subscript[A,z_]^2==0}]

returns

Subscript[A,sn]^3*Subscript[A,sp]*Subscript[A,sq]

because there is no rule for simplifying cube powers.

Perhaps you could study the documentation and think how to write a rule that says any positive power of a subscripted variable will equal zero. Look up Condition in the documentation and see if you can think how to use that to say that any positive power of a Subscript will equal zero.

Please test that carefully to see that it works as you expect.

POSTED BY: Bill Nelson
Posted 1 year ago

Thank you very much!

To be further, the expr in the picture in math is to be zero. However ,in mathematica it seems not. So how can I solve this problem? Thanks again! enter image description here

POSTED BY: Hao Pang
Posted 1 year ago

Try

Simplify[Subscript[H,SS]*Subscript[H,KK],Subscript[H,x_]*Subscript[H,y_]==0]

which returns

0

because x_ matches something named x while y_ matches something different named y

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard