Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4552

Re: Coolest Python recipe of all time

References (3 earlier) <018ur6da31iv7us9gm4dpgl7tfl0i6snb2@4ax.com> <ipo2df$14c$1@dough.gmane.org> <mailman.1098.1304402417.9059.python-list@python.org> <929lmdF59lU1@mid.individual.net> <ipp85f$mf2$1@dough.gmane.org>
Date 2011-05-03 09:51 -0700
Subject Re: Coolest Python recipe of all time
From geremy condra <debatem1@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1113.1304441504.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, May 3, 2011 at 8:49 AM, Terry Reedy <tjreedy@udel.edu> wrote:
> On 5/3/2011 2:29 AM, Gregory Ewing wrote:
>>
>> Terry Reedy wrote:
>>>
>>> The trick is that replacing x with j and evaluating therefore causes
>>> (in Python) all the coefficients of x (now j) to be added together
>>> separately from all the constant terms to reduce the linear equation
>>> to a*x+b (= 0 implied).
>>
>> Hmmm... so if we used quaternions, could we solve systems
>> of linear equations in 3 variables?
>
> Yes and no. The use of 1*j merely collected and added together all the
> multipliers of 'x' (and all the constant terms). That is a fairly trivial
> matter of constant folding. Systems of linear equations are usually
> presented in that form already. The actual solution to the simple equation
> is in the formula x = -a/b (where a and b are the sums). The solution
> formula for three variables would be far more complex.

Or just use a gauss-jordan solver, which has the advantage of being
easy to explain and possible to verify by hand on small instances.

Geremy Condra

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-02 10:33 -0700
  Re: Coolest Python recipe of all time David Monaghan <monaghand.david@gmail.com> - 2011-05-02 21:48 +0100
    Re: Coolest Python recipe of all time Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-02 14:58 -0600
      Re: Coolest Python recipe of all time David Monaghan <monaghand.david@gmail.com> - 2011-05-02 22:45 +0100
        Re: Coolest Python recipe of all time Stefan Behnel <stefan_ml@behnel.de> - 2011-05-03 07:04 +0200
          Re: Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-03 09:43 -0700
            Re: Coolest Python recipe of all time Chris Angelico <rosuav@gmail.com> - 2011-05-04 07:54 +1000
            Re: Coolest Python recipe of all time Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-03 16:10 -0600
        Re: Coolest Python recipe of all time Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-02 23:17 -0600
        Re: Coolest Python recipe of all time Terry Reedy <tjreedy@udel.edu> - 2011-05-03 02:00 -0400
          Re: Coolest Python recipe of all time Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-03 18:29 +1200
            Re: Coolest Python recipe of all time Terry Reedy <tjreedy@udel.edu> - 2011-05-03 11:49 -0400
            Re: Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-03 09:32 -0700
            Re: Coolest Python recipe of all time geremy condra <debatem1@gmail.com> - 2011-05-03 09:51 -0700
        Re: Coolest Python recipe of all time Stefan Behnel <stefan_ml@behnel.de> - 2011-05-03 08:23 +0200
          Re: Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-03 15:19 -0700
  Re: Coolest Python recipe of all time Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-06 16:59 +0000
    Re: Coolest Python recipe of all time geremy condra <debatem1@gmail.com> - 2011-05-06 10:43 -0700
    Re: Coolest Python recipe of all time Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-06 12:36 -0600
      Re: Coolest Python recipe of all time Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-07 08:29 +0000
        Re: Coolest Python recipe of all time Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-07 08:54 -0600
        Re: Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-07 14:02 -0700
    Re: Coolest Python recipe of all time Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-06 13:38 -0600
    Re: Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-06 12:58 -0700
  RE: Coolest Python recipe of all time Trent Nelson <trent@snakebite.org> - 2011-05-09 02:31 -0700
    Re: Coolest Python recipe of all time Raymond Hettinger <python@rcn.com> - 2011-05-09 14:10 -0700

csiph-web