Group Abstract Group Abstract

Message Boards Message Boards

0
|
1K Views
|
5 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Variable as an argument to Part

Posted 4 months ago

Greetings, everyone!

How to get Wolfram to do this kind of work:

mm = {a, b};
FullSimplify[Or[mm[[i]] == a, mm[[i]] == b], Assumptions -> i \[Element] {1, 2}]
POSTED BY: Sasha Mandra
5 Replies

Simplify is built for algebraic simplification, while Part is a programming construct. They don't mix together.

POSTED BY: Gianluca Gorni
Posted 4 months ago

You guys amaze me with your ingenuity! Thank you. But I'd like more. The problem is very simple. To get around the restriction on the use of variables in the Part function. Suppose we have a matrix of arbitrary dimension that has some internal symmetry. To find this symmetry, we need to select certain elements from the matrix, compose a certain formula from them and check whether it is fulfilled or not. For this purpose it is necessary to use variables. Only with their help you can determine the selection of elements from the matrix. Isn't it?

POSTED BY: Sasha Mandra
Posted 4 months ago
POSTED BY: Eric Rimbey
Posted 4 months ago
POSTED BY: Eric Rimbey

Perhaps:

mm = {a, b};
Assuming[i == 1 || i == 2,
 FullSimplify[Reduce[{Or[mm[[i]] == a, mm[[i]] == b], $Assumptions}]]
 ]

Or:

mm = {a, b};
Assuming[i == 1 || i == 2,
 FullSimplify[
  Reduce[Quiet[{Or[mm[[i]] == a, 
      mm[[i]] == b], $Assumptions}, {Part::pkspec1}]]]
 ]
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard