Message Boards Message Boards

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

How to put Wolfram|Alpha output in a Block

Posted 3 years ago

Hi Everyone,

I am using Wolfram|Alpha inside a Mathematica notebook for getting a permutation matrix for a particular order. I want to use output of this inside a Block but its not happening.

POSTED BY: Aditya Srivastav
Posted 3 years ago

Hi Aditya

MatrixForm is not computable. Also avoid use of symbol names starting with an uppercase letter, WL built-in symbols use that convention. And using %, especially in a function definition is asking for trouble.

m = WolframAlpha[
   "matrix of the permutation (4 3 2)(1)", {{"PermutationMatrix", 1}, 
    "ComputableData"}] // ReleaseHold

my[r_] := Block[{a, b}, a = m; b = a . r . a\[Transpose]]; (* Why do you need Block here? *)

my[{{1/2, 0, 0, -(1/2)}, {-(1/2), 1, 0, -(1/2)}, {-(1/2), 0, 1, -(1/2)}, {-(1/2), 0, 0, 1/2}}]
(* {{1/2, -(1/2), 0, 0}, {-(1/2), 1/2, 0, 0}, {-(1/2), -(1/2), 1, 0}, {-(1/2), -(1/2), 0, 1}} *)
POSTED BY: Rohit Namjoshi
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