1 Jan 03:19 2010

### Re: what does declare(x, special) do?

On Wed, Dec 16, 2009 at 7:27 PM, Robert Dodier wrote:
On Wed, Dec 16, 2009 at 11:39 AM, nijso beishuizen <nijso <at> hotmail.com> wrote:
> what does declare(x,special) do to x?

It's obsolete, probably we should have cut out that stuff long ago.
I'm pretty sure it has no effect whatsoever.

Maxima -- like Maclisp and other Lisps designed in the 1960's -- originally had dynamic scope when interpreted and a limited sort of lexical scope when compiled -- yes, interpreted and compiled code did not always give the same results!  Variables declared special were bound dynamically even in compiled code.

Maxima now has dynamic scope both interpreted and compiled (see test below) - in effect, *all* variables are declared special.  I do not know what commercial Macsyma did/does.

-s

(%i1) f() := block([a:23],g())$(%i2) g() := a$
(%i3) f();
(%o3)                                                                                        23
(%i4) translate(f,g);
(%o4)                                                                                      [f, g]
(%i5) f();
(%o5)                                                                                        23
(%i6) compile(f,g);
Compiling C:/Users/Stavros/AppData/Local/Temp/gazonk_2036_0.lsp.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=2, Space=3, Speed=3
Finished compiling C:/Users/Stavros/AppData/Local/Temp/gazonk_2036_0.lsp.
Compiling C:/Users/Stavros/AppData/Local/Temp/gazonk_2036_0.lsp.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=2, Space=3, Speed=3
Finished compiling C:/Users/Stavros/AppData/Local/Temp/gazonk_2036_0.lsp.
(%o6)                                                                                      [f, g]
(%i7) f();
(%o7)                                                                                        23
(%i8) block([a:56],f());
(%o8)                                                                                        23

For the record, all Maxima variables are special variables in the
sense of Lisp special variables (from which the Maxima special
declaration was copied, I suppose). From time to time I wish that
Maxima implemented some kind of lexical variable, but that's
a separate topic ....

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

1 Jan 18:10 2010

### Re: Maxima 5.20.1

Jim FitzSimons wrote:
> I tried to download Maxima 5.20.1 from
> http://sourceforge.net/projects/maxima/files/
>
> and it crashes internet explorer 6.
>
> Is there another place to get Maxima 5.20.1 ?
>
> Jim FitzSimons

If Internet Explorer crashes, that is a bug in Internet Explorer bug or Windows.
No matter what you do, you should not be able to crash it, so the fact you can,
indicates a bug. As such, it would be better to upgrade to Firefox, and you will
probably find the problem goes away.

Dave

1 Jan 19:10 2010

### Re: search and replace in expression?


On Wed, 30 Dec 2009, Rui Maciel wrote:

< Let's say we have a list like the following:
<
< (%i1) d:[d1,d2,d3,d4,d5,d6,d7,d8];
< (%o1)                     [d1, d2, d3, d4, d5, d6, d7, d8]
<
< Let's suppose that I changed my mind and, instead of a list with variables
< named d[0-8], I wish to have a list with variables named x[0-8] and two other
< lists with variables named y[0-8] and z[0-8].

To create your list, try
d :  makelist(concat('d,i),i,1,8);

If you want to create new lists via substitution, then subst can do it
subst( makelist(concat('d,i)=concat('x,i),i,1,8), d );

although it is probably easier to create the list from scratch.

<
< It would be great if instead of being forced to hand-write three new list
< declarations it was possible to simply search for a pattern in a input command
< (in this case it would be %i1), replace the search results with a new string
< and execute the newly generated input strings.
<
< So, does Maxima support that?

Yes, I believe that subst can handle most of your needs. If you have other, more

Leo

--

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

1 Jan 19:22 2010

### Re: programming in maxima


On Wed, 30 Dec 2009, r Rishikesh wrote:

< I want to write a function which computes derivative given a list.
< Consider the following situation:
<
< (%i1) array(x,10);
<
< (%o1) x
< (%i2) expr: product(1+x[i]^i,i,1,10);
<
< (%o2) (x[1]+1)*(x[2]^2+1)*(x[3]^3+1)*(x[4]^4+1)*(x[5]^5+1)*(x[6]^6+1)
<               *(x[7]^7+1)*(x[8]^8+1)*(x[9]^9+1)*(x[10]^10+1)
< (%i3) l:[1,1,2];
<
< (%o3) [1,1,2]
<
< I want to write a function f
<
< f(expr,l)  should compute diff(expr,x[1],1,x[2],1,x[3],2)
<
< I can create a list as below
<
<
< (%i4) create_list (x[i],i,1,length(l));
<
< (%o4) [x[1],x[2],x[3]]
< (%i5) join(%,l);
<
< (%o5) [x[1],1,x[2],1,x[3],2]
<
<
< but I am unable to solve beyond this. How can I solve the problem?

Try,
(%i13) mdiff(f,l) := apply(diff,append([f],l));

(%o13) mdiff(f,l):=apply(diff,append([f],l))
(%i14) mdiff(expr,[x[1],1,x[2],1,x[3],2]);

(%o14) 'diff(expr,x[1],1,x[2],1,x[3],2)
(%i15) subst(expr=product(1+x[i]^i,i,1,3),%);

(%o15) 'diff((x[1]+1)*(x[2]^2+1)*(x[3]^3+1),x[1],1,x[2],1,x[3],2)
(%i16) ev(%,nouns);

(%o16) 12*x[2]*x[3]

Happy New Year,
Leo

--

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

1 Jan 20:19 2010

### plot2d

Hello,

This is a newbee's problem: I just tried wxMaxima 0.8.4 and entered as
in the manual (chap. 1, Introduction to Maxima) the following command:

plot2d(sin(x)/x,[x,-20,20])

I obtained the plot but on ending the plot window there appeared a
message in the main window:

plot2d: expression evaluates to non-numeric value somewhere in
plotting range.

What had I done wrongly? Thanks for your help in advance.

M. K. Shen

1 Jan 20:38 2010

### Fine's Algebra

Happy New Year to all...

I was recently pointed to Henry Burchard Fine's College Algebra as an interesting synthesis of 'classic' (i.e. not abstract) algebra as of 1901--see blurb below.  I wonder if there's anything in there that would be useful ... or just interesting ... to people on this list.

-s

Free full text at Google Books: http://books.google.com/books?id=vycZAAAAYAAJ
Reprint from the AMS (\$25): http://www.ams.org/bookstore?fn=20&arg1=chelsealist&ikey=CHEL-354-H

--------------------------------------------------------
College Algebra
Henry Burchard Fine

At the beginning of the twentieth century, college algebra was taught differently than it is nowadays. There are many topics that are now part of calculus or analysis classes. Other topics are covered only in abstract form in a modern algebra class on field theory. Fine's College Algebra offers the reader a chance to learn the origins of a variety of topics taught in today's curriculum, while also learning valuable techniques that, in some cases, are almost forgotten.

In the early 1900s, methods were often emphasized, rather than abstract principles. In this book, Fine includes detailed discussions of techniques of solving quadratic and cubic equations, as well as some discussion of fourth-order equations. There are also detailed treatments of partial fractions, the method of undetermined coefficients, and synthetic division.

The book is ostensibly an algebra book; however, it covers many topics that are found throughout today's curriculum:

• calculus and analysis: infinite series, partial fractions, undetermined coefficients, properties of continuous functions,
• number theory: continued fractions,
• probability: basic results in probability.

Though the book is structured as a textbook, modern mathematicians will find it a delight to dip into. There are many gems that have been overlooked by today's emphasis on abstraction and generality. By revisiting familiar topics, such as continued fractions or solutions of polynomial equations, modern readers will enrich their knowledge of fundamental areas of mathematics, while gaining concrete methods for working with their modern incarnations. The book is suitable for undergraduates, graduate students, and researchers interested in algebra.

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

1 Jan 21:55 2010

### Re: plot2d

"expression evaluates to non-numeric value somewhere in plotting range".  Yes, that message means it tried to evaluate the function at x=0 which is not a numeric value since you get 0/0 there which is undefined.

Rich

On Fri, Jan 1, 2010 at 2:19 PM, mok-kong shen wrote:
Hello,

This is a newbee's problem: I just tried wxMaxima 0.8.4 and entered as
in the manual (chap. 1, Introduction to Maxima) the following command:

plot2d(sin(x)/x,[x,-20,20])

I obtained the plot but on ending the plot window there appeared a
message in the main window:

plot2d: expression evaluates to non-numeric value somewhere in
plotting range.

What had I done wrongly? Thanks for your help in advance.

M. K. Shen

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

2 Jan 11:08 2010

### Re: plot2d

mok-kong shen <mok-kong.shen <at> t-online.de> writes:

> Hello,
>
> This is a newbee's problem: I just tried wxMaxima 0.8.4 and entered as
> in the manual (chap. 1, Introduction to Maxima) the following command:
>
> plot2d(sin(x)/x,[x,-20,20])
>
> I obtained the plot but on ending the plot window there appeared a
> message in the main window:
>
> plot2d: expression evaluates to non-numeric value somewhere in
> plotting range.
>
> What had I done wrongly? Thanks for your help in advance.

What happened is that Maxima tried to evaluate sin(x)/x at x=0, getting
0/0, which doesn't make sense as a number. To check that's what's
happening, you can perturb one of the interval ends very slightly so
that you won't end up evaluating at zero:

(%i1) plot2d( sin(x)/x, [x,-20,20] );
plot2d: expression evaluates to non-numeric value somewhere in plotting range.
(%o1)
(%i2) plot2d( sin(x)/x, [x,-20,20.001] );
(%o2)
(%i3)

But, as you can see from the plot, Maxima and gnuplot are robust enough
to ignore this problem and just not plot the point at all. Since there
are lots of samples, you can't see the difference.

Rupert

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

1 Jan 19:35 2010

### Re: search and replace in expression?


Leo Butler wrote:
> On Wed, 30 Dec 2009, Rui Maciel wrote:
>
> < Let's say we have a list like the following:
> <
> < (%i1) d:[d1,d2,d3,d4,d5,d6,d7,d8];
> < (%o1)                     [d1, d2, d3, d4, d5, d6, d7, d8]
> <
> < Let's suppose that I changed my mind and, instead of a list with
>  variables < named d[0-8], I wish to have a list with variables named
>  x[0-8] and two other < lists with variables named y[0-8] and z[0-8].
>
> To create your list, try
> d :  makelist(concat('d,i),i,1,8);
>
> If you want to create new lists via substitution, then subst can do it
> subst( makelist(concat('d,i)=concat('x,i),i,1,8), d );
>
> although it is probably easier to create the list from scratch.

<snip/>

> Yes, I believe that subst can handle most of your needs. If you have other,

Your suggestion works great. The concat() function appears to be exactly what
I was looking for. Thanks!

Rui Maciel

2 Jan 12:42 2010

### Problem with integrate(log(1+exp(cos(phi))),phi,0,%pi)

There is a problem with one integral in the file rtestint.mac, which
seems to cause a hang of the testsuite.

Maxima is supposed to return a noun form for the following integral in
rtestint.mac. But we get an error:

(%i1) integrate(log(1+exp(cos(phi))),phi,0,%pi);
sign: argument cannot be imaginary; found %i
-- an error. To debug this try: debugmode(true);

First, I thought this error is related to some other work I am doing.
But the problem seems to be present in the current CVS too.

Within the testsuite this integral seems to loop endlessly. It is
strange, that I have not observed this problem until I have recompiled
the whole code. If I do a errcatch around the integral I can see the
endless loop. The integrator (not rischint) is called again and again:

(%i2) errcatch(integrate(log(1+exp(cos(phi))),phi,0,%pi));
sign: argument cannot be imaginary; found %i
sign: argument cannot be imaginary; found %i
sign: argument cannot be imaginary; found %i
sign: argument cannot be imaginary; found %i
sign: argument cannot be imaginary; found %i
sign: argument cannot be imaginary; found %i
sign: argument cannot be imaginary; found %i
^CMaxima encountered a Lisp error:

PRINT: User break

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

Is this problem present on other systems too?

At first I will comment out this example from rtestint.mac.

ein Frohes neues Jahr - Happy new year
Dieter Kaiser


Gmane