Douglas Blumeyer's RTT How-To: Difference between revisions

Cmloegcmluin (talk | contribs)
vectors and covectors: go straight into Wolfram Language; forget about Alpha
Cmloegcmluin (talk | contribs)
null-space: Wolfram Cloud, no Alpha
Line 628: Line 628:
So why the anti-transpose sandwich? What we (and everyone) want in a canonical mapping is to have a triangle of zeros in the bottom left corner. What we want in a comma basis is also to have a triangle of zeros in the bottom left corner. But the comma basis is on the other side of duality from the mapping, so it must be transposed before we can apply our nullSpaceBasis[] function to it, because that function is designed for mappings. But when we transpose the comma basis we end up with the triangle of zeros in the top right. If we take the null-space of that and then transpose it back again, we don't get our canonical form of the mapping, we get a mapping with a triangle of zeros in the top right. The way to fix this is to anti-transpose instead of transpose, before and after taking the null-space. Because when you anti-transpose the comma basis, you still turn columns into rows, but this time the triangle of zeros stays on the bottom left.
So why the anti-transpose sandwich? What we (and everyone) want in a canonical mapping is to have a triangle of zeros in the bottom left corner. What we want in a comma basis is also to have a triangle of zeros in the bottom left corner. But the comma basis is on the other side of duality from the mapping, so it must be transposed before we can apply our nullSpaceBasis[] function to it, because that function is designed for mappings. But when we transpose the comma basis we end up with the triangle of zeros in the top right. If we take the null-space of that and then transpose it back again, we don't get our canonical form of the mapping, we get a mapping with a triangle of zeros in the top right. The way to fix this is to anti-transpose instead of transpose, before and after taking the null-space. Because when you anti-transpose the comma basis, you still turn columns into rows, but this time the triangle of zeros stays on the bottom left.


Unfortunately, to the best of my Wolfram Alpha ability, I'm unable to make the entire process work in one go with Wolfram Alpha. Here is just the part where you take the null-space of the already anti-transposed comma basis:
Here's the Wolfram Language implementation:


{| class="wikitable"
{| class="wikitable"
|+WolframAlpha code ([https://www.wolframalpha.com/input/?i=basis+of+NullSpace%5B%7B%7B-1%2C4%2C-4%7D%2C%7B5%2C-1%2C-10%7D%7D%5D try it])
!input
!output
|-
|<code>basis of NullSpace[{{-1,4,-4},{5,-1,-10}}]</code>
|{44,30,19}
|}
It is possible to do the entire operation with Wolfram Language in general, which you can play with in a Wolfram computable notebook:
{| class="wikitable"
|+Wolfram Language code ([https://www.wolframcloud.com/obj/7063aca4-1fb1-439a-9b0c-faf1cb6558b0 try it])
!input
!input
!output
!output
Line 657: Line 645:
|}
|}


Notice how when writing our comma basis in Wolfram Language, we have to write it differently than we probably would otherwise. Wolfram doesn't understand RTT's angle bracket syntax for indicating how a matrix is sliced and diced; it supports only one way of writing matrices: as lists within lists, where the outermost list is always assumed to be vertical. So if we have a comma basis with two commas, we can't just write one comma and then the other; we have to do one element from each comma in a group at a time. It's not a big deal, but again, may take a little getting used to.


Now the null-space function, to take you from {{vector|{{map|19 30 44}}}} back to the matrix, is pretty much the same thing, but simpler! No need to anti-transpose. Just start at the augmentation step:
Now the null-space function, to take you from {{vector|{{map|19 30 44}}}} back to the matrix, is pretty much the same thing, but simpler! No need to anti-transpose. Just start at the augmentation step:
Line 725: Line 715:


{| class="wikitable"
{| class="wikitable"
|+WolframAlpha code ([https://www.wolframalpha.com/input/?i=basis+of+NullSpace%5B%7B%7B19%2C30%2C44%7D%7D%5D try it])
!input
!input
!output
!output
|-
|-
|<code>basis of NullSpace[<nowiki>{{19,30,44}}</nowiki>]</code>
|<code>nullSpaceBasis[<nowiki>{{19,30,44}}</nowiki>]</code>
|{{-44,0,19},{-30,19,0}}
|{{-44,0,19},{-30,19,0}}
|}
|}


Note that Wolfram's NullSpace[] gives its list of commas as rows, not columns<ref>i.e. we might have expected it to return {{-44,-30},{0,19},{19,0}} instead of {{-44,0,19},{-30,19,0}}. That's why if you look carefully at the Wolfram Language example given earlier, we define our custom nullSpaceBasis function to include a Transpose (it also includes a Reverse, which swaps the order of the commas, to get the lowest prime-limit ones first).</ref>.
It's great to have Wolfram and other such tools to compute these things for us, once we understand them. But I think it’s a very good idea to work through these operations by hand at least a couple times, to demystify them and give you a feel for them.
 
Null-space bases can be calculated by specialized math programs and web tools, as linked above. But I think it’s a good idea to work through it by hand at least a couple times, to demystify it and give you a feel for it.


=== the other side of duality ===
=== the other side of duality ===