<div dir="ltr"><div dir="ltr">here's why it cannot be done:<div><br></div><div>data TwoByTwoMatrix = TTM Integer Integer Integer Integer</div><div><br></div><div>instance Num TwoByTwoMatrix where</div><div> fromInteger i = TTM i 0 0 i</div><div> (TTM a b c d) + (TTM e f g h) = TTM (a+e) (b+f) (c+g) (d+h)</div><div> negate m = (fromInteger (-1)) * m</div><div> (TTM a b c d) * (TTM e f g h) = TTM (b*g+a*e) (a*f+b*h) (d*g+c*e) (c*f+d*h)</div><div>It should follow that the above is a (non-abelian) ring, as required (all definitions follow the standard matrix addition/multiplication/addition convensions).</div><div><br></div><div>n = (TTM 0 1 0 0)</div><div>then: n * (n + 1) = n.</div><div>Since n has odd entries, it cannot be divided by 2 (more precisely: we cannot find an m s.t. n * 2 = m).</div><div><br></div><div>Best,</div><div>Sebastiaan</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 16, 2020 at 6:14 PM Henning Thielemann <<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On Wed, 16 Dec 2020, Tom Smeding wrote:<br>
<br>
> You say 'abs x = x/2', but what's that (/)? For example, what is 'abs' <br>
> supposed to give when called on (the representation of) the polynomial <br>
> X^2 + 3X + 2?<br>
<br>
I meant it this way:<br>
<br>
instance (Fractional a) => Num (Polynomial a) where<br>
abs = fmap (/2)<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div>