Message Boards Message Boards

0
|
6839 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Symbolic matrices; Subsets; local variables

Posted 10 years ago
Hi all,

I am a long-time Maple user and I have some questions to ask.
For my research, I wonder if Mathematica will be more powerful in some aspects.
I have read some documents and know basic computations.
I also know how to write basic functions.
But still have difficulty in the followings:

1 - I want to get all possible lists (sets) of {0,1} given K
Examples like K=3,4,5
Note that the set with all 0s are removed.


2 - How to get "Matrix" in Mathematica? I read that they are like "Tables", but how exactly do I creat them?


I think I can get the "symbolic" matrix, like this:
Module[{ans},
ans = Table[
    Subscript[\[Mu], \[Phi]] + Subscript[\[Tau], \[Phi], j] +
     Subscript[\[Eta], \[Phi], c], {j, 1, 5}, {c, 1,
     3}] /. {Subscript[\[Tau], \[Phi], 1] -> 0,
    Subscript[\[Eta], \[Phi], 1] -> 0};
MatrixForm[ans]]

This is fine. But if I have assigned any of the variables, such as Subscript[\, \]=0.4, or any of the variables,
the output would change. I dont want that to happen.

How do I make ALL the variables in the above matrix "local" to the function?
Also, how do I ask Mathematica to get a set (list) of all the varibles in the matrix above?
Like the "indets" function in Maple.


3 - Problem with "MatrixForm"
 


Does " "MatrixForm" actually term the expression into Matrix?
I would expect the output to give me the entry of 1 row and 1 column, i.e. mu_phi

4 - In Mathematica, is mu_phi a valid "symbol" (variable)?
How do I define it to be a "whole"  "symbol" (variable)?

5 - Aside from True,False, how do I get an error message if neither True nor False is given?

In out39, I would expect a error message.

6 - Another form to say "True"


It is possible to have Out45 and Out56 to be the same we have the input "True"?

Thanks!
POSTED BY: Casper YC
Posted 10 years ago
myCHcc[K_] := Table[IntegerDigits[n, 2, K], {n, 1, 2^K - 1}]

https://reference.wolfram.com/mathematica/ref/If.html

In[2]:= Union[Apply[Flatten, tmp /. Plus -> List]]

Out[2]= {Subscript[\[Mu], \[Phi]], Subscript[\[Eta], \[Phi], 2], Subscript[\[Eta], \[Phi], 3],
Subscript[\[Tau], \[Phi], 2], Subscript[\[Tau], \[Phi], 3], Subscript[\[Tau], \[Phi], 4],
Subscript[\[Tau], \[Phi], 5]}
POSTED BY: Bill Simpson
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