1 Jul 18:07 2007

1 Jul 20:57 2007

### Maxima: Compiling with gcl, cmucl, sbcl, clisp.

C. Frangos <cfrangos <at> telkomsa.net>

2007-07-01 18:57:00 GMT

2007-07-01 18:57:00 GMT

Dear All, Due to a disk crash I am trying to compile Maxima 5.12 (and earlier versions) using gcl, sbcl and cmucl on suse 9.1 (32 bit) and suse 10.1 (64 bit) systems. Any assistance with the following would be much appreciated: (1) I installed sbcl on suse 10.1, 64 bit and used it to compile maxima 5.12, but am getting the following error: cfrangos <at> omega:~/gnu> sbcl mmap: Cannot allocate memory ensure_space: failed to validate 8589869056 bytes at 0x1000000000 (hint: Try "ulimit -a"; maybe you should increase memory limits.) The command: ulimit -v 8600000, solves the problem using bash but I do not know the equivalent command for tcsh, which is what I use. (The above memory allocation error does not appear with sbcl installed on suse 9.1, 32 bit). If I enter the full path then Maxima 5.12 sbcl starts correctly (using bash and tcsh). However, at the Maxima prompt I cannot recall the previous instructions using the arrow keys. Not clear how to remedy this. cfrangos <at> omega:~/axiom> /home/apps/maxima5.12sbcl/maxima-5.12.0/maxima-local Maxima 5.12.0 http://maxima.sourceforge.net Using Lisp SBCL 1.0.6 Distributed under the GNU Public License. See the file COPYING.(Continue reading)

1 Jul 22:17 2007

### formatted output to a file

<sen1 <at> math.msu.edu>

2007-07-01 20:17:02 GMT

2007-07-01 20:17:02 GMT

Hello, I have data which maxima prints to the screen as ################################ 1.0 [- .3536439110236552, - .3536429110236552] [5.244819758319341, 5.244820758319341] [.3388525556295289, .3388535556295289] [- .2551126228235315, - .2551116228235316] 1.0 3.0 ################################ 2.0 [- .3507737403750187, - .3507727403750187] [12.72043322786446, 12.72043422786446] [0.341129429715034, .3411304297150339] [- .2525642918546189, - 0.252563291854619] - 1.0 2.0 ################################ 3.0 [- .008600354488860871, - .008599354488860872] [19.43942526930742, 19.43942626930742] [.6239518437557894, .6239528437557894] [.1752413689703154, .1752423689703154] 1.0 1.0 ################################ 4.0 [- .03415417134425412, - .03415317134425412](Continue reading)

2 Jul 03:03 2007

### Re: formatted output to a file

Robert Dodier <robert.dodier <at> gmail.com>

2007-07-02 01:03:28 GMT

2007-07-02 01:03:28 GMT

On 7/1/07, sen1 <at> math.msu.edu <sen1 <at> math.msu.edu> wrote: > I would like to output this to a file so that it keeps the same > format. How do I do it? Sheldon, maybe with_stdout does what you want. with_stdout captures explicitly printed output (e.g. output from Maxima print and Lisp FORMAT) but with_stdout does not capture stuff printed by the Maxima display code. Or maybe writefile is what you want -- writefile captures all of the input and output (including expression labels and displayed output). The Maxima functions grind and stringout might also be useful in this context. HTH Robert Dodier

2 Jul 03:38 2007

### Differentiate into a sum

Jordi Gutierrez Hermoso <jordigh <at> gmail.com>

2007-07-02 01:38:58 GMT

2007-07-02 01:38:58 GMT

How can I do something like finding the derivative wrt to x[r] of some function of the sum sum(a[k]*x[k], k, 1, n)? With n an integer greater than 1 and r another integer between 1 and n, of course. I'd like Maxima to give a pretty answer whenever possible and not expand the summation. Thanks, - Jordi G. H.

2 Jul 18:00 2007

### Re: Differentiate into a sum

Stavros Macrakis <macrakis <at> alum.mit.edu>

2007-07-02 16:00:21 GMT

2007-07-02 16:00:21 GMT

On 7/1/07, Jordi Gutierrez Hermoso <jordigh <at> gmail.com> wrote: > How can I do something like finding the derivative wrt to x[r] of some > function of the sum sum(a[k]*x[k], k, 1, n)? There is no built-in way. You could of course write code to do this, but it wouldn't be completely trivial... consider cases like diff( sum(x[i]*x[n-i], i, 1, n), x[3] ) or diff( sum( sum( x[i+j], i, 0, j ), j, 0, n) ), x[3] )

2 Jul 19:16 2007

### Re: Differentiate into a sum

<sen1 <at> math.msu.edu>

2007-07-02 17:16:42 GMT

2007-07-02 17:16:42 GMT

Are the expressions x[k] independent? You say "some function" of the sum. Is this just the composition g(u) where u = sum(a[k]*x[k]) where a and x are just vectors? In that case, du/d(x[k]) is just a[k], so perhaps a[k]* subst(u= sum(a[k]*x[k],k,1,n), diff(g(u),u)) does what you want. -sen On Sun, 1 Jul 2007, Jordi Gutierrez Hermoso wrote: > How can I do something like finding the derivative wrt to x[r] of some > function of the sum sum(a[k]*x[k], k, 1, n)? With n an integer greater > than 1 and r another integer between 1 and n, of course. I'd like > Maxima to give a pretty answer whenever possible and not expand the > summation.(Continue reading)

3 Jul 06:26 2007

### python matrix output

Ryan Krauss <ryanlists <at> gmail.com>

2007-07-03 04:26:07 GMT

2007-07-03 04:26:07 GMT

I am trying to write a function that will allow me to take a symbolically derived matrix from Maxima and copy and paste it into Python for some numerical work. Each element in the matrix could simply be the fortran(element) so that exponents are handled correctly. Here is my function: pythonmat(matin) := block ( nc:length(matin[1]), nr:length(col(matin,1)), matstr:"array([", for i:1 thru nr do (if (i > 1) then matstr:concat(matstr, ","), currow:matin[i], rowstr:"[", (for j:1 thru nc do (if (j > 1) then rowstr:concat(rowstr, ","), curfor:fortran(currow[j]), rowstr:concat(rowstr,curfor))), rowstr:concat(rowstr,"]"), matstr:concat(matstr,rowstr)), matstr:concat(matstr,"])")); The only problem is that I cannot capture the current fortran expression for an element using: curfor:fortran(currow[j]), because the output of the fortran command is always done with the code printed to stdour. Here is an example of my problem: (%i103) pythonmat(J0); -sin(th1)*(cos(th2)*(cos(th3)*L3+L2)-sin(th2)*sin(th3)*L3+L1)(Continue reading)

3 Jul 07:14 2007

### Re: python matrix output

Robert Dodier <robert.dodier <at> gmail.com>

2007-07-03 05:14:56 GMT

2007-07-03 05:14:56 GMT

On 7/2/07, Ryan Krauss <ryanlists <at> gmail.com> wrote: > If a matrix is composed of [[A,B,C],[D,E,F]] then the output I need is > array([[A,B,C],[D,E,F]]). OK. How about this: python_matrix (M) := fortran (funmake ('array, [args (M)])); e.g. M : matrix ([cos(x)^3, sin(x)^4, tan(y^5)], [sin(y*x)*cos(y), tan(u*v), u^2*v^2]); python_matrix (M); => array([[cos(x)**3,sin(x)**4,tan(y**5)],[cos(y)*sin(x*y),tan(u*v),u 1 **2(Continue reading)*v**2]]) If you want to direct the output of fortran into a file, wrap it in with_stdout, e.g. with_stdout ("/tmp/foo.out", python_matrix (M)); => (stuff shown above goes into /tmp/foo.out) The leading "1" on the 2nd line is a continuation character. I don't know if you want to try to paste together lines. The program to print stuff in Fortran format is not too complex; if the Python output can be characterized as a not-too-great modification of Fortran, I'll help you modify the output of Maxima's fortran function as needed. Generating Python output has come up before so maybe a python function would be useful to others.

3 Jul 14:13 2007

### Re: python matrix output

Ryan Krauss <ryanlists <at> gmail.com>

2007-07-03 12:13:26 GMT

2007-07-03 12:13:26 GMT

Robert, This is a really good start. Thanks for your help. The leading numbers for Fortran continuation will cause a problem though. It would be great if we could modifiy the Fortran function to create a Python one. I would be glad to learn this kind of thing. Maxima Lisp programming is still quite challenging to me - I am still climbing a steep learning curve. Thanks again, Ryan On 7/3/07, Robert Dodier <robert.dodier <at> gmail.com> wrote: > On 7/2/07, Ryan Krauss <ryanlists <at> gmail.com> wrote: > > > If a matrix is composed of [[A,B,C],[D,E,F]] then the output I need is > > array([[A,B,C],[D,E,F]]). > > OK. How about this: > > python_matrix (M) := fortran (funmake ('array, [args (M)])); > > e.g. > M : matrix ([cos(x)^3, sin(x)^4, tan(y^5)], [sin(y*x)*cos(y), > tan(u*v), u^2*v^2]); > python_matrix (M); > => > array([[cos(x)**3,sin(x)**4,tan(y**5)],[cos(y)*sin(x*y),tan(u*v),u(Continue reading)