Message Boards Message Boards

0
|
5233 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Delete returned True and False from a list?

Posted 7 years ago

Hi, I am using a certain condition in generating a large set of lists whose elements can contain the two words 'True' and 'False' as returned by the condition. How to remove these two words from each list without the need to that manually knowing that some of teh lists may not contain these two words? I have tried DeleteCases and match to 'True' and 'False' but that didn't work. This is an example of the lists I am generating:

{False, True, False, False, False, 
 1/128 (6 + 18 Sqrt[5] - 96 Subscript[a, 11]) == 
  0, -(1/4) Sqrt[3] Subscript[a, 12] == 0, (Sqrt[3] Subscript[a, 12])/
  8 == 0, -(1/8) Sqrt[3] Subscript[a, 13] == 0, (
  Sqrt[3] Subscript[a, 13])/8 == 0}

also, how to delete elements that contain numbers only with no variables or coefficients? Thank you,

eftrsd

POSTED BY: eft rsd
3 Replies
Posted 7 years ago

Thank you all. eftrsd

POSTED BY: eft rsd

To delete also a numeric quantity, add to what Sander gives as follows:

DeleteCases[{False, True, False, False, False, 
  1/128 (6 + 18 Sqrt[5] - 96 Subscript[a, 11]) == 
   0, -(1/4) Sqrt[3] Subscript[a, 12] == 
   0, (Sqrt[3] Subscript[a, 12])/8 == 
   0, -(1/8) Sqrt[3] Subscript[a, 13] == 
   0, (Sqrt[3] Subscript[a, 13])/8 == 0, 3., 100, \[Pi]}, 
 True | False | _?NumericQ]
POSTED BY: Chi-Hsiang Wang
DeleteCases[{False, True, False, False, False, 
  1/128 (6 + 18 Sqrt[5] - 96 Subscript[a, 11]) == 
   0, -(1/4) Sqrt[3] Subscript[a, 12] == 
   0, (Sqrt[3] Subscript[a, 12])/8 == 
   0, -(1/8) Sqrt[3] Subscript[a, 13] == 
   0, (Sqrt[3] Subscript[a, 13])/8 == 0}, True | False]

works fineĀ…

POSTED BY: Sander Huisman
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