all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Non-commutative symbolic multiplication in Calc
       [not found] <mailman.6004.1125975207.20277.help-gnu-emacs@gnu.org>
@ 2005-09-06 14:09 ` Roland Winkler
  2005-09-06 17:07   ` Neon Absentius
       [not found]   ` <mailman.6076.1126026835.20277.help-gnu-emacs@gnu.org>
  2005-09-06 20:03 ` Jay Belanger
  1 sibling, 2 replies; 9+ messages in thread
From: Roland Winkler @ 2005-09-06 14:09 UTC (permalink / raw)


Neon Absentius <absent@sdf.lonestar.org> writes:

> Sorry if this is not the right list for this question. 
>
> Is there a way to suspend some of the automatic simplifications that
> calc performs? In particular I am interested in suspending the
> assumption that multiplication is commutative.  This would allow for 
> symbolic calculations with entities that are not necessarily numbers
> or elements of some vector space.   

It's a pretty tricky issue to get useful results when doing
analytical calculations with noncommuting variables. I doubt that
you will get what you want when you just remove the assumption that
multiplication is commutative.

Roland

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Non-commutative symbolic multiplication in Calc
  2005-09-06 14:09 ` Non-commutative symbolic multiplication in Calc Roland Winkler
@ 2005-09-06 17:07   ` Neon Absentius
       [not found]   ` <mailman.6076.1126026835.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Neon Absentius @ 2005-09-06 17:07 UTC (permalink / raw)


On Tue, Sep 06, 2005 at 04:09:36PM +0200, Roland Winkler wrote:
> Neon Absentius <absent@sdf.lonestar.org> writes:
> 
> > Sorry if this is not the right list for this question. 
> >
> > Is there a way to suspend some of the automatic simplifications that
> > calc performs? In particular I am interested in suspending the
> > assumption that multiplication is commutative.  This would allow for 
> > symbolic calculations with entities that are not necessarily numbers
> > or elements of some vector space.   
> 
> It's a pretty tricky issue to get useful results when doing
> analytical calculations with noncommuting variables. 

It seems to me that is tricky to get useful results when doing any
calculations! In any case I am mostly interested in algebraic rather
than analytic results.
 
> I doubt that you will get what you want when you just remove the
> assumption that multiplication is commutative.

Depends on what do you mean by "just" by "remove" and by
"assumption".  When I say "suspend the assumption" I mean
(obviously) to also suspend its consequences, for example there
should be a "left" and a "right" division. It depends also on what I
want, which (at the moment of writing at least) is rather modest, I
will be happy if I am able to work on a free group (or a tensor
algebra) and define relations as rewrite rules.

Ideally the multiplication should not be assumed commutative (or the
variables invertible) unless explicitly declared so.

> 
> Roland

-- 
Most precious among the relics remaining of Peter's skeleton in the
Vatican are 29 fragments of one of his skulls. (St. Peter's other
skull is preserved in a reliquary at the Cathedral of St. John
Lateran.)
   -- Frank R. Zindler, "Of Bones and Boners"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Non-commutative symbolic multiplication in Calc
       [not found]   ` <mailman.6076.1126026835.20277.help-gnu-emacs@gnu.org>
@ 2005-09-06 18:36     ` Roland Winkler
  2005-09-06 19:12       ` Neon Absentius
  0 siblings, 1 reply; 9+ messages in thread
From: Roland Winkler @ 2005-09-06 18:36 UTC (permalink / raw)


Neon Absentius <absent@sdf.lonestar.org> writes:

>> I doubt that you will get what you want when you just remove the
>> assumption that multiplication is commutative.
>
> Depends on what do you mean by "just" by "remove" and by
> "assumption".  When I say "suspend the assumption" I mean
> (obviously) to also suspend its consequences, for example there
> should be a "left" and a "right" division. It depends also on what I
> want, which (at the moment of writing at least) is rather modest, I
> will be happy if I am able to work on a free group (or a tensor
> algebra) and define relations as rewrite rules.
>
> Ideally the multiplication should not be assumed commutative (or the
> variables invertible) unless explicitly declared so.

Emacs calc (the way I look at it) is designed to be a powerful,
advanced calculator. But it is not a computer algebra system which I
would use to address the kind of problem you are talking about..

For example. take a look at Maxima, http://www.ma.utexas.edu/maxima.html.
It's now under GPL, and it even has a nice emacs interface.

Roland

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Non-commutative symbolic multiplication in Calc
  2005-09-06 18:36     ` Roland Winkler
@ 2005-09-06 19:12       ` Neon Absentius
  0 siblings, 0 replies; 9+ messages in thread
From: Neon Absentius @ 2005-09-06 19:12 UTC (permalink / raw)


On Tue, Sep 06, 2005 at 08:36:49PM +0200, Roland Winkler wrote:
> Neon Absentius <absent@sdf.lonestar.org> writes:
> > Ideally the multiplication should not be assumed commutative (or the
> > variables invertible) unless explicitly declared so.
> 
> Emacs calc (the way I look at it) is designed to be a powerful,
> advanced calculator. But it is not a computer algebra system which I
> would use to address the kind of problem you are talking about..
> 

If there is a line between an advanced desk calculator and a CAS then
surely Emacs calc has crossed it! OTOH what are PC's but (glorified)
advanced desk calculators? :)

But (more) seriously what I am talking about is not really that more 
complicated than what calc does already. If it can calculate 
          2     2            2
   (x + y)   = x  + 2 y x + y

then it should be able to do 
          2     2                2
   (x + y)   = x  + x y + y x + y
   

> For example. take a look at Maxima, http://www.ma.utexas.edu/maxima.html.
> It's now under GPL, and it even has a nice emacs interface.

Yes I know about maxima and I use it. However I usually prefer calc
for a "quick and dirty" calculation. And I really like the interface.


-- 
Most precious among the relics remaining of Peter's skeleton in the
Vatican are 29 fragments of one of his skulls. (St. Peter's other
skull is preserved in a reliquary at the Cathedral of St. John
Lateran.)
   -- Frank R. Zindler, "Of Bones and Boners"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Non-commutative symbolic multiplication in Calc
       [not found] <mailman.6004.1125975207.20277.help-gnu-emacs@gnu.org>
  2005-09-06 14:09 ` Non-commutative symbolic multiplication in Calc Roland Winkler
@ 2005-09-06 20:03 ` Jay Belanger
  2005-09-06 21:33   ` Bug in Calc? (was Re: Non-commutative symbolic multiplication in Calc) Neon Absentius
       [not found]   ` <mailman.6115.1126042963.20277.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: Jay Belanger @ 2005-09-06 20:03 UTC (permalink / raw)



Neon Absentius <absent@sdf.lonestar.org> writes:

> Sorry if this is not the right list for this question. 
>
> Is there a way to suspend some of the automatic simplifications that
> calc performs? In particular I am interested in suspending the
> assumption that multiplication is commutative.

Does matrix mode ("m v") do what you want?

Jay

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Bug in Calc? (was Re: Non-commutative symbolic multiplication in Calc)
  2005-09-06 20:03 ` Jay Belanger
@ 2005-09-06 21:33   ` Neon Absentius
  2005-09-07 11:42     ` Bug in Calc? Neon Absentius
       [not found]     ` <mailman.6172.1126094602.20277.help-gnu-emacs@gnu.org>
       [not found]   ` <mailman.6115.1126042963.20277.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: Neon Absentius @ 2005-09-06 21:33 UTC (permalink / raw)


On Tue, Sep 06, 2005 at 03:03:30PM -0500, Jay Belanger wrote:
> 
> Neon Absentius <absent@sdf.lonestar.org> writes:
> 
> > Sorry if this is not the right list for this question. 
> >
> > Is there a way to suspend some of the automatic simplifications that
> > calc performs? In particular I am interested in suspending the
> > assumption that multiplication is commutative.
> 
> Does matrix mode ("m v") do what you want?

Yes and no!

I mean if it would do what the info describes I would be happy. 
I don't think that the assumption all variables are matrices 
really says much more than "distinct variables do not necessarily
commute", so that would be exactly what I was looking for. Alas
there seems to be a bug: After I give 'm v' if I ask calc to
simplify the expression 'a b - b a' it leaves it as is which is as 
expected. However when I ask it to expand '(a+b)^2' it returns 
'a^2 + 2 b a + b^2' which is of course wrong if a and b don't commute. 
This happens both with emacs-multi-tty (22.0.50) and whith emacs
21.4.1 on a Debian testing/unstable. The bug manifsts itself also
for the expansion of '(a+b)^3' however calc expands '(x+y)(x-y)'
into 'x^2 + y x  -  x y + y^2'. Strange!

I attach the "Trail buffer" 

,----
| Emacs Calculator v2.1 by Dave Gillespie
|      1
| alg' (x + y)^2
| simp (x + y)^2
| simp (x + y)^2
| expa x^2 + 2 * y * x + y^2
| derv 2 * x + 2 * y
| alg' (a + b)^2
| expa a^2 + 2 * b * a + b^2
| alg' (a + b)^2
| expa a^2 + 2 * b * a + b^2
| alg' (b + a)^2
| expa b^2 + 2 * a * b + a^2
| alg' a
| alg' b
| alg' b
| aprt b
| alg' a
|    * b * a
|      3
| alg' a
|    * b * a
|    * a * b
|    - b * a - a * b
| simp b * a - a * b
| simp b * a - a * b
| alg' (b + a)^2
| expa b^2 + 2 * a * b + a^2
| alg' (a + b)^3
| expa a^3 + 3 * b * a^2 + 3 * b^2 * a + b^3
| alg' (x - y) * (x + y)
| expa x^2 + x * y - y * x - y^2
| alg' (a - b) * (b + a)
| expa a * b + a^2 - b^2 - b * a
| alg' a * b
| alg' b * a
|    + a * b + b * a
`----

-- 
Most precious among the relics remaining of Peter's skeleton in the
Vatican are 29 fragments of one of his skulls. (St. Peter's other
skull is preserved in a reliquary at the Cathedral of St. John
Lateran.)
   -- Frank R. Zindler, "Of Bones and Boners"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug in Calc?
  2005-09-06 21:33   ` Bug in Calc? (was Re: Non-commutative symbolic multiplication in Calc) Neon Absentius
@ 2005-09-07 11:42     ` Neon Absentius
       [not found]     ` <mailman.6172.1126094602.20277.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Neon Absentius @ 2005-09-07 11:42 UTC (permalink / raw)


On Tue, Sep 06, 2005 at 09:33:48PM +0000, Neon Absentius wrote:

> there seems to be a bug: After I give 'm v' if I ask calc to
> simplify the expression 'a b - b a' it leaves it as is which is as 
> expected. However when I ask it to expand '(a+b)^2' it returns 
> 'a^2 + 2 b a + b^2' which is of course wrong if a and b don't commute. 
> This happens both with emacs-multi-tty (22.0.50) and whith emacs
> 21.4.1 on a Debian testing/unstable. The bug manifsts itself also
> for the expansion of '(a+b)^3' however calc expands '(x+y)(x-y)'
> into 'x^2 + y x  -  x y + y^2'. Strange!

Maybe not so strange.  Probably calc uses formulae (the binomial
expansion?)  to expand the power instead of fully distributing the
multiplication over the addtition "by hand", so to speak.  Of course
the binomial expansion is not valid if the variables involved do not
commute.
 
I am not sure how to check if this is indeed the reason for the bug.

-- 
Most precious among the relics remaining of Peter's skeleton in the
Vatican are 29 fragments of one of his skulls. (St. Peter's other
skull is preserved in a reliquary at the Cathedral of St. John
Lateran.)
   -- Frank R. Zindler, "Of Bones and Boners"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug in Calc?
       [not found]     ` <mailman.6172.1126094602.20277.help-gnu-emacs@gnu.org>
@ 2005-09-07 13:56       ` Jay Belanger
  0 siblings, 0 replies; 9+ messages in thread
From: Jay Belanger @ 2005-09-07 13:56 UTC (permalink / raw)
  Cc: belanger


Neon Absentius <absent@sdf.lonestar.org> writes:

> On Tue, Sep 06, 2005 at 09:33:48PM +0000, Neon Absentius wrote:
>
>> there seems to be a bug: After I give 'm v' if I ask calc to
>> simplify the expression 'a b - b a' it leaves it as is which is as 
>> expected. However when I ask it to expand '(a+b)^2' it returns 
>> 'a^2 + 2 b a + b^2' which is of course wrong if a and b don't commute. 
>> This happens both with emacs-multi-tty (22.0.50) and whith emacs
>> 21.4.1 on a Debian testing/unstable. The bug manifsts itself also
>> for the expansion of '(a+b)^3' however calc expands '(x+y)(x-y)'
>> into 'x^2 + y x  -  x y + y^2'. Strange!
>
> Maybe not so strange.

Maybe not strange, but still a bug.

> Probably calc uses formulae (the binomial expansion?)  to expand the
> power instead of fully distributing the multiplication over the
> addtition "by hand", so to speak.  Of course the binomial expansion
> is not valid if the variables involved do not commute.

That is what happens.  It should be fixed soon.

Jay

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bug in Calc? (was Re: Non-commutative symbolic multiplication in Calc)
       [not found]   ` <mailman.6115.1126042963.20277.help-gnu-emacs@gnu.org>
@ 2005-09-07 19:36     ` Jay Belanger
  0 siblings, 0 replies; 9+ messages in thread
From: Jay Belanger @ 2005-09-07 19:36 UTC (permalink / raw)



Neon Absentius <absent@sdf.lonestar.org> writes:
...
> Alas, there seems to be a bug: After I give 'm v' if I ask calc to
> simplify the expression 'a b - b a' it leaves it as is which is as 
> expected. However when I ask it to expand '(a+b)^2' it returns 
> 'a^2 + 2 b a + b^2' which is of course wrong if a and b don't commute. 
> This happens both with emacs-multi-tty (22.0.50) and whith emacs
> 21.4.1 on a Debian testing/unstable. The bug manifsts itself also
> for the expansion of '(a+b)^3' however calc expands '(x+y)(x-y)'
> into 'x^2 + y x  -  x y + y^2'. Strange!

This should be fixed in CVS.

Jay

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-09-07 19:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.6004.1125975207.20277.help-gnu-emacs@gnu.org>
2005-09-06 14:09 ` Non-commutative symbolic multiplication in Calc Roland Winkler
2005-09-06 17:07   ` Neon Absentius
     [not found]   ` <mailman.6076.1126026835.20277.help-gnu-emacs@gnu.org>
2005-09-06 18:36     ` Roland Winkler
2005-09-06 19:12       ` Neon Absentius
2005-09-06 20:03 ` Jay Belanger
2005-09-06 21:33   ` Bug in Calc? (was Re: Non-commutative symbolic multiplication in Calc) Neon Absentius
2005-09-07 11:42     ` Bug in Calc? Neon Absentius
     [not found]     ` <mailman.6172.1126094602.20277.help-gnu-emacs@gnu.org>
2005-09-07 13:56       ` Jay Belanger
     [not found]   ` <mailman.6115.1126042963.20277.help-gnu-emacs@gnu.org>
2005-09-07 19:36     ` Bug in Calc? (was Re: Non-commutative symbolic multiplication in Calc) Jay Belanger

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.