Martin Schönecker | 1 Apr 09:06 2009
Picon
Picon

Re: "cave laqueum!"


> Maybe, but we should also systematically recommend and document the 
> load("name") form rather than load(name).

Thank you, I think I will stick to that.  Paths to, and names of, files 
typically are strings, and using quotes minimizes the error rate, and 
constructs like load("d:\\mypackages\\package1") to load package1.mac 
works, as well.
Valery A. Lovchikov | 1 Apr 08:19 2009

mistake /* Maxima-5.17.1 */

Hi!

f:2*((u-cos(b))^2-u^2+2*cos(b)*u)+2*u^2-4*cos(b)*u;
x:factor(expand(f));
err:sqrt(factor(expand(f)))-radcan(sqrt(f));
/* sqrt(x^2)=abs(x), not sqrt(x^2)=x  */

Please corect.

Truly yours,
Valery Lovchikov
Martin Schönecker | 1 Apr 14:15 2009
Picon
Picon

Rules and Patterns

This is a case where a pattern seems to match, but it doesn't match!? 
Anybody knows why?

Regards,
Martin

/*Declare patterns for f and for an atom.*/

(%i1) matchdeclare(
     fpat, fp,
     atompat, atom
);
(%o1) done
(%i2) fp(e) := (atom(e) and e=f);
(%o2) fp(e):=atom(e) and e=f

(%i3) expr: a*b*f;
(%o3) a*b*f

/*Declare a rule that tests for a product of an atom and f.
Return the factors as well as the pattern match results.*/

(%i4) defrule(
     prodrul,
     atompat*fpat,
     baz(atompat, atom(atompat), fpat, fp(fpat))
);
fpat*atompat partitions `product'
(%o4) prodrul:atompat*fpat->baz(atompat,atom(atompat),fpat,fp(fpat))

(Continue reading)

Stavros Macrakis | 1 Apr 15:31 2009
Picon

Re: "cave laqueum!"

2009/3/31 Robert Dodier <robert.dodier <at> gmail.com>
2009/3/31 Stavros Macrakis <macrakis <at> alum.mit.edu>:

> Maybe, but we should also systematically recommend and document the
> load("name") form rather than load(name).

Disagreed. I would rather that the argument to load is a
symbol which represents the package, rather than a string
which names a file.

I wouldn't disagree if we had some coherent semantics around symbols representing packages, such as ways of naming objects within packages e.g. packagename.objectname (note that "." would not be ambiguous if packagename were actually known to be of type 'package'), some sort of story about what packagename : value means (is it illegal? does it replace the package meaning with the value, and therefore make the package inaccessible? etc.); other useful functions on packages (e.g. loaded_p(package), objects(package), dependencies(package), ...).

As it is, the symbol within load() is used *strictly* for its name, and Maxima doesn't even know a priori that it is a package name.  Taking advantage of the fact that symbols evaluate to themselves if they don't evaluate to something else in this context is ugly and error-prone.  Even if we remove built-ins whose names conflict with package names, what about user functions and packages?

Having some functions implicitly quote their arguments and others not is just a mess.  Yes, it is 'convenient', but it means that doing things like map(load,<list of package names>) won't work as you would reasonably expect.

             -s

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Fateman | 1 Apr 15:53 2009
Picon

Re: mistake /* Maxima-5.17.1 */

Unfortunately, sqrt(x^2)=abs(x) is wrong.   It is well known that there 
are 2 square roots, which might in this case be written as {x, -x}.

Maxima does not have an effective way of dealing with {x, -x},
Radcan, as should be indicated in the documentation, picks one of them. 

RJF

Valery A. Lovchikov wrote:
> Hi!
>
> f:2*((u-cos(b))^2-u^2+2*cos(b)*u)+2*u^2-4*cos(b)*u;
> x:factor(expand(f));
> err:sqrt(factor(expand(f)))-radcan(sqrt(f));
> /* sqrt(x^2)=abs(x), not sqrt(x^2)=x  */
>
> Please corect.
>
> Truly yours,
> Valery Lovchikov
>
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>   
Richard Fateman | 1 Apr 16:00 2009
Picon

Re: Rules and Patterns

I'm not sure what you want to accomplish, but you might want to use the 
program for partitioning that is described in
http://www.cs.berkeley.edu/~fateman/papers/partition.pdf

RJF
Fabrizio Caruso | 1 Apr 16:48 2009
Picon
Picon

irreducibility test

Hi

Is there a function that tests whether
a polynomial is irreducible?

In particular I am interested
in polynomials over a finite field
with prime number of elements.

I would like to avoid having to
use "factor" and count the factors
nor reimplement Berlekamp's algorithm.

    Fabrizio
Richard Fateman | 1 Apr 17:19 2009
Picon

Re: irreducibility test

Fabrizio Caruso wrote:
> Hi
>
> Is there a function that tests whether
> a polynomial is irreducible?
>   

> In particular I am interested
> in polynomials over a finite field
> with prime number of elements.
>   
There is no test that will ALWAYS work, short of factoring.

> I would like to avoid having to
> use "factor" and count the factors
> nor reimplement Berlekamp's algorithm.
>
>   
Why would you reimplement this? Use the code in Maxima.
Fabrizio Caruso | 1 Apr 17:36 2009
Picon
Picon

Re: irreducibility test

Well, one can do better
than fully factoring into
irreducible factors to tell whether a
polynomial is irreducible.
Berlekamp's algorithm recursively tries
to factor a polynomial.
In order to tell whether a polynomial
is irreducible over a finite field,
one only needs to run one
factorization step of Berlekamp's algorithm.
This should in general be
much faster than what "factor" does.

Unfortunately I am not fluent enough
in Lisp to reuse Maxima's Lisp code.
If someone could help...

I need this in my next update of the
GF package for finite fields.

    Fabrizio

On Wed, 1 Apr 2009, Richard Fateman wrote:

> Fabrizio Caruso wrote:
>>  Hi
>>
>>  Is there a function that tests whether
>>  a polynomial is irreducible?
>> 
>
>>  In particular I am interested
>>  in polynomials over a finite field
>>  with prime number of elements.
>> 
> There is no test that will ALWAYS work, short of factoring.
>
>>  I would like to avoid having to
>>  use "factor" and count the factors
>>  nor reimplement Berlekamp's algorithm.
>>
>> 
> Why would you reimplement this? Use the code in Maxima.
>
>
>
Robert Dodier | 1 Apr 18:20 2009
Picon

Re: defining a function

On Wed, Apr 1, 2009 at 9:06 AM, Sam Steingold <sds <at> gnu.org> wrote:

> interesting, so in maxima '' is an "unquote".

Sort of -- it causes the current value to be substituted when
an expression is read.

> qhere is it documented?

? ''
or
?? quote
at the input prompt should find it.

best

Robert Dodier

Gmane