Message Boards Message Boards

0
|
3495 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Product and inverse of matrices interpreted unexpectedly in Wolfram|Alpha

Posted 2 years ago

Hello everyone!

I have some weirdness going on with matrix products and inverses. If I'm calculating the following expression in one step, I get a wrong result:
inverse (((1,2,3),(-1,0,1),(2,1,1)) * (inverse ((1,-2,0),(1,-3,0),(3,-2,1))))
If I instead calculate the inner inverse first, I get the correct result:
inverse ((1,-2,0),(1,-3,0),(3,-2,1))
inverse (((1,2,3),(-1,0,1),(2,1,1)) * ((3,-2,0),(1,-1,0),(-7,4,1)))
After being stumped over this, I calculated the expression by hand and got the same result.

Has anyone an idea why Wolfram|Alpha gives me a wrong result in the first case?
I noticed that there's no dot between the matrices in the first case, but I don't know why since I've used the same syntax throughout the queries.

POSTED BY: Magnus Lubkowitz
5 Replies

Hello Magnus

If you need "real" matrix multiplication you need Dot ( . ).

Otherwise the matrices A, B get multiplied element by element a(i,j)*b(i,j).

Robert

POSTED BY: Robert Nowak

Oh, that explains my stumpedness, thanks Robert!

Then I'm only a bit confused why the asterisk is interpreted as a dot in the second case, since the result there is a real matrix product - that is what lead me to believe the asterisk does what I want in the first place :D Using the query ((1,2,3),(-1,0,1),(2,1,1)) * ((3,-2,0),(1,-1,0),(-7,4,1)), the visual representation of Wolfram|Alpha also shows the asterisk as a dot, while with inverse (((1,2,3),(-1,0,1),(2,1,1)) * (inverse ((1,-2,0),(1,-3,0),(3,-2,1)))), no operator is shown between the matrices.

In any case, I now know how to tell Wolfram|Alpha what I want it to do!

POSTED BY: Magnus Lubkowitz

I think there are heuristics used to decide when asterisk means Times (in the sense of the Mathematica operation) and when it means Dot. So there can be cases where these simply fail to guess correctly the intention of the user.

POSTED BY: Daniel Lichtblau

Ah, I understand. Is there some more in-depth documentation for the online Wolfram|Alpha, besides the examples? I ran into similar problems before, but I always only find the Wolfram Language reference and the Wolfram|Alpha API documentation, and would be happy to understand such problems myself!

POSTED BY: Magnus Lubkowitz

Oh sorry, I only put the queries as description of the corresponding pictures.

Actually, I just found the source of the weirdness: The first query is

inverse (((1,2,3),(-1,0,1),(2,1,1)) * (inverse ((1,-2,0),(1,-3,0),(3,-2,1))))

the successful one ist

inverse (((1,2,3),(-1,0,1),(2,1,1)) * ((3,-2,0),(1,-1,0),(-7,4,1)))

If I instead of the " * " use " . ", the first query is working as expected as well. Looking at the examples now, the dot is used for matrix products, but for some instances the asterisk yields the same result as the dot, which lead me to believe they're interchangeable.

I didn't find an example of what the asterisk should actually do, so is it expected that it does something different when used in the first query?

POSTED BY: Magnus Lubkowitz
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