Question: hidden characters in worksheet

Two lines that look the same, produce different results. The first lines gives an error message, but the next line that looks the same, does not.

copying and pasting both lines in Notepad reveals the difference:

Determinant*(R1 . B+R2 . B+R3 . B+R4 . A)

Determinant(R1 . B+R2 . B+R3 . B+R4 . A)

It seems that there is a hidden character (the asterisk) in the first line that produces the error.

In the worksheet itself you cannot see the asterisk, but using the arrow keys you can notice that there is another character.

It's hard to debug your code if there are hidden characters.

``

restart; with(LinearAlgebra)

kernelopts(version)*interface(version)

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`*`Standard Worksheet Interface, Maple 2018.2, Windows 10, November 16 2018 Build ID 1362973`

(1)

A := Matrix(4, 4, symbol = a, shape = symmetric)

B := Matrix(4, 4, symbol = b, shape = symmetric)

R1 := Matrix(4, 4); R1[1, 1] := 1; R2 := Matrix(4, 4); R2[2, 2] := 1; R3 := Matrix(4, 4); R3[3, 3] := 1; R4 := Matrix(4, 4); R4[4, 4] := 1

Determinant*(R1.B+R2.B+R3.B+R4.A)

Error, (in LinearAlgebra:-Multiply) invalid arguments

 

Determinant(R1.B+R2.B+R3.B+R4.A)

-a[1, 4]*b[1, 2]*b[2, 3]*b[3, 4]+a[1, 4]*b[1, 2]*b[2, 4]*b[3, 3]+a[1, 4]*b[1, 3]*b[2, 2]*b[3, 4]-a[1, 4]*b[1, 3]*b[2, 3]*b[2, 4]-a[1, 4]*b[1, 4]*b[2, 2]*b[3, 3]+a[1, 4]*b[1, 4]*b[2, 3]^2+a[2, 4]*b[1, 1]*b[2, 3]*b[3, 4]-a[2, 4]*b[1, 1]*b[2, 4]*b[3, 3]-a[2, 4]*b[1, 2]*b[1, 3]*b[3, 4]+a[2, 4]*b[1, 2]*b[1, 4]*b[3, 3]+a[2, 4]*b[1, 3]^2*b[2, 4]-a[2, 4]*b[1, 3]*b[1, 4]*b[2, 3]-a[3, 4]*b[1, 1]*b[2, 2]*b[3, 4]+a[3, 4]*b[1, 1]*b[2, 3]*b[2, 4]+a[3, 4]*b[1, 2]^2*b[3, 4]-a[3, 4]*b[1, 2]*b[1, 3]*b[2, 4]-a[3, 4]*b[1, 2]*b[1, 4]*b[2, 3]+a[3, 4]*b[1, 3]*b[1, 4]*b[2, 2]+a[4, 4]*b[1, 1]*b[2, 2]*b[3, 3]-a[4, 4]*b[1, 1]*b[2, 3]^2-a[4, 4]*b[1, 2]^2*b[3, 3]+2*a[4, 4]*b[1, 2]*b[1, 3]*b[2, 3]-a[4, 4]*b[1, 3]^2*b[2, 2]

(2)

``


 

Download weird.mw

Please Wait...