From michel.vandenbergh at uhasselt.be Mon Jan 1 02:28:20 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 09:28:20 +0100 Subject: [Maxima] Strange plot2d behaviour Message-ID: <4598C624.1050407@uhasselt.be> Plot2d behaves very strangely. I will file a bug report unless somebody tells me I am doing something stupid. (%i1) g(s):=block([s__],s__:s,remvalue(s),s__)$ (%i2) g(2); (%o2) 2 (%i3) plot2d(g,[t,1,2]); Warning: Illegal `remvalue' attempt: s Warning: Illegal `remvalue' attempt: s etc... The plot however is fine. Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 04:12:08 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 11:12:08 +0100 Subject: [Maxima] Newbie question: testing for lvalue In-Reply-To: References: <45978BFB.4070503@uhasselt.be> <4598404E.3010204@uhasselt.be> Message-ID: <4598DE78.2080103@uhasselt.be> Thanks! Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 05:17:52 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 12:17:52 +0100 Subject: [Maxima] Newbie question: testing for lvalue (correction) In-Reply-To: References: <45978BFB.4070503@uhasselt.be> <4598404E.3010204@uhasselt.be> Message-ID: <4598EDE0.1020201@uhasselt.be> Actually your function is not quite correct. P((a+b)[3]) returns true whereas it should return false (one can argue that (a+b)[3] has no meaning if a,b are unbound, but maxima does not throw an error). The following seems to work always P(e) := (symbolp(e) or (subvarp(e) and P(part(e,0)))) and not ?mstringp(e); Robert Dodier wrote: > On 12/31/06, Michel Van den Bergh wrote: > >> Hmm, a string is not an lvalue (something that can appear on the >> left hand side of an assignment). "describe" claims that there is >> a function "stringp" but on my version of maxima stringp appears >> not to do anything. Is this a bug? > > > It turns out stringp is defined in an add-on package (namely stringproc). > Probably it should move into the main source code. > Be that as it may, the function ?mstringp has the desired effect. > So we can update the test function to > > P(e) := (symbolp(e) or subvarp(e)) and not ?mstringp(e); > > Sorry, I could have included that to begin with. Hope this helps. > > Robert From michel.vandenbergh at uhasselt.be Mon Jan 1 05:45:32 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 12:45:32 +0100 Subject: [Maxima] Happy new year. In-Reply-To: <7775b21a0612310346m6845e291yd39cdab4087945c5@mail.gmail.com> References: <45979D2C.1060606@uhasselt.be> <7775b21a0612310346m6845e291yd39cdab4087945c5@mail.gmail.com> Message-ID: <4598F45C.6060201@uhasselt.be> > (%i4) sum(n/(3*n+1)/(2*n+1)^2, n, 1, inf)$ > (%i5) closed_form(%), ratsimp; > (%o5) > -(12*sqrt(3)*log(3)-16*sqrt(3)*log(2)-sqrt(3)*%pi^2+4*%pi)/(8*sqrt(3)) I included this very nice example in the demonstration script for levin (www.bertold.org/levin). Michel From dan.stanger at ieee.org Mon Jan 1 07:14:06 2007 From: dan.stanger at ieee.org (Dan Stanger) Date: Mon, 01 Jan 2007 08:14:06 -0500 Subject: [Maxima] Are there any efforts to make MAXIMA interaction with java? In-Reply-To: References: <010d01c7299f$25210b90$3f6ea8c0@ady> Message-ID: <4599091E.4060502@ieee.org> The gcj project permits compiling java code and class files to an executable, with the intention of permitting inter language calls. Dan Stanger From michel.vandenbergh at uhasselt.be Mon Jan 1 10:57:27 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 17:57:27 +0100 Subject: [Maxima] Strange plot2d behaviour Message-ID: <45993D77.4060002@uhasselt.be> > > (%i1) g(s):=block([s__],s__:s,remvalue(s),s__)$ > (%i2) g(2); > (%o2) 2 > (%i3) plot2d(g,[t,1,2]); > Warning: Illegal `remvalue' attempt: > s > Warning: Illegal `remvalue' attempt: I have some more information on this problem. Changing the definition of g(s) to g(s):=block([s__],s__:s,print(properties(s)),remvalue(s),s__) it appears that within plot2d s has the property "system value" (with quotes) instead of value which presumably explains why maxima does not want to forget its value. Now this seems clearly a bug to me (there is nothing "system" about s within the function g, it is just a parameter). Comments or explanations? Michel From robert.dodier at gmail.com Mon Jan 1 11:05:50 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 1 Jan 2007 10:05:50 -0700 Subject: [Maxima] remvalue, was: Strange plot2d behaviour Message-ID: On 1/1/07, Michel Van den Bergh wrote: > (%i1) g(s):=block([s__],s__:s,remvalue(s),s__)$ > (%i2) g(2); > (%o2) 2 > (%i3) plot2d(g,[t,1,2]); > Warning: Illegal `remvalue' attempt: > s > Warning: Illegal `remvalue' attempt: > s Well, the strangeness is in REMVALUE (src/suprv1.lisp), which assumes that bound symbols must be on the Maxima values list (the list which comprises variables that have been assigned values). A Maxima function argument is bound but it is not on the values list, so REMVALUE complains. REMVALUE could be modified to unbind symbols even if they are not on the values list; maybe that would be better. If you just want to work with the symbol s verbatim, maybe you can just write 's to prevent evaluation. A Maxima trivia item -- function arguments don't appear on the values list, but local variables in block do appear. e.g. block([aa, bb, cc], print(values)) => prints out [aa, bb, cc]. All the best, Robert Dodier From michel.vandenbergh at uhasselt.be Mon Jan 1 11:13:29 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 18:13:29 +0100 Subject: [Maxima] remvalue, was: Strange plot2d behaviour Message-ID: <45994139.5090409@uhasselt.be> But look at the example. g(2) does *not* give a warning but g within plot2d does give warnings. Why does the parameter(!) s within g within plot2d suddenly acquire the property "system value". What does this mean anyway? Regards, Michel From robert.dodier at gmail.com Mon Jan 1 11:19:50 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 1 Jan 2007 10:19:50 -0700 Subject: [Maxima] Happy new year. In-Reply-To: <4598F45C.6060201@uhasselt.be> References: <45979D2C.1060606@uhasselt.be> <7775b21a0612310346m6845e291yd39cdab4087945c5@mail.gmail.com> <4598F45C.6060201@uhasselt.be> Message-ID: On 1/1/07, Michel Van den Bergh wrote: > > > (%i4) sum(n/(3*n+1)/(2*n+1)^2, n, 1, inf)$ > > (%i5) closed_form(%), ratsimp; > > (%o5) > > -(12*sqrt(3)*log(3)-16*sqrt(3)*log(2)-sqrt(3)*%pi^2+4*%pi)/(8*sqrt(3)) > > I included this very nice example in the demonstration script for levin > (www.bertold.org/levin). By the way, I've committed the levin files to cvs in maxima/share/contrib/levin/. Many thanks to Michel for this contribution. best, Robert From robert.dodier at gmail.com Mon Jan 1 11:29:47 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 1 Jan 2007 10:29:47 -0700 Subject: [Maxima] remvalue, was: Strange plot2d behaviour In-Reply-To: <45994139.5090409@uhasselt.be> References: <45994139.5090409@uhasselt.be> Message-ID: On 1/1/07, Michel Van den Bergh wrote: > But look at the example. g(2) does *not* give a warning but g within > plot2d does give warnings. Michel, it turns out the strangeness is indeed within plot2d. I've made 2 mistakes here. (1) plot2d calls g in a nonstandard way (not via MFUNCALL). So that's the origin of this bit of strangeness. For the record, the bit to repair is COERCE-FLOAT-FUN in src/plot.lisp. (2) When a Maxima function is called via MFUNCALL, the arguments do indeed appear on the values list (therefore REMVALUE is happy). It would be very helpful if you can report this bug to the SF bug tracker (http://sourceforge.net/tracker/index.php?group_id=4933&atid=104933) and, if you do, you can just cut-n-paste this email. best, Robert From michel.vandenbergh at uhasselt.be Mon Jan 1 11:31:21 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 18:31:21 +0100 Subject: [Maxima] remvalue, was: Strange plot2d behaviour Message-ID: <45994569.8010704@uhasselt.be> > > A Maxima trivia item -- function arguments don't appear on the > values list, but local variables in block do appear. > e.g. block([aa, bb, cc], print(values)) => prints out [aa, bb, cc]. This appears to not quite correct. Modifying the example again. //(%i1) g(s):=block([],print(values),s)$// [s,s__] (%o2) 2 But!!! (%i3) plot2d(g,[s,1,2]); [s__] [s__] [s__] [s__] [s__] ... Now s has disappeared from the value list.... Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 11:33:05 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 18:33:05 +0100 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) Message-ID: <459945D1.4050305@uhasselt.be> The example got mangles >/ />/ A Maxima trivia item -- function arguments don't appear on the />/ values list, but local variables in block do appear. />/ e.g. block([aa, bb, cc], print(values)) => prints out [aa, bb, cc]. / This appears to not quite correct. Modifying the example again. (%i1) g(s):=block([],print(values),s)$ (%i2) g(2); [s,s__] (%o2) 2 But!!! (%i3) plot2d(g,[s,1,2]); [s__] [s__] [s__] [s__] [s__] ... Now s has disappeared from the value list.... Michel From fateman at cs.berkeley.edu Mon Jan 1 11:32:45 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 09:32:45 -0800 Subject: [Maxima] remvalue, was: Strange plot2d behaviour In-Reply-To: Message-ID: <009e01c72dca$dad71180$210110ac@windsor> There are 2 issues: what should remvalue do, and what does Michel really intend here. 1. It seems to me that the purpose of remvalue is to try to reduce the Maxima state to one in which no user variables have global values. Thus running remvalue() on a locally bound symbol is beside the point. A change to the documentation of remvalue might "fix" this. Merely setting s, as in s:false; may be all that you intend, or perhaps it is enough to do s:'s. I think the "system value" has to do with trying to do remvalue(false); after s has been removed, but maybe not... 2. If you want to have a symbol that no one else can utter, someone suggested using gensyms. That is, r:?gensym(); r::3 /* note :: not : */ ; r; ev(r); Or using 's, as above, may solve your problem. Usually it is a good idea to put bug reports in some context, so that others can know what you are trying to accomplish. Using functions like remvalue in unintended ways may reveal behavior that is complicated to explain, but not important. (The analog in common lisp may be "unintern" whose meaning can be looked up in an common lisp manual.) RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert Dodier > Sent: Monday, January 01, 2007 9:06 AM > To: Michel Van den Bergh > Cc: maxima at math.utexas.edu > Subject: [Maxima] remvalue, was: Strange plot2d behaviour > > On 1/1/07, Michel Van den Bergh > wrote: > > > (%i1) g(s):=block([s__],s__:s,remvalue(s),s__)$ > > (%i2) g(2); > > (%o2) 2 > > (%i3) plot2d(g,[t,1,2]); > > Warning: Illegal `remvalue' attempt: > > s > > Warning: Illegal `remvalue' attempt: > > s > > Well, the strangeness is in REMVALUE (src/suprv1.lisp), > which assumes that bound symbols must be on the Maxima values list > (the list which comprises variables that have been assigned values). > A Maxima function argument is bound but it is not on the values list, > so REMVALUE complains. > > REMVALUE could be modified to unbind symbols even if they > are not on the values list; maybe that would be better. > > If you just want to work with the symbol s verbatim, maybe you can > just write 's to prevent evaluation. > > A Maxima trivia item -- function arguments don't appear on the > values list, but local variables in block do appear. > e.g. block([aa, bb, cc], print(values)) => prints out [aa, bb, cc]. > > All the best, > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From robert.dodier at gmail.com Mon Jan 1 11:41:12 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 1 Jan 2007 10:41:12 -0700 Subject: [Maxima] contour_plot function Message-ID: Hello, to the best of my knowledge, there is not a function to make contour plots in Maxima. I've attached an attempt. Here is the comment header. ; contour_plot -- set some parameters for Gnuplot and punt to plot3d ; ; We go to some trouble here to avoid clobbering the Gnuplot preamble ; specified by the user, either as a global option (via set_plot_option) ; or specified in arguments to contour_plot. Just append or prepend ; the parameters for contour plotting to the user-specified preamble. ; Assume that arguments take precedence over global options. ; ; contour_plot knows how to set parameters only for Gnuplot. ; If the plot_format is not a Gnuplot format, complain. ; ; Examples: ; ; contour_plot (x^2 + y^2, [x, -4, 4], [y, -4, 4]); ; contour_plot (sin(y) * cos(x)^2, [x, -4, 4], [y, -4, 4]); ; F(x, y) := x^3 + y^2; ; contour_plot (F, [u, -4, 4], [v, -4, 4]); ; contour_plot (F, [u, -4, 4], [v, -4, 4], [gnuplot_preamble, "set size ratio -1"]); ; set_plot_option ([gnuplot_preamble, "set cntrparam levels 12"]); ; contour_plot (F, [u, -4, 4], [v, -4, 4]); ; set_plot_option ([plot_format, openmath]); ; contour_plot (F, [u, -4, 4], [v, -4, 4]); => error: must be gnuplot format ; contour_plot (F, [u, -4, 4], [v, -4, 4], [plot_format, gnuplot]); There is already a function named implicit_plot but it is somewhat different, I think. Comments? Hope this helps, Robert Dodier From fateman at cs.berkeley.edu Mon Jan 1 11:41:10 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 09:41:10 -0800 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <459945D1.4050305@uhasselt.be> Message-ID: <009f01c72dcc$06e2e5a0$210110ac@windsor> It makes sense for plot2d to try to do something with the function it is plotting because it is being called many times. Compiling it to a numerical function that returns a floating point value is an attractive alternative, in order to make it run faster. It is also possible that one wants to mangle the semantics, on the basis that anything that is not a float is unacceptable. But this is risky. Mathematica got into trouble with its "compiler" because the compiler assumed that all internal computations in the function being compiled (and plotted) were REAL. In fact, there may be functions you want to plot that use COMPLEX arithmetic or other constructs internally, but result in a REAL number for plotting. Anyway, such functions could not be plotted in Mathematica (version 3?) without turning off the compiler. (At least that is what I recall). The issue remains as to what you are really trying to do. I doubt that remvalue() is serving a useful purpose in terms of scope, information hiding, or saving memory. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Michel > Van den Bergh > Sent: Monday, January 01, 2007 9:33 AM > To: maxima at math.utexas.edu > Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) > > The example got mangles > >/ > />/ A Maxima trivia item -- function arguments don't appear on the > />/ values list, but local variables in block do appear. > />/ e.g. block([aa, bb, cc], print(values)) => prints out > [aa, bb, cc]. > / > This appears to not quite correct. Modifying the example again. > > (%i1) g(s):=block([],print(values),s)$ > (%i2) g(2); > [s,s__] > (%o2) 2 > > But!!! > > (%i3) plot2d(g,[s,1,2]); > [s__] > [s__] > [s__] > [s__] > [s__] > ... > Now s has disappeared from the value list.... > > Michel > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From michel.vandenbergh at uhasselt.be Mon Jan 1 11:52:30 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 18:52:30 +0100 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <009f01c72dcc$06e2e5a0$210110ac@windsor> References: <009f01c72dcc$06e2e5a0$210110ac@windsor> Message-ID: <45994A5E.4040500@uhasselt.be> Dear Richard, This has now been beaten to dead. Try h(s, t) := ev(subvar(s, t), eval); h(t[4],1); Answer: t evaluates to 1 Improper name or value in functional position. #0: h(s=t[4],t=1) -- an error. To debug this try debugmode(true); The following is a mechanical fix h(s, t) := block([s__, t__], s__ : s, t__ : t, remvalue(s, t), ev(subvar(s__, t__), eval)) h(t[4],1); (t_4)_1 Of course I assume that the user will not use the variables s__, t__. s__, t__ should really be unique. If you can give me a (generic!) solution with ?gensum() I will be happy to learn it. But the fact remains is that I don't see why maxima interpreter cannot do this for us. In my opininion parameters are parameters and local variables are local variables. There should be ***no*** side effects ***at all***. Michel > From fateman at cs.berkeley.edu Mon Jan 1 12:25:52 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 10:25:52 -0800 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <45994A5E.4040500@uhasselt.be> Message-ID: <00a301c72dd2$45cd8f30$210110ac@windsor> I agree that it has been beaten to death, in the sense that most everything that needs to be said may have been said. But your example suggests that you are still trying to do things that need not, and probably should not be done. Stavros pointed out that substitution semantics is much cleaner, and ev should NOT be used unless you really mean to evaluate. For example converting "noun" forms to "verb" forms in differential forms. Merely putting values in for symbols can and should be done by substitution, at least if you want to be careful. Or you can write programs in Lisp, whose semantics are rather more carefully set out. By tradition, Lisp has a function "eval", and it is generally conceded that any (modern) Lisp program that call eval explicitly is extremely suspect. Novices use eval almost always wrong. When an advanced programmer uses eval (once in a hundred pages of code?), it tends to be surrounded by a block of comments explaining why this is excusable. (e.g. see Norvig's Paradigms of AI Programming). Using ev in Maxima has much the same problem as lisp's eval. Technically speaking lisp's eval needs 2 arguments: a form to be evaluated, say (+ a b), and an environment such as one that binds a to 3 and b to 4. Or a partial environment in which one or both are unbound and their values found in a global environment. Maxima messes with this concept because there are other tricks: if a symbol has no binding then it is implicitly bound to itself ("quoted"). And there are other hazards including functions which are "nounified" and "verbified". Also, chains of bindings are unraveled by repeated ev's. Also see "infeval". Please be assured that noun, verb, infeval, were not part of the original design, but were added out of some apparent necessity, to encode certain constructs like unevaluated limits, integrals, derivatives, etc. Using this when NOT necessary is asking for trouble. And this is not just Maxima. People writing code in Mathematica have to deal with Hold, HoldFirst, Release, and other uncomfortable features. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Michel > Van den Bergh > Sent: Monday, January 01, 2007 9:53 AM > To: Richard Fateman; maxima at math.utexas.edu > Subject: Re: [Maxima] remvalue, was: Strange plot2d behaviour > (correction) > > Dear Richard, > > This has now been beaten to dead. Try > > h(s, t) := ev(subvar(s, t), eval); > > h(t[4],1); > > Answer: > t evaluates to 1 > Improper name or value in functional position. > #0: h(s=t[4],t=1) > -- an error. To debug this try debugmode(true); > > The following is a mechanical fix > h(s, t) := block([s__, t__], s__ : s, t__ : t, remvalue(s, t), > > ev(subvar(s__, t__), > eval)) > > h(t[4],1); > > (t_4)_1 > > Of course I assume that the user will not use the variables s__, t__. > s__, t__ > should really be unique. If you can give me a (generic!) solution with > ?gensum() > I will be happy to learn it. > > But the fact remains is that I don't see why maxima interpreter cannot > do this for us. > In my opininion parameters are parameters and local variables > are local > variables. There should > be ***no*** side effects ***at all***. > > Michel > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From robert.dodier at gmail.com Mon Jan 1 12:30:26 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 1 Jan 2007 11:30:26 -0700 Subject: [Maxima] oops, here's the attachment (contour_plot function) Message-ID: Sorry, I forgot to attach the file before. Here it is for real. Robert ---------- Forwarded message ---------- From: Robert Dodier Date: Jan 1, 2007 10:41 AM Subject: contour_plot function To: Maxima list mailing Hello, to the best of my knowledge, there is not a function to make contour plots in Maxima. I've attached an attempt. -------------- next part -------------- A non-text attachment was scrubbed... Name: contour.lisp Type: application/octet-stream Size: 3657 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070101/07941aec/attachment.obj From fateman at cs.berkeley.edu Mon Jan 1 12:40:48 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 10:40:48 -0800 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <45994A5E.4040500@uhasselt.be> Message-ID: <00aa01c72dd4$5b495e00$210110ac@windsor> I still don't know what you are trying to accomplish with your ev. Assuming that you wish to create (t_4)_1 in TeX notation.. for h(r,s), where r=t[4] and s=1.. try this [r:?gensym(), s:?gensym(), define(h(r,s),r[s]),remvalue(r,s)]; now there is no way to "fool" h. ....... > If you can give me a (generic!) solution with > ?gensum() > I will be happy to learn it. > > But the fact remains is that I don't see why maxima interpreter cannot > do this for us. (See previous note: basically because "ev" doesn't know where to get bindings, and probably cannot do better.) RJF From michel.vandenbergh at uhasselt.be Mon Jan 1 12:42:26 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 19:42:26 +0100 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: <00a301c72dd2$45cd8f30$210110ac@windsor> References: <00a301c72dd2$45cd8f30$210110ac@windsor> Message-ID: <45995612.7020007@uhasselt.be> Dear Richard, The example works just as well (or should I say, just as bad). without eval h(s, t) := subvar(s, t); h(t,1) t evaluates to 1 Improper name or value in functional position. #0: h(s=t,t=1) -- an error. To debug this try debugmode(true); Of course I understand why this happens. But my point is that maxima code is ***extremely fragile***. With some some small changes to the interpreter maxima could be lot more robust. Basically the interpreter should internally replace parameters and local variables by unique symbols. This is what any language I know of does. Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 12:49:43 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 19:49:43 +0100 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <00aa01c72dd4$5b495e00$210110ac@windsor> References: <00aa01c72dd4$5b495e00$210110ac@windsor> Message-ID: <459957C7.4060507@uhasselt.be> Richard Fateman wrote: > > I still don't know what you are trying to accomplish with your ev. > > Assuming that you wish to create (t_4)_1 in TeX notation.. for h(r,s), > where r=t[4] and s=1.. > > try this > [r:?gensym(), s:?gensym(), define(h(r,s),r[s]),remvalue(r,s)]; > > now there is no way to "fool" h. > > This looks rather good! I will try it out. But again why shouldn't the maxima interpreter do this automatically? Or maybe there should be some function "make_robust" so that if you have defined a function f you put f:make_robust(f) and suddenly everything is safe. Michel From fateman at cs.berkeley.edu Mon Jan 1 12:51:27 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 10:51:27 -0800 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: <45995612.7020007@uhasselt.be> Message-ID: <00ab01c72dd5$d7dfa270$210110ac@windsor> > -----Original Message----- > From: Michel Van den Bergh [mailto:michel.vandenbergh at uhasselt.be] > Sent: Monday, January 01, 2007 10:42 AM > robust. > > Basically the interpreter should internally replace > parameters and local > variables by unique > symbols. This is what any language I know of does. How many of those languages have "eval"? Usually parameters are not replaced by unique symbols, but by positions on a stack. That is, parameter x is changed to "location 4 from stack-pointer". But then if parameter x has value y, you must translate that to some other location on the stack if you are allowed to do "eval". This never happens in Fortran, C, Java,... It happens in (old-fashioned) Lisp, Scheme, and Common Lisp. The responses depend respectively on the nature of bindings, being, in the three cases, (dynamic binding unless compiled, then lexical), (lexical), (lexical unless declared "special"). There may be evals in some other languages (like Tcl, I think. Maybe Perl, or jscript) which may use only global environments. This doesn't solve your problem. RJF From michel.vandenbergh at uhasselt.be Mon Jan 1 13:03:19 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 20:03:19 +0100 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: <00ab01c72dd5$d7dfa270$210110ac@windsor> References: <00ab01c72dd5$d7dfa270$210110ac@windsor> Message-ID: <45995AF7.9020707@uhasselt.be> Dear Richard, This has nothing to do with eval. See my last email with the example that does not use eval. My point is that the ***names*** of parameters and local variables in the ***definitiion*** of a function are syntactic entities (dummy variables in a sense). Their names should be irrelevant. In maxima the behaviour of a function depends on these names. It seems to me that this is very bad and can lead to all kinds of subtle bugs. In your earlier email you basically gave an easy mechanical procedure to replace parameters by unique symbols. Something similar can perhaps be done for local variables. This would make the behaviour of a function independent of the names of parameters and local variables chosen by the user. Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 13:15:18 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 20:15:18 +0100 Subject: [Maxima] eval=evil? was remvalue References: 00ab01c72dd5$d7dfa270$210110ac@windsor Message-ID: <45995DC6.60806@uhasselt.be> Dear Richard, Sorry my last example was bogus of course. I can't immediately make up an example which does not use eval although I am not sure it cannot be done. Earlier fragilities (leaking of names of local variables still stand). Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 13:16:44 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 20:16:44 +0100 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: <00ab01c72dd5$d7dfa270$210110ac@windsor> References: <00ab01c72dd5$d7dfa270$210110ac@windsor> Message-ID: <45995E1C.3090906@uhasselt.be> No the example is not bogus! Why did I say that? Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 13:35:23 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 20:35:23 +0100 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: <00ab01c72dd5$d7dfa270$210110ac@windsor> References: <00ab01c72dd5$d7dfa270$210110ac@windsor> Message-ID: <4599627B.90602@uhasselt.be> An interesting case is give by local variables that "escape". I.e. f(x):=block([y],y) These cannot be replaced by other symbols. But in this case the side effect is intentional. The case where there are no (intended) side effects is still important I think. Michel > From fateman at cs.berkeley.edu Mon Jan 1 14:24:43 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 12:24:43 -0800 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <459957C7.4060507@uhasselt.be> Message-ID: <00af01c72de2$e0e325b0$210110ac@windsor> 1. It could be that subvar has a bug in it, at least relative to what you want. It is defined as... (defmspec $subvar (l) (setq l (cdr l)) (if (null l) (wna-err '$subvar)) (meval (cons '(mqapply array) l))) What you want is to evaluate s exactly once to get t, not twice to get 1. Why your function should evaluate s twice, I don't know. For example, h(s,t):=s+t returns h(t,1) = t+1, not 2. (defmspec $subvar (l) (setq l (cdr l)) (if (null l) (wna-err '$subvar)) (cons '(mqapply array) l)) Note the problem is that subvar does an extra "ev" by calling meval. This is bringing the chickens home to roost: blaming ev. I'm not sure when subvar is supposed to be used. I've never seen it before this discussion. It could be that the issue you are most concerned with is scope, and this ev is just a distraction. Consider t[1]:hello; h(s,t):=subvar(s,t); h(t,1); do you want t[1] or hello? If you want hello, then the argument binding convention for maxima (and for lisp in 1969) of dynamic scope, is not going to get that answer. Rewriting maxima to do lexical scope, as is used in common lisp, might be worthwhile, and could be done by changing meval and associated programs, mostly in one source file, but could break user programs that now work. I believe that Maple changed its scope rules about 10 years ago. Regarding replacing arguments with gensyms... Here is a program: sanitize(f):=block([subl:[], s:apply(fundef,[f])], subl:map(lambda([r],r=?gensym()),substpart("[",part(s,1),0)), apply(define, [subst(subl,part(s,1)), subst(subl,part(s,2)) ])) Here is another program that is often equivalent: sanitize2(s):=( s:apply(fundef,[s]), ev(subst(map(lambda([r],r=?gensym()),substpart("[",part(s,1),0)),s))) The sanitize program does not have to be sanitized, ever, because it doesn't use ev. The sanitize2 program uses ev, and I do not entirely trust it. Even if run through sanitize. Also, if you insist on using ev inside your program, then I suspect that internal lambda-bindings or local bindings also need to be sanitized, and neither of these programs may be good enough. But I'm not usre. Regarding the case of f(x):=block([y],y) consider even more... g(a):=lambda([x],a+x)$ /* g returns not a symbol, but a function with a local binding for the variable "a" */ add3:''g(3); /* should be lambda([x],3+x) */ add3(4) --> should be 7, but is a+4. The equivalent lisp program gives 7. (defun g(a)(lambda(x)(+ a x))) (apply (r 3) '(4)) This case of a returned functional argument has been discussed at length in the lisp literature, going back 40 years. It is a powerful concept missing from most other languages, even today. > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Michel > Van den Bergh > > > > This looks rather good! I will try it out. But again why shouldn't the > maxima interpreter do > this automatically? From michel.vandenbergh at uhasselt.be Mon Jan 1 14:25:49 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 21:25:49 +0100 Subject: [Maxima] eval=evil? was remvalue References: 00ab01c72dd5$d7dfa270$210110ac@windsor Message-ID: <45996E4D.80502@uhasselt.be> I wrote (slightly edited) > An interesting case is give by local variables that "escape". I.e. > > f():=block([y],y) (*) > > This is really interesting since f() properties(%) gives the list ["sytem value"]! I think a better way to express (*) is f():='y In that way there is no confusion between symbols and local variables. (the resulting y still has the property "system value", it is not clear to me why). Michel From robert.dodier at gmail.com Mon Jan 1 14:35:11 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 1 Jan 2007 13:35:11 -0700 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: <45995AF7.9020707@uhasselt.be> References: <00ab01c72dd5$d7dfa270$210110ac@windsor> <45995AF7.9020707@uhasselt.be> Message-ID: On 1/1/07, Michel Van den Bergh wrote: > My point is that the ***names*** of parameters and local variables in > the ***definitiion*** of a function > are syntactic entities (dummy variables in a sense). Their names should > be irrelevant. In maxima the behaviour of > a function depends on these names. It seems to me that this is very bad > and can lead to all kinds of subtle bugs. Agreed, name collisions should be harmless. The problem you have encountered is an effect of dynamic binding. In this sense, Maxima is "broken as designed". People have often raised the possibility of reworking the Maxima language so that it has lexical scope instead. I mention this not to discourage you, but rather just to note that the more often this topic is discussed, the more likely it is that someone will come up with a solution. As a stop-gap measure, maybe we can come up with a declaration which tells Maxima to carry out gensym substitution on function arguments. e.g. F(x, y) := (declare([x, y], lexical), blah blah blah ...) I haven't thought this through; it is just an idea. All the best, Robert Dodier From michel.vandenbergh at uhasselt.be Mon Jan 1 14:46:06 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 21:46:06 +0100 Subject: [Maxima] eval=evil? was remvalue In-Reply-To: References: <00ab01c72dd5$d7dfa270$210110ac@windsor> <45995AF7.9020707@uhasselt.be> Message-ID: <4599730E.2040703@uhasselt.be> Robert Dodier wrote: > On 1/1/07, Michel Van den Bergh wrote: > >> My point is that the ***names*** of parameters and local variables in >> the ***definitiion*** of a function >> are syntactic entities (dummy variables in a sense). Their names should >> be irrelevant. In maxima the behaviour of >> a function depends on these names. It seems to me that this is very bad >> and can lead to all kinds of subtle bugs. > > Agreed, name collisions should be harmless. The problem you have > encountered is an effect of dynamic binding. In this sense, Maxima > is "broken as designed". People have often raised the possibility of > reworking the Maxima language so that it has lexical scope instead. > I mention this not to discourage you, but rather just to note that the > more often this topic is discussed, the more likely it is that someone > will come up with a solution. > > As a stop-gap measure, maybe we can come up with a declaration > which tells Maxima to carry out gensym substitution on function > arguments. e.g. F(x, y) := (declare([x, y], lexical), blah blah blah ...) > I haven't thought this through; it is just an idea. > > All the best, > Robert Dodier Yes something like that. And not even as a stop gap measure. This seems like the ideal solution to me since it is backwards compatible. A similar declaration should be available for the arguments to the "block" statement ("local variables"). Richard has posted a "sanitize" program. I have not studied it yet in detail but it might already do more of less what one wants. Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 16:45:23 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 01 Jan 2007 23:45:23 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <00af01c72de2$e0e325b0$210110ac@windsor> References: <00af01c72de2$e0e325b0$210110ac@windsor> Message-ID: <45998F03.7020509@uhasselt.be> Example f(x):=oddp(x)$ f(1); true sanitize(f); f(g32641) := false f(1); false However sanitize2 works correctly f(x):=oddp(x)$ sanitize2(f); f(g32629) := oddp(g32629) f(1); true; Note: sanitize2 does not sanitize local variables f(s):=block([t],local(t),t[4]:s[4],t[4]); sanitize2(f); f(g34408):=block([t], local(t), t[4]: g34408[4], t[4] ) which has the usual problems (see the earlier discussion on the list) I applied sanitize2 to the five (easy) functions in levin and the test script still completed succesfully (after commenting out the initial "kill(all)" of course). sanitize did not work at all. Michel From fateman at cs.berkeley.edu Mon Jan 1 17:06:45 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 1 Jan 2007 15:06:45 -0800 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <45998F03.7020509@uhasselt.be> Message-ID: <004d01c72df9$87f78240$230110ac@RJFE510> Aha, I see what is happening.. sanitize ends up evaluating the function body after the substitution, so oddp(g32641) is changed to false. Substitution into a function definition does not evaluate the body. One way around this would be to use Lisp's sublis function instead of subst. E.g, a non-evaluating Maxima version... (defun $sublis(L target) ;; L looks like ((mlist) ((mequal) a 1)((mequal) b 2) ...) (sublis (mapcar #'(lambda(r)(cons (cadr r)(caddr r)))(cdr L)) target)) ;; some error checking of args would increase the function size by 3X or more... > -----Original Message----- > From: Michel Van den Bergh [mailto:michel.vandenbergh at uhasselt.be] > Sent: Monday, January 01, 2007 2:45 PM > To: Richard Fateman > Cc: maxima at math.utexas.edu > Subject: Sanitize is not fool proof (yet) .Sanitize2 seems to work as > advertized. > > Example > > f(x):=oddp(x)$ > f(1); > true > sanitize(f); > f(g32641) := false > f(1); > false > > However sanitize2 works correctly > > f(x):=oddp(x)$ > sanitize2(f); > f(g32629) := oddp(g32629) > f(1); > true; > > Note: sanitize2 does not sanitize local variables > > f(s):=block([t],local(t),t[4]:s[4],t[4]); > sanitize2(f); > f(g34408):=block([t], local(t), t[4]: g34408[4], t[4] ) > > which has the usual problems (see the earlier discussion on the list) > > I applied sanitize2 to the five (easy) functions in levin and the test > script > still completed succesfully (after commenting out the initial > "kill(all)" of course). > sanitize did not work at all. > > > Michel From michel.vandenbergh at uhasselt.be Mon Jan 1 17:11:56 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 00:11:56 +0100 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <00af01c72de2$e0e325b0$210110ac@windsor> References: <00af01c72de2$e0e325b0$210110ac@windsor> Message-ID: <4599953C.8090607@uhasselt.be> Richard Fateman wrote: > > 1. It could be that subvar has a bug in it, at least relative to what you > want. It is defined as... > > (defmspec $subvar (l) (setq l (cdr l)) > (if (null l) (wna-err '$subvar)) (meval (cons '(mqapply array) > l))) > > What you want is to evaluate s exactly once to get t, not twice to get 1. > Why your function should evaluate s twice, I don't know. For example, > h(s,t):=s+t returns h(t,1) = t+1, not 2. > > > (defmspec $subvar (l) (setq l (cdr l)) > (if (null l) (wna-err '$subvar)) (cons '(mqapply array) l)) > > Note the problem is that subvar does an extra "ev" by calling meval. This is > bringing the chickens home to roost: blaming ev. > > I'm not sure when subvar is supposed to be used. I've never seen it before > this discussion. > I thought subvar is synonymous to arrayapply but it seems it is not. arrayapply works correctly. > It could be that the issue you are most concerned with is scope, and this ev > is just a distraction. > > Consider > > > t[1]:hello; > h(s,t):=subvar(s,t); > h(t,1); > do you want t[1] or hello? > I think I want hello. Since if we sanitize h: h(uniq1,uniq2):=subvar(uniq1,uniq2) then maxima returns hello. > If you want hello, then the argument binding convention for maxima (and for > lisp in 1969) of dynamic scope, is not going to get that answer. > > Rewriting maxima to do lexical scope, as is used in common lisp, might be > worthwhile, and could be done by changing meval and associated programs, > mostly in one source file, but could break user programs that now work. I > believe that Maple changed its scope rules about 10 years ago. > > > Regarding replacing arguments with gensyms... > > Here is a program: > > sanitize(f):=block([subl:[], > s:apply(fundef,[f])], > subl:map(lambda([r],r=?gensym()),substpart("[",part(s,1),0)), > apply(define, [subst(subl,part(s,1)), > subst(subl,part(s,2)) ])) > > > Here is another program that is often equivalent: > > sanitize2(s):=( s:apply(fundef,[s]), > ev(subst(map(lambda([r],r=?gensym()),substpart("[",part(s,1),0)),s))) > > The sanitize program does not have to be sanitized, ever, because it doesn't > use ev. > > The sanitize2 program uses ev, and I do not entirely trust it. Even if run > through sanitize. > Thank you very much! See my other mail for a report on these functions. > Also, if you insist on using ev inside your program, then I suspect that > internal lambda-bindings or local bindings also need to be sanitized, and > neither of these programs may be good enough. But I'm not usre. > > Regarding the case of > > f(x):=block([y],y) > > consider even more... > g(a):=lambda([x],a+x)$ /* g returns not a symbol, but a function with a > local binding for the variable "a" */ > > > add3:''g(3); /* should be lambda([x],3+x) */ > > add3(4) --> should be 7, but is a+4. > I did this example. I agree this looks rather bad for maxima! Luckily this fails so badly that people will not be tempted to use it. Something that does not work at all is better than something that is subtly broken. > The equivalent lisp program gives 7. > (defun g(a)(lambda(x)(+ a x))) > (apply (r 3) '(4)) > > This case of a returned functional argument has been discussed at length in > the lisp literature, going back 40 years. It is a powerful concept missing > from most other languages, even today. > > > These are also called closures isn't it? They exist in python: def adda(a): return(lambda x: x+a) add3=adda(3) add3(5) 8 Michel From toy.raymond at gmail.com Mon Jan 1 18:37:56 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 01 Jan 2007 19:37:56 -0500 Subject: [Maxima] recent attempt In-Reply-To: <200612291122.55633.pip@iszf.irk.ru> References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> Message-ID: <4599A964.90309@gmail.com> Valery Pipin wrote: > Raymond Toy wrote: > >> Valery Pipin wrote: >> >>> howto launch functions from lapack-tests.lisp? >>> >> Oops. That was from f2cl and not intended to be part of lapack-maxima. >> But if you want to run it, load it, and ?do\-all\-lapack\-tests(); >> > I think it is important as testsite for lapack. > Yes, I plan on having at least a few tests, but not at this low level. I want a maxima version. But the interface is still undecided. There are quite a few options to dgeev and dgesvd and I'm not sure how to expose all of them. Perhaps it doesn't matter and the interface should be simple. I'm also not sure about the copying of the Lisp array data to maxima matrix type. >> But if you want to run it, load it, and ?do\-all\-lapack\-tests(); >> > Nothing happens ... This is for gcl > I'm not really concerned that these tests don't work at all. They work in f2cl. Ray From michel.vandenbergh at uhasselt.be Tue Jan 2 03:30:11 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 10:30:11 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <4599BC12.90109@ieee.org> References: <00af01c72de2$e0e325b0$210110ac@windsor> <45998F03.7020509@uhasselt.be> <4599BC12.90109@ieee.org> Message-ID: <459A2623.9090709@uhasselt.be> Dan Stanger wrote: > Hello Michel, > Are you aware that of the syntax f('x):=... creates a function which > does not evaluate x when called? > You may find that useful. Did you download the comercial macsyma demo > from Dr. Fateman's web site? > It contains the reference manual for the Macsyma language, which I > think you would find helpful. > Dan Stanger No, but I did know about f(x)::= which is the same I presume. Anyway this is irrelevant for the example: h('s,t):=s[t]$ h(r,1); r_1 h(t,1); t evaluates to 1 Improper name or value in functional position. #0: h(s=t,t=1) -- an error. To debug this try debugmode(true); Now I ***know*** one can rewrite this example so that it works (e.g. Richard has given a fairly generic way using ?gensym()). But this is not my point. The ***user should not have to worry about this***. After all this is a ***completely trivial one line program***. It should work as expected. Michel From michel.vandenbergh at uhasselt.be Tue Jan 2 04:14:59 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 11:14:59 +0100 Subject: [Maxima] Issues in maxima. In-Reply-To: <4599BC12.90109@ieee.org> References: <00af01c72de2$e0e325b0$210110ac@windsor> <45998F03.7020509@uhasselt.be> <4599BC12.90109@ieee.org> Message-ID: <459A30A3.8080503@uhasselt.be> > Hello Michel, >> Are you aware that of the syntax f('x):=... creates a function which >> does not evaluate x when called? >> You may find that useful. Did you download the comercial macsyma demo >> from Dr. Fateman's web site? >> It contains the reference manual for the Macsyma language, which I >> think you would find helpful. >> Dan Stanger > No, but I did know about f(x)::= which is the same I presume. Anyway > this is irrelevant for the example: > h('s,t):=s[t]$ > h(r,1); > r_1 > h(t,1); > t evaluates to 1 > Improper name or value in functional position. > #0: h(s=t,t=1) > -- an error. To debug this try debugmode(true); > > Now I ***know*** one can rewrite this example so that it works (e.g. > Richard has given a fairly generic way > using ?gensym()). But this is not my point. The ***user should not have > to worry about this***. After all > this is a ***completely trivial one line program***. It should work as > expected. > > Michel > Followup: I think many new comers to maxima who try to write their first trivial program and are confronted with issues like this will declare maxima to be "buggy as hell" and return to the safe haven of Maple or Mathematica. If one can say to such users: please use sanitize(h), or h(s:lexical,t:lexical) or something similar then perhaps we can keep them. However technical explanations about lexical versus dynamical scoping (yes I understand what this means) or the advice to use lisp won't do the job. Sorry if this sounds a little bitter. Michel From miguel39123 at hotmail.com Tue Jan 2 06:51:17 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Tue, 2 Jan 2007 12:51:17 +0000 (UTC) Subject: [Maxima] Issues in maxima. References: <00af01c72de2$e0e325b0$210110ac@windsor> <45998F03.7020509@uhasselt.be> <4599BC12.90109@ieee.org> <459A30A3.8080503@uhasselt.be> Message-ID: Michel Van den Bergh uhasselt.be> writes: > > > Hello Michel, > >> Are you aware that of the syntax f('x):=... creates a function which > >> does not evaluate x when called? > > No, but I did know about f(x)::= which is the same I presume. Anyway > > this is irrelevant for the example. Hello, about this f(x)::= makes an extra evaluation (in lisp this is called a macro, first you construct and expression using the language, and then you evaluate that expression. So f('x) := and f(x)::= are very different. I see that the new year begins with a lot of work trying to sanite the scope and declarations. Perhaps, if anything clear come out, you would be so kind to make a brief descriptions of the main points. Good work. A brief general reflexion: I think that the problem is that there is a gap between the purpose of maxima for the user and maxima for the designer. Sometimes the developers of maxima are trying to guest what the common user is doing, perhaps this explain the scope, looking for values or binding everywhere ... but developers need a finer control, they don't want the system to be so clever. An example of this look in the mailing-list for the op discussion: Should it gives false on atoms or should it gives an error? From an user point of view: don't give me errors, try to recover. From a developer point of view: give me an error. Anyway this gap requires you to pay a price. From robert.dodier at gmail.com Tue Jan 2 08:56:34 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 2 Jan 2007 07:56:34 -0700 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <459A2623.9090709@uhasselt.be> References: <00af01c72de2$e0e325b0$210110ac@windsor> <45998F03.7020509@uhasselt.be> <4599BC12.90109@ieee.org> <459A2623.9090709@uhasselt.be> Message-ID: On 1/2/07, Michel Van den Bergh wrote: > > Are you aware that of the syntax f('x):=... creates a function which > > does not evaluate x when called? Hmm, that's interesting. I don't remember seeing that one before. Looks like the documentation for := can be beefed up; I'll work on it. > Now I ***know*** one can rewrite this example so that it works (e.g. > Richard has given a fairly generic way using ?gensym()). > But this is not my point. The ***user should not have to worry about > this***. After all this is a ***completely trivial one line program***. > It should work as expected. I think we all agree that lexical scope is generally better than dynamic. We're just working on stuff as our limited time and expertise allows. All the best, Robert From robert.dodier at gmail.com Tue Jan 2 09:13:31 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 2 Jan 2007 08:13:31 -0700 Subject: [Maxima] remvalue, was: Strange plot2d behaviour (correction) In-Reply-To: <00af01c72de2$e0e325b0$210110ac@windsor> References: <459957C7.4060507@uhasselt.be> <00af01c72de2$e0e325b0$210110ac@windsor> Message-ID: On 1/1/07, Richard Fateman wrote: > sanitize(f):=block([subl:[], > s:apply(fundef,[f])], > subl:map(lambda([r],r=?gensym()),substpart("[",part(s,1),0)), > apply(define, [subst(subl,part(s,1)), > subst(subl,part(s,2)) ])) > > > Here is another program that is often equivalent: > > sanitize2(s):=( s:apply(fundef,[s]), > ev(subst(map(lambda([r],r=?gensym()),substpart("[",part(s,1),0)),s))) Another substitution function that could be useful here is buildq. HTH Robert From robert.dodier at gmail.com Tue Jan 2 09:37:11 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 2 Jan 2007 08:37:11 -0700 Subject: [Maxima] recent attempt In-Reply-To: <4599A964.90309@gmail.com> References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: On 1/1/07, Raymond Toy wrote: > But the interface is still undecided. There are quite a few options to > dgeev and dgesvd and I'm not sure how to expose all of them. Perhaps it > doesn't matter and the interface should be simple. Maybe it is appropriate to have simplified interface at the Maxima level, since one can always drop into Lisp to get all the bells and whistles. Or make some of the arguments optional or keyword arguments (by this I just mean recognize foo=bar in the arguments). > I'm also not sure about the copying of the Lisp array data to maxima > matrix type. Not sure what you mean here. I'm pretty sure that the Maxima function should take a Maxima matrix as an argument, and return a Maxima matrix. Thanks for working on this -- Robert From macrakis at alum.mit.edu Tue Jan 2 09:37:42 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 2 Jan 2007 10:37:42 -0500 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <459A2623.9090709@uhasselt.be> References: <00af01c72de2$e0e325b0$210110ac@windsor> <45998F03.7020509@uhasselt.be> <4599BC12.90109@ieee.org> <459A2623.9090709@uhasselt.be> Message-ID: <8b356f880701020737y28608ac9hca36753d429f0c84@mail.gmail.com> > > Are you aware that of the syntax f('x):=... creates a function which > > does not evaluate x when called? > No, but I did know about f(x)::= which is the same I presume. No, it is not the same. ::= defines a *macro* which is re-evaluated. Macros are a powerful mechanism which should be used sparingly and tastefully.... Quoted arguments, in my opinion, are almost never a good idea. They make for "convenience" in the short run at the cost of complications in the long run. I agree with Michel that getting clean general semantics is the right solution, however, I am not sure it is as straightforward as something like "sanitize". -s From raymond.toy at ericsson.com Tue Jan 2 09:56:37 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 02 Jan 2007 10:56:37 -0500 Subject: [Maxima] recent attempt In-Reply-To: (Robert Dodier's message of "Tue, 2 Jan 2007 08:37:11 -0700") References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/1/07, Raymond Toy wrote: >> But the interface is still undecided. There are quite a few options to >> dgeev and dgesvd and I'm not sure how to expose all of them. Perhaps it >> doesn't matter and the interface should be simple. Robert> Maybe it is appropriate to have simplified interface at the Maxima level, Robert> since one can always drop into Lisp to get all the bells and whistles. Robert> Or make some of the arguments optional or keyword arguments Robert> (by this I just mean recognize foo=bar in the arguments). The interface right now is fairly simple. dgeev(matrix, right-eig, left-eig) dgesvd(matrix, u-p, v-p) Where right-eig, left-eig, u-p, and v-p are optional args. In particular, dgesvd supports quite a few more options which aren't currently exposed. But perhaps that's good enough for now. >> I'm also not sure about the copying of the Lisp array data to maxima >> matrix type. Robert> Not sure what you mean here. I'm pretty sure that the Maxima function Robert> should take a Maxima matrix as an argument, and return a Maxima matrix. Ok. I was just wondering if the functions should return the Lisp arrays themselves instead of copying them to a Maxima matrix object. As a first cut, this is ok. The question now is if you still want lapack in src and not share. By putting them in src, the routines are always available. However, it adds quite a bit more time to compile it up (only a problem for developers), but it also adds quite a bit of memory usage to maxima, even for people who would never use these routines. (I'll try to measure how much more memory soon.) If they were in share, we wouldn't have this problem, except that users will now take a hit to compile the lapack routines the first time. But no memory bloat, and no additional compile time for developers. I can go either way on this. I would just like some opinions on the right approach. Ray From raymond.toy at ericsson.com Tue Jan 2 10:04:44 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 02 Jan 2007 11:04:44 -0500 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: (Robert Dodier's message of "Tue, 2 Jan 2007 07:56:34 -0700") References: <00af01c72de2$e0e325b0$210110ac@windsor> <45998F03.7020509@uhasselt.be> <4599BC12.90109@ieee.org> <459A2623.9090709@uhasselt.be> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/2/07, Michel Van den Bergh wrote: >> > Are you aware that of the syntax f('x):=... creates a function which >> > does not evaluate x when called? Robert> Hmm, that's interesting. I don't remember seeing that one before. Robert> Looks like the documentation for := can be beefed up; I'll work on it. >> Now I ***know*** one can rewrite this example so that it works (e.g. >> Richard has given a fairly generic way using ?gensym()). >> But this is not my point. The ***user should not have to worry about >> this***. After all this is a ***completely trivial one line program***. >> It should work as expected. Robert> I think we all agree that lexical scope is generally better than dynamic. Indeed. But what do we really want? In lisp, (defun foo (x) ) where x is a special variable will bind x to the arg's value in the body of the function foo. I think this is useful, but usually it's not what we want and because Common Lisp generally uses *x* to denote special variables. (I'm pretty sure there are parts of maxima that actually depend on this rebinding of args.) What is maxima supposed to do? What if the user really wants this binding to happen? How do we make it not happen? I certainly would like to see lexical scope, but I don't really know how to make that happen. Ray From michel.vandenbergh at uhasselt.be Tue Jan 2 10:23:17 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 17:23:17 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. References: 459A2623.9090709@uhasselt.be Message-ID: <459A86F5.9060608@uhasselt.be> > > Quoted arguments, in my opinion, are almost never a good idea. They > make for "convenience" in the short run at the cost of complications > in the long run. To avoid confusion I would like to stress again that the issue with my example is not related to quotation. h(s,t):=s[t]$ h(r,1); r_1 h(t,1); t evaluates to 1 Improper name or value in functional position. #0: h(s=t,t=1) -- an error. To debug this try debugmode(true); > I agree with Michel that getting clean general semantics is the right > solution, however, I am not sure it is as straightforward as something > like "sanitize". Something like Richard's sanitize (suitably extended) which would replace parameters and local block variables (and probably the dummy variables in lambda expression as well) by ?gensym()'s would go a long way to emulating lexical scope I think. It would be stop gap measure but it seems easy to implement (it should probably be done in lisp to make it fool proof). Basically one has to traverse the syntax tree of a function (which is already available as a list in lisp) and use a symbol table to do the correct subsitutions. For the record sanitize(h) gives (with display2d off) h(?g32637,?g32638):=?g32637[?g32638] h(t,1); t[1] Do you see any issues with this (I am not very experienced in maxima so I might be missing something)? Michel From macrakis at alum.mit.edu Tue Jan 2 10:41:01 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 2 Jan 2007 11:41:01 -0500 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <459A86F5.9060608@uhasselt.be> References: <459A86F5.9060608@uhasselt.be> Message-ID: <8b356f880701020841j1fc10fbbo9c5da3d4461dc737@mail.gmail.com> On 1/2/07, Michel Van den Bergh wrote: > To avoid confusion I would like to stress again that the issue with my > example is not related to quotation. I understand. I was replying to a post suggesting f('x):=. > Something like Richard's sanitize (suitably extended) which would replace parameters > and local block variables (and probably the dummy variables in lambda expression as well) by ?gensym()'s > would go a long way to emulating lexical scope I think. Off the top of my head, there are three issues with "sanitize": -- how to make it efficient -- how to make functions display reasonably -- handling quoted material which happens to contain symbols with the same name as variables (e.g. f(x):= 'x ) Surely, the substitution of gensyms shouldn't happen at every evaluation of the function. On the other hand, when you dispfun the function or write it out to disk, you shouldn't see gensyms in the result. Writing the necessary caching code is pretty trivial, but yet another layer of messiness. -s From michel.vandenbergh at uhasselt.be Tue Jan 2 10:56:11 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 17:56:11 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <8b356f880701020841j1fc10fbbo9c5da3d4461dc737@mail.gmail.com> References: <459A86F5.9060608@uhasselt.be> <8b356f880701020841j1fc10fbbo9c5da3d4461dc737@mail.gmail.com> Message-ID: <459A8EAB.1080607@uhasselt.be> Stavros Macrakis wrote: > On 1/2/07, Michel Van den Bergh wrote: >> To avoid confusion I would like to stress again that the issue with my >> example is not related to quotation. > > I understand. I was replying to a post suggesting f('x):=. > >> Something like Richard's sanitize (suitably extended) which would >> replace parameters >> and local block variables (and probably the dummy variables in lambda >> expression as well) by ?gensym()'s >> would go a long way to emulating lexical scope I think. > > Off the top of my head, there are three issues with "sanitize": > > -- how to make it efficient Hmm you run it only once per function so this is not so important. > -- how to make functions display reasonably It would be like compile(-). Just keep the original definition of the function around for display. But I consider this less urgent. After all the user already has the definition of his function in his source files. > -- handling quoted material which happens to contain symbols with > the same name as variables (e.g. f(x):= 'x ) This is tricky. I would guess that quoted material should not be touched since f(x):='x seems to be equivalent to f(y):='x. This also goes for things like f(x):='(x+1). Michel From michel.vandenbergh at uhasselt.be Tue Jan 2 11:05:59 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 18:05:59 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. References: 8b356f880701020841j1fc10fbbo9c5da3d4461dc737@mail.gmail.com Message-ID: <459A90F7.5000505@uhasselt.be> > > This is tricky. I would guess that quoted material should not be touched > since f(x):='x seems to be > equivalent to f(y):='x. This also goes for things like f(x):='(x+1). Of course eval messes things up! fIx):=ev('x) This is getting tricky.... Richard Fateman claims one should never use eval.... Michel From fateman at cs.berkeley.edu Tue Jan 2 13:06:39 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 2 Jan 2007 11:06:39 -0800 Subject: [Maxima] recent attempt In-Reply-To: Message-ID: <005001c72ea1$27adc360$230110ac@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Raymond Toy > Sent: Tuesday, January 02, 2007 7:57 AM > > If they were in share, we wouldn't have this problem, except that > users will now take a hit to compile the lapack routines the first > time. But no memory bloat, and no additional compile time for > developers. My impression is that the most typical user does not compile anything. At least when I download the windows "install" file, nothing gets compiled. I vote against putting it in src. Share or some other place for numerical routines makes more sense. There is the whole gnu scientific library, netlib.org, octave, etc... all of which may be "useful" too. > RJF From fateman at cs.berkeley.edu Tue Jan 2 13:13:15 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 2 Jan 2007 11:13:15 -0800 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <459A8EAB.1080607@uhasselt.be> Message-ID: <005101c72ea2$138bb0d0$230110ac@RJFE510> Blindly substituting in f(x):= (globalx: 'x, otherfun(z):= x, lambda([r],x) ...) are all ways that allow the gensym to "escape" and gets us back to the previous situation. The "right" solution is to recognize free and bound instances of x in the function body. RJF From michel.vandenbergh at uhasselt.be Tue Jan 2 14:28:28 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 21:28:28 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. Message-ID: <459AC06C.1080109@uhasselt.be> Perhaps parameters appearing quoted in the body of a function should not be gensym'ed as a safety measure? One could print a warning. If the user really really needs an f(x):='x he should know what he is doing. For most parameters of most functions this is not an issue. Michel. From robert.dodier at gmail.com Tue Jan 2 15:23:48 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 2 Jan 2007 14:23:48 -0700 Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: On 1/2/07, Raymond Toy wrote: > Ok. I was just wondering if the functions should return the Lisp > arrays themselves instead of copying them to a Maxima matrix object. I think the Lisp arrays should be copied back into Maxima matrices. > The question now is if you still want lapack in src and not share. > If they were in share, we wouldn't have this problem, except that > users will now take a hit to compile the lapack routines the first > time. But no memory bloat, and no additional compile time for > developers. It's OK by me to put them in share, let's say in share/lapack. But even better would be to put them in src/lapack and compile them at the same time as everything else, but just omit them from the final image. Then load(lapack) would just load the lapack binaries instead of compiling them. The reason I suggest this is that recompiling a large Lisp file takes a long time, and it has its own perils (e.g. confusing messages from the Lisp compiler such as "Should I bother you again?", not to mention the extremely voluminous progress messages of some compilers, or a read-only file system). Robert From michel.vandenbergh at uhasselt.be Tue Jan 2 15:27:19 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 02 Jan 2007 22:27:19 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. References: 459A8EAB.1080607@uhasselt.be Message-ID: <459ACE37.5060709@uhasselt.be> > > Blindly substituting in f(x):= (globalx: 'x, otherfun(z):= x, lambda([r],x) > ...) are all ways that allow the gensym to "escape" and gets us back to > the previous situation. > > The "right" solution is to recognize free and bound instances of x in the > function body. > > RJF Am I right that gensym substitution for x can be done safely if x does not appear in a non evaluated argument to some function? The following seems safe f(x):=(define(otherfun(z),x)) since define evaluates its second argument. Michel From robert.dodier at gmail.com Tue Jan 2 19:22:04 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 2 Jan 2007 18:22:04 -0700 Subject: [Maxima] proposal to cut out romberg and quanc8 functions Message-ID: Hello, I want to cut out the romberg and quanc8 functions. These are numerical quadrature functions which are superseded by QUADPACK. I believe that it will improve Maxima to remove these obsolete functions. Specifically I want (1) to move demo/rombrg.dem doc/share/rombrg.usg src/rombrg.lisp share/numeric/qq.dem share/numeric/qq.lisp share/numeric/qq.usg to the archive directory, and (2) to cut out the descriptions of the romberg and quanc8 stuff from the reference manual. (There is also a version of romberg which uses bigfloat computations. I am undecided about whether or not to also remove that.) romberg implements Romberg's extrapolation method. quanc8 implements an adaptive Newton-Cotes method. These methods are superseded by the Gauss-Kronrod methods implemented in QUADPACK. The QUADPACK functions are extrapolation methods, and the basic rules are Gaussian quadrature rules. Also, QUADPACK contains methods for specific problems (infinite interval, integrand with diferent weight functions, Cauchy principal value) and romberg and quanc8 do not. Empirically I have tested the romberg, quanc8, and quad_qags (from QUADPACK) on a set of 15 problems collected from the documentation for romberg, quanc8, and QUADPACK. Except for one problem in which numerical integration is expected to fail, I found that quad_qags always reports success and always meets the specified relative error tolerance (1e-6). romberg failed to converge or failed with a programming error in several cases, although it met the error tolerance otherwise. quanc8 failed to converge or failed with a programming error in some cases, and reported success without meeting the relative error tolerance in some others, and reported success and met the error tolerance in others. Thus I believe that it can established that QUADPACK is superior both from theoretical considerations and empirical observations. I would like to know if you are opposed to cutting romberg and quanc8. All the best, & hope this helps, Robert Dodier PS. input script: http://maxima.sourceforge.net/misc/compare_quadrature.mac raw output: http://maxima.sourceforge.net/misc/compare_quadrature.log summary: http://maxima.sourceforge.net/misc/compare_quadrature.txt (and also shown here) legend: (t/F, nnn) = (met relative error claim, #function evaluations) F.C. = failed to converge f.c.e. = failed to converge, but that was expected X/0 = division by 0 quad_qags romberg quanc8 F1 (t, 609) F.C. (t, 289) F2 (t, 441) (t, 85) (t, 1089) F3 (t, 2037) F.C. (F, 481) F4 (t, 105) (t, 257) (t, 65) F5 (t, 21) (t, 17) (t, 33) F6 (t, 21) (t, 65) (t, 33) F7 (t, 399) F.C. (t, 305) F8 (t, 357) (t, 2049) (F, 145) F9 (t, 441) (t, 277) (t, 5937) F10 f.c.e. f.c.e. f.c.e. F11 (t, 525) (t, 2049) (F, 33) F12 (t, 525) (t, 1025) (t, 353) F13 (t, 231) X/0 X/0 F14 (t, 693) F.C. F.C. F15 (t, 819) X/0 X/0 From toy.raymond at gmail.com Tue Jan 2 19:35:11 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 02 Jan 2007 20:35:11 -0500 Subject: [Maxima] recent attempt In-Reply-To: <005001c72ea1$27adc360$230110ac@RJFE510> References: <005001c72ea1$27adc360$230110ac@RJFE510> Message-ID: <459B084F.3060402@gmail.com> Richard Fateman wrote: > >> -----Original Message----- >> From: maxima-bounces at math.utexas.edu [mailto:maxima- >> bounces at math.utexas.edu] On Behalf Of Raymond Toy >> Sent: Tuesday, January 02, 2007 7:57 AM >> >> If they were in share, we wouldn't have this problem, except that >> users will now take a hit to compile the lapack routines the first >> time. But no memory bloat, and no additional compile time for >> developers. >> > > My impression is that the most typical user does not compile anything. At > least when I download the windows "install" file, nothing gets compiled. > > Currently, I have it set up so that load(lapack) goes out and compiles and loads the files. I was assuming users would want reasonably fast execution. > I vote against putting it in src. Share or some other place for numerical > routines makes more sense. There is the whole gnu scientific library, > netlib.org, octave, etc... all of which may be "useful" too. > > > Yes, that's why the code is currently in share. I think the quadpack routines should have been placed in share as well. The current slatec routines shouldn't be in share because they're used all over in the core of maxima for numerical evaluation of stuff that's already in src. FWIW, Ray > RJF > > > From toy.raymond at gmail.com Tue Jan 2 20:34:28 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 02 Jan 2007 21:34:28 -0500 Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: <459B1634.7020707@gmail.com> Raymond Toy wrote: > even for people who would never use these routines. (I'll try to > measure how much more memory soon.) For the record, here is what (ROOM) reports for CMUCL/ppc before and after compiling and loading lapack: > Dynamic Space Usage: 4,665,776 bytes (out of 256 MB). > Read-Only Space Usage: 37,250,280 bytes (out of 128 MB). > Static Space Usage: 3,972,936 bytes (out of 128 MB). > Control Stack Usage: 2,432 bytes (out of 128 MB). > Binding Stack Usage: 48 bytes (out of 128 MB). > Dynamic Space Usage: 14,106,856 bytes (out of 256 MB). > Read-Only Space Usage: 37,250,280 bytes (out of 128 MB). > Static Space Usage: 3,972,936 bytes (out of 128 MB). > Control Stack Usage: 2,432 bytes (out of 128 MB). > Binding Stack Usage: 48 bytes (out of 128 MB). So adding LAPACK only added 10MB of additional memory. For clisp, we have: > Bytes permanently allocated: 91168 > Bytes currently in use: 6433368 > Bytes available until next GC: 305719 > Bytes permanently allocated: 91168 > Bytes currently in use: 7220324 > Bytes available until next GC: 414646 I think that means 1MB was added, which doesn't seem so much. Ray From toy.raymond at gmail.com Tue Jan 2 20:34:28 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 02 Jan 2007 21:34:28 -0500 Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: <459B1634.7020707@gmail.com> Raymond Toy wrote: > even for people who would never use these routines. (I'll try to > measure how much more memory soon.) For the record, here is what (ROOM) reports for CMUCL/ppc before and after compiling and loading lapack: > Dynamic Space Usage: 4,665,776 bytes (out of 256 MB). > Read-Only Space Usage: 37,250,280 bytes (out of 128 MB). > Static Space Usage: 3,972,936 bytes (out of 128 MB). > Control Stack Usage: 2,432 bytes (out of 128 MB). > Binding Stack Usage: 48 bytes (out of 128 MB). > Dynamic Space Usage: 14,106,856 bytes (out of 256 MB). > Read-Only Space Usage: 37,250,280 bytes (out of 128 MB). > Static Space Usage: 3,972,936 bytes (out of 128 MB). > Control Stack Usage: 2,432 bytes (out of 128 MB). > Binding Stack Usage: 48 bytes (out of 128 MB). So adding LAPACK only added 10MB of additional memory. For clisp, we have: > Bytes permanently allocated: 91168 > Bytes currently in use: 6433368 > Bytes available until next GC: 305719 > Bytes permanently allocated: 91168 > Bytes currently in use: 7220324 > Bytes available until next GC: 414646 I think that means 1MB was added, which doesn't seem so much. Ray From michel.vandenbergh at uhasselt.be Wed Jan 3 01:58:35 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 08:58:35 +0100 Subject: [Maxima] proposal to cut out romberg and quanc8 functions Message-ID: <459B622B.10802@uhasselt.be> I have not been following this thread but this seems like a good idea to me. But the manual should give a description of the new methods. Michel From michel.vandenbergh at uhasselt.be Wed Jan 3 02:02:23 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 09:02:23 +0100 Subject: [Maxima] proposal to cut out romberg and quanc8 functions Message-ID: <459B630F.2040501@uhasselt.be> There is also the issue of backwards compatibility that has to be thought of. I don't care so much for this but some people do. Making a non-backward compatible change to maxima between versions 5.11 and 5.12 seems to be precisely the thing open source projects are often blamed for. But perhaps given the limited developer time one should ignore this? Michel From andrej.vodopivec at gmail.com Wed Jan 3 03:15:29 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Wed, 3 Jan 2007 10:15:29 +0100 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: References: Message-ID: <7775b21a0701030115y44b56cdv456b95f2eeff3558@mail.gmail.com> I don't have any strong opinions about this. But romberg and quanc8 have the advantage that they can be nested: (%i1) romberg(romberg(x^2+y^2, x, 0, y), y, 0, 1); (%o1) 0.33333333333333 (%i2) integrate(integrate(x^2+y^2, x, 0, y), y, 0, 1); (%o2) 1/3 Andrej On 1/3/07, Robert Dodier wrote: > Hello, I want to cut out the romberg and quanc8 functions. > These are numerical quadrature functions which are superseded > by QUADPACK. I believe that it will improve Maxima to remove > these obsolete functions. > > Specifically I want (1) to move > > demo/rombrg.dem > doc/share/rombrg.usg > src/rombrg.lisp > > share/numeric/qq.dem > share/numeric/qq.lisp > share/numeric/qq.usg > > to the archive directory, and (2) to cut out the descriptions of the > romberg and quanc8 stuff from the reference manual. > > (There is also a version of romberg which uses bigfloat computations. > I am undecided about whether or not to also remove that.) > > romberg implements Romberg's extrapolation method. > quanc8 implements an adaptive Newton-Cotes method. > These methods are superseded by the Gauss-Kronrod methods > implemented in QUADPACK. The QUADPACK functions are > extrapolation methods, and the basic rules are Gaussian > quadrature rules. Also, QUADPACK contains methods for > specific problems (infinite interval, integrand with diferent > weight functions, Cauchy principal value) and romberg and > quanc8 do not. > > Empirically I have tested the romberg, quanc8, and quad_qags > (from QUADPACK) on a set of 15 problems collected from the > documentation for romberg, quanc8, and QUADPACK. > Except for one problem in which numerical integration is expected > to fail, I found that quad_qags always reports success and always > meets the specified relative error tolerance (1e-6). > romberg failed to converge or failed with a programming error > in several cases, although it met the error tolerance otherwise. > quanc8 failed to converge or failed with a programming error in > some cases, and reported success without meeting the relative > error tolerance in some others, and reported success and met > the error tolerance in others. > > Thus I believe that it can established that QUADPACK is superior > both from theoretical considerations and empirical observations. > > I would like to know if you are opposed to cutting romberg and quanc8. > > All the best, & hope this helps, > Robert Dodier > > PS. > input script: http://maxima.sourceforge.net/misc/compare_quadrature.mac > raw output: http://maxima.sourceforge.net/misc/compare_quadrature.log > summary: http://maxima.sourceforge.net/misc/compare_quadrature.txt > (and also shown here) > > legend: > > (t/F, nnn) = (met relative error claim, #function evaluations) > F.C. = failed to converge > f.c.e. = failed to converge, but that was expected > X/0 = division by 0 > > quad_qags romberg quanc8 > > F1 (t, 609) F.C. (t, 289) > > F2 (t, 441) (t, 85) (t, 1089) > > F3 (t, 2037) F.C. (F, 481) > > F4 (t, 105) (t, 257) (t, 65) > > F5 (t, 21) (t, 17) (t, 33) > > F6 (t, 21) (t, 65) (t, 33) > > F7 (t, 399) F.C. (t, 305) > > F8 (t, 357) (t, 2049) (F, 145) > > F9 (t, 441) (t, 277) (t, 5937) > > F10 f.c.e. f.c.e. f.c.e. > > F11 (t, 525) (t, 2049) (F, 33) > > F12 (t, 525) (t, 1025) (t, 353) > > F13 (t, 231) X/0 X/0 > > F14 (t, 693) F.C. F.C. > > F15 (t, 819) X/0 X/0 > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From michel.vandenbergh at uhasselt.be Wed Jan 3 03:26:26 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 10:26:26 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. In-Reply-To: <006801c72eb8$60bfa120$230110ac@RJFE510> References: <006801c72eb8$60bfa120$230110ac@RJFE510> Message-ID: <459B76C2.9030800@uhasselt.be> Richard Fateman wrote: >>Am I right that gensym substitution for x can be done safely if x does >>not appear in a non evaluated >>argument to some function? >> >>The following seems safe >> >>f(x):=(define(otherfun(z),x)) >> >>since define evaluates its second argument. >> >> >> > >What would you do with f(cos,x):= cos(x)^2 ? >Do you want to call the cosine function? > > > > > Hmm I see. cos is a noun (properties(cos)). So this means it is implicitly quoted. (1) By the rule: don't touch unevaluated material *at all* the sanitized version of this function would be f(cos,uniq):=cos(uniq)^2 (2) By the rule: don't touch unevaluated material *inside the function body* the sanitized version would be f(uniq1,uniq2):=cos(uniq2)^2 In this case both versions seem to be equivalent. However they behave differently for f(x):=ev('x) since now x is evaluated. I am not sure if it possible to detect this syntactically. (I think every ev removes one round of quoting, but what if the user has redefined ev?). If not I prefer rule (2) even in this case but this changes current behaviour. Rule (1) keeps current behaviour. Michel From michel.vandenbergh at uhasselt.be Wed Jan 3 04:16:00 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 11:16:00 +0100 Subject: [Maxima] Sanitize is not fool proof (yet) .Sanitize2 seems to work as advertized. Message-ID: <459B8260.9080505@uhasselt.be> > > >(1) By the rule: don't touch unevaluated material *at all* the >sanitized version of this >function would be > >f(cos,uniq):=cos(uniq)^2 > >(2) By the rule: don't touch unevaluated material *inside the function >body* the >sanitized version would be > >f(uniq1,uniq2):=cos(uniq2)^2 > Unfortunately I now see that it may not be possible to detect unevaluated material syntactically. What about f('x):=x$ g(y):=f(y)$ g(z); y This case is still ok in a sense since sanitize(-) could look up the definition of f. But if f is defined dynamically inside some other function it becomes problem. In principle the solution to this problem would be that sanitize(g) adds code to g to detect evaluated/unevaluated arguments to operators *at runtime* (some suitable lisp function should be written for this). But perhaps this is going too far? And maybe it is not even possible? Michel From michel.vandenbergh at uhasselt.be Wed Jan 3 05:32:00 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 12:32:00 +0100 Subject: [Maxima] proposal to cut out romberg and quanc8 functions References: eb9c4b9a0701021722w2ff187cbm141267d64f8f3e14@mail.gmail.com Message-ID: <459B9430.7000401@uhasselt.be> > > I don't have any strong opinions about this. But romberg and quanc8 > have the advantage that they can be nested: > > (%i1) romberg(romberg(x^2+y^2, x, 0, y), y, 0, 1); > (%o1) 0.33333333333333 > (%i2) integrate(integrate(x^2+y^2, x, 0, y), y, 0, 1); > (%o2) 1/3 > > Andrej > The semantics of this nesting seems dubious as romberg(x^2+y^2, x, 0, y) gives (of course) an error. I am just saying this since on this list there seems to be a tendency to frown upon functions that don't evaluate their arguments:-) I assume the nesting can be achieved with the new functions using some kind of lambda construct... Cheers, Michel From robert.dodier at gmail.com Wed Jan 3 06:29:55 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 05:29:55 -0700 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: <7775b21a0701030115y44b56cdv456b95f2eeff3558@mail.gmail.com> References: <7775b21a0701030115y44b56cdv456b95f2eeff3558@mail.gmail.com> Message-ID: On 1/3/07, Andrej Vodopivec wrote: > I don't have any strong opinions about this. But romberg and quanc8 > have the advantage that they can be nested: > > (%i1) romberg(romberg(x^2+y^2, x, 0, y), y, 0, 1); > (%o1) 0.33333333333333 > (%i2) integrate(integrate(x^2+y^2, x, 0, y), y, 0, 1); > (%o2) 1/3 By itself it's not enough to keep romberg and quanc8. I don't think we want to tell people, "You can simply nest the numerical integration calls if you're OK with using methods which don't work so well." Quoting the inner call yields the same result with quad_qags -- quad_qags ('(quad_qags (x^2 + y^2, x, 0, y)[1]), y, 0, 1); => [.3333333333333333, 3.70074341541719E-15, 21, 0] best, Robert From robert.dodier at gmail.com Wed Jan 3 06:57:30 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 05:57:30 -0700 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: <459B9430.7000401@uhasselt.be> References: <459B9430.7000401@uhasselt.be> Message-ID: On 1/3/07, Michel Van den Bergh wrote: > I assume the nesting can be achieved with the new functions using some > kind of lambda construct... Yes, a lambda expression has the expected effect here. quad_qags (lambda ([y], quad_qags (lambda ([x], x^2 + y^2), x, 0, y)[1]), y, 0, 1); => [.3333333333333333, 3.70074341541719E-15, 21, 0] best Robert From fateman at cs.berkeley.edu Wed Jan 3 09:20:06 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 07:20:06 -0800 Subject: [Maxima] romberg In-Reply-To: <7775b21a0701030115y44b56cdv456b95f2eeff3558@mail.gmail.com> Message-ID: <008501c72f4a$a6d857f0$230110ac@RJFE510> The Romberg program was a short (1 page) Fortran program that I copied from my (graduate) numerical analysis course notes into lisp, in 1969 or so. I had no idea that it would last this long in Macsyma/Maxima. On the other hand, it should not be replaced by something that is functionally inferior in any way. I consider failure to support recursive calls to be inferior, but I don't see why the qq programs, properly packaged would not allow recursion too. Furthermore, if the qq programs do not support bigfloats, it seems Romberg should stay until they do. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Andrej Vodopivec > Sent: Wednesday, January 03, 2007 1:15 AM > To: Robert Dodier > Cc: Maxima list mailing > Subject: Re: [Maxima] proposal to cut out romberg and quanc8 functions > > I don't have any strong opinions about this. But romberg and quanc8 > have the advantage that they can be nested: > > (%i1) romberg(romberg(x^2+y^2, x, 0, y), y, 0, 1); > (%o1) 0.33333333333333 > (%i2) integrate(integrate(x^2+y^2, x, 0, y), y, 0, 1); > (%o2) 1/3 > > Andrej > > On 1/3/07, Robert Dodier wrote: > > Hello, I want to cut out the romberg and quanc8 functions. > > These are numerical quadrature functions which are superseded > > by QUADPACK. I believe that it will improve Maxima to remove > > these obsolete functions. > > > > Specifically I want (1) to move > > > > demo/rombrg.dem > > doc/share/rombrg.usg > > src/rombrg.lisp > > > > share/numeric/qq.dem > > share/numeric/qq.lisp > > share/numeric/qq.usg > > > > to the archive directory, and (2) to cut out the descriptions of the > > romberg and quanc8 stuff from the reference manual. > > > > (There is also a version of romberg which uses bigfloat computations. > > I am undecided about whether or not to also remove that.) > > > > romberg implements Romberg's extrapolation method. > > quanc8 implements an adaptive Newton-Cotes method. > > These methods are superseded by the Gauss-Kronrod methods > > implemented in QUADPACK. The QUADPACK functions are > > extrapolation methods, and the basic rules are Gaussian > > quadrature rules. Also, QUADPACK contains methods for > > specific problems (infinite interval, integrand with diferent > > weight functions, Cauchy principal value) and romberg and > > quanc8 do not. > > > > Empirically I have tested the romberg, quanc8, and quad_qags > > (from QUADPACK) on a set of 15 problems collected from the > > documentation for romberg, quanc8, and QUADPACK. > > Except for one problem in which numerical integration is expected > > to fail, I found that quad_qags always reports success and always > > meets the specified relative error tolerance (1e-6). > > romberg failed to converge or failed with a programming error > > in several cases, although it met the error tolerance otherwise. > > quanc8 failed to converge or failed with a programming error in > > some cases, and reported success without meeting the relative > > error tolerance in some others, and reported success and met > > the error tolerance in others. > > > > Thus I believe that it can established that QUADPACK is superior > > both from theoretical considerations and empirical observations. > > > > I would like to know if you are opposed to cutting romberg and quanc8. > > > > All the best, & hope this helps, > > Robert Dodier > > > > PS. > > input script: http://maxima.sourceforge.net/misc/compare_quadrature.mac > > raw output: http://maxima.sourceforge.net/misc/compare_quadrature.log > > summary: http://maxima.sourceforge.net/misc/compare_quadrature.txt > > (and also shown here) > > > > legend: > > > > (t/F, nnn) = (met relative error claim, #function evaluations) > > F.C. = failed to converge > > f.c.e. = failed to converge, but that was expected > > X/0 = division by 0 > > > > quad_qags romberg quanc8 > > > > F1 (t, 609) F.C. (t, 289) > > > > F2 (t, 441) (t, 85) (t, 1089) > > > > F3 (t, 2037) F.C. (F, 481) > > > > F4 (t, 105) (t, 257) (t, 65) > > > > F5 (t, 21) (t, 17) (t, 33) > > > > F6 (t, 21) (t, 65) (t, 33) > > > > F7 (t, 399) F.C. (t, 305) > > > > F8 (t, 357) (t, 2049) (F, 145) > > > > F9 (t, 441) (t, 277) (t, 5937) > > > > F10 f.c.e. f.c.e. f.c.e. > > > > F11 (t, 525) (t, 2049) (F, 33) > > > > F12 (t, 525) (t, 1025) (t, 353) > > > > F13 (t, 231) X/0 X/0 > > > > F14 (t, 693) F.C. F.C. > > > > F15 (t, 819) X/0 X/0 > > _______________________________________________ > > 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 From macrakis at alum.mit.edu Wed Jan 3 09:27:18 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 3 Jan 2007 10:27:18 -0500 Subject: [Maxima] recent attempt In-Reply-To: <459B1634.7020707@gmail.com> References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> <459B1634.7020707@gmail.com> Message-ID: <8b356f880701030727g782c9f39hd12787bbfafd4f62@mail.gmail.com> On 1/2/07, Raymond Toy wrote: > ... adding LAPACK only added 10MB of additional memory. "Only"? It *tripled* dynamic space usage. What's the problem with autoload? From michel.vandenbergh at uhasselt.be Wed Jan 3 09:54:03 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 16:54:03 +0100 Subject: [Maxima] romberg References: 7775b21a0701030115y44b56cdv456b95f2eeff3558@mail.gmail.com Message-ID: <459BD19B.8050909@uhasselt.be> > > On the other > hand, it should not be replaced by something that is functionally inferior > in any way. I consider failure to support recursive calls to be inferior, > but I don't see why the qq programs, properly packaged would not allow > recursion too. As Robert pointed out, the other programs support correctly support recursion. As I pointed out in my earlier email the syntax allowed by romberg: romberg(romberg(x^2+y^2, x, 0, y), y, 0, 1); is semantically dubious. I thought it was now agreed upon that functions should evaluate all their arguments, if at all possible, which apparently romberg does not do. Michel From raymond.toy at ericsson.com Wed Jan 3 09:55:40 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 10:55:40 -0500 Subject: [Maxima] recent attempt In-Reply-To: <8b356f880701030727g782c9f39hd12787bbfafd4f62@mail.gmail.com> (Stavros Macrakis's message of "Wed, 3 Jan 2007 10:27:18 -0500") References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> <459B1634.7020707@gmail.com> <8b356f880701030727g782c9f39hd12787bbfafd4f62@mail.gmail.com> Message-ID: >>>>> "Stavros" == Stavros Macrakis writes: Stavros> On 1/2/07, Raymond Toy wrote: >> ... adding LAPACK only added 10MB of additional memory. Stavros> "Only"? It *tripled* dynamic space usage. Oh, you need to include the read-only and static spaces too, not just the dynamic space. The read-only space is all of the compiled code from maxima itself (and cmucl itself, about 20 MB), and the static space (usually about 3 MB). Hence the total usage increased to about 55 MB from 45 MB, which isn't quite so bad. Stavros> What's the problem with autoload? Nothing. I think that would be the preferred way, but if it's in src, I don't really know how to get the code compiled but not also in the loaded into core. Maxima has this weird scheme where the code is compiled and loaded, and then loaded again from scratch before creating a Lisp core file. Ray From raymond.toy at ericsson.com Wed Jan 3 10:01:32 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 11:01:32 -0500 Subject: [Maxima] recent attempt In-Reply-To: (Robert Dodier's message of "Tue, 2 Jan 2007 14:23:48 -0700") References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/2/07, Raymond Toy wrote: >> Ok. I was just wondering if the functions should return the Lisp >> arrays themselves instead of copying them to a Maxima matrix object. Robert> I think the Lisp arrays should be copied back into Maxima matrices. Ok. >> The question now is if you still want lapack in src and not share. >> If they were in share, we wouldn't have this problem, except that >> users will now take a hit to compile the lapack routines the first >> time. But no memory bloat, and no additional compile time for >> developers. Robert> It's OK by me to put them in share, let's say in share/lapack. That's where I've put them already, in my experiments. :-) Robert> But even better would be to put them in src/lapack and compile Robert> them at the same time as everything else, but just omit them from Robert> the final image. Then load(lapack) would just load the lapack binaries Robert> instead of compiling them. I don't know how to do that. Maxima's build system for src is a bit messy. The defsystem file compiles and loads everything. Then it's done again, using the same defsystem to load everything. Hence, everything gets loaded. We'd have to rearrange the defsystem and build scripts. Robert> The reason I suggest this is that recompiling a large Lisp file takes Robert> a long time, and it has its own perils (e.g. confusing messages from Robert> the Lisp compiler such as "Should I bother you again?", not to That message comes from defsystem. Robert> mention the extremely voluminous progress messages of some Robert> compilers, or a read-only file system). We could set *compile-verbose* and friends not to display these progress messages. However, on my ppc system it takes a long time (15+ minutes?) to compile, so having some messages go by gives the user a nice warm fuzzy that something is actually happening. But there's a precedent for this. affine compiles it's code too, so it wouldn't work on read-only file systems either. Ray From raymond.toy at ericsson.com Wed Jan 3 10:08:11 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 11:08:11 -0500 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: (Robert Dodier's message of "Wed, 3 Jan 2007 05:57:30 -0700") References: <459B9430.7000401@uhasselt.be> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/3/07, Michel Van den Bergh wrote: >> I assume the nesting can be achieved with the new functions using some >> kind of lambda construct... Robert> Yes, a lambda expression has the expected effect here. Robert> quad_qags (lambda ([y], quad_qags (lambda ([x], x^2 + y^2), x, 0, Robert> y)[1]), y, 0, 1); Robert> => [.3333333333333333, 3.70074341541719E-15, 21, 0] Just a note for the unwary: The error estimate produced here (3.7e-15) is probably way off because it doesn't take into account the error produced by the inner quad_qags. One nice thing about having converted the code to Lisp instead of using an FFI: You might not be able to do nested calls like this with the original Fortran code because recursive calls like this are unspecified or forbidden in Fortran 77. I think the quadpack manual actually gives an example of this, but specifically mentions that two different integrators are used. Ray From michel.vandenbergh at uhasselt.be Wed Jan 3 10:12:18 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 17:12:18 +0100 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: References: <459B9430.7000401@uhasselt.be> Message-ID: <459BD5E2.9010807@uhasselt.be> > Robert> On 1/3/07, Michel Van den Bergh wrote: > >> I assume the nesting can be achieved with the new functions using some > >> kind of lambda construct... > > Robert> Yes, a lambda expression has the expected effect here. > > Robert> quad_qags (lambda ([y], quad_qags (lambda ([x], x^2 + y^2), x, 0, > Robert> y)[1]), y, 0, 1); > Robert> => [.3333333333333333, 3.70074341541719E-15, 21, 0] > > Just a note for the unwary: The error estimate produced here > (3.7e-15) is probably way off because it doesn't take into account the > error produced by the inner quad_qags. > Hmm true! I assume the original romberg did not have this problem? Michel From fateman at cs.berkeley.edu Wed Jan 3 10:43:50 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 08:43:50 -0800 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: Message-ID: <008901c72f56$596913e0$230110ac@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Raymond Toy ....> > Robert> I think the Lisp arrays should be copied back into Maxima > matrices. > Just to point out what may help inform this discussion: It is not at all that hard -- and in fact is done in Mathematica, I believe -- to support another type of matrix (or more...). Namely large numerical matrices are stored in Mathematica NOT at lists of lists. This makes it possible to mimic programs like matlab at full speed (in fact, as fast as matlab or faster). A full commitment to numerical matrix computation would provide the full complement of representation possibilities, including triangular, tridiagonal, symmetric, sparse, ... double, complex I suggest the following: (a) a new maxima "head" or "operator" which would be (say) ddmatrix for dense matrix of real double floats, e.g. ((ddmatrix 10 20 simp) ) (b) display programs for this. Naturally it would be unusual to see ALL of a large matrix in a 2-D display, since the typical entry would itself take 16+ character spaces. (c) setting and accessing functions ... i.e. a[p,q] as a value and a[p,q]: ... (d) conversion to and from ddmatrix to list-of-lists. Note that (d) at least must be written anyway. Also some policy that might automatically convert to a ddmatrix --when possible-- for the first use of a matrix in lapack functions etc, and automatic conversion to a list-of-lists when necessary by setting a location to a symbol. What is the payoff, since conversion is in any case linear time and the lapack stuff is quadratic or worse? Well, the overhead of converting each matrix repeatedly inside a loop or even inside a single matrix expression like A.B.transpose(A) ... would be painful. And if you want Maxima to compete head-on with Matlab, you can do it this way. From sen1 at math.msu.edu Wed Jan 3 10:53:44 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 3 Jan 2007 11:53:44 -0500 (EST) Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: <008901c72f56$596913e0$230110ac@RJFE510> References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: If it is not too silly, I think it would be good to have both floats and bigfloats supported, perhaps in separate packages. It might take a lot longer to run, but, in some cases, the user might be willing to wait. There are a number of applications of moderate size, say matrices of order up to 500x500 where knowing the bigfloat answers might be useful. -sen On Wed, 3 Jan 2007, Richard Fateman wrote: > > >> -----Original Message----- >> From: maxima-bounces at math.utexas.edu [mailto:maxima- >> bounces at math.utexas.edu] On Behalf Of Raymond Toy > ....> >> Robert> I think the Lisp arrays should be copied back into Maxima >> matrices. >> > > > Just to point out what may help inform this discussion: > > It is not at all that hard -- and in fact is done in Mathematica, I believe > -- to support another type of matrix (or more...). Namely large numerical > matrices are stored in Mathematica NOT at lists of lists. This makes it > possible to mimic programs like matlab at full speed (in fact, as fast as > matlab or faster). > > A full commitment to numerical matrix computation would provide the full > complement of representation possibilities, including triangular, > tridiagonal, symmetric, sparse, ... double, complex > > I suggest the following: > > (a) a new maxima "head" or "operator" which would be (say) ddmatrix for > dense matrix of real double floats, e.g. ((ddmatrix 10 20 simp) matrix compatible with C>) > (b) display programs for this. Naturally it would be unusual to see ALL of a > large matrix in a 2-D display, since the typical entry would itself take 16+ > character spaces. > (c) setting and accessing functions ... i.e. a[p,q] as a value and a[p,q]: > ... > > (d) conversion to and from ddmatrix to list-of-lists. > > > Note that (d) at least must be written anyway. > > > Also some policy that might automatically convert to a ddmatrix --when > possible-- for the first use of a matrix in lapack functions etc, and > automatic conversion to a list-of-lists when necessary by setting a location > to a symbol. > > What is the payoff, since conversion is in any case linear time and the > lapack stuff is quadratic or worse? Well, the overhead of converting each > matrix repeatedly inside a loop or even inside a single matrix expression > like A.B.transpose(A) ... would be painful. > > And if you want Maxima to compete head-on with Matlab, you can do it this > way. > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From sen1 at math.msu.edu Wed Jan 3 11:00:16 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 3 Jan 2007 12:00:16 -0500 (EST) Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: This brings up another question. Is it reasonable to set some kind of switch, maybe at compile time, so that some routines loaded in can be run in a given preset precision? Perhaps there could be an option to create two "maxima" packages. One as it now is, and one where all computations in certain routines can be run with a preset precision. Initially, the user would be responsible for conversion problems. I realize that this might be of low priority for now, but it is just an idea. -sen at On Wed, 3 Jan 2007, sen1 at math.msu.edu wrote: > If it is not too silly, I think it would be good to have both floats > and bigfloats supported, perhaps in separate packages. It might take > a lot longer to run, but, in some cases, the user might be willing to wait. > > There are a number of applications of moderate size, say matrices of > order up to 500x500 where knowing the bigfloat answers might be > useful. > > -sen > > > On Wed, 3 Jan 2007, Richard Fateman wrote: > >> >> >>> -----Original Message----- >>> From: maxima-bounces at math.utexas.edu [mailto:maxima- >>> bounces at math.utexas.edu] On Behalf Of Raymond Toy >> ....> >>> Robert> I think the Lisp arrays should be copied back into Maxima >>> matrices. >>> >> >> >> Just to point out what may help inform this discussion: >> >> It is not at all that hard -- and in fact is done in Mathematica, I believe >> -- to support another type of matrix (or more...). Namely large numerical >> matrices are stored in Mathematica NOT at lists of lists. This makes it >> possible to mimic programs like matlab at full speed (in fact, as fast as >> matlab or faster). >> >> A full commitment to numerical matrix computation would provide the full >> complement of representation possibilities, including triangular, >> tridiagonal, symmetric, sparse, ... double, complex >> >> I suggest the following: >> >> (a) a new maxima "head" or "operator" which would be (say) ddmatrix for >> dense matrix of real double floats, e.g. ((ddmatrix 10 20 simp) > matrix compatible with C>) >> (b) display programs for this. Naturally it would be unusual to see ALL of a >> large matrix in a 2-D display, since the typical entry would itself take 16+ >> character spaces. >> (c) setting and accessing functions ... i.e. a[p,q] as a value and a[p,q]: >> ... >> >> (d) conversion to and from ddmatrix to list-of-lists. >> >> >> Note that (d) at least must be written anyway. >> >> >> Also some policy that might automatically convert to a ddmatrix --when >> possible-- for the first use of a matrix in lapack functions etc, and >> automatic conversion to a list-of-lists when necessary by setting a location >> to a symbol. >> >> What is the payoff, since conversion is in any case linear time and the >> lapack stuff is quadratic or worse? Well, the overhead of converting each >> matrix repeatedly inside a loop or even inside a single matrix expression >> like A.B.transpose(A) ... would be painful. >> >> And if you want Maxima to compete head-on with Matlab, you can do it this >> way. >> >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> > > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From raymond.toy at ericsson.com Wed Jan 3 11:12:58 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 12:12:58 -0500 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: <008901c72f56$596913e0$230110ac@RJFE510> (Richard Fateman's message of "Wed, 3 Jan 2007 08:43:50 -0800") References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: >>>>> "Richard" == Richard Fateman writes: Richard> A full commitment to numerical matrix computation would provide the full Richard> complement of representation possibilities, including triangular, Richard> tridiagonal, symmetric, sparse, ... double, complex Richard> I suggest the following: Richard> (a) a new maxima "head" or "operator" which would be (say) ddmatrix for Richard> dense matrix of real double floats, e.g. ((ddmatrix 10 20 simp) matrix compatible with C>) Just a note about the actual implementation. First, Fortran arrays are in column-major order but Lisp and C arrays are in row-major order. To make this work, we need to hide this fact somehow. Perhaps by making a[row,col] actually access element a(col,row). Second, the f2cl translation only uses 1D arrays, even for 2D arrays. This is done to make array slicing work out. (Array slicing is when you call a function with an arg like x(2,10) to mean a submatrix starting at element (2,10) and all the following elements.) This can also be hidden by making a[row,col] access element a(row + col*ncol). Ray From nicolas.pettiaux at ael.be Wed Jan 3 11:32:46 2007 From: nicolas.pettiaux at ael.be (Nicolas Pettiaux) Date: Wed, 3 Jan 2007 18:32:46 +0100 Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple Message-ID: When I told a colleague of mine, in general a supporter of free software, who tries to develop the use of CAS in the university that he should favor Maxima as it is a free software, instead of maple or mathematica (that he uses), he answered that the language underlying maxima was "the old LISP" while maple and mathematica were developped using more modern technologies, hence, more powerful or at least valuable for a student to learn. he also claimed that he was more confident in a company supporting a software than a community, but this is a completely other point. I could not argue as I do not know Lisp (I have just started with a tutorial) but I would like to collect argument from the list members and put them in the wiki eg at http://maxima.sourceforge.net/wiki/index.php/Supporting%20arguments I would also like to have an idea about high schools or universities using Maxima in effective underraduate or graduate education, and again put this in the wiki eg at http://maxima.sourceforge.net/wiki/index.php/Example%20of%20use Thanks, Nicolas -- Nicolas Pettiaux - email: nicolas.pettiaux at ael.be From robert.dodier at gmail.com Wed Jan 3 11:35:26 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 10:35:26 -0700 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: <459BD5E2.9010807@uhasselt.be> References: <459B9430.7000401@uhasselt.be> <459BD5E2.9010807@uhasselt.be> Message-ID: On 1/3/07, Michel Van den Bergh wrote: > > Robert> quad_qags (lambda ([y], quad_qags (lambda ([x], x^2 + y^2), x, 0, > > Robert> y)[1]), y, 0, 1); > > Robert> => [.3333333333333333, 3.70074341541719E-15, 21, 0] > > > > Just a note for the unwary: The error estimate produced here > > (3.7e-15) is probably way off because it doesn't take into account the > > error produced by the inner quad_qags. > > Hmm true! I assume the original romberg did not have this problem? romberg and quanc8 are susceptible to the same problem, for the same reason: the error estimate of the inner integration is ignored. To do a 2-d integral correctly as a nested 1-d integration, the outer integration should take into account the error. It could be done with interval arithmetic. Better still is to use a method specifically for multidimensional problems. best Robert From raymond.toy at ericsson.com Wed Jan 3 11:36:13 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 12:36:13 -0500 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: (sen1@math.msu.edu's message of "Wed, 3 Jan 2007 11:53:44 -0500 (EST)") References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: >>>>> "sen1" == sen1 writes: sen1> If it is not too silly, I think it would be good to have both floats sen1> and bigfloats supported, perhaps in separate packages. It might take sen1> a lot longer to run, but, in some cases, the user might be willing to wait. sen1> There are a number of applications of moderate size, say matrices of sen1> order up to 500x500 where knowing the bigfloat answers might be sen1> useful. LAPACK only supports 2 precisions: single and double. I am only doing the double precision version since maxima normally operates in double-precision. Ray From raymond.toy at ericsson.com Wed Jan 3 11:37:38 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 12:37:38 -0500 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: (sen1@math.msu.edu's message of "Wed, 3 Jan 2007 12:00:16 -0500 (EST)") References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: >>>>> "sen1" == sen1 writes: sen1> This brings up another question. sen1> Is it reasonable to set some kind of switch, maybe at compile time, so sen1> that some routines loaded in can be run in a given preset precision? sen1> Perhaps there could be an option to create two "maxima" packages. One sen1> as it now is, and one where all computations in certain routines can sen1> be run with a preset precision. Initially, the user would be responsible for sen1> conversion problems. You can already do that with bfloats. Just set fpprec to the desired precision. Unfortunately, not all functions have bfloat implementations. Ray From robert.dodier at gmail.com Wed Jan 3 11:46:03 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 10:46:03 -0700 Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: On 1/3/07, Raymond Toy wrote: > Robert> But even better would be to put them in src/lapack and compile > Robert> them at the same time as everything else, but just omit them from > Robert> the final image. Then load(lapack) would just load the lapack binaries > Robert> instead of compiling them. > > I don't know how to do that. Maxima's build system for src is a bit > messy. The defsystem file compiles and loads everything. Then it's > done again, using the same defsystem to load everything. Hence, > everything gets loaded. We'd have to rearrange the defsystem and > build scripts. OK, let's not mess with the src build system. Let's put it in share/lapack. Can we compile it there so that users don't need to? > We could set *compile-verbose* and friends not to display these > progress messages. However, on my ppc system it takes a long time > (15+ minutes?) to compile, so having some messages go by gives the > user a nice warm fuzzy that something is actually happening. 15 minutes?! I think users are going to be unhappy about that. I know I will be. > But there's a precedent for this. affine compiles it's code too, so > it wouldn't work on read-only file systems either. I don't want to use affine as a model for other packages. It is unfortunately something of a mess, from what I can tell. Thanks for working on this problem -- Robert From michel.vandenbergh at uhasselt.be Wed Jan 3 12:02:38 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 19:02:38 +0100 Subject: [Maxima] bfloat question In-Reply-To: References: <459B9430.7000401@uhasselt.be> <459BD5E2.9010807@uhasselt.be> Message-ID: <459BEFBE.1060000@uhasselt.be> Does anybody know if a bfloat number can overflow or underflow? I did a test and it seemed not. But I wanted to make sure. Michel From macrakis at alum.mit.edu Wed Jan 3 12:08:15 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 3 Jan 2007 13:08:15 -0500 Subject: [Maxima] bfloat question In-Reply-To: <459BEFBE.1060000@uhasselt.be> References: <459B9430.7000401@uhasselt.be> <459BD5E2.9010807@uhasselt.be> <459BEFBE.1060000@uhasselt.be> Message-ID: <8b356f880701031008h4d2a6098qd3d25984c7be241d@mail.gmail.com> On 1/3/07, Michel Van den Bergh wrote: > Does anybody know if a bfloat number can overflow or underflow? No, it cannot. The exponent is a Lisp bignum, so is limited only by memory size. The precision is also only limited by memory size (and calculation time...). -s From robert.dodier at gmail.com Wed Jan 3 12:08:27 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 11:08:27 -0700 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: <008901c72f56$596913e0$230110ac@RJFE510> References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: On 1/3/07, Richard Fateman wrote: > It is not at all that hard -- and in fact is done in Mathematica, I believe > -- to support another type of matrix (or more...). Namely large numerical > matrices are stored in Mathematica NOT at lists of lists. This makes it > possible to mimic programs like matlab at full speed (in fact, as fast as > matlab or faster). A distinct dense general purpose matrix type (i.e. comparable to the existing matrix type) would be a disaster. Maxima is enough of a mess as it stands. Much better would be to rework the existing matrix type, so that from the user's point of view there is still only one general purpose dense matrix type. I made an incomplete prototype of a matrix reimplementation a while ago. Finishing it be tedious (finding all the (EQ (CAAR EXPR) '$MATRIX) mostly) but well within our capability. See: http://www.math.utexas.edu/pipermail/maxima/2006/001181.html and other messages in the same thread. > A full commitment to numerical matrix computation would provide the full > complement of representation possibilities, including triangular, > tridiagonal, symmetric, sparse, ... double, complex Well, a full commitment would be nice, but even a partial commitment would be an improvement. > (a) a new maxima "head" or "operator" which would be (say) ddmatrix for > dense matrix of real double floats, e.g. ((ddmatrix 10 20 simp) matrix compatible with C>) No, another general-purpose dense matrix type would only add to the confusion. I'm not opposed to special-purpose types (e.g. sparse). > (b) display programs for this. Naturally it would be unusual to see ALL of a > large matrix in a 2-D display, since the typical entry would itself take 16+ > character spaces. OK. > (c) setting and accessing functions ... i.e. a[p,q] as a value and a[p,q]: > ... If we invent new matrix types, they should act like the existing ones w.r.t. getting and setting values. Not sure if you mean something else here. > (d) conversion to and from ddmatrix to list-of-lists. OK. best Robert From sen1 at math.msu.edu Wed Jan 3 12:03:10 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 3 Jan 2007 13:03:10 -0500 (EST) Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: On Wed, 3 Jan 2007, Robert Dodier wrote: [snip] >> Robert> the final image. Then load(lapack) would just load the lapack binaries >> Robert> instead of compiling them. [snip] > > 15 minutes?! I think users are going to be unhappy about that. > I know I will be. This seems to be only an issue for developers. At the risk of making a stupid suggestion ( I do that all the time anyway), why not make a configure option for these long compiling packages? Thus, one could have a default and ./configure --with-lapack or ./configure --without-lapack -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From macrakis at alum.mit.edu Wed Jan 3 12:13:53 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 3 Jan 2007 13:13:53 -0500 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: References: <008901c72f56$596913e0$230110ac@RJFE510> Message-ID: <8b356f880701031013x59280ec0m9767df1447d2eb5c@mail.gmail.com> On 1/3/07, Robert Dodier wrote: > A distinct dense general purpose matrix type (i.e. comparable to the > existing matrix type) would be a disaster. I agree that a distinct *user-visible* matrix type would be a disaster -- whether general-purpose or special-purpose (sparse, etc.). There are many abstract types (lists, matrices, graphs, sets, multiple-precision numbers, ...) where it would be desirable to have multiple underlying implementations. Without going down the rathole of trying to make all of Maxima beautifully object-oriented, perhaps we could at least figure out some standard framework for all these cases, rather than reinvent the wheel each time. This might or might not use existing CL mechanisms for objects. -s From robert.dodier at gmail.com Wed Jan 3 12:18:07 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 11:18:07 -0700 Subject: [Maxima] romberg In-Reply-To: <008501c72f4a$a6d857f0$230110ac@RJFE510> References: <7775b21a0701030115y44b56cdv456b95f2eeff3558@mail.gmail.com> <008501c72f4a$a6d857f0$230110ac@RJFE510> Message-ID: On 1/3/07, Richard Fateman wrote: > The Romberg program was a short (1 page) Fortran program that I copied from > my (graduate) numerical analysis course notes into lisp, in 1969 or so. I > had no idea that it would last this long in Macsyma/Maxima. On the other > hand, it should not be replaced by something that is functionally inferior > in any way. QUADPACK is functionally superior in the aspects which matter most -- it did not fail on problems which romberg and quanc8 failed on, and its computed estimate meets the specified error tolerance. > I consider failure to support recursive calls to be inferior, > but I don't see why the qq programs, properly packaged would not allow > recursion too. You'll need to take this up with Stavros, then. He always says that argument quoting (which is what allows romberg and quanc8 calls to be nested) is a bad idea. But if you can convince him that quoting the integrand in QUADPACK functions is a good idea, I will gladly modify the QUADPACK code accordingly. By qq I guess you mean QUADPACK. qq is the package which contains quanc8. > Furthermore, if the qq programs do not support bigfloats, it seems Romberg > should stay until they do. I'm not convinced. I don't want to tell people that they should use a method known to be inferior. Bigfloat arithmetic isn't much of an issue in numerical integration anyway; integration errors are typically several orders of magnitude larger than the floating point epsilon. All the best, Robert From michel.vandenbergh at uhasselt.be Wed Jan 3 12:19:24 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 19:19:24 +0100 Subject: [Maxima] bfloat question In-Reply-To: <8b356f880701031008h4d2a6098qd3d25984c7be241d@mail.gmail.com> References: <459B9430.7000401@uhasselt.be> <459BD5E2.9010807@uhasselt.be> <459BEFBE.1060000@uhasselt.be> <8b356f880701031008h4d2a6098qd3d25984c7be241d@mail.gmail.com> Message-ID: <459BF3AC.9080002@uhasselt.be> Stavros Macrakis wrote: > On 1/3/07, Michel Van den Bergh wrote: >> Does anybody know if a bfloat number can overflow or underflow? > > No, it cannot. The exponent is a Lisp bignum, so is limited only by > memory size. The precision is also only limited by memory size (and > calculation time...). > > -s Good! The formula for the levin transform divides by a large integer factor in numerator and denominator to avoid floating point overflow. So I can just cancel that factor:-) For the record: I can now reliably compute the propagation of (b)floating point errors in the levin transform. So I can now do fpprec:50; blevin_u_sum(1/n-log(1+1/n),n,1); and it will compute the sum with a precision of 50 digits. Michel From macrakis at alum.mit.edu Wed Jan 3 12:19:39 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 3 Jan 2007 13:19:39 -0500 Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple In-Reply-To: References: Message-ID: <8b356f880701031019r55dab79bo8270617310e17ae5@mail.gmail.com> On 1/3/07, Nicolas Pettiaux wrote: > ...he answered that the language underlying > maxima was "the old LISP" while maple and mathematica were developped > using more modern technologies, hence, more powerful or at least > valuable for a student to learn If Mathematica and Maple gave you access to the underlying implementation, I can see how that would be an argument. But their implmentations are, as far as I know, completely opaque to the user, so I don't see how it matters. Perhaps your colleague is thinking about the use of packages *written in the Mathematica language itself*, where there is arguably some advantage. Maxima was originally written in MacLisp, and does not take advantage of Common Lisp in many ways, but at least you do have access to source code, obscure and messy as it may be. -s From michel.vandenbergh at uhasselt.be Wed Jan 3 12:25:07 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 19:25:07 +0100 Subject: [Maxima] Argument in favor of Maxima In-Reply-To: References: Message-ID: <459BF503.2010706@uhasselt.be> > ------------------------------ > > Message: 2 > Date: Wed, 3 Jan 2007 18:32:46 +0100 > From: "Nicolas Pettiaux" > Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple > To: "Maxima list" > Cc: Nicolas Pettiaux > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > When I told a colleague of mine, in general a supporter of free > software, who tries to develop the use of CAS in the university that > he should favor Maxima as it is a free software, instead of maple or > mathematica (that he uses), he answered that the language underlying > maxima was "the old LISP" while maple and mathematica were developped > using more modern technologies, hence, more powerful or at least > valuable for a student to learn. he also claimed that he was more > confident in a company supporting a software than a community, but > this is a completely other point. > > I could not argue as I do not know Lisp (I have just started with a > tutorial) but I would like to collect argument from the list members > and put them in the wiki eg at > http://maxima.sourceforge.net/wiki/index.php/Supporting%20arguments > > I would also like to have an idea about high schools or universities > using Maxima in effective underraduate or graduate education, and > again put this in the wiki eg at > http://maxima.sourceforge.net/wiki/index.php/Example%20of%20use > > Thanks, > > Nicolas > > Hi, Nicolas, There has just been a discussion about this on the mailing list. I am not an expert on this matter but here is a quick summary. The basic issue is that maxima uses dynamical scoping (like old lisp) whereas allmost all modern languages (including modern lisp) use lexical scoping. There is a nice article on wikipedia on the issue of lexical vs dynamical scoping. People would like to convert the maxima language to use lexical scoping but it is a substantial project. Michel From raymond.toy at ericsson.com Wed Jan 3 12:26:21 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 13:26:21 -0500 Subject: [Maxima] recent attempt In-Reply-To: (Robert Dodier's message of "Wed, 3 Jan 2007 10:46:03 -0700") References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/3/07, Raymond Toy wrote: Robert> But even better would be to put them in src/lapack and compile Robert> them at the same time as everything else, but just omit them from Robert> the final image. Then load(lapack) would just load the lapack binaries Robert> instead of compiling them. >> >> I don't know how to do that. Maxima's build system for src is a bit >> messy. The defsystem file compiles and loads everything. Then it's >> done again, using the same defsystem to load everything. Hence, >> everything gets loaded. We'd have to rearrange the defsystem and >> build scripts. Robert> OK, let's not mess with the src build system. Let's put it in Robert> share/lapack. Can we compile it there so that users don't need to? Yeah, that we can probably do by running maxima one additional time to build it. I'm not sure what this will achieve though, unless you also ship the result fasls to the user. I don't think we do that today, do we? >> We could set *compile-verbose* and friends not to display these >> progress messages. However, on my ppc system it takes a long time >> (15+ minutes?) to compile, so having some messages go by gives the >> user a nice warm fuzzy that something is actually happening. Robert> 15 minutes?! I think users are going to be unhappy about that. Robert> I know I will be. I may have been exaggerating, but testing now on an unloaded 1.5 GHz sparc at work, cmucl takes 413 sec to compile lapack. IIRC, your machine is much slower than this, so not matter what, I think you'll be unhappy with the compile times. Clisp, however, is much faster, of course, and only takes 47 sec. I don't know how long gcl would take. Sheldon's suggestion about configure --with-lapack is also doable. But the bottom line is somebody has to take the hit. And I'd prefer it not be a developer since his time is scarce. :-) Ray From michel.vandenbergh at uhasselt.be Wed Jan 3 12:59:05 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 03 Jan 2007 19:59:05 +0100 Subject: [Maxima] proposal to cut out romberg and quanc8 functions In-Reply-To: References: <459B9430.7000401@uhasselt.be> <459BD5E2.9010807@uhasselt.be> Message-ID: <459BFCF9.7040308@uhasselt.be> > > I'm not convinced. I don't want to tell people that they should use a > method known to be inferior. Bigfloat arithmetic isn't much of an > issue in numerical integration anyway; integration errors are > typically several orders of magnitude larger than the floating point epsilon. Well if romberg can do numerical integration with arbitrary precision then that is a feature of maxima that should not be discarded lightly I think. There are many packages to do numerical integration, but perhaps not as many that can work with arbitrary precision. Michel From sen1 at math.msu.edu Wed Jan 3 15:31:50 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 3 Jan 2007 16:31:50 -0500 (EST) Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: I hope I am not miunderstanding this thread. 1. Richard proposed some suggestions for making the lapack (and other numerical routines) fast. 2. It seems that some of his suggestions might be hard to implement, (e.g., the ddmatrix or something similar) given the current state of maxima source code. 3. Perhaps the ensuing discussion simply made alternate proposals which would not have a degrading effect on the speed of the final routines. If so, that is fine. If not, then I would rather see things done right (even if it takes longer to implement). Otherwise, I don't see the point for real utility. Serious users will simply go to octave, python, matlab, etc. or some other tool after possibly doing some testing in maxima. -sen On Wed, 3 Jan 2007, Raymond Toy wrote: >>>>>> "Robert" == Robert Dodier writes: > > Robert> On 1/3/07, Raymond Toy wrote: > > Robert> But even better would be to put them in src/lapack and compile > Robert> them at the same time as everything else, but just omit them from > Robert> the final image. Then load(lapack) would just load the lapack binaries > Robert> instead of compiling them. > >> > >> I don't know how to do that. Maxima's build system for src is a bit > >> messy. The defsystem file compiles and loads everything. Then it's > >> done again, using the same defsystem to load everything. Hence, > >> everything gets loaded. We'd have to rearrange the defsystem and > >> build scripts. > > Robert> OK, let's not mess with the src build system. Let's put it in > Robert> share/lapack. Can we compile it there so that users don't need to? > > Yeah, that we can probably do by running maxima one additional time to > build it. I'm not sure what this will achieve though, unless you also > ship the result fasls to the user. I don't think we do that today, do > we? > > >> We could set *compile-verbose* and friends not to display these > >> progress messages. However, on my ppc system it takes a long time > >> (15+ minutes?) to compile, so having some messages go by gives the > >> user a nice warm fuzzy that something is actually happening. > > Robert> 15 minutes?! I think users are going to be unhappy about that. > Robert> I know I will be. > > I may have been exaggerating, but testing now on an unloaded 1.5 GHz > sparc at work, cmucl takes 413 sec to compile lapack. IIRC, your > machine is much slower than this, so not matter what, I think you'll > be unhappy with the compile times. Clisp, however, is much faster, of > course, and only takes 47 sec. I don't know how long gcl would take. > > Sheldon's suggestion about configure --with-lapack is also doable. > > But the bottom line is somebody has to take the hit. And I'd prefer > it not be a developer since his time is scarce. :-) > > Ray > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From robert.dodier at gmail.com Wed Jan 3 16:06:41 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 3 Jan 2007 15:06:41 -0700 Subject: [Maxima] recent attempt In-Reply-To: References: <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: On 1/3/07, Raymond Toy wrote: > Robert> OK, let's not mess with the src build system. Let's put it in > Robert> share/lapack. Can we compile it there so that users don't need to? > > Yeah, that we can probably do by running maxima one additional time to > build it. I'm not sure what this will achieve though, unless you also > ship the result fasls to the user. I don't think we do that today, do > we? Yes, I am proposing that we ship the compiler output (fasls or whatever) to the users. We don't do it at present but it seems like it is just a matter of naming the files in Makefile.am or something. We might want to figure out a defsystem thing for lapack but that would not be part of the shipped stuff. > But the bottom line is somebody has to take the hit. And I'd prefer > it not be a developer since his time is scarce. :-) If you don't have time to work out the build/packaging stuff, I'll try to do it. Just let me know. Thanks again for working on lapack, I think it's a great contribution. All the best, Robert From fateman at cs.berkeley.edu Wed Jan 3 16:12:30 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 14:12:30 -0800 Subject: [Maxima] Why I think lapack matrices should not be converted to list-of-lists. In-Reply-To: Message-ID: <009a01c72f84$43580920$230110ac@RJFE510> Setting fpprec to some number affects the arithmetic, and some elementary functions. It does not appropriately set the error tolerances, iteration limits, etc. for functions. Thus a method that is supposed to compute (say) pi to double precision using a series, will ordinariliy not compute pi to 100 decimals by doing fpprec:100. One can construct programs that work this way, but they are generally quite different from the usual efficient methods. A double-precision cosine routine might use a fixed-degree polynomial approximation. A bigfloat cosine cannot. RJF > -----Original Message----- > From: Raymond Toy [mailto:raymond.toy at ericsson.com] > Sent: Wednesday, January 03, 2007 9:38 AM > To: sen1 at math.msu.edu > Cc: Richard Fateman; maxima at math.utexas.edu; 'Robert Dodier' > Subject: Re: [Maxima] Why I think lapack matrices should not be converted > to list-of-lists. > > >>>>> "sen1" == sen1 writes: > > sen1> This brings up another question. > sen1> Is it reasonable to set some kind of switch, maybe at compile > time, so > sen1> that some routines loaded in can be run in a given preset > precision? > > sen1> Perhaps there could be an option to create two "maxima" > packages. One > sen1> as it now is, and one where all computations in certain routines > can > sen1> be run with a preset precision. Initially, the user would be > responsible for > sen1> conversion problems. > > You can already do that with bfloats. Just set fpprec to the desired > precision. > > Unfortunately, not all functions have bfloat implementations. > > Ray From raymond.toy at ericsson.com Wed Jan 3 16:26:16 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 17:26:16 -0500 Subject: [Maxima] recent attempt In-Reply-To: (sen1@math.msu.edu's message of "Wed, 3 Jan 2007 16:31:50 -0500 (EST)") References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: >>>>> "sen1" == sen1 writes: sen1> 3. Perhaps the ensuing discussion simply made alternate proposals sen1> which would not have a degrading effect on the speed of the final sen1> routines. If so, that is fine. sen1> If not, then sen1> I would rather see things done right (even if it takes longer to sen1> implement). sen1> Otherwise, I don't see the point for real utility. Serious users sen1> will simply go to octave, python, matlab, etc. or some other tool sen1> after possibly doing some testing in maxima. Even without testing, I am very confident in telling you that you will be disappointed if you are expecting these LAPACK routines to be as fast as octave or matlab. You'll be even more disappointed if you're doing large matrices and octave/matlab are using an optimized ATLAS library. In addition, I didn't even compile the code with (speed 3) (safety 0) so there will some loss in speed anyway because there will be type checks in many places. And the converted routines aren't using specialized arrays, so you get hit there as well. I would guess maybe a factor of 2(?) loss in speed compared to Fortran, and even more if you're used to ATLAS or some other optimized BLAS package. If all you want to do is crunch numbers, maxima may not be what you want. Ray From raymond.toy at ericsson.com Wed Jan 3 16:28:56 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 03 Jan 2007 17:28:56 -0500 Subject: [Maxima] recent attempt In-Reply-To: (Robert Dodier's message of "Wed, 3 Jan 2007 15:06:41 -0700") References: <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/3/07, Raymond Toy wrote: >> But the bottom line is somebody has to take the hit. And I'd prefer >> it not be a developer since his time is scarce. :-) Robert> If you don't have time to work out the build/packaging stuff, Robert> I'll try to do it. Just let me know. Thanks again for working on Robert> lapack, I think it's a great contribution. Oh, I didn't mean me in particular, but all developers in general. Having to wait an extra 15 minutes or more to compile may not be so good if you're doing it all the time. I'll do what I can on the building/packaging stuff, once it's checked in. Ray From fateman at cs.berkeley.edu Wed Jan 3 16:36:14 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 14:36:14 -0800 Subject: [Maxima] romberg In-Reply-To: Message-ID: <009c01c72f87$9611d530$230110ac@RJFE510> > -----Original Message----- > From: Robert Dodier [mailto:robert.dodier at gmail.com] ..... > Bigfloat arithmetic isn't much of an > issue in numerical integration anyway; integration errors are > typically several orders of magnitude larger than the floating point > epsilon. I don't understand this. Bigfloat integration can get higher accuracy if you carry more precision and adapt the algorithm. If you want to get a value to 50 decimal places, what choice do you have? From fateman at cs.berkeley.edu Wed Jan 3 16:39:13 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 14:39:13 -0800 Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple In-Reply-To: <8b356f880701031019r55dab79bo8270617310e17ae5@mail.gmail.com> Message-ID: <009d01c72f87$ffcd8d20$230110ac@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Stavros Macrakis > Sent: Wednesday, January 03, 2007 10:20 AM > To: nicolas.pettiaux at ael.be > Cc: Maxima list > Subject: Re: [Maxima] Argument in favor of Maxima vs mathematica / maple > > On 1/3/07, Nicolas Pettiaux wrote: > > ...he answered that the language underlying > > maxima was "the old LISP" while maple and mathematica were developped > > using more modern technologies, hence, more powerful or at least > > valuable for a student to learn... In fact, studying the internals of Maple and Mathematica, if they were available, would show the student how to implement a somewhat cut-down Lisp system. Greenspun's 10th law applies. > > If Mathematica and Maple gave you access to the underlying > implementation, I can see how that would be an argument. But their > implmentations are, as far as I know, completely opaque to the user, > so I don't see how it matters. Perhaps your colleague is thinking > about the use of packages *written in the Mathematica language > itself*, where there is arguably some advantage. > > Maxima was originally written in MacLisp, and does not take advantage > of Common Lisp in many ways, but at least you do have access to source > code, obscure and messy as it may be. > > -s > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From sen1 at math.msu.edu Wed Jan 3 17:01:01 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 3 Jan 2007 18:01:01 -0500 (EST) Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: Actually, a factor of 2 or even 3 is not so bad, considering the convenience of not having to import, export data files in other formats. Of course there will always be some program which handles a particular routine better than others. I, too, want to thank you for porting lapack. Whatever the speed, it will be a real plus to have it available. -sen On Wed, 3 Jan 2007, Raymond Toy wrote: >>>>>> "sen1" == sen1 writes: > > sen1> 3. Perhaps the ensuing discussion simply made alternate proposals > sen1> which would not have a degrading effect on the speed of the final > sen1> routines. If so, that is fine. > > sen1> If not, then > sen1> I would rather see things done right (even if it takes longer to > sen1> implement). > > sen1> Otherwise, I don't see the point for real utility. Serious users > sen1> will simply go to octave, python, matlab, etc. or some other tool > sen1> after possibly doing some testing in maxima. > > Even without testing, I am very confident in telling you that you will > be disappointed if you are expecting these LAPACK routines to be as > fast as octave or matlab. You'll be even more disappointed if you're > doing large matrices and octave/matlab are using an optimized ATLAS > library. > > In addition, I didn't even compile the code with (speed 3) (safety 0) > so there will some loss in speed anyway because there will be type > checks in many places. And the converted routines aren't using > specialized arrays, so you get hit there as well. I would guess maybe > a factor of 2(?) loss in speed compared to Fortran, and even more if > you're used to ATLAS or some other optimized BLAS package. > > If all you want to do is crunch numbers, maxima may not be what you > want. > > Ray > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From dlakelan at street-artists.org Wed Jan 3 18:13:34 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 3 Jan 2007 16:13:34 -0800 Subject: [Maxima] romberg In-Reply-To: <009c01c72f87$9611d530$230110ac@RJFE510> References: <009c01c72f87$9611d530$230110ac@RJFE510> Message-ID: <20070104001334.GP25287@street-artists.org> On Wed, Jan 03, 2007 at 02:36:14PM -0800, Richard Fateman wrote: > > > > -----Original Message----- > > From: Robert Dodier [mailto:robert.dodier at gmail.com] > ..... > > Bigfloat arithmetic isn't much of an > > issue in numerical integration anyway; integration errors are > > typically several orders of magnitude larger than the floating point > > epsilon. > > I don't understand this. Bigfloat integration can get higher accuracy if > you carry more precision and adapt the algorithm. If you want to get a > value to 50 decimal places, what choice do you have? I think he meant that typically the error in an estimate of an integral computed using double precision is dominated by the truncation error inherent in the method rather than by the roundoff. So for a method designed for doubles, using bigfloat doesn't add anything much. I think most people using numerical integration are generally happy to have a double precision float's worth of accurate digits. Perhaps improving the documentation on quadpack, standardizing the interface with respect to multiple integrals, or creating a special multiple integral routine would be a better time investment. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From sen1 at math.msu.edu Wed Jan 3 20:52:09 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 3 Jan 2007 21:52:09 -0500 (EST) Subject: [Maxima] question about sublists Message-ID: Hi, Given a list, say xx: [2,1,3,3,5], how would I use 'sublist' to extract the indices where '3' occurs? I know I can write a routine checking whether each element xx[i] = 3 or not and print out the indices 'i'. What I want to know is how to implement a predicate in 'sublist' which will work. TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From fateman at cs.berkeley.edu Thu Jan 4 00:04:55 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 22:04:55 -0800 Subject: [Maxima] recent attempt In-Reply-To: Message-ID: <00ae01c72fc6$42bc8670$230110ac@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of sen1 at math.msu.edu > Sent: Wednesday, January 03, 2007 1:32 PM > To: Raymond Toy > Cc: maxima at math.utexas.edu; Robert Dodier > Subject: Re: [Maxima] recent attempt > > I hope I am not miunderstanding this thread. > > 1. Richard proposed some suggestions for making the lapack (and other > numerical routines) fast. > > 2. It seems that some of his suggestions might be hard to implement, > (e.g., the ddmatrix or something similar) > given the current state of maxima source code. > > 3. Perhaps the ensuing discussion simply made alternate proposals > which would not have a degrading effect on the speed of the final > routines. If so, that is fine. > > If not, then > I would rather see things done right (even if it takes longer to > implement). > > Otherwise, I don't see the point for real utility. Serious users > will simply go to octave, python, matlab, etc. or some other tool > after possibly doing some testing in maxima. > > -sen > There has been some suggestion (repeated recently) that by using the common lisp object system at least some of the confusing multiplicity of options in Maxima can be handled more systematically, and that new features could be added more easily. I believe that this concept can be over-sold (it almost always is when writing computer algebra "systems" in C++), but that it has some validity. A package for doing generic arithmetic that could be modified for use in Maxima is on my web site, in case anyone cares to look at it. It is in draft form at http://www.cs.berkeley.edu/~fateman/generic Comments are welcome. RJF From fateman at cs.berkeley.edu Thu Jan 4 00:26:39 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 3 Jan 2007 22:26:39 -0800 Subject: [Maxima] romberg In-Reply-To: <20070104001334.GP25287@street-artists.org> Message-ID: <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Daniel Lakeland > Sent: Wednesday, January 03, 2007 4:14 PM > To: maxima at math.utexas.edu > Subject: Re: [Maxima] romberg > > On Wed, Jan 03, 2007 at 02:36:14PM -0800, Richard Fateman wrote: > > > > > > > -----Original Message----- > > > From: Robert Dodier [mailto:robert.dodier at gmail.com] > > ..... > > > Bigfloat arithmetic isn't much of an > > > issue in numerical integration anyway; integration errors are > > > typically several orders of magnitude larger than the floating point > > > epsilon. > > > > I don't understand this. Bigfloat integration can get higher accuracy > if > > you carry more precision and adapt the algorithm. If you want to get a > > value to 50 decimal places, what choice do you have? > > I think he meant that typically the error in an estimate of an > integral computed using double precision is dominated by the > truncation error inherent in the method rather than by the > roundoff. So for a method designed for doubles, using bigfloat doesn't > add anything much. Any method designed specifically and only for doubles would be inappropriate for bigfloats. There are methods that can be used for variable precision, adjusting their convergence criteria based on the requested accuracy and perhaps the precision of basic arithmetic. These generally produce increasing accuracy for high precision (and more time, subdivisions, etc.). They also sometimes find answers where lower precision does not converge at all. > > I think most people using numerical integration are generally happy to > have a double precision float's worth of accurate digits. Maybe this is true for people taking programs out of netlib or using matlab. In my experience this is not true, and that people who are told that they can get more accuracy for more computation time, often try to get additional digits. Especially when the integration method offers only an "estimate" of accuracy, and when people want to integrate nasty functions and don't have confidence in the numerical methods. Or the lower precision result is a failure. > > Perhaps improving the documentation on quadpack, standardizing the > interface with respect to multiple integrals, or creating a special > multiple integral routine would be a better time investment. I think that throwing away the bigfloat version of Romberg without replacing it with a bigfloat version of some better numerical integration program would be a bad choice. Both Maple and Mathematica have bigfloat numerical integration. Removing a feature from Maxima on the grounds that [someone thinks that] most people are generally happy without it, would remove quite a few features! :) RJF From neuss at mathematik.uni-karlsruhe.de Thu Jan 4 03:20:49 2007 From: neuss at mathematik.uni-karlsruhe.de (Nicolas Neuss) Date: 04 Jan 2007 10:20:49 +0100 Subject: [Maxima] recent attempt In-Reply-To: <00ae01c72fc6$42bc8670$230110ac@RJFE510> References: <00ae01c72fc6$42bc8670$230110ac@RJFE510> Message-ID: <87irfnp2q6.fsf@ma-patru.mathematik.uni-karlsruhe.de> "Richard Fateman" writes: > There has been some suggestion (repeated recently) that by using the common > lisp object system at least some of the confusing multiplicity of options in > Maxima can be handled more systematically, and that new features could be > added more easily. I believe that this concept can be over-sold (it almost > always is when writing computer algebra "systems" in C++), but that it has > some validity. A package for doing generic arithmetic that could be > modified for use in Maxima is on my web site, in case anyone cares to look > at it. It is in draft form at http://www.cs.berkeley.edu/~fateman/generic > > Comments are welcome. I think this code (or at least part of it) would be interesting as a stand-alone library (working across several CL implementations). Already the GMP interface would have been useful for me last year. A possible strategy could be to start a project at common-lisp.net providing generic arithmetic for Allegro. I'm quite sure that this library would be ported to other CLs quite fast. An LLGPL license (or similar) would be important. Nicolas From van.nek at arcor.de Thu Jan 4 06:16:05 2007 From: van.nek at arcor.de (van Nek) Date: Thu, 04 Jan 2007 13:16:05 +0100 Subject: [Maxima] functions from add-on packages, was: Newbie question: testing for lvalue In-Reply-To: References: <4598404E.3010204@uhasselt.be> Message-ID: <459CFE15.7055.4A3FEF@van.nek.arcor.de> Am 31 Dec 2006 um 17:50 hat Robert Dodier geschrieben: Hi Robert, happy new year! if there is no example included in the documentation of a function, which shows that a load("add-on") is necessary, the user in a lot of cases gets no information, that this function is from an add-on package. This is true for stringproc and a lot of others. Should we revise the add-on package documentations and add a "please load(xyz) first" to every function definition or is there a possibility, that describe itself gives a short information, like (%i1) ? stringp 0: lstringp (Definitions for strings, add-on package stringproc) 1: stringp (Definitions for strings, add-on package stringproc) Enter space-separated numbers, `all' or `none': What would you recommend? All the best, Volker > On 12/31/06, Michel Van den Bergh wrote: > > > Hmm, a string is not an lvalue (something that can appear on the > > left hand side of an assignment). "describe" claims that there is > > a function "stringp" but on my version of maxima stringp appears > > not to do anything. Is this a bug? > > It turns out stringp is defined in an add-on package (namely stringproc). > Probably it should move into the main source code. > Be that as it may, the function ?mstringp has the desired effect. > So we can update the test function to > > P(e) := (symbolp(e) or subvarp(e)) and not ?mstringp(e); > > Sorry, I could have included that to begin with. Hope this helps. > > Robert From miguel39123 at hotmail.com Thu Jan 4 06:34:40 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 12:34:40 +0000 (UTC) Subject: [Maxima] I can't resist this one Message-ID: From Sen Hi, Given a list, say xx: [2,1,3,3,5], how would I use 'sublist' to extract the indices where '3' occurs? I know I can write a routine checking whether each element xx[i] = 3 or not and print out the indices 'i'. What I want to know is how to implement a predicate in 'sublist' which will work. I can't resist to this one, this is really funny, the best of the day. Happy day. Also: Read the documentation of sublist, if gives the values of element of the list, so how can you extract any number that is not on the list?. Consider l:=[fun,fun,morefun] what values of this list are equal to the position of fun? Also: there is a list function position :lisp (position 3 '[1 2 3 4 5 6 3 3 3]) Again, sorry but i can resist to this one,too funny for me. From miguel39123 at hotmail.com Thu Jan 4 06:53:05 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 12:53:05 +0000 (UTC) Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple Message-ID: My opinion: 1) In the actual situation, it would be fair to say that Mathematica or Maple code will be much better than Maxima. But: 1.- Maxima is free (no money to pay). 2.- Maxima code is open. 3.- Maxima has a wonderful team of people in the maxima list. 4.- The power of communication. What is (4)? Imagine that a large number of Universities around the world choose to develop maxima as a free math computer programm, and that student all around the world contribute to make maxima better, then maxima would be the best tool for numerical and symbolic computation. Is (4) possible?, is foresible. No one knows, you have the opportunity to construct your future, is up to you to believe. My two cents. -M From pip at iszf.irk.ru Thu Jan 4 07:26:18 2007 From: pip at iszf.irk.ru (Valery Pipin) Date: Thu, 4 Jan 2007 21:26:18 +0800 Subject: [Maxima] contour_plot function In-Reply-To: References: Message-ID: <200701042126.18810.pip@iszf.irk.ru> Dear Robert, Thank you very much for this function. Is it in cvs already? Is it possible to plot data with it? I also think that possibility to make plots for z(i,j),x(i,j),y(i,j), where x,y are coordinates, would make it more powerfull. Options for style of contour lines may be valuble as well. all the best Valery On Tuesday 02 January 2007 01:41, Robert Dodier wrote: > Hello, to the best of my knowledge, there is not a function > to make contour plots in Maxima. I've attached an attempt. > Here is the comment header. > > ; contour_plot -- set some parameters for Gnuplot and punt to plot3d > ; > ; We go to some trouble here to avoid clobbering the Gnuplot preamble > ; specified by the user, either as a global option (via set_plot_option) > ; or specified in arguments to contour_plot. Just append or prepend > ; the parameters for contour plotting to the user-specified preamble. > ; Assume that arguments take precedence over global options. > ; > ; contour_plot knows how to set parameters only for Gnuplot. > ; If the plot_format is not a Gnuplot format, complain. > ; > ; Examples: > ; > ; contour_plot (x^2 + y^2, [x, -4, 4], [y, -4, 4]); > ; contour_plot (sin(y) * cos(x)^2, [x, -4, 4], [y, -4, 4]); > ; F(x, y) := x^3 + y^2; > ; contour_plot (F, [u, -4, 4], [v, -4, 4]); > ; contour_plot (F, [u, -4, 4], [v, -4, 4], [gnuplot_preamble, "set > size ratio -1"]); > ; set_plot_option ([gnuplot_preamble, "set cntrparam levels 12"]); > ; contour_plot (F, [u, -4, 4], [v, -4, 4]); > ; set_plot_option ([plot_format, openmath]); > ; contour_plot (F, [u, -4, 4], [v, -4, 4]); => error: must be gnuplot > format ; contour_plot (F, [u, -4, 4], [v, -4, 4], [plot_format, > gnuplot]); > > > There is already a function named implicit_plot but it is somewhat > different, I think. > > Comments? > > Hope this helps, > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From macrakis at alum.mit.edu Thu Jan 4 07:42:38 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 4 Jan 2007 08:42:38 -0500 Subject: [Maxima] I can't resist this one In-Reply-To: References: Message-ID: <8b356f880701040542r66a7b859gfefc0f84ec53edbd@mail.gmail.com> On 1/4/07, miguel lopez wrote: > Given a list, say xx: [2,1,3,3,5], how would I use 'sublist' to > extract the indices where '3' occurs? Why would you think that sublist is the right function to use for this? -s From miguel39123 at hotmail.com Thu Jan 4 07:52:39 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 13:52:39 +0000 (UTC) Subject: [Maxima] From Elisa to Racter in a rocket. Message-ID: Read the reply of Stavros to my post I can't resist. Also: Read the opinion of Stavros about a book whose author say that he did'nt write the book. >From all of this, from Elisa to Rackter in a rocket. From michel.vandenbergh at uhasselt.be Thu Jan 4 08:34:27 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 04 Jan 2007 15:34:27 +0100 Subject: [Maxima] functions from add-on packages, was: Newbie question: testing for lvalue References: eb9c4b9a0612311650r5e4b7d33o9d600c4a0bd8edb3@mail.gmail.com Message-ID: <459D1073.3080406@uhasselt.be> > > (%i1) ? stringp > 0: lstringp (Definitions for strings, add-on package stringproc) > 1: stringp (Definitions for strings, add-on package stringproc) > Enter space-separated numbers, `all' or `none': > > That would be very nice! Michel From jeremy.dudley at wrcplc.co.uk Thu Jan 4 08:07:35 2007 From: jeremy.dudley at wrcplc.co.uk (Dudley, Jeremy) Date: Thu, 4 Jan 2007 14:07:35 -0000 Subject: [Maxima] Quality of Maxima/Mathematica/maple code Message-ID: <6EBA03DE3AE54044A7D5F905636ADF88012B0C8B@lynx.wrcgroup.com> >From: miguel lopez >Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple > > My opinion: > > 1) In the actual situation, it would be fair to say that Mathematica or Maple > code will be much better than Maxima. I haven't seen the Mathematica or Maple code, and neither have I browsed the Maxima code. But having seen the internal quality of code from some commercial organisations I wouldn't be so sure that Maple/Mathematica were better than Maxima. ------------------------------------------------------------------------------------------- Visit our websites www.wrcplc.co.uk and www.wrcnsf.com, as well as www.waterportfolio.com for collaborative research projects. ------------------------------------------------------------------------------------------- The Information in this e-mail is confidential and is intended solely for the addressee. Access to this e-mail by any other party is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on the information contained in this e-mail is prohibited and maybe unlawful. When addressed to WRc Clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing WRc Client Agreement. ------------------------------------------------------------------------------------------- From jeremy.dudley at wrcplc.co.uk Thu Jan 4 08:09:34 2007 From: jeremy.dudley at wrcplc.co.uk (Dudley, Jeremy) Date: Thu, 4 Jan 2007 14:09:34 -0000 Subject: [Maxima] Quality of Maxima/Mathematica/maple code Message-ID: <6EBA03DE3AE54044A7D5F905636ADF88012B0C8C@lynx.wrcgroup.com> >From: miguel lopez >Subject: [Maxima] Argument in favor of Maxima vs mathematica / maple > > My opinion: > > 1) In the actual situation, it would be fair to say that Mathematica or Maple > code will be much better than Maxima. I haven't seen the Mathematica or Maple code, and neither have I browsed the Maxima code. But having seen the internal quality of code from some commercial organisations I wouldn't be so sure that Maple/Mathematica were better than Maxima. ------------------------------------------------------------------------------------------- Visit our websites www.wrcplc.co.uk and www.wrcnsf.com, as well as www.waterportfolio.com for collaborative research projects. ------------------------------------------------------------------------------------------- The Information in this e-mail is confidential and is intended solely for the addressee. Access to this e-mail by any other party is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on the information contained in this e-mail is prohibited and maybe unlawful. When addressed to WRc Clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing WRc Client Agreement. ------------------------------------------------------------------------------------------- From raymond.toy at ericsson.com Thu Jan 4 08:56:26 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Thu, 04 Jan 2007 09:56:26 -0500 Subject: [Maxima] recent attempt In-Reply-To: References: <200612231127.43680.pip@iszf.irk.ru> <459407EB.60904@gmail.com> <200612291122.55633.pip@iszf.irk.ru> <4599A964.90309@gmail.com> Message-ID: <459D159A.2000801@ericsson.com> Raymond Toy wrote: >>>>>> "Robert" == Robert Dodier writes: >>>>>> > > Robert> On 1/3/07, Raymond Toy wrote: > > Robert> But even better would be to put them in src/lapack and compile > Robert> them at the same time as everything else, but just omit them from > Robert> the final image. Then load(lapack) would just load the lapack binaries > Robert> instead of compiling them. > >> > >> I don't know how to do that. Maxima's build system for src is a bit > >> messy. The defsystem file compiles and loads everything. Then it's > >> done again, using the same defsystem to load everything. Hence, > >> everything gets loaded. We'd have to rearrange the defsystem and > >> build scripts. > > Robert> OK, let's not mess with the src build system. Let's put it in > Robert> share/lapack. Can we compile it there so that users don't need to? > > Yeah, that we can probably do by running maxima one additional time to > build it. I'm not sure what this will achieve though, unless you also > ship the result fasls to the user. I don't think we do that today, do > we? > > >> We could set *compile-verbose* and friends not to display these > >> progress messages. However, on my ppc system it takes a long time > >> (15+ minutes?) to compile, so having some messages go by gives the > >> user a nice warm fuzzy that something is actually happening. > > Robert> 15 minutes?! I think users are going to be unhappy about that. > Robert> I know I will be. > > I may have been exaggerating, but testing now on an unloaded 1.5 GHz > sparc at work, cmucl takes 413 sec to compile lapack. IIRC, your > machine is much slower than this, so not matter what, I think you'll > be unhappy with the compile times. Clisp, however, is much faster, of > course, and only takes 47 sec. I don't know how long gcl would take. > > FWIW, on the same machine, gcl 2.6.8 takes 41 sec. Ray From robert.dodier at gmail.com Thu Jan 4 09:23:42 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 4 Jan 2007 08:23:42 -0700 Subject: [Maxima] contour_plot function In-Reply-To: <200701042126.18810.pip@iszf.irk.ru> References: <200701042126.18810.pip@iszf.irk.ru> Message-ID: Hello Valery, thanks for your reply. > Thank you very much for this function. Is it in cvs already? I just committed it. Thanks for the reminder. > Is it possible to plot data with it? I also think that possibility to make > plots for z(i,j),x(i,j),y(i,j), where x,y are coordinates, would make it more > powerfull. I'm sorry, I don't understand what you mean here. Can you send me a link to an example of such a plot? > Options for style of contour lines may be valuble as well. contour_plot just sets some parameters and then calls plot3d. So all of the options which are recognized by plot3d are also recognized by contour_plot. All the best Robert Dodier From michel.vandenbergh at uhasselt.be Thu Jan 4 09:35:31 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 04 Jan 2007 16:35:31 +0100 Subject: [Maxima] Levin 0.6 In-Reply-To: References: <459B9430.7000401@uhasselt.be> Message-ID: <459D1EC3.6090801@uhasselt.be> I have made a new version of levin (www.bertold.org/levin) Changes: Faster for series with terms that take only rational values. Since levin can now compute propagation of rounding errors it is possible to sum series with terms that take non-rational values with predetermined precision. Example fpprec:50; bflevin_u_sum(1/n-log(1+1/n),n,1); 5.7721566490153286060651209008240243104215933593992b-1 bfloat(%-%gamma); 0.0b0 Note 0: To see the algorithm in action put levin_options["debug"]:true; Note 1: Summing series with terms that take non-rational values is generally slower than summing terms that take rational values. Note 2: The code is not optimized yet. For now I was mainly aiming for correctness. Note 3: Levin seems to converge rather slowly for series with wildly oscilating terms. It is of course still better than summing the series naively. Michel From robert.dodier at gmail.com Thu Jan 4 09:42:42 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 4 Jan 2007 08:42:42 -0700 Subject: [Maxima] romberg In-Reply-To: <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> References: <20070104001334.GP25287@street-artists.org> <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> Message-ID: On 1/3/07, Richard Fateman wrote: > Any method designed specifically and only for doubles would be inappropriate > for bigfloats. There are methods that can be used for variable precision, > adjusting their convergence criteria based on the requested accuracy and > perhaps the precision of basic arithmetic. These generally produce > increasing accuracy for high precision (and more time, subdivisions, etc.). > They also sometimes find answers where lower precision does not converge at > all. Well, there aren't any constant values appearing in the Romberg method so, if you're willing to wait and the integrand in question isn't too badly behaved (a vague attribute, I know), you should be able to get any precision you want. From looking at the bromberg code and trying an example, I believe that is indeed the case. So that is a capability which is not available otherwise. On reconsideration I guess we should keep bromberg. Robert From pip at iszf.irk.ru Thu Jan 4 09:53:32 2007 From: pip at iszf.irk.ru (Valery Pipin) Date: Thu, 4 Jan 2007 23:53:32 +0800 Subject: [Maxima] contour_plot function In-Reply-To: References: <200701042126.18810.pip@iszf.irk.ru> Message-ID: <200701042353.32905.pip@iszf.irk.ru> Hello Robert, On Thursday 04 January 2007 23:23, you wrote: > I just committed it. Thanks for the reminder. > > > Is it possible to plot data with it? I also think that possibility to > > make plots for z(i,j),x(i,j),y(i,j), where x,y are coordinates, would > > make it more powerfull. > > I'm sorry, I don't understand what you mean here. > Can you send me a link to an example of such a plot? Well, I never did it under gnuplot. z - is array of data to plot with plplot interface to python it could be like plcont(z[:,:],x[:,:],y[:,:]). here x, y are coordinates of (i,j) node The beauty that it make possible to draw contours in curvlinear regions best wishes Valery From dlakelan at street-artists.org Thu Jan 4 10:01:51 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Thu, 4 Jan 2007 08:01:51 -0800 Subject: [Maxima] romberg In-Reply-To: <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> References: <20070104001334.GP25287@street-artists.org> <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> Message-ID: <20070104160151.GS25287@street-artists.org> > I think that throwing away the bigfloat version of Romberg without replacing > it with a bigfloat version of some better numerical integration program > would be a bad choice. Both Maple and Mathematica have bigfloat numerical > integration. I tend to think that the romberg code should stay as an alternative to the quadpack, but that the third option (can't remember the name) is superfluous since it performed worst among the three that Robert tested. The Romberg code should be documented as having been superseded for most purposes by quadpack. > Removing a feature from Maxima on the grounds that [someone thinks that] > most people are generally happy without it, would remove quite a few > features! :) True enough. I think one of Robert's concerns is that it's not completely robust, having failed some of his tests. If a bigfloat version of quadpack were available it would probably be wise to deprecate romberg as suggested. For now, perhaps it's best to deprecate Romberg in the documentation but leave it available in the code. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From sen1 at math.msu.edu Thu Jan 4 09:55:44 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 4 Jan 2007 10:55:44 -0500 (EST) Subject: [Maxima] command line maxima terminals Message-ID: I am using linux (Fedora Core 4) with maxima-5.11.0 When using the command line maxima with gcl or clisp, the terminal performs as expected with C-P, C-N working fine for previous and next commands. When I use cmucl and sbcl, the terminal is set differently and the C-P, C-N don't work. Is this by design? Is there some command line option to feed to maxima so that the control combinations will work (e.g. as in emacs)? TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From robert.dodier at gmail.com Thu Jan 4 10:09:23 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 4 Jan 2007 09:09:23 -0700 Subject: [Maxima] question about sublists In-Reply-To: References: Message-ID: On 1/3/07, sen1 at math.msu.edu wrote: > Given a list, say xx: [2,1,3,3,5], how would I use 'sublist' to > extract the indices where '3' occurs? I think this is a general problem and Maxima should have a built-in function for it. How about if we call it "find". Here's an attempt which worked OK for the one example I tried: find (L, p) := block ([I : makelist (i, i, 1, length (L))], sublist (I, lambda ([i], is(p(L[i]))))); xx: [2,1,3,3,5]; P(x) := x=3; find (xx, P); => [3, 4] find (xx, lambda ([x], x=3)); => [3, 4] Of course we would want to rewrite it in Lisp. All the best, Robert From raymond.toy at ericsson.com Thu Jan 4 10:27:58 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Thu, 04 Jan 2007 11:27:58 -0500 Subject: [Maxima] command line maxima terminals In-Reply-To: (sen1@math.msu.edu's message of "Thu, 4 Jan 2007 10:55:44 -0500 (EST)") References: Message-ID: >>>>> "sen1" == sen1 writes: sen1> When using the command line maxima with gcl or clisp, the terminal performs as sen1> expected with C-P, C-N working fine for previous and next commands. Most likely because gcl and clisp have readline compiled in. sen1> When I use cmucl and sbcl, the terminal is set differently and the sen1> C-P, C-N don't work. Most likely because cmucl and sbcl do not have readline. There is some package somewhere that provides some readline-style capability for cmucl and sbcl. I can't remember the name though. sen1> Is this by design? Is there some command line option to feed to sen1> maxima so that the control combinations will work (e.g. as in emacs)? I just use a shell window in xemacs. Of course, c-p and c-n do different things there. Ray From jromerobernal at gmail.com Thu Jan 4 10:29:42 2007 From: jromerobernal at gmail.com (Juan Pablo Romero Bernal) Date: Thu, 4 Jan 2007 11:29:42 -0500 Subject: [Maxima] command line maxima terminals In-Reply-To: References: Message-ID: Hi, > I am using linux (Fedora Core 4) with maxima-5.11.0 > > When using the command line maxima with gcl or clisp, the terminal performs as > expected with C-P, C-N working fine for previous and next commands. > > When I use cmucl and sbcl, the terminal is set differently and the > C-P, C-N don't work. I think, that this behavior is related with the readline support for the Lisp implementation that you are using to run Maxima. In the SBCL case, the readline support is not present. A good solution (IMHO) is use rlwrap (readline wrapper), and run the rmaxima command instead maxima. Bye, -- Juan Pablo Romero Bernal Grupo Linux Universidad Distrital Blog: http://jpromerobx.blogspot.com/ Canal IRC (IRC Channel) #glud (irc.freenode.org) Visita el sitio web de Software Libre en Colombia: http://www.el-directorio.org From sen1 at math.msu.edu Thu Jan 4 10:23:34 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 4 Jan 2007 11:23:34 -0500 (EST) Subject: [Maxima] question about sublists In-Reply-To: References: Message-ID: How about a name more mnemonic about indices? Like find_index, list_index, or locate_index Of course, the actual function could actually find many indices for various predicates. A user could always make an alias for him or herself if the name is too long. -sen On Thu, 4 Jan 2007, Robert Dodier wrote: > On 1/3/07, sen1 at math.msu.edu wrote: > >> Given a list, say xx: [2,1,3,3,5], how would I use 'sublist' to >> extract the indices where '3' occurs? > > I think this is a general problem and Maxima should have a built-in > function for it. How about if we call it "find". > > Here's an attempt which worked OK for the one example I tried: > find (L, p) := block ([I : makelist (i, i, 1, length (L))], sublist > (I, lambda ([i], is(p(L[i]))))); > > xx: [2,1,3,3,5]; > P(x) := x=3; > find (xx, P); > => [3, 4] > find (xx, lambda ([x], x=3)); > => [3, 4] > > Of course we would want to rewrite it in Lisp. > > All the best, > Robert > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From raymond.toy at ericsson.com Thu Jan 4 10:37:00 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Thu, 04 Jan 2007 11:37:00 -0500 Subject: [Maxima] romberg In-Reply-To: <20070104160151.GS25287@street-artists.org> (Daniel Lakeland's message of "Thu, 4 Jan 2007 08:01:51 -0800") References: <20070104001334.GP25287@street-artists.org> <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> <20070104160151.GS25287@street-artists.org> Message-ID: >>>>> "Daniel" == Daniel Lakeland writes: Daniel> completely robust, having failed some of his tests. If a bigfloat Daniel> version of quadpack were available it would probably be wise to I have given this idea a little thought. I think that quad_qags is basically independent of the float type except for the routine qk21, which is the Gauss-Kronrod integrator. For each bfloat precision, you'd have to recompute the coefficients of the Gauss-Kronrod integrator. I don't know how to do that, but if requires solving for the roots of a polynomial, you have very good starting points since you have the values for the double-float version. An interesting project, I think. Ray From miguel39123 at hotmail.com Thu Jan 4 10:40:29 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 16:40:29 +0000 (UTC) Subject: [Maxima] question about sublists Message-ID: >From Robert Dodier: >I think this is a general problem and Maxima should have a built-in >function for it. How about if we call it "find". I think that find should gives the elements that verify the predicate P and not the positions of this elements (like in lisp), so i suggest that this be called position (find-position, etc.). Find should be like select in Mathematica. Also: Gmane maxima doesn't work today (last message that appears is from yesterday). From macrakis at alum.mit.edu Thu Jan 4 10:44:37 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 4 Jan 2007 11:44:37 -0500 Subject: [Maxima] romberg In-Reply-To: References: <20070104001334.GP25287@street-artists.org> <00bc01c72fc9$4b7a80c0$230110ac@RJFE510> <20070104160151.GS25287@street-artists.org> Message-ID: <8b356f880701040844sd9c9cfdo487b29ec34c7eff2@mail.gmail.com> As long as the Romberg function faithfully implements the Romberg algorithm, I see no reason to remove or deprecate it. The Romberg algorithm may or may not be appropriate or useful for a particular application, but that's up to the user, as with other functions which are named for the *algorithm* as opposed to the abstract *functionality*. If it were called numeric_integrate, that would be a different matter. In fact, it would probably be a good idea to build a numeric_integrate, which intelligently chooses among existing algorithms, perhaps based on a (symbolic) analysis of the form of the integrand. That function would be our "best effort" for general users, as opposed to sophisticated users who want tight control over the method being used. -s From pip at iszf.irk.ru Thu Jan 4 10:46:02 2007 From: pip at iszf.irk.ru (Valery Pipin) Date: Fri, 5 Jan 2007 00:46:02 +0800 Subject: [Maxima] command line maxima terminals In-Reply-To: References: Message-ID: <200701050046.02713.pip@iszf.irk.ru> On Friday 05 January 2007 00:27, Raymond Toy wrote: > >>>>> "sen1" == sen1 writes: > > sen1> When using the command line maxima with gcl or clisp, the > terminal performs as sen1> expected with C-P, C-N working fine for previous > and next commands. > > Most likely because gcl and clisp have readline compiled in. > > sen1> When I use cmucl and sbcl, the terminal is set differently and > the sen1> C-P, C-N don't work. > > Most likely because cmucl and sbcl do not have readline. There is > some package somewhere that provides some readline-style capability > for cmucl and sbcl. I can't remember the name though. rlwrap Please install rlwrap and execute "rmaxima" From miguel39123 at hotmail.com Thu Jan 4 10:54:14 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 16:54:14 +0000 (UTC) Subject: [Maxima] Should be functions names in Maxima similar to Lisp names? Message-ID: Perhaps it would be a good idea that new functions that exists in lisp receive names as in lisp (at least this is an orientation). This way Lisp user would be more familiar with maxima language, and also is easier to remember a function name that is known (this is not asking for a rule, only a suggestion). For example now that is going to be implemented position and position-if in maxima, perhaps with another name but the same functioning like in lisp. From sen1 at math.msu.edu Thu Jan 4 10:58:40 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 4 Jan 2007 11:58:40 -0500 (EST) Subject: [Maxima] question about sublists In-Reply-To: References: Message-ID: Actually, it would be good to have functions to do both tasks. For instance, to do various operations on permutations, it is very useful to find the indices where certain list values occur. As a related comment, in using the functions lmin, lmax, I find it useful to get not only the minimum value, but the places in the list where it occurs. Is there already a function which does this? I looked at Barton's maxmin.lisp but could not find one. t was a simpletask to write a routine which does this, but I think such routines should be built in. -sen On Thu, 4 Jan 2007, miguel lopez wrote: > >> From Robert Dodier: > >> I think this is a general problem and Maxima should have a built-in >> function for it. How about if we call it "find". > > > I think that find should gives the elements that verify the predicate P and > not the positions of this elements (like in lisp), so i suggest that this be > called position (find-position, etc.). > > Find should be like select in Mathematica. > > > Also: Gmane maxima doesn't work today (last message that appears is from > yesterday). > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From macrakis at alum.mit.edu Thu Jan 4 11:29:37 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 4 Jan 2007 12:29:37 -0500 Subject: [Maxima] question about sublists In-Reply-To: References: Message-ID: <8b356f880701040929g44b90972ua9672d718fab0187@mail.gmail.com> I agree that functions like this would be a good idea. I have been toying with the idea of looking at APL-like programming languages (notably K) for ideas in this area. The functional programming people, of course, have also been doing this for a long time. -s On 1/4/07, sen1 at math.msu.edu wrote: > As a related comment, in using the functions lmin, lmax, I find it > useful to get not only the minimum value, but the places in the list > where it occurs.... From william.wood3 at comcast.net Thu Jan 4 11:46:53 2007 From: william.wood3 at comcast.net (Bill Wood) Date: Thu, 04 Jan 2007 11:46:53 -0600 Subject: [Maxima] question about sublists In-Reply-To: References: Message-ID: <1167932813.23968.21.camel@localhost> On Thu, 2007-01-04 at 11:23 -0500, sen1 at math.msu.edu wrote: > How about a name more mnemonic about indices? > > Like > find_index, list_index, or locate_index > > Of course, the actual function could actually find many indices for various > predicates. >From the examples it seems clear that the desired functionality is to return the list of indices of all occurrences of items satisfying the predicate. The Common Lisp built-in "position-if" returns the index of only the left-most (right-most if :from-end is non-nil) occurrence, so some code has to be written. How about "all-positions-if" or "all-positions"? "positions-if" or "positions" might also be used, but they could too easily be confused with (or fat-fingered into) "position-if" or "position", and you might want those functions as well. Here's a bare-bones CL function definition: (defun all-positions-if (items pred) (do ((i 0 (1+ i)) (xs items (cdr xs)) (acc '() (if (funcall pred (car xs)) (cons i acc) acc))) ((endp xs) (nreverse acc)))) Test runs: * (all-positions-if '(2 1 3 3 5) #'(lambda (x) (= x 3))) (2 3) * (all-positions-if '(2 1 3 3 5) #'(lambda (x) (= x 33))) NIL (Don't forget, CL uses 0-based indexing; I guess maxima uses 1-based?) If you like a more functional style, here's an alternative definition: (defun all-positions-if (items pred) (labels ((h (pr x) (cons (1+ (car pr)) (if (funcall pred x) (cons (car pr) (cdr pr)) (cdr pr))))) (nreverse (cdr (reduce #'h items :initial-value (cons 0 '())))))) -- Bill Wood From fateman at cs.berkeley.edu Thu Jan 4 12:14:54 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Thu, 4 Jan 2007 10:14:54 -0800 Subject: [Maxima] romberg In-Reply-To: <20070104160151.GS25287@street-artists.org> Message-ID: <00dc01c7302c$4230b0d0$230110ac@RJFE510> I'm not especially defending the Romberg code, and deprecating the double-float version is fine, if it is really totally superceded by better stuff. I am sure I can come up with problems that quadpack fails on, too. It is not clear what you are advocating here, But deprecating the (bigfloat) version of it seems to me would be a BIG mistake. What distinguishes Maxima from Fortran, C, Matlab ... is that numerical programs can, at least in principle, be run to arbitrary precision. What distinguishes Maxima from MPFR is that the specification of calculations can be done interactively. Deprecating the Maxima facility to do bigfloat integration is exactly the wrong direction. There are other things to do: how about replacing bigfloats (which I wrote) by MPFR (which I did not write, but is actively under development and appears to be fast). I don't see offhand an MPFR numerical integrator (but one could be built with Romberg).. Another possibility is to use quad-double integration which has been studied by Sherry Li: http://crd.lbl.gov/~xiaoye/fp.html and could be put into my generic arithmetic package easily, and into Maxima too, though not without some effort. This brings up the foreign function interface issue in whatever CL you are using, as well as the cross-platform compilation issues for libraries --- which lack of standardization seems to be a disqualification for Maxima. (I would prefer this to not be a disqualification, but I am unwilling personally to fix all lisps! And recompile everything in C or C++ for Mac, Linux, Windows, Solaris...) RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Daniel Lakeland > Sent: Thursday, January 04, 2007 8:02 AM > To: maxima at math.utexas.edu > Subject: Re: [Maxima] romberg > > > I think that throwing away the bigfloat version of Romberg without > replacing > > it with a bigfloat version of some better numerical integration program > > would be a bad choice. Both Maple and Mathematica have bigfloat > numerical > > integration. > > I tend to think that the romberg code should stay as an alternative to > the quadpack, but that the third option (can't remember the name) is > superfluous since it performed worst among the three that Robert > tested. The Romberg code should be documented as having been > superseded for most purposes by quadpack. > > > Removing a feature from Maxima on the grounds that [someone thinks that] > > most people are generally happy without it, would remove quite a few > > features! :) > > True enough. I think one of Robert's concerns is that it's not > completely robust, having failed some of his tests. If a bigfloat > version of quadpack were available it would probably be wise to > deprecate romberg as suggested. For now, perhaps it's best to > deprecate Romberg in the documentation but leave it available in the > code. > > > -- > Daniel Lakeland > dlakelan at street-artists.org > http://www.street-artists.org/~dlakelan > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From robert.dodier at gmail.com Thu Jan 4 13:06:14 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 4 Jan 2007 12:06:14 -0700 Subject: [Maxima] romberg In-Reply-To: <00dc01c7302c$4230b0d0$230110ac@RJFE510> References: <20070104160151.GS25287@street-artists.org> <00dc01c7302c$4230b0d0$230110ac@RJFE510> Message-ID: On 1/4/07, Richard Fateman wrote: > It is not clear what you are advocating here, But deprecating the > (bigfloat) version of it seems to me would be a BIG mistake. Maybe it got lost among the recent flurry of messages but: I'm not advocating removing bromberg anymore. > There are other things to do: how about replacing bigfloats (which I wrote) > by MPFR (which I did not write, but is actively under development and > appears to be fast). I don't see offhand an MPFR numerical integrator (but > one could be built with Romberg).. Another possibility is to use > quad-double integration which has been studied by Sherry Li: > http://crd.lbl.gov/~xiaoye/fp.html These are all good ideas. Robert From sdl.web at gmail.com Thu Jan 4 13:32:28 2007 From: sdl.web at gmail.com (Leo) Date: Thu, 04 Jan 2007 19:32:28 +0000 Subject: [Maxima] command line maxima terminals References: Message-ID: * Sen1 (2007-01-04 10:55 -0500) said: ^^^^ > I am using linux (Fedora Core 4) with maxima-5.11.0 > > When using the command line maxima with gcl or clisp, the terminal > performs as expected with C-P, C-N working fine for previous and > next commands. > > When I use cmucl and sbcl, the terminal is set differently and the > C-P, C-N don't work. > > Is this by design? Is there some command line option to feed to > maxima so that the control combinations will work (e.g. as in > emacs)? > > TIA, > -sen If you run maxima in Emacs, you don't need any readline support and thus can use your favorite CL compiler. -- Leo (GPG Key: 9283AA3F) From dlakelan at street-artists.org Thu Jan 4 13:49:29 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Thu, 4 Jan 2007 11:49:29 -0800 Subject: [Maxima] Fourier package? Message-ID: <20070104194929.GU25287@street-artists.org> I'm confused by the documentation for the fourier package. In the following: Function: fourier (f, x, p) Returns a list of the Fourier coefficients of f(x) defined on the interval [-%pi, %pi]. what is the role of "p" ??? Also, when the fourier package asks me about the sign of various things, what is it doing with those signs? If there is no definite answer to the question, what do I do? (example : what is the sign of cos(%pi*n)??? this could be positive or negative depending on whether n is even or odd... ------ Here is how I would like to use the fourier package: I have a problem which can be stated in terms of minimizing the potential energy of a certain situation. The situation is determined by a "height function" which is positive at one end of a domain, and zero at the other. It can not be negative. I am plugging in an expansion of the h function in terms of a truncated fourier series and trying to solve for the unknown coefficients. Unfortunately, the differential potential energy involves a term related to the length of the curve (ie. sqrt(1+dh/dx)) and therefore maxima can not integrate it. I would like to replace this term with a fourier expansion of the term and then integrate that instead. I am not sure whether this approximation of approximation will work, but it seems worth trying. However, I can not figure out how to get the fourier coefficients of the term using the fourie package. Any help would be appreciated. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From sen1 at math.msu.edu Thu Jan 4 13:44:28 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 4 Jan 2007 14:44:28 -0500 (EST) Subject: [Maxima] question about sublists In-Reply-To: <1167932813.23968.21.camel@localhost> References: <1167932813.23968.21.camel@localhost> Message-ID: My newbie question of the minute: In Bill's function below, he as a lisp list which he works on. I have a maxima list of length 188 (i.e., like [4, 6, 7, -3, 8, 2, 2, 5, 2, . . . ] How do I transform this to the lisp list, apply your function, and find the indices where 2 appears? More generally, this procedure is actually a special case of finding the inverse of a function. That is, (using latex notation) we have a map $f$ from the set $N = \{ 0, 1,2, \ldots , 187 \}$ into a set $B$ (in this case the set of integers), and we want to find the pre-image of an element (in this case the element $2$). Since maxima operates on sets and lists, it may be useful to have something which operates on both objects, or, since there are conversion tools, maybe just on sets themselves. TIA, -sen On Thu, 4 Jan 2007, Bill Wood wrote: > On Thu, 2007-01-04 at 11:23 -0500, sen1 at math.msu.edu wrote: >> How about a name more mnemonic about indices? >> >> Like >> find_index, list_index, or locate_index >> >> Of course, the actual function could actually find many indices for various >> predicates. > >> From the examples it seems clear that the desired functionality is to > return the list of indices of all occurrences of items satisfying the > predicate. The Common Lisp built-in "position-if" returns the index of > only the left-most (right-most if :from-end is non-nil) occurrence, so > some code has to be written. How about "all-positions-if" or > "all-positions"? "positions-if" or "positions" might also be used, but > they could too easily be confused with (or fat-fingered into) > "position-if" or "position", and you might want those functions as well. > > Here's a bare-bones CL function definition: > > (defun all-positions-if (items pred) > (do ((i 0 (1+ i)) > (xs items (cdr xs)) > (acc '() (if (funcall pred (car xs)) (cons i acc) acc))) > ((endp xs) (nreverse acc)))) > > Test runs: > > * (all-positions-if '(2 1 3 3 5) #'(lambda (x) (= x 3))) > (2 3) > * (all-positions-if '(2 1 3 3 5) #'(lambda (x) (= x 33))) > NIL > > (Don't forget, CL uses 0-based indexing; I guess maxima uses 1-based?) > > If you like a more functional style, here's an alternative definition: > > (defun all-positions-if (items pred) > (labels ((h (pr x) > (cons (1+ (car pr)) > (if (funcall pred x) > (cons (car pr) (cdr pr)) > (cdr pr))))) > (nreverse (cdr (reduce #'h items :initial-value (cons 0 '())))))) > > -- Bill Wood > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From dlakelan at street-artists.org Thu Jan 4 14:09:52 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Thu, 4 Jan 2007 12:09:52 -0800 Subject: [Maxima] Fourier package? In-Reply-To: <20070104194929.GU25287@street-artists.org> References: <20070104194929.GU25287@street-artists.org> Message-ID: <20070104200952.GV25287@street-artists.org> On Thu, Jan 04, 2007 at 11:49:29AM -0800, Daniel Lakeland wrote: whoops, in my previous post I made a typo > Unfortunately, the differential potential energy involves a term > related to the length of the curve (ie. sqrt(1+dh/dx)).... that should read sqrt(1+(dh/dx)^2) -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From miguel39123 at hotmail.com Thu Jan 4 14:46:41 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 20:46:41 +0000 (UTC) Subject: [Maxima] question about sublists Message-ID: >From sen1: How do I transform this to the lisp list, apply your function, and find the indices where 2 appears? Perhaps this way: code 1-based, observe the change do(( i 1... :lisp (defun all-positions-if (items pred) (do ((i 1 (1+ i)) (xs items (cdr xs)) (acc '() (if (funcall pred (car xs)) (cons i acc) acc))) ((endp xs) (nreverse acc)))); lst:[4, 6, 7, -3, 8, 2, 2, 5, 2]; :lisp (all-positions-if (cdr $lst) (lambda (x) (= x 2))); result ==> (6 7 9) More generally, this procedure is actually a special case of finding the inverse of a function. If (f x) is a lisp function for f:N->N, then the pre-image of k block([re],re:[], for i:=1 thru 187 do if f(x)=k then endcons(k,re),re); From miguel39123 at hotmail.com Thu Jan 4 15:12:54 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 21:12:54 +0000 (UTC) Subject: [Maxima] Fourier Package Message-ID: To Lakeland,about Fourier and the problem. This type of problem seems to be a typical application of FEM (finite element method). That is, you try to find a solution as a sum of well known functions with arbitrary coefficients, but FEM use a good basis for this problem, the linear problem of calculating the coefficient has a coefficient matrix with special properties (tridiagonal,etc.) About Fourier, I don't know what is p but perhaps is (1) the number of coefficients or (2) a term to make a change in the interval [-L,L] -> [-pi/2,pi/2] In any case, I think that the usual formulas for the coefficients of Fourier are trivial to program in Maxima. b(n):= 1/L * integrate(f(x)*cos(n*x),x,-L,L); a(n):= 1/L * integrate(f(x)*sin(n*x),x,-L,L); f(x)= a0/2 + sum a(n) sin(n*w*x) + sum b(n)*cos(n*w*x) with w=%pi/L From miguel39123 at hotmail.com Thu Jan 4 15:24:55 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Thu, 4 Jan 2007 21:24:55 +0000 (UTC) Subject: [Maxima] Fourier package Message-ID: There was a mistake in the formulas, the correct ones (i think) are theses In any case, I think that the usual formulas for the coefficients of Fourier are trivial to program in Maxima. b(n):= 1/L * integrate(f(x)*cos(n*w*x),x,-L,L); a(n):= 1/L * integrate(f(x)*sin(n*w*x),x,-L,L); f(x)= a0/2 + sum a(n)*sin(n*w*x) + sum b(n)*cos(n*w*x) with w=%pi/(2*L) From raymond.toy at ericsson.com Thu Jan 4 16:14:25 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Thu, 04 Jan 2007 17:14:25 -0500 Subject: [Maxima] Fourier package? In-Reply-To: <20070104194929.GU25287@street-artists.org> References: <20070104194929.GU25287@street-artists.org> Message-ID: <459D7C41.9030701@ericsson.com> Daniel Lakeland wrote: > I'm confused by the documentation for the fourier package. In the > following: > > Function: fourier (f, x, p) > > Returns a list of the Fourier coefficients of f(x) defined on the interval [-%pi, %pi]. > > what is the role of "p" ??? > From a brief look at the code, it seems that p is used to indicate the interval [-p, p]. I think the documentation is wrong about the interval being -%pi to %pi. Ray From dlakelan at street-artists.org Thu Jan 4 16:30:19 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Thu, 4 Jan 2007 14:30:19 -0800 Subject: [Maxima] Fourier package? In-Reply-To: <459D7C41.9030701@ericsson.com> References: <20070104194929.GU25287@street-artists.org> <459D7C41.9030701@ericsson.com> Message-ID: <20070104223019.GX25287@street-artists.org> On Thu, Jan 04, 2007 at 05:14:25PM -0500, Raymond Toy wrote: > Daniel Lakeland wrote: > > I'm confused by the documentation for the fourier package. In the > > following: > > > > Function: fourier (f, x, p) > > > > Returns a list of the Fourier coefficients of f(x) defined on the interval [-%pi, %pi]. > > > > what is the role of "p" ??? > From a brief look at the code, it seems that p is used to indicate the > interval [-p, p]. I think the documentation is wrong about the interval > being -%pi to %pi. That's what I suspected from playing around with it. Perhaps someone else can confirm, and if so, we can change the docs. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From fateman at cs.berkeley.edu Thu Jan 4 18:02:51 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Thu, 4 Jan 2007 16:02:51 -0800 Subject: [Maxima] romberg-- replacement for bigfloat romberg In-Reply-To: <00dc01c7302c$4230b0d0$230110ac@RJFE510> Message-ID: <00e301c7305c$d881acd0$230110ac@RJFE510> I looked at Sherry Li's papers again, and there are 2 things worth noting. 1. There is a version of ARPREC, which is comparable to MPFR (that is, arbitrary precision floats) implemented in Fortran 90. So maybe it can be run through f2cl. (I have used ARPREC and its predecessor MPFUN in the past; MPFR seems to have more of a following and in some timing tests is faster. In favor of ARPREC (and QD), it is locally produced by friends and I can sometimes get help :) ) 2. There is a version of ARBITRARY precision quadrature using ARPREC (actually 3 programs) that could substitute for bf Romberg. The source code is online. http://crd.lbl.gov/~xiaoye/quadrature.pdf Also, http://crd.lbl.gov/~dhbailey/mpdist is the distribution page There are problems for which each of the programs performs better. Note that there are also a bunch of papers, some by me, some by Keith Geddes, and I think James Davenport on how symbolic math systems can reformulate numerical integration problems to be easier to solve. Typical kinds of transformations are converting infinite endpoints to finite; averaging out oscillations; removing singularities at endpoints by various tricks (e.g. separating out an integrable part). Is there anyone who cares about making this (a: arprec; b: Li's integration) work in Maxima? I believe that part b can be done using existing bigfloats. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Richard Fateman > Sent: Thursday, January 04, 2007 10:15 AM > To: maxima at math.utexas.edu > Subject: Re: [Maxima] romberg > > I'm not especially defending the Romberg code, and deprecating the > double-float version is fine, if it is really totally superceded by better > stuff. I am sure I can come up with problems that quadpack fails on, too. > > It is not clear what you are advocating here, But deprecating the > (bigfloat) version of it seems to me would be a BIG mistake. What > distinguishes Maxima from Fortran, C, Matlab ... is that numerical > programs > can, at least in principle, be run to arbitrary precision. What > distinguishes Maxima from MPFR is that the specification of calculations > can > be done interactively. Deprecating the Maxima facility to do bigfloat > integration is exactly the wrong direction. > > > > There are other things to do: how about replacing bigfloats (which I > wrote) > by MPFR (which I did not write, but is actively under development and > appears to be fast). I don't see offhand an MPFR numerical integrator (but > one could be built with Romberg).. Another possibility is to use > quad-double integration which has been studied by Sherry Li: > http://crd.lbl.gov/~xiaoye/fp.html > > and could be put into my generic arithmetic package easily, and into > Maxima > too, though not without some effort. This brings up the foreign function > interface issue in whatever CL you are using, as well as the cross- > platform > compilation issues for libraries --- which lack of standardization seems > to > be a disqualification for Maxima. (I would prefer this to not be a > disqualification, but I am unwilling personally to fix all lisps! And > recompile everything in C or C++ for Mac, Linux, Windows, Solaris...) > > RJF > > > > -----Original Message----- > > From: maxima-bounces at math.utexas.edu [mailto:maxima- > > bounces at math.utexas.edu] On Behalf Of Daniel Lakeland > > Sent: Thursday, January 04, 2007 8:02 AM > > To: maxima at math.utexas.edu > > Subject: Re: [Maxima] romberg > > > > > I think that throwing away the bigfloat version of Romberg without > > replacing > > > it with a bigfloat version of some better numerical integration > program > > > would be a bad choice. Both Maple and Mathematica have bigfloat > > numerical > > > integration. > > > > I tend to think that the romberg code should stay as an alternative to > > the quadpack, but that the third option (can't remember the name) is > > superfluous since it performed worst among the three that Robert > > tested. The Romberg code should be documented as having been > > superseded for most purposes by quadpack. > > > > > Removing a feature from Maxima on the grounds that [someone thinks > that] > > > most people are generally happy without it, would remove quite a few > > > features! :) > > > > True enough. I think one of Robert's concerns is that it's not > > completely robust, having failed some of his tests. If a bigfloat > > version of quadpack were available it would probably be wise to > > deprecate romberg as suggested. For now, perhaps it's best to > > deprecate Romberg in the documentation but leave it available in the > > code. > > > > > > -- > > Daniel Lakeland > > dlakelan at street-artists.org > > http://www.street-artists.org/~dlakelan > > _______________________________________________ > > 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 From toy.raymond at gmail.com Thu Jan 4 19:32:17 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Thu, 04 Jan 2007 20:32:17 -0500 Subject: [Maxima] romberg-- replacement for bigfloat romberg In-Reply-To: <00e301c7305c$d881acd0$230110ac@RJFE510> References: <00e301c7305c$d881acd0$230110ac@RJFE510> Message-ID: <459DAAA1.405@gmail.com> Richard Fateman wrote: > I looked at Sherry Li's papers again, and there are 2 things worth noting. > > 1. There is a version of ARPREC, which is comparable to MPFR (that is, > arbitrary precision floats) implemented in Fortran 90. So maybe it can be > run through f2cl. (I have used ARPREC and its predecessor MPFUN in the > Unless the code uses only a small part of Fortran 90, it's unlikely f2cl can convert it. At least not without adding a ton of new parsers and such. MPFUN, as you know, can be converted fairly easily. > past; MPFR seems to have more of a following and in some timing tests is > faster. In favor of ARPREC (and QD), it is locally produced by friends and I > can sometimes get help :) ) > FWIW, I have (had) an implementation of double-double in pure portable Lisp. I also have a partial implementation of QD in Lisp but it currently depends on a (complex double-double) type. Without such support, there would be a lot of consing going on for each operation, but perhaps that's not so bad, since, I think a quad-double add is some 500 (or more) machine instructions. > Is there anyone who cares about > making this (a: arprec; b: Li's integration) work in Maxima? I believe that > part b can be done using existing bigfloats. > > Although not directly applicable to either a or b, I've wanted to add some classes to support double, bfloat, and complex bfloat operations. Right now, I find it a pain to do bfloat stuff in Lisp, especially if you want to operate on complex numbers. Ray From sen1 at math.msu.edu Thu Jan 4 20:17:18 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 4 Jan 2007 21:17:18 -0500 (EST) Subject: [Maxima] plotting wish list Message-ID: Hi, I decided to try to embed some plots in xmaxima so that I could easily make comments about them above and below in the tk window. This would give functionality similar to Mathematica Notebooks. Here are some suggestions for future versions. 1. It would be nice to choose the size of the canvas in xmaxima, so one could make the canvas small or large. This way one could place plots side by side. Since one can already zoom in the openmath plots, this would allow interactive viewing of several parts of plots on the same screen. Also, if one could arrange to have plots removed and replotted on the same canvas, animation would be possible. 2. I can scroll up in the workspace line by line, but scrolling down seems to jump. So, it is cumbersome to make comments about a plot below it. One has to keep paging up and down. 3. There is a command in gnuplot which allows the printing of coordinates of points on the plot selected by the mouse. This is using the commands set print "coord.out" print MOUSE_X, MOUSE_Y Each subsequent mouse click has its coords stored in the file "coord.out" It would be nice to have an option to collect this data in a file with the plotting routines in maxima. -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From David.Billinghurst at riotinto.com Thu Jan 4 20:36:48 2007 From: David.Billinghurst at riotinto.com (Billinghurst, David (RTATECH)) Date: Fri, 5 Jan 2007 13:36:48 +1100 Subject: [Maxima] romberg-- replacement for bigfloat romberg Message-ID: <026DCC31AB859648A6F16C0E5CD2580D736BEC@calttsv025.cal.riotinto.org> > From: Raymond Toy > > Although not directly applicable to either a or b, I've wanted to add > some classes to support double, bfloat, and complex bfloat > operations. > Right now, I find it a pain to do bfloat stuff in Lisp, especially if > you want to operate on complex numbers. I started working on some complex bigfloat stuff this time last year, http://www.math.utexas.edu/pipermail/maxima/2006/000100.html Richard Fateman provided some feedback, http://www.math.utexas.edu/pipermail/maxima/2006/000102.html I started looking at generic arithmetic and put together a working prototype, then life got busy again. Only last night I was thinking that I should finish this job off, but I could use some help in defining the interface. David NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. From michel.vandenbergh at uhasselt.be Fri Jan 5 08:04:15 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 05 Jan 2007 15:04:15 +0100 Subject: [Maxima] Question: invoking levin by default References: eb9c4b9a0701030457x5efc2a84wb9ff6dd62a2c7125@mail.gmail.com Message-ID: <459E5ADF.6080904@uhasselt.be> I would like to experiment with invoking levin by default. The interface would be something like load(levin); fpprec:50; sum(1/n-log(1+1/n),n,1,inf),bfloat; 5.7721566490153286060651209008240243104215933593992b-1 Question: is this achievable in the maxima language, or should one go down to the lisp level? If the latter, can one do it in a localized way (i.e. purely within the package levin)? Michel From gerhard.zintel at faurecia.com Fri Jan 5 05:11:25 2007 From: gerhard.zintel at faurecia.com (ZINTEL Gerhard) Date: Fri, 5 Jan 2007 12:11:25 +0100 Subject: [Maxima] how to make results more compact? Message-ID: Hello List, a problem I'm fiddling with for days. Solving an equation I've got a result of the form: EQ1: Zo*C*L+Zo*A*L-Zo*D*K+Zo*B*K-Zo*C*J-Zo*A*J-Zo*D*I+Zo*B*I+B*L-D*J Now I know the most compact form would be EQ2: Zo * ((C+A)*(L-J) + (B-D)*(K+I)) + B*L - D*J How to make MAXIMA finding EQ2 from EQ1? I tried a lot using e.g. ratsimp (%); scanmap(factor,%); and others without any success. Any help would be greatly appreciated! Gerhard This electronic transmission (and any attachments thereto) is intended solely for the use of the addressee(s). It may contain confidential or legally privileged information. If you are not the intended recipient of this message, you must delete it immediately and notify the sender. Any unauthorized use or disclosure of this message is strictly prohibited. Faurecia does not guarantee the integrity of this transmission and shall therefore never be liable if the message is altered or falsified nor for any virus, interception or damage to your system. From macrakis at alum.mit.edu Fri Jan 5 08:39:06 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 5 Jan 2007 09:39:06 -0500 Subject: [Maxima] how to make results more compact? In-Reply-To: References: Message-ID: <8b356f880701050639q5a0e006fubbb4a4ebbd87d02b@mail.gmail.com> On 1/5/07, ZINTEL Gerhard wrote: > EQ1: Zo*C*L+Zo*A*L-Zo*D*K+Zo*B*K-Zo*C*J-Zo*A*J-Zo*D*I+Zo*B*I+B*L-D*J > > Now I know the most compact form would be > > EQ2: Zo * ((C+A)*(L-J) + (B-D)*(K+I)) + B*L - D*J > > How to make MAXIMA finding EQ2 from EQ1? In general, scanmap(factor,...) doesn't do anything useful, because it recurses over individual terms; neither does scanmap(factor,...,bottomup). Factorsum handles some cases like this, but not all. I have written combinatorial search functions for simpler forms, but they can get very time-consuming. In this particular case, it seems that the approach to take manually is fairly straightforward: map(factorsum,rat(EQ1,Zo)); or dd: divide(EQ1,Zo)$ Zo*factorsum(dd[1])+dd[2]) ; Of course, this doesn't generalize to arbitrary expressions.... -s From robert.dodier at gmail.com Fri Jan 5 08:44:41 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 5 Jan 2007 07:44:41 -0700 Subject: [Maxima] question about sublists In-Reply-To: <1167932813.23968.21.camel@localhost> References: <1167932813.23968.21.camel@localhost> Message-ID: On 1/4/07, Bill Wood wrote: > Here's a bare-bones CL function definition: > > (defun all-positions-if (items pred) > (do ((i 0 (1+ i)) > (xs items (cdr xs)) > (acc '() (if (funcall pred (car xs)) (cons i acc) acc))) > ((endp xs) (nreverse acc)))) Bill, thanks a lot for your help. I've modified the code as shown below. (defun $sublist_indices (items pred) (let ((items (require-list items "$sublist_indices"))) (do ((i 0 (1+ i)) (xs items (cdr xs)) (acc '() (if (definitely-so (mfuncall pred (car xs))) (cons (1+ i) acc) acc))) ((endp xs) `((mlist) ,@(nreverse acc)))))) A user could paste this into a Maxima session via to_lisp(); (to-maxima) or copy it to a file and load it via load() . Examples: sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = a)); => [1, 6, 10, 11] sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = b)); => [2, 7] sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = b or x = a)); => [1, 2, 6, 7, 10, 11] P(x) := not (x = a); sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], P); => [2, 3, 4, 5, 7, 8, 9] best Robert From fateman at cs.berkeley.edu Fri Jan 5 08:47:47 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Fri, 5 Jan 2007 06:47:47 -0800 Subject: [Maxima] Question: invoking levin by default In-Reply-To: <459E5ADF.6080904@uhasselt.be> Message-ID: <010301c730d8$7cb22f70$230110ac@RJFE510> I think this default would not be consistent with the general approach in Maxima. In particular, if sum(..) can be done exactly, and the result then converted to a bfloat, that is what I would expect the commands below to do. Also you would have to consider what to do with (f(a)+sum (....)), bfloat. How about this: use "nsum" instead of "sum" (Mathematica uses NSum vs Sum). Or do this: Simpsum:Levin, as a third option, other than true and false. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Friday, January 05, 2007 6:04 AM > To: maxima at math.utexas.edu > Subject: [Maxima] Question: invoking levin by default > > I would like to experiment with invoking levin by default. The interface > would be something like > > load(levin); > fpprec:50; > sum(1/n-log(1+1/n),n,1,inf),bfloat; > > 5.7721566490153286060651209008240243104215933593992b-1 > > > Question: is this achievable in the maxima language, or should one go down > to the lisp level? > > If the latter, can one do it in a localized way (i.e. purely within the > package levin)? > > Michel > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Fri Jan 5 09:03:25 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 05 Jan 2007 16:03:25 +0100 Subject: [Maxima] Question: invoking levin by default In-Reply-To: <010301c730d8$7cb22f70$230110ac@RJFE510> References: <010301c730d8$7cb22f70$230110ac@RJFE510> Message-ID: <459E68BD.6080304@uhasselt.be> Richard Fateman wrote: > I think this default would not be consistent with the general approach in > Maxima. In particular, if sum(..) can be done exactly, and the result then > converted to a bfloat, that is what I would expect the commands below to do. > I don't feel very strongly about this but since I think bfloat evaluates its first argument the expected behaviour would be automatic. Levin would be handed an expression that can not be simplified further (in the current situation that would be almost all indefinite sums but this could change if the closed_form package becomes more and more powerful!). > Also you would have to consider what to do with (f(a)+sum (....)), bfloat. > > Good question. I would imagine the behaviour to be the same as f(a)+cos(1),bfloat; f(a) + 5.403023058681397b-1 > How about this: use "nsum" instead of "sum" (Mathematica uses NSum vs > Sum). > Yes this could be a good idea. > Or do this: > > Simpsum:Levin, as a third option, other than true and false. > This I don't really like. Numerical evaluation is not the same as simplification. Michel > RJF > > >> -----Original Message----- >> From: maxima-bounces at math.utexas.edu [mailto:maxima- >> bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh >> Sent: Friday, January 05, 2007 6:04 AM >> To: maxima at math.utexas.edu >> Subject: [Maxima] Question: invoking levin by default >> >> I would like to experiment with invoking levin by default. The interface >> would be something like >> >> load(levin); >> fpprec:50; >> sum(1/n-log(1+1/n),n,1,inf),bfloat; >> >> 5.7721566490153286060651209008240243104215933593992b-1 >> >> >> Question: is this achievable in the maxima language, or should one go down >> to the lisp level? >> >> If the latter, can one do it in a localized way (i.e. purely within the >> package levin)? >> >> Michel >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> > > From michel.vandenbergh at uhasselt.be Fri Jan 5 09:26:53 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 05 Jan 2007 16:26:53 +0100 Subject: [Maxima] Question: invoking levin by default In-Reply-To: <010301c730d8$7cb22f70$230110ac@RJFE510> References: <010301c730d8$7cb22f70$230110ac@RJFE510> Message-ID: <459E6E3D.2010802@uhasselt.be> I wrote > load(levin); > fpprec:50; > sum(1/n-log(1+1/n),n,1,inf),bfloat; > > 5.7721566490153286060651209008240243104215933593992b-1 > To avoid confusion. I was not suggesting to make levin a global default! It should only happen after "load(levin)". I was asking for tips on how to achieve this (***if*** it is consistent with maxima behaviour, which Richard seems to think it is not, but I am not convinced yet). Richard Fateman wrote > Simpsum:Levin, as a third option, other than true and false. > > As I said I don't like this. But I would like simpsum:closed_form which would invoke closed_form by default. Michel From gerhard.zintel at faurecia.com Fri Jan 5 09:11:08 2007 From: gerhard.zintel at faurecia.com (ZINTEL Gerhard) Date: Fri, 5 Jan 2007 16:11:08 +0100 Subject: [Maxima] how to make results more compact? Message-ID: Thank you very much for your help! I'm a bit disappointed that there seems to be no easy way to do such kind of transformation in a save, automatic way. I have put a real example of what I have to simplify (to make more compact) below. None of your tips give me a good result with those monsters. On the other side, I know that there is a much more compact form for them (doing it by hand). Concerning your "combinatorial search functions", can I make use of them for this special case and where can I find them. The time consumption is not the problem. Gerhard > On 1/5/07, ZINTEL Gerhard wrote: > > EQ1: Zo*C*L+Zo*A*L-Zo*D*K+Zo*B*K-Zo*C*J-Zo*A*J-Zo*D*I+Zo*B*I+B*L-D*J > > > > Now I know the most compact form would be > > > > EQ2: Zo * ((C+A)*(L-J) + (B-D)*(K+I)) + B*L - D*J > > > > How to make MAXIMA finding EQ2 from EQ1? > > In general, scanmap(factor,...) doesn't do anything useful, because it > recurses over individual terms; neither does > scanmap(factor,...,bottomup). Factorsum handles some cases like this, > but not all. I have written combinatorial search functions for > simpler forms, but they can get very time-consuming. > > In this particular case, it seems that the approach to take manually > is fairly straightforward: > > map(factorsum,rat(EQ1,Zo)); > > or > > dd: divide(EQ1,Zo)$ > Zo*factorsum(dd[1])+dd[2]) ; > > Of course, this doesn't generalize to arbitrary expressions.... > > -s [ZINTEL Gerhard] Zo*A11*A22*T14*T45*T56 - Zo*A12*A21*T14*T45*T56 + Zo*A11*T12*T45*T56 - Zo*A12*T11*T45*T56 - Zo*A11*A22*T15*T44*T56 + Zo*A12*A21*T15*T44*T56 - Zo*A11*A22*T13*T44*T56 + Zo*A12*A21*T13*T44*T56 + Zo*A21*T12*T44*T56 - Zo*A22*T11*T44*T56 + Zo*A11*A22*T14*T43*T56 - Zo*A12*A21*T14*T43*T56 + Zo*A11*T12*T43*T56 - Zo*A12*T11*T43*T56 - Zo*A11*T15*T42*T56 - Zo*A21*T14*T42*T56 - Zo*A11*T13*T42*T56 - Zo*T11*T42*T56 + Zo*A12*T15*T41*T56 + Zo*A22*T14*T41*T56 + Zo*A12*T13*T41*T56 + Zo*T12*T41*T56 + A11*A22*T14*T35*T56 - A12*A21*T14*T35*T56 + A11*T12*T35*T56 - A12*T11*T35*T56 - A11*A22*T15*T34*T56 + A12*A21*T15*T34*T56 - A11*A22*T13*T34*T56 + A12*A21*T13*T34*T56 + A21*T12*T34*T56 - A22*T11*T34*T56 + A11*A22*T14*T33*T56 - A12*A21*T14*T33*T56 + A11*T12*T33*T56 - A12*T11*T33*T56 - A11*T15*T32*T56 - A21*T14*T32*T56 - A11*T13*T32*T56 - T11*T32*T56 + A12*T15*T31*T56 + A22*T14*T31*T56 + A12*T13*T31*T56 + T12*T31*T56 - Zo*A11*A22*T14*T46*T55 + Zo*A12*A21*T14*T46*T55 - Zo*A11*T12*T46*T55 + Zo*A12*T11*T46*T55 + Zo*A11*A22*T16*T44*T55 - Zo*A12*A21*T16*T44*T55 + Zo*A11*T12*T44*T55 - Zo*A12*T11*T44*T55 + Zo*A11*T16*T42*T55 - Zo*A11*T14*T42*T55 - Zo*A12*T16*T41*T55 + Zo*A12*T14*T41*T55 - A11*A22*T14*T36*T55 + A12*A21*T14*T36*T55 - A11*T12*T36*T55 + A12*T11*T36*T55 + A11*A22*T16*T34*T55 - A12*A21*T16*T34*T55 + A11*T12*T34*T55 - A12*T11*T34*T55 + A11*T16*T32*T55 - A11*T14*T32*T55 - A12*T16*T31*T55 + A12*T14*T31*T55 + Zo*A11*A22*T15*T46*T54 - Zo*A12*A21*T15*T46*T54 + Zo*A11*A22*T13*T46*T54 - Zo*A12*A21*T13*T46*T54 - Zo*A21*T12*T46*T54 + Zo*A22*T11*T46*T54 - Zo*A11*A22*T16*T45*T54 + Zo*A12*A21*T16*T45*T54 - Zo*A11*T12*T45*T54 + Zo*A12*T11*T45*T54 - Zo*A11*A22*T16*T43*T54 + Zo*A12*A21*T16*T43*T54 - Zo*A11*T12*T43*T54 + Zo*A12*T11*T43*T54 + Zo*A21*T16*T42*T54 + Zo*A11*T15*T42*T54 + Zo*A11*T13*T42*T54 + Zo*T11*T42*T54 - Zo*A22*T16*T41*T54 - Zo*A12*T15*T41*T54 - Zo*A12*T13*T41*T54 - Zo*T12*T41*T54 + A11*A22*T15*T36*T54 - A12*A21*T15*T36*T54 + A11*A22*T13*T36*T54 - A12*A21*T13*T36*T54 - A21*T12*T36*T54 + A22*T11*T36*T54 - A11*A22*T16*T35*T54 + A12*A21*T16*T35*T54 - A11*T12*T35*T54 + A12*T11*T35*T54 - A11*A22*T16*T33*T54 + A12*A21*T16*T33*T54 - A11*T12*T33*T54 + A12*T11*T33*T54 + A21*T16*T32*T54 + A11*T15*T32*T54 + A11*T13*T32*T54 + T11*T32*T54 - A22*T16*T31*T54 - A12*T15*T31*T54 - A12*T13*T31*T54 - T12*T31*T54 - Zo*A11*A22*T14*T46*T53 + Zo*A12*A21*T14*T46*T53 - Zo*A11*T12*T46*T53 + Zo*A12*T11*T46*T53 + Zo*A11*A22*T16*T44*T53 - Zo*A12*A21*T16*T44*T53 + Zo*A11*T12*T44*T53 - Zo*A12*T11*T44*T53 + Zo*A11*T16*T42*T53 - Zo*A11*T14*T42*T53 - Zo*A12*T16*T41*T53 + Zo*A12*T14*T41*T53 - A11*A22*T14*T36*T53 + A12*A21*T14*T36*T53 - A11*T12*T36*T53 + A12*T11*T36*T53 + A11*A22*T16*T34*T53 - A12*A21*T16*T34*T53 + A11*T12*T34*T53 - A12*T11*T34*T53 + A11*T16*T32*T53 - A11*T14*T32*T53 - A12*T16*T31*T53 + A12*T14*T31*T53 + Zo*A11*T15*T46*T52 + Zo*A21*T14*T46*T52 + Zo*A11*T13*T46*T52 + Zo*T11*T46*T52 - Zo*A11*T16*T45*T52 + Zo*A11*T14*T45*T52 - Zo*A21*T16*T44*T52 - Zo*A11*T15*T44*T52 - Zo*A11*T13*T44*T52 - Zo*T11*T44*T52 - Zo*A11*T16*T43*T52 + Zo*A11*T14*T43*T52 - Zo*T16*T41*T52 + Zo*T14*T41*T52 + A11*T15*T36*T52 + A21*T14*T36*T52 + A11*T13*T36*T52 + T11*T36*T52 - A11*T16*T35*T52 + A11*T14*T35*T52 - A21*T16*T34*T52 - A11*T15*T34*T52 - A11*T13*T34*T52 - T11*T34*T52 - A11*T16*T33*T52 + A11*T14*T33*T52 - T16*T31*T52 + T14*T31*T52 - Zo*A12*T15*T46*T51 - Zo*A22*T14*T46*T51 - Zo*A12*T13*T46*T51 - Zo*T12*T46*T51 + Zo*A12*T16*T45*T51 - Zo*A12*T14*T45*T51 + Zo*A22*T16*T44*T51 + Zo*A12*T15*T44*T51 + Zo*A12*T13*T44*T51 + Zo*T12*T44*T51 + Zo*A12*T16*T43*T51 - Zo*A12*T14*T43*T51 + Zo*T16*T42*T51 - Zo*T14*T42*T51 - A12*T15*T36*T51 - A22*T14*T36*T51 - A12*T13*T36*T51 - T12*T36*T51 + A12*T16*T35*T51 - A12*T14*T35*T51 + A22*T16*T34*T51 + A12*T15*T34*T51 + A12*T13*T34*T51 + T12*T34*T51 + A12*T16*T33*T51 - A12*T14*T33*T51 + T16*T32*T51 - T14*T32*T51 This electronic transmission (and any attachments thereto) is intended solely for the use of the addressee(s). It may contain confidential or legally privileged information. If you are not the intended recipient of this message, you must delete it immediately and notify the sender. Any unauthorized use or disclosure of this message is strictly prohibited. Faurecia does not guarantee the integrity of this transmission and shall therefore never be liable if the message is altered or falsified nor for any virus, interception or damage to your system. From macrakis at alum.mit.edu Fri Jan 5 09:47:32 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 5 Jan 2007 10:47:32 -0500 Subject: [Maxima] how to make results more compact? In-Reply-To: <8b356f880701050747r776aa12aue36633345edb1352@mail.gmail.com> References: <8b356f880701050747r776aa12aue36633345edb1352@mail.gmail.com> Message-ID: <8b356f880701050747q1dae3511h205ad84849f9aed@mail.gmail.com> On 1/5/07, ZINTEL Gerhard wrote: > I'm a bit disappointed that there seems to be no easy way to do such kind of > transformation in a save, automatic way Yes, it would be nice. Part of the issue is that there is no unique "best" representation of an expression. > I have put a real example of what I > have to simplify (to make more compact) below. None of your tips give me a > good result with those monsters. On the other side, I know that there is a > much more compact form for them (doing it by hand). > > Concerning your "combinatorial search functions", can I make use of them for > this special case and where can I find them. The time consumption is not the > problem. The combinatorial technique I used is very naive: look at partitions of the expression and use some standard tools (e.g. factor) on them. The problem is of course that the number of partitions is exponential in the number of terms, so time consumption *is* a problem, no matter how large your machine, if you have 96 terms.... And if there are any shared terms in the decomposition (e.g. (a-b)*(c-d)+b*d) ), this approach fails. If you were able to analyze your expression manually, then you must have followed some strategy which allowed you to master this combinatorial blowup, which may be based on a priori knowledge of the form of the result. You should be able to program this strategy in Maxima. For example, if every term is of the form (v1+v2)*(v3-v4), then you could try divide'ing the expression by all possible (vm+vn) etc. -s From fateman at cs.berkeley.edu Fri Jan 5 10:42:13 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Fri, 5 Jan 2007 08:42:13 -0800 Subject: [Maxima] Question: invoking levin by default In-Reply-To: <459E6E3D.2010802@uhasselt.be> Message-ID: <00c901c730e8$76c77ec0$210110ac@windsor> > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Michel > Van den Bergh ..... > > > > > As I said I don't like this. But I would like > > simpsum:closed_form > > which would invoke closed_form by default. I have always been puzzled about why simpsum:true didn't already try to call whatever tools were around to compute a closed form. Setting simpsum:true (in Macsyma) does the job some of the time, to get a closed form. But other methods are used only when its version of closedform is called. Perhaps it is just that bringing out the big guns of closedform is too expensive to use? RJF From fateman at cs.berkeley.edu Fri Jan 5 10:50:11 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Fri, 5 Jan 2007 08:50:11 -0800 Subject: [Maxima] how to make results more compact? In-Reply-To: <8b356f880701050747q1dae3511h205ad84849f9aed@mail.gmail.com> Message-ID: <00cd01c730e9$98103260$210110ac@windsor> > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Stavros Macrakis > Sent: Friday, January 05, 2007 7:48 AM > To: Maxima list; ZINTEL Gerhard > Subject: [Maxima] how to make results more compact? > ...... > If you were able to analyze your expression manually, then you must > have followed some strategy which allowed you to master this > combinatorial blowup, which may be based on a priori knowledge of the > form of the result. You should be able to program this strategy in > Maxima. .... I agree with what Stavros said here, and would like to point out that if you are reasonably expert in some kind of calculation but have no idea how to do something algorithmically "by paper and pencil" you should not be surprised to find that there is no program written by someone else to magically solve the problem. There are a few areas in which a computer algebra system does what amounts to magic -- simply because so few people are really expert at these tasks, or the tasks are very tedious. Symbolic integration and polynomial factorization are two such examples. If you do come up with a neat algorithmic way of reformatting expressions to be "simpler" according to your criteria, there is a directory for such contributions! From michel.vandenbergh at uhasselt.be Fri Jan 5 10:51:31 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 05 Jan 2007 17:51:31 +0100 Subject: [Maxima] Question: invoking levin by default In-Reply-To: <00c901c730e8$76c77ec0$210110ac@windsor> References: <00c901c730e8$76c77ec0$210110ac@windsor> Message-ID: <459E8213.10200@uhasselt.be> Richard Fateman wrote: > > > >> -----Original Message----- >> From: maxima-bounces at math.utexas.edu >> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Michel >> Van den Bergh >> > ..... > >>> >>> >> As I said I don't like this. But I would like >> >> simpsum:closed_form >> >> which would invoke closed_form by default. >> > > I have always been puzzled about why simpsum:true didn't already try to call > whatever tools were around to compute a closed form. > > Setting simpsum:true (in Macsyma) does the job some of the time, to get a > closed form. But other methods are used only when its version of closedform > is called. > > Perhaps it is just that bringing out the big guns of closedform is too > expensive to use? > I think that's it. Currently in maxima simpsum:true enables a few cheap simplications. Those in closedform may be too expensive to use by default (without any user action). Maybe the idea in maxima is that expensive operations should be requested explicitly by the user (ratsimp, trigsimp etc...). So we should have sumsimp for consistency:-) Michel From raymond.toy at ericsson.com Fri Jan 5 11:32:49 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 05 Jan 2007 12:32:49 -0500 Subject: [Maxima] Fourier package? In-Reply-To: <20070104223019.GX25287@street-artists.org> (Daniel Lakeland's message of "Thu, 4 Jan 2007 14:30:19 -0800") References: <20070104194929.GU25287@street-artists.org> <459D7C41.9030701@ericsson.com> <20070104223019.GX25287@street-artists.org> Message-ID: >>>>> "Daniel" == Daniel Lakeland writes: Daniel> On Thu, Jan 04, 2007 at 05:14:25PM -0500, Raymond Toy wrote: >> Daniel Lakeland wrote: >> > I'm confused by the documentation for the fourier package. In the >> > following: >> > >> > Function: fourier (f, x, p) >> > >> > Returns a list of the Fourier coefficients of f(x) defined on the interval [-%pi, %pi]. >> > >> > what is the role of "p" ??? >> From a brief look at the code, it seems that p is used to indicate the >> interval [-p, p]. I think the documentation is wrong about the interval >> being -%pi to %pi. Daniel> That's what I suspected from playing around with it. Perhaps someone Daniel> else can confirm, and if so, we can change the docs. I think it's also unfortunate the fourexpand and friends need you to specify p again. I would have expected fourier to leave enough info around to know the interval. I was getting confused for a while when I was doing e:fourier(f,x,10); plot2d(fourexpand(e,x,1,5),[x,-10,10]). But maybe the intent is that you should be able to compute the Fourier series with a period of p, but expand the series with a different period. Ray From raymond.toy at ericsson.com Fri Jan 5 11:58:36 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 05 Jan 2007 12:58:36 -0500 Subject: [Maxima] LAPACK checkin Message-ID: I think the current LAPACK code is in reasonable shape now, so I'll be checking it into the share/lapack directory, including an update to init-cl.lisp so that we search the lapack directory. load(lapack) will cause maxima to compile and load all of the lapack routines, and the one simple maxima interface file. The routines copy the output to a Maxima matrix list-of-lists. We can revisit these issues later if we decide a different approach is needed. I hope this is useful, Ray P.S. What is the oldest version of gcl we support? 2.6.7? P.P.S. It's unfortunate gcl 2.6.8 still doesn't have ensure-directories-exist. I poked around a bit and I don't see how you could even write one since gcl doesn't seem to have any kind of mkdir function. From Daniel.L.Solomon at ivv.nasa.gov Fri Jan 5 12:09:42 2007 From: Daniel.L.Solomon at ivv.nasa.gov (Dan Solomon) Date: Fri, 5 Jan 2007 13:09:42 -0500 Subject: [Maxima] stuck with vectors Message-ID: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov> Help, help! I am trying to work with an ODE in 3 space, so I want my dependent variable to be a column 3-vector x, a function of t. I'm not trying to solve the ODE, but I am building xprime, which is a moderately complicated expression. First question: should I declare x somehow to be a vector, or does the next line do so by using x[1], x[2], x[3]? P1:matrix([(-sigma) * x[1]+sigma * x[2]],[rho * x[1]-x[2]],[(-beta) * x[3]]); P2:matrix([0],[(-x[1]) * x[3]],[x[1] * x[2]]); SQ: matrix([x[1]],[x[2]],[x[3]]) . matrix([sigma * x[1]],[x[2]],[beta * x[3]]) - (rho+sigma) * x[1] * x[2]; RR:matrix([x[1]],[x[2]],[x[3]]) . matrix([x[1]],[x[2]],[x[3]]); xprime:(1+RR) * (1-RR) . P1 + (1+RR) . P2 + 2 * (1-RR) * SQ . matrix ([x[1]],[x[2]],[x[3]]); mm: xprime . xprime; Next question: the last output comes back expt(the expression for xprime,2), which is obviously correct, but how do I get the actual dot product to be computed? mm is a scalar, but I can't get it simplified. If I say expand(mm); it just expands the RRs that appear. Thank you in advance! Dan Solomon From navneethc at gmail.com Fri Jan 5 15:18:40 2007 From: navneethc at gmail.com (Navneeth Chandrasekaran) Date: Sat, 6 Jan 2007 02:48:40 +0530 Subject: [Maxima] Ubuntu 6.10/Lisp Message-ID: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> Hi, I was in the process of compiling Maxima 5.11.0 from source in Ubuntu Edgy. After I typed ./configure, I saw this message at the end of a list of true's and false's. configure: error: No lisp implementation specified and none of the default > executables > clisp(clisp),gcl(GCL),lisp(CMUCL),scl(SCL),sbcl(SBCL),lisp(ACL),openmcl(OpenMCL) > were found in PATH Could someone please tell me how to rectify this error? Thanks, Navneeth -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070106/c7cbc778/attachment.htm From willisb at unk.edu Fri Jan 5 15:42:34 2007 From: willisb at unk.edu (Barton Willis) Date: Fri, 5 Jan 2007 15:42:34 -0600 Subject: [Maxima] stuck with vectors In-Reply-To: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov> References: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov> Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >First question: should I declare x somehow to be >a vector, or does the next line do so by using x[1], x[2], x[3]? There is no need to declare x to be a vector. Maxima doesn't have a vector data structure---just lists, matrices, and arrays. >xprime:(1+RR) * (1-RR) . P1 + (1+RR) . P2 + 2 * >(1-RR) * SQ . matrix ([x[1]],[x[2]],[x[3]]); I think you used "." twice for scalar times column vector. Instead of "." (non commutative multiplication), you need "*" (commutative multiplication). Something like: (1+RR) * (1-RR) * P1 + (1+RR) . P2 + 2 * (1-RR) * SQ * matrix ([x[1]],[x[2]],[x[3]]); After that, expand will expand 'mm' into a (giant) scalar. Barton From miguel39123 at hotmail.com Fri Jan 5 15:48:31 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Fri, 5 Jan 2007 21:48:31 +0000 (UTC) Subject: [Maxima] how to make results more compact? References: Message-ID: ZINTEL Gerhard faurecia.com> writes: > > Thank you very much for your help! > > I'm a bit disappointed that there seems to be no easy way to do such kind of > transformation in a save, automatic way. This type of problem look very similar to logical circuit simplification, Karnaugh Map and other techniques are used here. Perhaps you should ask an expert in boolean circuit simplification to adapt some well-known heuristic to your problem. (multiplication similar to and gates, ...) Hope that this help. -M From willisb at unk.edu Fri Jan 5 15:49:30 2007 From: willisb at unk.edu (Barton Willis) Date: Fri, 5 Jan 2007 15:49:30 -0600 Subject: [Maxima] stuck with vectors In-Reply-To: References: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov>, Message-ID: Yeechs...try something like ( (1+RR) . P2 --> (1+RR) * P2 ) xprime : (1+RR) * (1-RR) * P1 + (1+RR) * P2 + 2 * (1-RR) * SQ * matrix([x[1]],[x[2]],[x[3]]); Barton From dlakelan at street-artists.org Fri Jan 5 15:58:18 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Fri, 5 Jan 2007 13:58:18 -0800 Subject: [Maxima] Ubuntu 6.10/Lisp In-Reply-To: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> References: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> Message-ID: <20070105215818.GD25287@street-artists.org> On Sat, Jan 06, 2007 at 02:48:40AM +0530, Navneeth Chandrasekaran wrote: > Hi, > I was in the process of compiling Maxima 5.11.0 from source in Ubuntu > Edgy. After I typed ./configure, I saw this message at the end of a list of > true's and false's. > > configure: error: No lisp implementation specified and none of the default > >executables > >clisp(clisp),gcl(GCL),lisp(CMUCL),scl(SCL),sbcl(SBCL),lisp(ACL),openmcl(OpenMCL) > >were found in PATH > > > Could someone please tell me how to rectify this error? Install one of the lisps. Debian has packages for clisp, cmucl, sbcl, gcl at least, ubuntu should have them as well. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From nmarais at sun.ac.za Fri Jan 5 17:10:07 2007 From: nmarais at sun.ac.za (Neilen Marais) Date: Sat, 06 Jan 2007 01:10:07 +0200 Subject: [Maxima] integrating trig functions with large constants, exponent out of range Message-ID: Hi I get the following problem: (%i8) integrate(%i*sin((34037595938027*x3)/6154596958582590-(863833069661327*x2)/ 6222711301569210-(863833069661327*x1)/6222711301569210-, 99614657/338602740)*x3,x3); Exponent out of range I tried reducing the error: (%i9) integrate(%i*sin(34037595938027*x3)*x3, x3); but had to interrupt it since it seemed to take forever. I found that the integration time is dependent on the size of the constant in the expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. This is a bit strange, but usually one could just just a variable in place of the number. I have an unsual use case that prevents me from doing this without a lot of work. If there is no workaround for the large-number integral problem I will post more details in the hopes of someone better than me giving a workable solution :) Regards Neilen -- you know its kind of tragic we live in the new world but we've lost the magic -- Battery 9 (www.battery9.co.za) From raymond.toy at ericsson.com Fri Jan 5 17:22:30 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 05 Jan 2007 18:22:30 -0500 Subject: [Maxima] Ubuntu 6.10/Lisp In-Reply-To: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> (Navneeth Chandrasekaran's message of "Sat, 6 Jan 2007 02:48:40 +0530") References: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> Message-ID: >>>>> "Navneeth" == Navneeth Chandrasekaran writes: Navneeth> 1. (*) text/plain ( ) text/html Navneeth> Hi, Navneeth> I was in the process of compiling Maxima 5.11.0 from source in Ubuntu Navneeth> Edgy. After I typed ./configure, I saw this message at the end of a list of Navneeth> true's and false's. Navneeth> configure: error: No lisp implementation specified and none of the default >> executables >> clisp(clisp),gcl(GCL),lisp(CMUCL),scl(SCL),sbcl(SBCL),lisp(ACL),openmcl(OpenMCL) >> were found in PATH Given this error message, I would first go check to see if typing clisp, gcl, lisp, scl, etc. actually does something other than give an command not found. If none of the commands work, then you don't have any Lisp implementation installed, so you need to get one (any will do). If you know you have one of the mentioned implementations installed, figure out where it is and add that to PATH. Alternatively, tell configure where it is using --with-= Ray From raymond.toy at ericsson.com Fri Jan 5 17:39:59 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 05 Jan 2007 18:39:59 -0500 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: (Neilen Marais's message of "Sat, 06 Jan 2007 01:10:07 +0200") References: Message-ID: >>>>> "Neilen" == Neilen Marais writes: Neilen> Hi Neilen> I get the following problem: Neilen> (%i8) Neilen> integrate(%i*sin((34037595938027*x3)/6154596958582590-(863833069661327*x2)/ Neilen> 6222711301569210-(863833069661327*x1)/6222711301569210-, Neilen> 99614657/338602740)*x3,x3); Neilen> Exponent out of range Neilen> I tried reducing the error: Neilen> (%i9) integrate(%i*sin(34037595938027*x3)*x3, x3); Neilen> but had to interrupt it since it seemed to take forever. I found that Neilen> the integration time is dependent on the size of the constant in the Neilen> expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, Neilen> integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. I can't help with this problem, but the error comes from the fact that maxima is expecting fixnum arithmetic but the numbers aren't fixnums for some reason. The other issue comes from the Risch integrator which is what integrate uses for simplified integral. I don't know anything about how the Risch integrator works. Ray From dlakelan at street-artists.org Fri Jan 5 17:51:45 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Fri, 5 Jan 2007 15:51:45 -0800 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: References: Message-ID: <20070105235145.GE25287@street-artists.org> On Sat, Jan 06, 2007 at 01:10:07AM +0200, Neilen Marais wrote: > Hi > > I get the following problem: > > I tried reducing the error: > > (%i9) integrate(%i*sin(34037595938027*x3)*x3, x3); > > but had to interrupt it since it seemed to take forever. I found that > the integration time is dependent on the size of the constant in the > expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, > integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. This executes in no time flat for me on windows stock maxima 5.10.0 in GCL. ****** It also gives a wrong answer!!! ****** (%i1) integrate(%i*sin(34037595938027*x3)*x3, x3); %i (sin(2 x3) - 2 x3 cos(2 x3)) (%o1) ------------------------------- 4 (%i2) diff(%,x3); (%o2) %i x3 sin(2 x3) -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From sen1 at math.msu.edu Fri Jan 5 20:04:45 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Fri, 5 Jan 2007 21:04:45 -0500 (EST) Subject: [Maxima] 5.11.0 won't compile with fasl format 72 Message-ID: Hi, I don't know if this is important, but I could not compile maxima-5.11.0 with the sbcl which is made for Fedora Core 6. sbcl-1.0.1-4.fc6 There are no problems with gcl, cmucl, or clisp. Here are the error messages debugger invoked on a SIMPLE-ERROR: Error during processing of --eval option "(progn (load \"../lisp-utils/defsystem.lisp\") (funcall (intern (symbol-name :operate-on-system) :mk) \"maxima\" :compile :verbose t) (sb-ext:quit))": # is in native code fasl file format version 66, but this version of SBCL uses format version 72. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Ignore and continue with next --eval option. 1: [ABORT ] Skip rest of --eval options. 2: Skip to toplevel READ/EVAL/PRINT loop. 3: [QUIT ] Quit SBCL (calling #'QUIT, killing the process). ((LAMBDA (SB-IMPL::E)) #) Just as an aside. I used to run Fedora Core 4--no problems compiling maxima with clisp, sbcl, cmucl, or gcl. The old version of sbcl was sbcl-0.9.14-1.fc4.1. The MB on my old computer died and I bought one of these fancy new Intel Core 2 duo boxes. To get Fedora installed without a lot of hassles, it took upgrading to FC-6. Then, when trying to compile maxima, I ran into the above problems. -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From dlakelan at street-artists.org Fri Jan 5 20:23:43 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Fri, 5 Jan 2007 18:23:43 -0800 Subject: [Maxima] 5.11.0 won't compile with fasl format 72 In-Reply-To: References: Message-ID: <20070106022343.GA6841@localhost.localdomain> On Fri, Jan 05, 2007 at 09:04:45PM -0500, sen1 at math.msu.edu wrote: > The MB on my old computer died and I bought one of these fancy new Intel Core > 2 duo boxes. To get Fedora installed without a lot of hassles, it > took upgrading to FC-6. Then, when trying to compile maxima, I ran > into the above problems. Looks to me like old versions of fasl files are lying around from the old install of sbcl. Sbcl has upgraded their fasl file format, and can't load the old ones. The offending package is the nregex package which isn't part of maxima. I'd say uninstall sbcl and reinstall it. If that doesn't work, you may have to clean up all the fasl files by hand or uninstall and reinstall nregex at least. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From dlakelan at street-artists.org Fri Jan 5 20:31:51 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Fri, 5 Jan 2007 18:31:51 -0800 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: <20070105235145.GE25287@street-artists.org> References: <20070105235145.GE25287@street-artists.org> Message-ID: <20070106023151.GB6841@localhost.localdomain> On Fri, Jan 05, 2007 at 03:51:45PM -0800, Daniel Lakeland wrote: > On Sat, Jan 06, 2007 at 01:10:07AM +0200, Neilen Marais wrote: > > Hi > > > > I get the following problem: > > > > > I tried reducing the error: > > > > (%i9) integrate(%i*sin(34037595938027*x3)*x3, x3); > > > > but had to interrupt it since it seemed to take forever. I found that > > the integration time is dependent on the size of the constant in the > > expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, > > integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. > > This executes in no time flat for me on windows stock maxima 5.10.0 in > GCL. > > ****** It also gives a wrong answer!!! ****** > The debian package 5.10.0-6 on amd64 has the same hanging behavior that you see rather than the fast wrong answer. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From dlakelan at street-artists.org Fri Jan 5 20:35:42 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Fri, 5 Jan 2007 18:35:42 -0800 Subject: [Maxima] 5.11.0 won't compile with fasl format 72 In-Reply-To: <20070106022343.GA6841@localhost.localdomain> References: <20070106022343.GA6841@localhost.localdomain> Message-ID: <20070106023542.GC6841@localhost.localdomain> On Fri, Jan 05, 2007 at 06:23:43PM -0800, Daniel Lakeland wrote: > On Fri, Jan 05, 2007 at 09:04:45PM -0500, sen1 at math.msu.edu wrote: > can't load the old ones. The offending package is the nregex package > which isn't part of maxima. whoops, should have looked more carefully at the error message. it's the nregex that is included with maxima.. you could try find /usr/local -name "*.fasl" | less now check that the appropriate file list is coming out of the find command, then find /usr/local -name "*.fasl" | xargs rm to get rid of them. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From David.Billinghurst at riotinto.com Fri Jan 5 20:57:36 2007 From: David.Billinghurst at riotinto.com (Billinghurst, David (RTATECH)) Date: Sat, 6 Jan 2007 13:57:36 +1100 Subject: [Maxima] romberg-- replacement for bigfloat romberg Message-ID: <026DCC31AB859648A6F16C0E5CD2580D736BEE@calttsv025.cal.riotinto.org> > From: Raymond Toy > > Although not directly applicable to either a or b, I've wanted to add > some classes to support double, bfloat, and complex bfloat > operations. > Right now, I find it a pain to do bfloat stuff in Lisp, especially if > you want to operate on complex numbers. I started working on some complex bigfloat stuff this time last year, http://www.math.utexas.edu/pipermail/maxima/2006/000100.html Richard Fateman provided some feedback, http://www.math.utexas.edu/pipermail/maxima/2006/000102.html I started looking at generic arithmetic and put together a working prototype, then life got busy again. Only last night I was thinking that I should finish this job off. I'll dig up the previous work and post it for comment. David NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. From robert.dodier at gmail.com Fri Jan 5 21:12:26 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 5 Jan 2007 20:12:26 -0700 Subject: [Maxima] 5.11.0 won't compile with fasl format 72 In-Reply-To: References: Message-ID: On 1/5/07, sen1 at math.msu.edu wrote: > # /usr/local/src/maxima/src/binary-sbcl/nregex.fasl" {AB3E2F9}> > is in native code fasl file format version 66, but this version of > SBCL uses > format version 72. I'm pretty sure this means you need to execute "make clean" (which should remove the old fasls) and then "make" again. hope this helps Robert From Harald.Geyer at gmx.at Fri Jan 5 21:53:48 2007 From: Harald.Geyer at gmx.at (Harald Geyer) Date: Sat, 06 Jan 2007 04:53:48 +0100 Subject: [Maxima] Question: invoking levin by default In-Reply-To: <459E68BD.6080304@uhasselt.be> References: <010301c730d8$7cb22f70$230110ac@RJFE510> <459E68BD.6080304@uhasselt.be> Message-ID: > > How about this: use "nsum" instead of "sum" (Mathematica uses NSum vs > > Sum). > > > Yes this could be a good idea. > > Or do this: > > > > Simpsum:Levin, as a third option, other than true and false. > > > This I don't really like. Numerical evaluation is not the same as > simplification. But in maxima those two things are strongly related. numer actually is a simplifier flag: (%i1) simp:false; (%o1) false (%i2) sin(1), numer; (%o2) sin(1) (%i3) sin(1), numer,simp; (%o3) .8414709848078965 When I noticed this first, while playing with simplification vs. evaluation, I was quite puzzled, but I think now I see why this actually is a job for the simplifier. I guess somebody should write a book about maxima, which handles such concepts in detail... Regards, Harald From toy.raymond at gmail.com Fri Jan 5 22:03:25 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 05 Jan 2007 23:03:25 -0500 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: <20070106023151.GB6841@localhost.localdomain> References: <20070105235145.GE25287@street-artists.org> <20070106023151.GB6841@localhost.localdomain> Message-ID: <459F1F8D.2060506@gmail.com> Daniel Lakeland wrote: > On Fri, Jan 05, 2007 at 03:51:45PM -0800, Daniel Lakeland wrote: > >> On Sat, Jan 06, 2007 at 01:10:07AM +0200, Neilen Marais wrote: >> >>> Hi >>> >>> I get the following problem: >>> >>> >>> I tried reducing the error: >>> >>> (%i9) integrate(%i*sin(34037595938027*x3)*x3, x3); >>> >>> but had to interrupt it since it seemed to take forever. I found that >>> the integration time is dependent on the size of the constant in the >>> expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, >>> integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. >>> >> This executes in no time flat for me on windows stock maxima 5.10.0 in >> GCL. >> >> ****** It also gives a wrong answer!!! ****** >> >> > > The debian package 5.10.0-6 on amd64 has the same hanging behavior > that you see rather than the fast wrong answer. > > I don't know the real reason, but I suspect it's caused by compiling the code with safety low enough that gcl doesn't check to see if the result of multiplication is a fixnum. At least that's the case with clisp and cmucl. For amd64, I assume most-positive-fixnum is close to 64 bits instead of 32, so issue isn't reached, at least as quickly. Ray From Daniel.L.Solomon at nasa.gov Fri Jan 5 22:21:50 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Fri, 5 Jan 2007 23:21:50 -0500 Subject: [Maxima] stuck with vectors In-Reply-To: References: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov> Message-ID: <149B5660-F3BA-419A-B57A-1E56D8002AE6@nasa.gov> This helped - Thanks! But here's a follow up question: when I substituted #s for x, expand (''mm); gave a one by one matrix, which seems a little weird: matrix([a polynomial in the parameters]) then I substituted #s for the parameters, and expand(''mm); gave a number without any brackets. Next I divided xprime by sqrt(mm) to get a unit tangent vector T:xprime/sqrt(mm); which returns the vector expression for xprime divided by the big mess for mm Then issuing ''T; to substitute for everything, responds with an error message: FULLMAP found arguments with incompatible structure. On Jan 5, 2007, at 4:42 PM, Barton Willis wrote: > -----maxima-bounces at math.utexas.edu wrote: ----- > >> First question: should I declare x somehow to be >> a vector, or does the next line do so by using x[1], x[2], x[3]? > > There is no need to declare x to be a vector. Maxima doesn't > have a vector data structure---just lists, matrices, and arrays. > >> xprime:(1+RR) * (1-RR) . P1 + (1+RR) . P2 + 2 * >> (1-RR) * SQ . matrix ([x[1]],[x[2]],[x[3]]); > > I think you used "." twice for scalar times column vector. > Instead of "." (non commutative multiplication), you need "*" > (commutative multiplication). Something like: > > (1+RR) * (1-RR) * P1 + (1+RR) . P2 + 2 * (1-RR) * SQ * matrix > ([x[1]],[x[2]],[x[3]]); > > After that, expand will expand 'mm' into a (giant) scalar. > > Barton > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From robert.dodier at gmail.com Fri Jan 5 22:38:28 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 5 Jan 2007 21:38:28 -0700 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: <20070105235145.GE25287@street-artists.org> References: <20070105235145.GE25287@street-artists.org> Message-ID: On 1/5/07, Daniel Lakeland wrote: > > but had to interrupt it since it seemed to take forever. I found that > > the integration time is dependent on the size of the constant in the > > expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, > > integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. > > This executes in no time flat for me on windows stock maxima 5.10.0 in > GCL. > > ****** It also gives a wrong answer!!! ****** > > > (%i1) integrate(%i*sin(34037595938027*x3)*x3, x3); > %i (sin(2 x3) - 2 x3 cos(2 x3)) > (%o1) ------------------------------- > 4 I'll make a guess that's because a fixnum has overflowed and GCL didn't notice it. In integrate(sin(N*x)*x, x) with values of N < 2^31, integrate takes a long time. With N > 2^31, integrate returns immediately with an incorrect answer. The message 'Exponent out of range' comes from PCOEFADD in src/rat3a.lisp. There are several variables declared fixnum there and I guess it would help to cut out those declarations, but I think it won't solve this problem: it looks like PCOEFADD is called with N, N - 1, N - 2, N - 3, .... I don't know what is supposed to be computed in that loop, but whatever it is, it won't work for really large N. With symbolic N integrate returns (sin(x*N)-x*N*cos(x*N))/N^2 right away. I guess this is a case in which Maxima knows the general solution but fails on a special case; I'm pretty sure other examples have been observed. If this is common enough we might consider a heuristic such as replacing constants with symbols and trying to solve that. Just a thought. Hope this helps, Robert From dlakelan at street-artists.org Fri Jan 5 22:47:25 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Fri, 5 Jan 2007 20:47:25 -0800 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: References: <20070105235145.GE25287@street-artists.org> Message-ID: <20070106044725.GF25287@street-artists.org> On Fri, Jan 05, 2007 at 09:38:28PM -0700, Robert Dodier wrote: > > I'll make a guess that's because a fixnum has overflowed and GCL > didn't notice it. I think you're right. And to add to this information, apparently even on amd64 architecture GCL uses fixnums that are 31 bits: (%i1) :lisp most-positive-fixnum 2147483647 this from GCL package from amd64 debian. It doesn't bother me as much that GCL on linux takes forever as it does that on windows it returns a wrong answer immediately. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From fateman at cs.berkeley.edu Fri Jan 5 23:05:51 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Fri, 5 Jan 2007 21:05:51 -0800 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: Message-ID: <000001c73150$572a4080$05d09888@RJFE510> There is a question as to whether you want to slow maxima down to allow for the case that a polynomial in rational form will have a maximum degree of more than 2^31 (or whatever the boundary is between fixnum and arbitrary precision). Presumably the declarations don't have to do with the coefficients, but with the exponents. The particular bug here is presumably provoked by a bad algorithm that converts sin(n*x) into a polynomial of degree n. (in exp(%i*x) presumably). The Risch algorithm, which should not be called here, is apparently being called. It would perhaps not happen if %i were not there. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Robert Dodier > Sent: Friday, January 05, 2007 8:38 PM > To: Daniel Lakeland > Cc: Maxima Mailing List > Subject: Re: [Maxima] integrating trig functions with large > constants,exponent out of range > > On 1/5/07, Daniel Lakeland wrote: > > > > but had to interrupt it since it seemed to take forever. I found that > > > the integration time is dependent on the size of the constant in the > > > expression. integrate(%i*sin((3*x3))*x3, x3) happens fast, > > > integrate(%i*sin((30000*x3))*x3, x3) takes several seconds etc. > > > > This executes in no time flat for me on windows stock maxima 5.10.0 in > > GCL. > > > > ****** It also gives a wrong answer!!! ****** > > > > > > (%i1) integrate(%i*sin(34037595938027*x3)*x3, x3); > > %i (sin(2 x3) - 2 x3 cos(2 x3)) > > (%o1) ------------------------------- > > 4 > > I'll make a guess that's because a fixnum has overflowed and GCL > didn't notice it. > > In integrate(sin(N*x)*x, x) with values of N < 2^31, integrate takes > a long time. With N > 2^31, integrate returns immediately with an > incorrect answer. > > The message 'Exponent out of range' comes from PCOEFADD > in src/rat3a.lisp. There are several variables declared fixnum there > and I guess it would help to cut out those declarations, but I think > it won't solve this problem: it looks like PCOEFADD is called > with N, N - 1, N - 2, N - 3, .... I don't know what is supposed to be > computed in that loop, but whatever it is, it won't work for really > large N. > > With symbolic N integrate returns (sin(x*N)-x*N*cos(x*N))/N^2 > right away. I guess this is a case in which Maxima knows the > general solution but fails on a special case; I'm pretty sure > other examples have been observed. If this is common enough > we might consider a heuristic such as replacing constants with > symbols and trying to solve that. Just a thought. > > Hope this helps, > Robert > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From navneethc at gmail.com Sat Jan 6 01:11:40 2007 From: navneethc at gmail.com (Navneeth Chandrasekaran) Date: Sat, 6 Jan 2007 12:41:40 +0530 Subject: [Maxima] Ubuntu 6.10/Lisp In-Reply-To: References: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> Message-ID: <6b9bff50701052311m1e50f925o7ca0e8bd6d71a4a7@mail.gmail.com> Thank you very much for the responses. I installed clisp, since the download size was nearly a tenth of gcl's. The installation was done without a problem. I tried out some basic commands from the CLI and they worked, but I wasn't able to plot graphs. I get "/bin/dash: gnuplot: not found ". Should I install gnuplot from gnuplot site? Also, can I get a separate window for maxima, like it is in Windows. When I type "maxima" in the terminal, it opens in the terminal. Navneeth On 06/01/07, Raymond Toy wrote: > > >>>>> "Navneeth" == Navneeth Chandrasekaran writes: > > Navneeth> 1. (*) text/plain ( ) text/html > Navneeth> Hi, > Navneeth> I was in the process of compiling Maxima 5.11.0 from > source in Ubuntu > Navneeth> Edgy. After I typed ./configure, I saw this message at the > end of a list of > Navneeth> true's and false's. > > Navneeth> configure: error: No lisp implementation specified and none > of the default > >> executables > >> > clisp(clisp),gcl(GCL),lisp(CMUCL),scl(SCL),sbcl(SBCL),lisp(ACL),openmcl(OpenMCL) > > >> were found in PATH > > Given this error message, I would first go check to see if typing > clisp, gcl, lisp, scl, etc. actually does something other than give an > command not found. If none of the commands work, then you don't have > any Lisp implementation installed, so you need to get one (any will > do). > > If you know you have one of the mentioned implementations installed, > figure out where it is and add that to PATH. Alternatively, tell > configure where it is using --with-= > > Ray > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070106/465efa24/attachment.htm From toy.raymond at gmail.com Sat Jan 6 07:49:04 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Sat, 06 Jan 2007 08:49:04 -0500 Subject: [Maxima] Ubuntu 6.10/Lisp In-Reply-To: <6b9bff50701052311m1e50f925o7ca0e8bd6d71a4a7@mail.gmail.com> References: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> <6b9bff50701052311m1e50f925o7ca0e8bd6d71a4a7@mail.gmail.com> Message-ID: <459FA8D0.4050304@gmail.com> Navneeth Chandrasekaran wrote: > Thank you very much for the responses. I installed clisp, since the > download size was nearly a tenth of gcl's. The installation was done > without a problem. I tried out some basic commands from the CLI and > they worked, but I wasn't able to plot graphs. I get "/bin/dash: > gnuplot: not found > ". Should I install gnuplot from gnuplot site? > Yes, you need to install some version of gnuplot. > Also, can I get a separate window for maxima, like it is in Windows. > When I type "maxima" in the terminal, it opens in the terminal. I think xmaxima will give you a window. I don't think I've ever used that. Ray From edmond.orignac at wanadoo.fr Sat Jan 6 07:51:56 2007 From: edmond.orignac at wanadoo.fr (Edmond Orignac) Date: Sat, 06 Jan 2007 14:51:56 +0100 Subject: [Maxima] Heun and Appell functions Message-ID: <1168091516.3008.12.camel@sashimi> Hello, I have tried to write some maxima functions to reduce the Heun function and the Appell F1 hypergeometric function of two variables to simpler expressions, similar to what the hgfred function does with pFq hypergeometric functions. These two functions are included below as attachments. They seem to give correct results for the limited tests I did, but I am unsure that they are able to detect an incorrect input and that they will not fail to detect some possible simplifications. I would like to know if a similar package already exists for Maxima, and if not whether these functions with appropriate corrections can be put at the disposition of Maxima users via some repository. Sincerely, E. Orignac -------------- next part -------------- appellf1red(a,b,c,d,x,y):=block([], /* We reduce the Appell hypergeometric functions of 2 variables to simpler functions of one variable using the identities listed in http://functions.wolfram.com or the original paper of Paul Appell */ if x = 0 then hgfred([a,c],[d],y) else if y=0 then hgfred([a,b],[d],x) else if x=1 then hgfred([a,b],[d],1)*hgfred([a,c],[d-b],y) else if y=1 then hgfred([a,c],[d],1)*hgfred([a,b],[d-c],x) else if (x=y) then hgfred([a,b+c],[d],x) else if (x=-y and b=c) then hgfred([(a+1)/2,a/2,b],[(d+1)/2,d/2],x**2) else if (d=b+c) then (1-y)^(-a)*hgfred([a,b],[d],(x-y)/(1-y)) /* Some identities with elliptic functions are not included due to G&R's definition not being in accordance with A&S' definition */ /* Identity from Ismail and Pitman, Can. J. Math. 52 p. 961 (2000) */ else if (b=c and d=2*a and x*y=x+y and(abs(x)<1/2 or abs(y)<1/2)) then hgfred([a,b],[a+1/2],x*y/4) /* Identity from Ira Gessel, quoted in Ismail and Pitman op. cit. */ else if (d=2*a and b=c and b=a+1/2 and abs(x)<1 and abs(y)<1) then 1/2*(1+1/(sqrt(1-y)*sqrt(1-z)))*(2/(sqrt(1-y)+sqrt(1-z)))^(2*a) else appell_f1([a],[b,c],[d],x,y) ); /* Source hep-ph/9511322 Eqs. (B.1) to (B.6) */ appellf3red(a,a1,b,b1,c,x,y):=block([], if (x=0) then return(hgfred([a1,b1],[c],y)), if (y=0) then return(hgfred([a1,b1],[c],y)), if (a+a1=c) then return(appellf1red(a,b,b1,c,x,y/(y-1))/(1-y)^b1), return(appell_f3([a,a1],[b,b1],[c],x,y)))$ -------------- next part -------------- /* Source of identities for Heun's function: G. Valent, math-ph/0512006 */ heun_red(l1,l2,w):=block([rho,r,k2,s,a,b,c,d], if (not(listp(l1)) or not(listp(l2))) then return(false), print (l1), print (l2), if ((length(l1)#2) or (length(l2)#4)) then return(false), k2:first(l1), s:last(l1), a:first(l2), b:second(l2), c:third(l2), d:fourth(l2), print (k2), print (s), rho:(c+d-1)/2, if (k2=0) then return(hgfred([rho+sqrt(rho^2+s),rho-sqrt(rho^2+s)],[c],w)), rho:(c-a-b)/2, r:rho-sqrt(rho^2-a*b-s), if (k2=1) then return(hgfred([r+a,r+b],[c],w)), if ((k2=-1) and (s=0) and ((a+b+1)=(d+2*c))) then return(hgfred([a,b],[c],w^2)), if ((k2=1/2) and ((a*b)=(-2*s)) and (d=(1+a+b-2*c))) then return(hgfred([a,b],[c],w*(2-w))), if ((k2=2) and (s=(-a*b)) and (c=d)) then return(hgfred([a,b],[c],4*w*(1-w))), if ((k2=1/4) and (s=(-a*b/4)) and (c=1/2) and (d=2*(a+b)/3)) then return (hgfred([a,b],[1/2],w*(3-w)^2/4)), if ((k2=1/2) and (s=(-a*b/2)) and (c=((a+b)/4+1/2)) and (d=(a+b)/2)) then return(hgfred([a,b],[a+b+1/2],4*w*(2-w)*(1-w)^2)), if ((k=1/4) and (s=-1/8) and (a=1/2) and (b=1/2) and (c=1) and (d=1/2)) then return(sqrt(sqrt(4-w)-sqrt(1-w))*hgfred([1/2,1/2],[1],(2-w*sqrt(4-w)-(2-w)*sqrt(1-w)))), /* Carlitz solutions */ return(heun_hn([k2,s],[a,b,c,d],w)) )$ From navneethc at gmail.com Sat Jan 6 08:29:12 2007 From: navneethc at gmail.com (Navneeth Chandrasekaran) Date: Sat, 6 Jan 2007 19:59:12 +0530 Subject: [Maxima] Ubuntu 6.10/Lisp In-Reply-To: <459FA8D0.4050304@gmail.com> References: <6b9bff50701051318w5f21fbfeuba6b5742d026709@mail.gmail.com> <6b9bff50701052311m1e50f925o7ca0e8bd6d71a4a7@mail.gmail.com> <459FA8D0.4050304@gmail.com> Message-ID: <6b9bff50701060629q70fbffcckd0db1fe1ad0b135a@mail.gmail.com> Thank you, once again. You've been very helpful. gnuplot is up and running. :-) Navneeth On 06/01/07, Raymond Toy wrote: > > Navneeth Chandrasekaran wrote: > > Thank you very much for the responses. I installed clisp, since the > > download size was nearly a tenth of gcl's. The installation was done > > without a problem. I tried out some basic commands from the CLI and > > they worked, but I wasn't able to plot graphs. I get "/bin/dash: > > gnuplot: not found > > ". Should I install gnuplot from gnuplot site? > > > Yes, you need to install some version of gnuplot. > > Also, can I get a separate window for maxima, like it is in Windows. > > When I type "maxima" in the terminal, it opens in the terminal. > I think xmaxima will give you a window. I don't think I've ever used > that. > > Ray > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070106/b4353cd2/attachment.htm From willisb at unk.edu Sat Jan 6 08:37:13 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 6 Jan 2007 08:37:13 -0600 Subject: [Maxima] stuck with vectors In-Reply-To: <149B5660-F3BA-419A-B57A-1E56D8002AE6@nasa.gov> References: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov> , <149B5660-F3BA-419A-B57A-1E56D8002AE6@nasa.gov> Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >But here's a follow up question: when I >substituted #s for x, expand >(''mm); gave a one by one matrix, which seems a >little weird: What do you mean by 'substituted #s for x'? What command did you use? I understood this, maybe I'd be able to figure out your remaining questions. Barton From Daniel.L.Solomon at nasa.gov Sat Jan 6 08:55:18 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 6 Jan 2007 09:55:18 -0500 Subject: [Maxima] stuck with vectors In-Reply-To: References: <6F3F67F6-AED3-44B4-89EC-1BBE716820D2@ivv.nasa.gov> , <149B5660-F3BA-419A-B57A-1E56D8002AE6@nasa.gov> Message-ID: sorry. I used : x[1]:1;x[2]:2;x[3]:.5; expand(''mm); the result of which was matrix([a polynomial in the parameters sigma, rho, beta]) It's correct that it's a polynomial, but weird that it's a one by one matrix then picking values for the parameters sigma:5;rho:25;beta:3; expand(''mm); gives a pure number inside [ ], and it's not a matrix Thank you! On Jan 6, 2007, at 9:37 AM, Barton Willis wrote: > > -----maxima-bounces at math.utexas.edu wrote: ----- > > >> But here's a follow up question: when I >> substituted #s for x, expand >> (''mm); gave a one by one matrix, which seems a >> little weird: > > What do you mean by 'substituted #s for x'? What > command did you use? I understood this, maybe I'd > be able to figure out your remaining questions. > > Barton > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From willisb at unk.edu Sat Jan 6 09:49:02 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 6 Jan 2007 09:49:02 -0600 Subject: [Maxima] stuck with vectors In-Reply-To: Message-ID: This is what I got: (%i1) P1:matrix([(-sigma) * x[1]+sigma * x[2]],[rho * x[1]-x[2]],[(-beta) * x[3]])$ P2:matrix([0],[(-x[1]) * x[3]],[x[1] * x[2]])$ SQ: matrix([x[1]],[x[2]],[x[3]]) . matrix([sigma * x[1]],[x[2]],[beta * x[3]]) - (rho+sigma) * x[1] * x[2]$ RR:matrix([x[1]],[x[2]],[x[3]]) . matrix([x[1]],[x[2]],[x[3]]); xprime:(1+RR) * (1-RR) * P1 + (1+RR) * P2 + 2 * (1-RR) * SQ * matrix ([x[1]],[x[2]],[x[3]])$ mm: xprime . xprime$ x[1]:1;x[2]:2;x[3]:.5$ expand(''mm); (%i2) (%i3) (%i4) (%o4) x[3]^2+x[2]^2+x[1]^2 (%i5) (%i6) (%i7) (%o7) 1 (%o8) 2 (%i10) (%o10) 633.31640625*sigma^2-289.0*rho*sigma+36.125*beta*sigma+578.0*sigma+416.56640625*rho^2+72.25*beta*rho-1500.25*rho+ 171.8759765625*beta^2+187.53125*beta+1500.25 (%i11) sigma:5;rho:25;beta:3$ expand(''mm); (%o11) 5 (%o12) 25 (%i14) (%o14) 215016.0166015625 Notice that (%o10) and (%o14) are not 1 x 1 matrices. In the expression for xprime, did you change three dot operators to star operators? Barton maxima-bounces at math.utexas.edu wrote on 01/06/2007 08:55:18 AM: > sorry. I used : > > x[1]:1;x[2]:2;x[3]:.5; expand(''mm); > the result of which was > matrix([a polynomial in the parameters sigma, rho, beta]) > It's correct that it's a polynomial, but weird that it's a one by one > matrix > > then picking values for the parameters > sigma:5;rho:25;beta:3; expand(''mm); > gives a pure number inside [ ], and it's not a matrix > From g_gherdovich at yahoo.it Sat Jan 6 10:24:28 2007 From: g_gherdovich at yahoo.it (giovanni gherdovich) Date: Sat, 6 Jan 2007 17:24:28 +0100 (CET) Subject: [Maxima] I cannot load zeilberger package |||| nusum & Zeilberger Message-ID: <20070106162428.28736.qmail@web27211.mail.ukl.yahoo.com> Hello. I have two questions: 1) I cannot load the zeilberger package. Here is the Maxima session: ************************************************ (%i1) load(zeilberger); Could not find `zeilberger' using paths in file_search_maxima,file_search_lisp (combined values: [...]) -- an error. Quitting. To debug this try debugmode(true); ************************************************ But I'm able to normally load other packages from maxima/share/contrib: ************************************************ (%i2) load(distrib); (%o2) /usr/share/maxima/5.9.2/share/contrib/distrib/distrib.mac (%i3) load(plotdf); (%o3) /usr/share/maxima/5.9.2/share/contrib/plotdf.lisp (%i4) load(descriptive); (%o4) /usr/share/maxima/5.9.2/share/contrib/descriptive/descriptive.mac *********************************************** I run Maxima 5.9.2, got from the "Synaptic Manager" tool in Ubuntu Dapper Drake. I downloaded separately (from Ubuntu system) the maxima/share directory. How should I do? 2) I would like to know if the Zeilberger package uses the command "nusum" when it performs the Gosper Algorithm. Regards, Giovanni Gherdovich __________________________________________________ Do You Yahoo!? Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi http://mail.yahoo.it From andrej.vodopivec at gmail.com Sat Jan 6 10:57:03 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sat, 6 Jan 2007 17:57:03 +0100 Subject: [Maxima] I cannot load zeilberger package |||| nusum & Zeilberger In-Reply-To: <20070106162428.28736.qmail@web27211.mail.ukl.yahoo.com> References: <20070106162428.28736.qmail@web27211.mail.ukl.yahoo.com> Message-ID: <7775b21a0701060857n1b5dd820ub3f6a4ba9096d6ce@mail.gmail.com> On 1/6/07, giovanni gherdovich wrote: > Hello. > > I have two questions: > > 1) I cannot load the zeilberger package. Here is the > Maxima session: > > How should I do? You can try with load("Zeilberger/zeilberger.mac") and if that does not work, upgrade maxima to 5.11. > 2) I would like to know if the Zeilberger package > uses the command "nusum" when it performs the Gosper > Algorithm. Zeilberger has its own implementation of Gosper algorithm. You can use it directly with GosperSum. Zeilberger will use the Gosper algorithm if gosper_in_zeilberger is set to true (which is the default). Andrej From michel.vandenbergh at uhasselt.be Sat Jan 6 11:14:59 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 06 Jan 2007 18:14:59 +0100 Subject: [Maxima] I cannot load zeilberger package |||| nusum & Zeilberger References: 20070106162428.28736.qmail@web27211.mail.ukl.yahoo.com Message-ID: <459FD913.1000805@uhasselt.be> > > Zeilberger has its own implementation of Gosper algorithm. You can use > it directly with GosperSum. Zeilberger will use the Gosper algorithm > if gosper_in_zeilberger is set to true (which is the default). > Don't forget that GosperSum included with Zeilberger has some bad bugs. Try GosperSum(-1/(n*(n+1)),n,1,k); and GosperSum(1/(n*(n+1)),n,1,k); Michel From robert.dodier at gmail.com Sat Jan 6 11:18:02 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 6 Jan 2007 10:18:02 -0700 Subject: [Maxima] I cannot load zeilberger package |||| nusum & Zeilberger In-Reply-To: <20070106162428.28736.qmail@web27211.mail.ukl.yahoo.com> References: <20070106162428.28736.qmail@web27211.mail.ukl.yahoo.com> Message-ID: On 1/6/07, giovanni gherdovich wrote: > I run Maxima 5.9.2, got from the "Synaptic Manager" > tool in Ubuntu Dapper Drake. I downloaded separately > (from Ubuntu system) the maxima/share directory. > How should I do? Try this: file_search_maxima : append (["/usr/share/maxima/.../share/contrib/Zeilberger"], file_search_maxima); load(LOADZeilberger); For the "/usr/share/maxima/..." you will have to put whatever precedes share/contrib/Zeilberger on your system. I recommend pretty strongly that you try to get a newer version of Maxima -- there have been many improvements since 5.9.2. > 2) I would like to know if the Zeilberger package > uses the command "nusum" when it performs the Gosper > Algorithm. No, the Zeilberger package has its own implementation of the Gosper algorithm, it doesn't call nusum. Hope this helps Robert Dodier From michel.vandenbergh at uhasselt.be Sat Jan 6 11:28:16 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 06 Jan 2007 18:28:16 +0100 Subject: [Maxima] I cannot load zeilberger package |||| nusum & Zeilberger Message-ID: <459FDC30.6030800@uhasselt.be> I wrote > Don't forget that GosperSum included with Zeilberger has some bad bugs. Try > > GosperSum(-1/(n*(n+1)),n,1,k); > > and > > GosperSum(1/(n*(n+1)),n,1,k); This bug is probably easy to fix. The error message comes form the fuction shiftQuoHypCheckAux in the file zeilberger/shiftQuotient.mac. This checks for all possible operators in a certain expression and does something. It checks for "+" but forgets to check for "-". Somebody who is slightly familiar with the Gosper algorithm can probably figure out how to correct this. Michel From michel.vandenbergh at uhasselt.be Sat Jan 6 11:39:07 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 06 Jan 2007 18:39:07 +0100 Subject: [Maxima] Bugfix for GosperSum? (was: cannot load Zeilberger) Message-ID: <459FDEBB.90501@uhasselt.be> Blindly changing if op(expr) = "+" then into if op(expr) = "+" or op(expr)="-" then near the end of the function shiftQuoHypCheckAux(expr,k,hyp_flag) in zeilberger/shiftQuotient.mac seems to fix this bug. I didn't do much testing. Are there any regression tests around for zeilberger? Michel From andrej.vodopivec at gmail.com Sat Jan 6 12:02:17 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sat, 6 Jan 2007 19:02:17 +0100 Subject: [Maxima] Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <459FDEBB.90501@uhasselt.be> References: <459FDEBB.90501@uhasselt.be> Message-ID: <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> On 1/6/07, Michel Van den Bergh wrote: > Blindly changing > > if op(expr) = "+" then > > into > > if op(expr) = "+" or op(expr)="-" then This alone is not enough. It still fails for -n*n!. A better fix is probably to add another if statment: if op(expr)="-" then return(shiftQuoAuxHypCheck(-expr, k, hyp_flag)) This will work for -n*n! also. Andrej From Daniel.L.Solomon at nasa.gov Sat Jan 6 12:33:58 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 6 Jan 2007 13:33:58 -0500 Subject: [Maxima] stuck with vectors In-Reply-To: References: Message-ID: <47267BB1-85CF-47F2-B35E-A2953790021F@nasa.gov> Thank you thank you thank you! I've been stuck on this for two weeks. I had the same input, but got the matrix([]) business. I looked carefully again at my input and removed a statement (at the beginning) declaring x to be non-scalar. reran it, and bingo. Subsequent stuff works, too, now - it had been crashing when I tried to compute the matrix d/dx of (xprime/sqrt(mm)); presumably because it didn't think xprime/sqrt(mm) was a 3-vector. Not sure what was wrong with declaring x to be non-scalar, but as I say it works now. On Jan 6, 2007, at 10:49 AM, Barton Willis wrote: > This is what I got: > > (%i1) P1:matrix([(-sigma) * x[1]+sigma * x[2]],[rho * x[1]-x[2]],[(- > beta) > * > x[3]])$ > > P2:matrix([0],[(-x[1]) * x[3]],[x[1] * x[2]])$ > > SQ: matrix([x[1]],[x[2]],[x[3]]) . matrix([sigma * x[1]],[x[2]],[beta > * x[3]]) - (rho+sigma) * x[1] * x[2]$ > > RR:matrix([x[1]],[x[2]],[x[3]]) . matrix([x[1]],[x[2]],[x[3]]); > > xprime:(1+RR) * (1-RR) * P1 + (1+RR) * P2 + 2 * (1-RR) * SQ * matrix > ([x[1]],[x[2]],[x[3]])$ > > mm: xprime . xprime$ > > x[1]:1;x[2]:2;x[3]:.5$ > expand(''mm); > (%i2) > (%i3) > (%i4) > (%o4) x[3]^2+x[2]^2+x[1]^2 > (%i5) > (%i6) > (%i7) > (%o7) 1 > (%o8) 2 > (%i10) > (%o10) > 633.31640625*sigma^2-289.0*rho*sigma+36.125*beta*sigma+578.0*sigma > +416.56640625*rho^2+72.25*beta*rho-1500.25*rho+ > 171.8759765625*beta^2+187.53125*beta+1500.25 > (%i11) sigma:5;rho:25;beta:3$ > expand(''mm); > (%o11) 5 > (%o12) 25 > (%i14) > (%o14) 215016.0166015625 > > Notice that (%o10) and (%o14) are not 1 x 1 matrices. In the > expression > for xprime, did you change > three dot operators to star operators? > > Barton > > maxima-bounces at math.utexas.edu wrote on 01/06/2007 08:55:18 AM: > >> sorry. I used : >> >> x[1]:1;x[2]:2;x[3]:.5; expand(''mm); >> the result of which was >> matrix([a polynomial in the parameters sigma, rho, beta]) >> It's correct that it's a polynomial, but weird that it's a one by one >> matrix >> >> then picking values for the parameters >> sigma:5;rho:25;beta:3; expand(''mm); >> gives a pure number inside [ ], and it's not a matrix >> > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From willisb at unk.edu Sat Jan 6 13:06:25 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 6 Jan 2007 13:06:25 -0600 Subject: [Maxima] stuck with vectors In-Reply-To: <47267BB1-85CF-47F2-B35E-A2953790021F@nasa.gov> References: , <47267BB1-85CF-47F2-B35E-A2953790021F@nasa.gov> Message-ID: Glad to help. It's too cold in my office to figure out why declaring x non-scalar caused a problem. Barton From michel.vandenbergh at uhasselt.be Sat Jan 6 13:13:55 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 06 Jan 2007 20:13:55 +0100 Subject: [Maxima] Bugfix for GosperSum? (was: cannot load Zeilberger) References: 459FDEBB.90501@uhasselt.be Message-ID: <459FF4F3.9010309@uhasselt.be> > >/ Blindly changing > />/ > />/ if op(expr) = "+" then > />/ > />/ into > />/ > />/ if op(expr) = "+" or op(expr)="-" then > / > This alone is not enough. It still fails for -n*n!. Hmm true > A better fix is > probably to add another if statment: > > if op(expr)="-" then > return(shiftQuoAuxHypCheck(-expr, k, hyp_flag)) > You mean another else if? I still get AntiDifference(-k*k!,k); - k k! is not hypergeometric in k Michel From andrej.vodopivec at gmail.com Sat Jan 6 15:34:50 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sat, 6 Jan 2007 22:34:50 +0100 Subject: [Maxima] Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <459FF4F3.9010309@uhasselt.be> References: <459FF4F3.9010309@uhasselt.be> Message-ID: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> On 1/6/07, Michel Van den Bergh wrote: > > > >/ Blindly changing > > />/ > > />/ if op(expr) = "+" then > > />/ > > />/ into > > />/ > > />/ if op(expr) = "+" or op(expr)="-" then > > / > > This alone is not enough. It still fails for -n*n!. > Hmm true > > > A better fix is > > probably to add another if statment: > > > > if op(expr)="-" then > > return(shiftQuoAuxHypCheck(-expr, k, hyp_flag)) > > > You mean another else if? I still get > > AntiDifference(-k*k!,k); > - k k! is not hypergeometric in k Yes, another else if. The correct result is -k!. Andrej From fateman at cs.berkeley.edu Sat Jan 6 16:19:14 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sat, 6 Jan 2007 14:19:14 -0800 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> Message-ID: <003c01c731e0$b3aa5b70$05d09888@RJFE510> I don't know what you are really trying to test for, but op(expr)="-" means either the expression is a negative number like -3, or perhaps -x, or perhaps something like -a*b*c. So what you are really determining is if expr is a negative number or a product with a negative constant e.g. -1 out front. Note that op(a-b) is +. Also, be aware that op() takes a fair amount of time and space, since it formats its argument. For op(a/b) to return //, it must first convert ((MTIMES SIMP) $A ((MEXPT SIMP) $B -1)) To ((MQUOTIENT) $A $B) Which is done by the lisp program nformat. A much faster programming technique, which does not require reformatting the expression argument, is to use inpart. Thus a program might look like this: If atom(expr) then xxxx else block([op=inpart(expr,0)], if op="+" then yyy else if op="*" A neater way of doing this would be with a case statement, e.g. Else case(inpart(expr,0), ["+", yyy], ["*", zzz], [otherwise, ...]) Macsyma has a case statement. Maxima could have one too. It takes about 5 lines of code using buildq, I think. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Andrej Vodopivec > Sent: Saturday, January 06, 2007 1:35 PM > To: Michel Van den Bergh > Cc: maxima at math.utexas.edu > Subject: Re: [Maxima] Bugfix for GosperSum? (was: cannot load Zeilberger) > > On 1/6/07, Michel Van den Bergh wrote: > > > > > >/ Blindly changing > > > />/ > > > />/ if op(expr) = "+" then > > > />/ > > > />/ into > > > />/ > > > />/ if op(expr) = "+" or op(expr)="-" then > > > / > > > This alone is not enough. It still fails for -n*n!. > > Hmm true > > > > > A better fix is > > > probably to add another if statment: > > > > > > if op(expr)="-" then > > > return(shiftQuoAuxHypCheck(-expr, k, hyp_flag)) > > > > > You mean another else if? I still get > > > > AntiDifference(-k*k!,k); > > - k k! is not hypergeometric in k > > Yes, another else if. The correct result is -k!. > > Andrej > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Sat Jan 6 16:33:50 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 06 Jan 2007 23:33:50 +0100 Subject: [Maxima] Bugfix for GosperSum? In-Reply-To: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> References: <459FF4F3.9010309@uhasselt.be> <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> Message-ID: <45A023CE.1020900@uhasselt.be> >> >> You mean another else if? I still get >> >> AntiDifference(-k*k!,k); >> - k k! is not hypergeometric in k > > > Yes, another else if. The correct result is -k!. > > Andrej Yes but with this change I still get - k k! is not hypergeometric in k So either I misunderstand you or your fix is not working. Michel From andrej.vodopivec at gmail.com Sat Jan 6 16:59:02 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sat, 6 Jan 2007 23:59:02 +0100 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <003c01c731e0$b3aa5b70$05d09888@RJFE510> References: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> <003c01c731e0$b3aa5b70$05d09888@RJFE510> Message-ID: <7775b21a0701061459u262a29fdhc496548e38a5cf43@mail.gmail.com> On 1/6/07, Richard Fateman wrote: > I don't know what you are really trying to test for, but op(expr)="-" means > either the expression is a negative number like -3, or perhaps -x, or > perhaps something like -a*b*c. So what you are really determining is if > expr is a negative number or a product with a negative constant e.g. -1 out > front. The code tries to computes the shift quotient (that is f(k+1)/f(k) ). It failed when expr was a product with a negative constant in front. It does not happen that often, thats probably why the author of the code missed this case. > Also, be aware that op() takes a fair amount of time and space, since it > formats its argument. For op(a/b) to return //, it must first convert > ((MTIMES SIMP) $A ((MEXPT SIMP) $B -1)) > > To > ((MQUOTIENT) $A $B) > > Which is done by the lisp program nformat. > > > A much faster programming technique, which does not require reformatting the > expression argument, is to use inpart. > > Thus a program might look like this: > > If atom(expr) then xxxx > else block([op=inpart(expr,0)], > if op="+" then yyy > else if op="*" I agree that Zeilberger could be more efficient when computing the shift quotient. But this is not the most time consuming part of the algorithm. > A neater way of doing this would be with a case statement, e.g. > > Else case(inpart(expr,0), > ["+", yyy], > ["*", zzz], > [otherwise, ...]) > > > Macsyma has a case statement. Maxima could have one too. It takes about 5 > lines of code using buildq, I think. I agree that a case statement would be very useful to have in maxima. It would simplify a lot of my code. Andrej From aronovitch at gmail.com Sat Jan 6 17:18:13 2007 From: aronovitch at gmail.com (Amit Aronovitch) Date: Sun, 07 Jan 2007 01:18:13 +0200 Subject: [Maxima] sum: extra dynamic evaluation? Message-ID: Hi, I was told that the following might be a bug in "sum". It seems to do an extra evaluation, which causes unexpected results. In the following code, users of the function "f" should not expect it to behave differently when the "dummy variable"'s name is "x" than when it's "t". Note that this does not happen for finite sums. regards, Amit Aronovitch --- pls read the following with fixed width font -----> Maxima 5.10.0 http://maxima.sourceforge.net Using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (aka GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) f(x):= sum(x^n/n!,n,0,inf); n x (%o1) f(x) := sum(--, n, 0, inf) n! (%i2) f(2*t); /* result as expected: */ inf ==== n n \ 2 t (%o2) > ----- / n! ==== n = 0 (%i3) f(2*x); /* this is weird: */ inf ==== n n \ 4 x (%o3) > ----- / n! ==== n = 0 (%i4) From robert.dodier at gmail.com Sat Jan 6 19:27:10 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 6 Jan 2007 18:27:10 -0700 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <003c01c731e0$b3aa5b70$05d09888@RJFE510> References: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> <003c01c731e0$b3aa5b70$05d09888@RJFE510> Message-ID: On 1/6/07, Richard Fateman wrote: > Also, be aware that op() takes a fair amount of time and space, > since it formats its argument. If op is a bottleneck for many programs, we should work on speeding up nformat then. Better than than to tell every user to use a more obscure alternative. > Else case(inpart(expr,0), > ["+", yyy], > ["*", zzz], > [otherwise, ...]) I'm not opposed to having a case statement, but I don't like constructs that don't distinguish the different parts. I don't think a list of 2-element expressions has anything to recommend it, except it would be easy to implement. Better would be something more explicit like FOO (expr, case "+" : yyy, case "*" : zzz, otherwise : ...) where FOO represents the name of this thing (I don't have any suggestion for that). Other people doubtless have other ideas about what make the keywords or how to arrange the syntax. That's fine, I'm not heavily invested in the syntax shown above. best Robert From Daniel.L.Solomon at nasa.gov Sat Jan 6 20:00:58 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 6 Jan 2007 21:00:58 -0500 Subject: [Maxima] error in plot command? Message-ID: <39AA8D4C-6AC8-4BF8-8F92-7F2B0B311B2A@nasa.gov> x[1]:.5; x[2]:sqrt(1-x[1]^2) * cos(2*tau); x[3]:sqrt(1-x[1]^2) * sin (2*tau); plot2d([x[2],x[3]], [tau,0,2*%pi]); gives a plot of the cosine & sine over two periods, as expected but when I try to plot the circle, parametrized by tau with: plot2d([parametric, x[2],x[3], [tau,0,2*%pi]]); maxima crashes with: *** - argument to COMMON-LISP:FLOAT should be a real number: ((MTIMES SIMP) 0.8660254037844386 ((%COS SIMP) ((MTIMES SIMP) 2 $TAU))) The following restarts are available: R1 = Macsyma top-level 1. Break [1]> Anyone tell me what I'm doing wrong? And how do you exit one of those break [1]> things? I have to close xmaxima and start again. thanks dan From dlakelan at street-artists.org Sat Jan 6 22:01:10 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Sat, 6 Jan 2007 20:01:10 -0800 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: References: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> <003c01c731e0$b3aa5b70$05d09888@RJFE510> Message-ID: <20070107040109.GE6841@localhost.localdomain> On Sat, Jan 06, 2007 at 06:27:10PM -0700, Robert Dodier wrote: > On 1/6/07, Richard Fateman wrote: > > > Also, be aware that op() takes a fair amount of time and space, > > since it formats its argument. > > If op is a bottleneck for many programs, we should work on > speeding up nformat then. Better than than to tell every user > to use a more obscure alternative. > > > Else case(inpart(expr,0), > > ["+", yyy], > > ["*", zzz], > > [otherwise, ...]) > > I'm not opposed to having a case statement, but I don't like > constructs that don't distinguish the different parts. > I don't think a list of 2-element expressions has anything to > recommend it, except it would be easy to implement. I like the two element lists... for what it's worth. It's easy to balance them using syntax flashing in text editors, it's relatively easy to explain how it works... and the syntactic elements are easy to see, whereas "else" and "case" and other keywords look more like identifiers than syntactic seperators. my 2c -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From fateman at cs.berkeley.edu Sat Jan 6 22:24:34 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sat, 6 Jan 2007 20:24:34 -0800 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: Message-ID: <00ef01c73213$bd2e8b20$210110ac@windsor> > -----Original Message----- > From: Robert Dodier [mailto:robert.dodier at gmail.com] > Sent: Saturday, January 06, 2007 5:27 PM > .....\> > If op is a bottleneck for many programs, we should work on > speeding up nformat then. Better than than to tell every user > to use a more obscure alternative. > > The most obvious way of implementing op is to use nformat on the whole expression. I haven't looked at the implementation, so maybe it is cleverer. Certainly using inpart instead of part improves speed. RJF From fateman at cs.berkeley.edu Sat Jan 6 22:30:15 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sat, 6 Jan 2007 20:30:15 -0800 Subject: [Maxima] case syntax In-Reply-To: <20070107040109.GE6841@localhost.localdomain> Message-ID: <00f601c73214$87dde730$210110ac@windsor> > -----Original Message----- > From: maxima-bounces at math.utexas.edu > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Daniel Lakeland > .... > > > > > Else case(inpart(expr,0), > > > ["+", yyy], > > > ["*", zzz], > > > [otherwise, ...]) > > > > I'm not opposed to having a case statement, but I don't like > > constructs that don't distinguish the different parts. > > I don't think a list of 2-element expressions has anything to > > recommend it, except it would be easy to implement. Mostly it is roughly the same as lisp, which uses syntax like this.. (case xxx (first_alternative first_action) ((list of possible alternatives) action1 action2 ....) (otherwise the_rest of the case actions...) ) Using : is, in my view, confusing since that has another use. But then some people like the C language which uses * for about 5 different concepts. RJF From robert.dodier at gmail.com Sat Jan 6 22:32:59 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 6 Jan 2007 21:32:59 -0700 Subject: [Maxima] sum: extra dynamic evaluation? In-Reply-To: References: Message-ID: On 1/6/07, Amit Aronovitch wrote: > I was told that the following might be a bug in "sum". > It seems to do an extra evaluation, which causes unexpected results. Amit, you are correct, there was an extra evaluation. I have modified src/asum.lisp to cut it out & committed the modified version to cvs. I've appended MEVALSUMARG to this message, and also a patch file in case you are building Maxima yourself. By the way this change does not change the behavior of sum for any of the 200+ cases in the Maxima test suite (run_testsuite). Thanks for the bug report and please let us know if this change does not fix it. best Robert Dodier -------------- next part -------------- A non-text attachment was scrubbed... Name: mevalsumarg.lisp Type: application/octet-stream Size: 1091 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070106/fa8d54e1/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: asum.lisp-patch Type: application/octet-stream Size: 730 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070106/fa8d54e1/attachment-0001.obj From robert.dodier at gmail.com Sat Jan 6 23:04:38 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 6 Jan 2007 22:04:38 -0700 Subject: [Maxima] error in plot command? In-Reply-To: <39AA8D4C-6AC8-4BF8-8F92-7F2B0B311B2A@nasa.gov> References: <39AA8D4C-6AC8-4BF8-8F92-7F2B0B311B2A@nasa.gov> Message-ID: On 1/6/07, Dan Solomon wrote: > x[1]:.5; x[2]:sqrt(1-x[1]^2) * cos(2*tau); x[3]:sqrt(1-x[1]^2) * sin > (2*tau); > plot2d([parametric, x[2],x[3], [tau,0,2*%pi]]); Dan, for these inputs, I get "Unknown plot option specified: tau". If I change the tau in the expressions to t, then the parametric plot works OK. If you have time please file a bug report. http://sourceforge.net/tracker/?group_id=4933&atid=104933 A parametric plot should work for any name of the parameter. If you're using an older version of Maxima I'll recommend pretty strongly to get the most recent version. There have been many improvements (although not a fix for this particular bug). > The following restarts are available: > R1 = Macsyma top-level > > 1. Break [1]> Try entering "R1" at the prompt. If that doesn't help try "(run)". Hope this helps, Robert Dodier From sen1 at math.msu.edu Sat Jan 6 23:21:24 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Sun, 7 Jan 2007 00:21:24 -0500 (EST) Subject: [Maxima] error in plot command? In-Reply-To: References: <39AA8D4C-6AC8-4BF8-8F92-7F2B0B311B2A@nasa.gov> Message-ID: I never got parametric plot2d to work without out t as parameter as well. In 5.11.0, plot2d([parametric,cos(t),sin(t)],[t,0,6]); produces the plot, but (%i3) plot2d([parametric,cos(u),sin(u)],[u,0,6]); Unknown plot option specified: u -- an error. To debug this try debugmode(true); -sen On Sat, 6 Jan 2007, Robert Dodier wrote: > On 1/6/07, Dan Solomon wrote: > >> x[1]:.5; x[2]:sqrt(1-x[1]^2) * cos(2*tau); x[3]:sqrt(1-x[1]^2) * sin >> (2*tau); > >> plot2d([parametric, x[2],x[3], [tau,0,2*%pi]]); > > Dan, for these inputs, I get "Unknown plot option specified: tau". > If I change the tau in the expressions to t, then the parametric > plot works OK. > > If you have time please file a bug report. > http://sourceforge.net/tracker/?group_id=4933&atid=104933 > A parametric plot should work for any name of the parameter. > > If you're using an older version of Maxima I'll recommend pretty > strongly to get the most recent version. There have been many > improvements (although not a fix for this particular bug). > >> The following restarts are available: >> R1 = Macsyma top-level >> >> 1. Break [1]> > > Try entering "R1" at the prompt. If that doesn't help try "(run)". > > Hope this helps, > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From biomates at telefonica.net Sun Jan 7 02:09:09 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Sun, 07 Jan 2007 09:09:09 +0100 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: References: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> <003c01c731e0$b3aa5b70$05d09888@RJFE510> Message-ID: <1168157349.8335.6.camel@localhost.localdomain> El s?b, 06-01-2007 a las 18:27 -0700, Robert Dodier escribi?: > On 1/6/07, Richard Fateman wrote: > > > Also, be aware that op() takes a fair amount of time and space, > > since it formats its argument. > > If op is a bottleneck for many programs, we should work on > speeding up nformat then. Better than than to tell every user > to use a more obscure alternative. > > > Else case(inpart(expr,0), > > ["+", yyy], > > ["*", zzz], > > [otherwise, ...]) > > I'm not opposed to having a case statement, but I don't like > constructs that don't distinguish the different parts. > I don't think a list of 2-element expressions has anything to > recommend it, except it would be easy to implement. > > Better would be something more explicit like > > FOO (expr, case "+" : yyy, case "*" : zzz, otherwise : ...) I vote for something like case(expr, "+", xxx, "*", yyy, otherwise, zzz) There are other situations in Maxima ('depends', for example) where the meaning of an argument depends on its position in the arguments list. -- Mario Rodriguez Riotorto www.biomates.net From michel.vandenbergh at uhasselt.be Sun Jan 7 02:22:53 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 09:22:53 +0100 Subject: [Maxima] sum: extra dynamic evaluation? Message-ID: <45A0ADDD.3060707@uhasselt.be> > > >f(x):= sum(x^n/n!,n,0,inf); > This is the same issue that has been beaten do death on this list.... It is very hard to write functions in maxima whose behaviour does not depend on the names of their parameters (and local variables). In this case Robert fixed it (since sum is implemented at the lisp level one has more control) but there are many other instances where similar behaviour (bugs?) occurs. It seems to me that to understand the behaviour of a maxima function one has to know exactly how many evals on the arguments occur (and at other places in the program). This is difficult since some evaluations occur internally. In this case f(x):=sum('(x^n/n!),x,1,inf) would have worked correctly since the quote would have cancelled the spurious evaluation. Michel From michel.vandenbergh at uhasselt.be Sun Jan 7 02:24:51 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 09:24:51 +0100 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) Message-ID: <45A0AE53.1040204@uhasselt.be> > > >The code tries to computes the shift quotient (that is f(k+1)/f(k) ). >It failed when expr was a product with a negative constant in front. >It does not happen that often, thats probably why the author of the >code missed this case. > Can somebody explain to me why just using f(k+1)/f(k) would not have been enough? Michel From michel.vandenbergh at uhasselt.be Sun Jan 7 03:53:39 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 10:53:39 +0100 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) Message-ID: <45A0C323.1020102@uhasselt.be> > > >/ > />/ > />/The code tries to computes the shift quotient (that is f(k+1)/f(k) ). > />/It failed when expr was a product with a negative constant in front. > />/It does not happen that often, thats probably why the author of the > />/code missed this case. > />/ > /Can somebody explain to me why just using > > f(k+1)/f(k) > > would not have been enough? > > Michel Hmm I see. Maxima does not seem to know that (k+1)!/k!=k+1... Fair enough. Michel From michel.vandenbergh at uhasselt.be Sun Jan 7 04:15:55 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 11:15:55 +0100 Subject: [Maxima] Bugfix for GosperSum (about Andrej's fix)? In-Reply-To: <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> References: <459FDEBB.90501@uhasselt.be> <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> Message-ID: <45A0C85B.5020206@uhasselt.be> Andrej wrote > > if op(expr)="-" then > return(shiftQuoAuxHypCheck(-expr, k, hyp_flag)) > > This will work for -n*n! also. > > Andrej I found the problem. Your email has a typo. I should be if op(expr)="-" then shiftQuoHypCheckAux(-expr, k, hyp_flag) Thanks for looking into this. Michel From michel.vandenbergh at uhasselt.be Sun Jan 7 04:30:00 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 11:30:00 +0100 Subject: [Maxima] Regression tests for Zeilberger? In-Reply-To: <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> References: <459FDEBB.90501@uhasselt.be> <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> Message-ID: <45A0CBA8.3030307@uhasselt.be> Is there a regression test file for Zeilberger? If not then I will convert the current test file to a regression test file and add a test case for a unary minus. I think a corrrectly working Zeilberger package is crucially important for maxima. Michel From g_gherdovich at yahoo.it Sun Jan 7 04:40:27 2007 From: g_gherdovich at yahoo.it (giovanni gherdovich) Date: Sun, 7 Jan 2007 11:40:27 +0100 (CET) Subject: [Maxima] I cannot load zeilberger package |||| nusum & Zeilberger In-Reply-To: Message-ID: <20070107104028.58912.qmail@web27212.mail.ukl.yahoo.com> Thankyou for your help. > I recommend pretty strongly that you try to get a > newer version of Maxima -- there have been many > improvements since 5.9.2. I did. After that, I immediatly typed > file_search_maxima : append > (["/usr/share/maxima/.../share/contrib/Zeilberger"], > file_search_maxima); and I had success in doing (%i2) load(zeilberger.mac); I would like to know: this modification of file_search_maxima is permanent or it holds just during the current session? Regards, Giovanni Gherdovich __________________________________________________ Do You Yahoo!? Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi http://mail.yahoo.it From michel.vandenbergh at uhasselt.be Sun Jan 7 05:45:36 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 12:45:36 +0100 Subject: [Maxima] More weird behaviour in Gosper and nusum (maxima does not know enough about factorials) Message-ID: <45A0DD60.3060501@uhasselt.be> (%i1) load(zeilberger); (%o1) /usr/share/maxima/5.11.0/share/contrib/Zeilberger/zeilberger.mac (%i2) AntiDifference((k+1)!-k!,k); (k + 1)! - k! is not hypergeometric in k (%o2) NON_HYPERGEOMETRIC nusum has a similar problem, and hence so does closed_form. I think maxima really needs some rules to work with factorials. At the minimum there should be some (optional) rules like (expr+constant)!=expr! * (expr+1)*....*(expr+constant) and similarly for (expr-constant)!. Unfortunately this is somewhat tricky as expr is equal to (expr-1)+1. I fact maxima is aware of this! As an experiment I did matchdeclare(n,true); tellsimpafter((n+1)!,(n+1)*n!); k!; k (k - 1)! <== No this is *not* what I want. Maxima is too smart:-( Michel From g_gherdovich at yahoo.it Sun Jan 7 07:28:51 2007 From: g_gherdovich at yahoo.it (giovanni gherdovich) Date: Sun, 7 Jan 2007 14:28:51 +0100 (CET) Subject: [Maxima] again on Zeilberger package behaviour Message-ID: <20070107132851.2486.qmail@web27213.mail.ukl.yahoo.com> Dear Fabrizio, dear Maxima user, I'm trying to apply the so-called "WZ method" I've learnt in chapter 7 of the book "A = B" http://www.cis.upenn.edu/~wilf/AeqB.html to prove combinatorial identities. Since to do that I need an implementation of Gosper's algorithm, I made some experiments with the command nusum and with the Zeilberger package. I tried a very basic example, and nusum can handle it while (it seems) Zeilberger package cannot: \sum_{k} (\binom(n,k) / 2^n) = 1 If I call F(n,k) = binomial(n,k)/2^n, the game is finding a G(n,k) such that F(n+1,k) - F(n,k) = G(n,k+1) - G(n,k) that is the hypergeometric anti-difference of DeltaF(n,k) = F(n+1,k) - F(n,k) (if I guess well what an antidifference is). In this case by pen and paper you can find that: DeltaF(n,k) = binom(n,k)*(2*k-n-1)/(2*(n+1-k)) G(n,k) = - binomial(n,k-1)/2^(n+1) Sometimes the ratio G(n,k)/F(n,k) = R(n,k) is called "the WZ certificate". In this case: R(n,k) = -k/(2*(n-k+1)) now the Maxima session: **************************************************** (%i2) load(zeilberger); (%o2) [...] (%i3) F(n,k):=binomial(n,k)/2^n; binomial(n, k) (%o3) F(n, k) := -------------- n 2 (%i4) defrule(h,binomial(n+1,k), binomial(n,k)*(n+1)/(n+1-k)); (%i5) DeltaF(n,k):=ratsimp(apply1(F(n+1,k)-F(n,k),h)); (%i6) DeltaF(n,k); (n - 2 k + 1) binomial(n, k) (%o6) - ---------------------------- n (2 n - 2 k + 2) 2 ***************************************************** What follows made me quite disappointed: ***************************************************** (%i7) AntiDifference(DeltaF(n,k),k); (%o7) NON_HYPERGEOMETRIC ***************************************************** But the function IS hypergeometric! The expected answer is G(n,k) = - binomial(n,k-1)/2^(n+1) or any equivalent expression. ***************************************************** (%i8) Gosper(DeltaF(n,k),k); (%o8) NON_HYPERGEOMETRIC ***************************************************** Gosper(f_k, k) should find the WZ certificate, in this case R(n,k) = -k/(2*(n-k+1)), but it doesn't. ***************************************************** (%i9) GosperSum(DeltaF(n,k),k,0,k); (%o9) NON_HYPERGEOMETRIC ***************************************************** GosperSum should find the closed formula for the summation, in this case G(n,k) = - binomial(n,k-1)/2^(n+1), but it doesn't. ***************************************************** (%i10) nusum(DeltaF(n,k),k,0,k); Dependent equations eliminated: (1) (k + 1) binomial(n, k + 1) (%o10) - -------------------------- n 2 (n - k) 2 ***************************************************** And nusum happily finds the solution. What went wrong with Zeilberger package? Regards, Giovanni Gherdovich __________________________________________________ Do You Yahoo!? Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi http://mail.yahoo.it From andrej.vodopivec at gmail.com Sun Jan 7 08:38:51 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sun, 7 Jan 2007 15:38:51 +0100 Subject: [Maxima] again on Zeilberger package behaviour In-Reply-To: <20070107132851.2486.qmail@web27213.mail.ukl.yahoo.com> References: <20070107132851.2486.qmail@web27213.mail.ukl.yahoo.com> Message-ID: <7775b21a0701070638n566abb30j88cd1477ad773559@mail.gmail.com> This is cause by the same bug as was discussed on the list in recent days. With my patch your example works. > ***************************************************** > (%i7) AntiDifference(DeltaF(n,k),k); > (%o7) NON_HYPERGEOMETRIC > ***************************************************** (%i6) AntiDifference(DeltaF(n,k),k); Dependent equations eliminated: (1) (%o6) (k*(n-2*k+1)*binom(n,k))/(2*(-n/2+k-1/2)*(2*n-2*k+2)*2^n) > But the function IS hypergeometric! The expected > answer is > G(n,k) = - binomial(n,k-1)/2^(n+1) or any equivalent > expression. > > ***************************************************** > (%i8) Gosper(DeltaF(n,k),k); > (%o8) NON_HYPERGEOMETRIC > ***************************************************** (%i7) Gosper(DeltaF(n,k),k); Dependent equations eliminated: (1) (%o7) -k/(2*(-n/2+k-1/2)) (%i8) ratsimp(%); (%o8) k/(n-2*k+1) > Gosper(f_k, k) should find the WZ certificate, in > this case > R(n,k) = -k/(2*(n-k+1)), but it doesn't. > > ***************************************************** > (%i9) GosperSum(DeltaF(n,k),k,0,k); > (%o9) NON_HYPERGEOMETRIC > ***************************************************** (%i9) GosperSum(DeltaF(n,k),k,0,k)$ Dependent equations eliminated: (1) (%i10) ratsimp(%); (%o10) -((k+1)*binom(n,k+1))/((2*n-2*k)*2^n) > And nusum happily finds the solution. What went wrong > with Zeilberger package? There was a bug in Zeilberger. I will commit the patch to cvs soon. Andrej From andrej.vodopivec at gmail.com Sun Jan 7 08:51:39 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sun, 7 Jan 2007 15:51:39 +0100 Subject: [Maxima] More weird behaviour in Gosper and nusum (maxima does not know enough about factorials) In-Reply-To: <45A0DD60.3060501@uhasselt.be> References: <45A0DD60.3060501@uhasselt.be> Message-ID: <7775b21a0701070651r6b1510dfq653752f9a7c6dc@mail.gmail.com> On 1/7/07, Michel Van den Bergh wrote: > (%i1) load(zeilberger); > (%o1) /usr/share/maxima/5.11.0/share/contrib/Zeilberger/zeilberger.mac > (%i2) AntiDifference((k+1)!-k!,k); > (k + 1)! - k! is not hypergeometric in k > (%o2) NON_HYPERGEOMETRIC > > nusum has a similar problem, and hence so does closed_form. > > I think maxima really needs some rules to work with factorials. At the > minimum there > should be some (optional) rules like The function you want is minfactorial: (%i1) load(zeilberger)$ (%i2) (k+1)! - k!$ (%i3) minfactorial(%); (%o3) (k+1)*k!-k! (%i4) AntiDifference(%, k); Dependent equations eliminated: (1) (%o4) ((k+1)*k!-k!)/k (%i5) ratsimp(%); (%o5) k! Andrej From toy.raymond at gmail.com Sun Jan 7 09:10:52 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 07 Jan 2007 10:10:52 -0500 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <45A0C323.1020102@uhasselt.be> References: <45A0C323.1020102@uhasselt.be> Message-ID: <45A10D7C.5080602@gmail.com> Michel Van den Bergh wrote: >>> / >>> >> />/ >> />/The code tries to computes the shift quotient (that is f(k+1)/f(k) ). >> />/It failed when expr was a product with a negative constant in front. >> />/It does not happen that often, thats probably why the author of the >> />/code missed this case. >> />/ >> /Can somebody explain to me why just using >> >> f(k+1)/f(k) >> >> would not have been enough? >> >> Michel >> > Hmm I see. Maxima does not seem to know that (k+1)!/k!=k+1... > Fair enough. > minfactorial((k+1)!/k!) -> k+1 Ray From michel.vandenbergh at uhasselt.be Sun Jan 7 09:45:01 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 16:45:01 +0100 Subject: [Maxima] More weird behaviour in Gosper and nusum (maxima does not know enough about factorials) References: 45A0DD60.3060501@uhasselt.be Message-ID: <45A1157D.5050306@uhasselt.be> > > The function you want is minfactorial: > > (%i1) load(zeilberger)$ > (%i2) (k+1)! - k!$ > (%i3) minfactorial(%); > (%o3) (k+1)*k!-k! > (%i4) AntiDifference(%, k); > Dependent equations eliminated: (1) > (%o4) ((k+1)*k!-k!)/k > (%i5) ratsimp(%); > (%o5) k! Ok very nice!! But why do I need to know this? Why can't zeilberger (or closed_form) do this by default....? I am thinking of the new user which does a "trivial" exercise which fails rather spectacularly... Michel From robert.dodier at gmail.com Sun Jan 7 10:51:39 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 7 Jan 2007 09:51:39 -0700 Subject: [Maxima] Regression tests for Zeilberger? In-Reply-To: <45A0CBA8.3030307@uhasselt.be> References: <459FDEBB.90501@uhasselt.be> <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> <45A0CBA8.3030307@uhasselt.be> Message-ID: On 1/7/07, Michel Van den Bergh wrote: > Is there a regression test file for Zeilberger? If not then I will > convert the current > test file to a regression test file and add a test case for a unary minus. No, there is no regression test file for Zeilberger at present. There is the script testZeilberger.mac (perhaps this is the test file to which you refer) but it is not organized as a regression test. If you want to work on creating a regression test file that would be very much appreciated. best Robert Dodier From michel.vandenbergh at uhasselt.be Sun Jan 7 10:57:00 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 17:57:00 +0100 Subject: [Maxima] Regression tests for Zeilberger? In-Reply-To: References: <459FDEBB.90501@uhasselt.be> <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> <45A0CBA8.3030307@uhasselt.be> Message-ID: <45A1265C.9060306@uhasselt.be> Robert Dodier wrote: > On 1/7/07, Michel Van den Bergh wrote: > >> Is there a regression test file for Zeilberger? If not then I will >> convert the current >> test file to a regression test file and add a test case for a unary >> minus. > > No, there is no regression test file for Zeilberger at present. > There is the script testZeilberger.mac (perhaps this is the test > file to which you refer) but it is not organized as a regression test. > If you want to work on creating a regression test file that would > be very much appreciated. > > best > Robert Dodier I am doing it right now! Michel From robert.dodier at gmail.com Sun Jan 7 11:00:55 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 7 Jan 2007 10:00:55 -0700 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <1168157349.8335.6.camel@localhost.localdomain> References: <7775b21a0701061334g297864c7t7511bff4fa8c90f3@mail.gmail.com> <003c01c731e0$b3aa5b70$05d09888@RJFE510> <1168157349.8335.6.camel@localhost.localdomain> Message-ID: > I vote for something like > > case(expr, > "+", xxx, > "*", yyy, > otherwise, zzz) > > There are other situations in Maxima ('depends', for example) where the > meaning of an argument depends on its position in the arguments list. Yes, and that's confusing, isn't it, because in a long list ..., a, b, c, ... that might be interpreted as (a, b), (c, ...) or as (..., a), (b, c). Various declaration functions have this misfeature; that's a bad precedent I don't want to propagate. All the best, Robert From robert.dodier at gmail.com Sun Jan 7 11:04:36 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 7 Jan 2007 10:04:36 -0700 Subject: [Maxima] case syntax In-Reply-To: <00f601c73214$87dde730$210110ac@windsor> References: <20070107040109.GE6841@localhost.localdomain> <00f601c73214$87dde730$210110ac@windsor> Message-ID: On 1/6/07, Richard Fateman wrote: > Mostly it is roughly the same as lisp, which uses syntax like this.. > > (case xxx > (first_alternative first_action) > ((list of possible alternatives) action1 action2 ....) > (otherwise the_rest of the case actions...) > > ) Lisp is a very bad model for Maxima syntax. FWIW. > Using : is, in my view, confusing since that has another use. Let's think of another token, then. best Robert From andrej.vodopivec at gmail.com Sun Jan 7 11:37:35 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sun, 7 Jan 2007 18:37:35 +0100 Subject: [Maxima] Regression tests for Zeilberger? In-Reply-To: <45A1265C.9060306@uhasselt.be> References: <459FDEBB.90501@uhasselt.be> <7775b21a0701061002u743c2205o6333c56af5b3d7f@mail.gmail.com> <45A0CBA8.3030307@uhasselt.be> <45A1265C.9060306@uhasselt.be> Message-ID: <7775b21a0701070937r2d2ef3d5w20537d8849609695@mail.gmail.com> > I am doing it right now! Maybe you can add the following examples, which currently give wrong answers. AntiDifference(2^(k^2), k); (should be NON_HYPERGEOMETRIC) AntiDifference(k^k, k); (should be NON_HYPERGEOMETRIC) Zeilberger(binomial(n,i), i, n); (works if i is replaced with j) I think there is some way to declare which problems are expected to give incorrect results. I have a patch to fix these examples but it is not in cvs yet. Andrej From fateman at cs.berkeley.edu Sun Jan 7 12:05:27 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 10:05:27 -0800 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: Message-ID: <006301c73286$69f52b30$05d09888@RJFE510> Arguing programming language syntax is somewhat akin to arguing about religions, however there are some issues that can be raised. The syntax previously proposed allows Case (expr [testvalue, dothis, dothat, returnthis], [testvalue2, ....] ...) Which is why lisp uses it. Just a list of expr,test,dothis,test,dothat, is not so handy. You could simulate it by case(expr,test,block([]....), test, .... I suppose. Just wordier. > > > > There are other situations in Maxima ('depends', for example) where the > > meaning of an argument depends on its position in the arguments list. > > Yes, and that's confusing, isn't it, because in a long list ..., a, b, c, > ... > that might be interpreted as (a, b), (c, ...) or as (..., a), (b, c). > Various declaration functions have this misfeature; that's a bad > precedent I don't want to propagate. I think I agree here. RJF From fateman at cs.berkeley.edu Sun Jan 7 12:18:43 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 10:18:43 -0800 Subject: [Maxima] case syntax In-Reply-To: Message-ID: <006401c73288$44777910$05d09888@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Robert Dodier > Sent: Sunday, January 07, 2007 9:05 AM > > ) > > Lisp is a very bad model for Maxima syntax. FWIW. (the old Mac-)Lisp is already a model for Maxima semantics. And to a substantial extent it is a structural model for the Maxima language. As well as the Mathematica language. One difference being an alternative syntax for those who insist on infix. Try typing in to maxima "+"(a,b,"*"(c,d)); {in Mathematica, a+b == Plus[a,b] } Also notice sin(x) is functional. The second difference is that Lisp is far more uniform and instead of f(a,b,c) uses (f a b c). While this may seem unnatural at first, it is so simple that students in a first course at Berkeley learn to use it in an hour. By contrast, it takes students weeks to understand the syntax of C++ or Java; so much so that they do not even learn all the syntax in a full semester. An argument I sometimes encounter is that a+b is ordinary mathematical notation. True enough. But a*b is not. Mathematicians write ab, most likely. And sin(x) is not mathematical either. Typically one would just use sin x, and if typeset, with the x being in italics. As I said previously, programming language syntax issues are often problematical. RJF > > > Using : is, in my view, confusing since that has another use. > > Let's think of another token, then. > > best > Robert > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Sun Jan 7 13:22:22 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 20:22:22 +0100 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) References: eb9c4b9a0701070900k4e173743qc243bbb2e6631a65@mail.gmail.com Message-ID: <45A1486E.7050907@uhasselt.be> > > You could simulate it by case(expr,test,block([]....), test, .... I > suppose. Just wordier. The block statements are not necessary unless you want local variables and then you need "block" anyway. I think case ( expr1, ( statement1, statement2 ), expr2, ( statement1, statement2 ) ) looks rather good. I don't like the square brackets. They are not used as delimiters elsewhere. Michel From michel.vandenbergh at uhasselt.be Sun Jan 7 13:29:11 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 07 Jan 2007 20:29:11 +0100 Subject: [Maxima] Attached: regression test files for Zeilberger. References: 45A0CBA8.3030307@uhasselt.be Message-ID: <45A14A07.8020608@uhasselt.be> Attached are two regression test files for Zeilberger. The "extreme" tests take a long time to excecute so I have separated them out in rtest_zeilberger_extreme.mac. rtest_zeilberger.mac contains 4 failing tests. The one with the unary minus which was fixed by Andrej and three other bugs pointed out by Andrej. Michel -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rtest_zeilberger_extreme.mac Url: http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/80807b39/attachment.diff -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rtest_zeilberger.mac Url: http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/80807b39/attachment-0001.diff From andrej.vodopivec at gmail.com Sun Jan 7 13:51:26 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sun, 7 Jan 2007 20:51:26 +0100 Subject: [Maxima] Extending maxima language Message-ID: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Since people are discussing a new case statement for maxima I propose we add some more stuff at the same time. Currently I can think of three things which I would like to have in maxima. I think I would like to have 2) and 3) even more that 1). 1) cond statement (with whatever syntax) 2) assignments to lists: something like [a,b,c] == [1,2,3] would be equivalent to a:1, b:2, c:3. This could be done by extending : to work in this case or adding a new operator == or similar. 3) unwind_protect: I think Barton had an implementation which he posted to this list. Andrej From fateman at cs.berkeley.edu Sun Jan 7 13:56:54 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 11:56:54 -0800 Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? (was: cannot load Zeilberger) In-Reply-To: <45A1486E.7050907@uhasselt.be> Message-ID: <006b01c73295$fdeb2330$05d09888@RJFE510> Attached is an implementation (in lisp) of a case statement. I disagree with your design that looks like case(a,b,c,d,e,f,g). Too easy to lose the parity. I prefer case(a,[b,c],[d,e]...). Note that [] is used to enclose lists, and is used in some options for Taylor series, declarations, ... It turns out that the implementation is agnostic with respect to syntax, And so case(a, b:c, d:e, f:g) works and so does infix("->"); case(a, b->c, d->e, f->g). Further documentation is in the file. Someone looking into the evaluation of mprog in maxima might make the program a little spiffier. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Sunday, January 07, 2007 11:22 AM > To: maxima at math.utexas.edu > Subject: [Maxima] programming, using op(), was ..RE: Bugfix for GosperSum? > (was: cannot load Zeilberger) > > > > > You could simulate it by case(expr,test,block([]....), test, .... I > > suppose. Just wordier. > The block statements are not necessary unless you want local variables > and then you need "block" > anyway. > > I think > > case ( > expr1, ( > statement1, > statement2 > ), expr2, ( > statement1, > statement2 > ) > ) > > looks rather good. I don't like the square brackets. They are not used > as delimiters elsewhere. > > Michel > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- A non-text attachment was scrubbed... Name: casemac.lisp Type: application/octet-stream Size: 1884 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/0fb9c104/attachment.obj From robert.dodier at gmail.com Sun Jan 7 14:03:50 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 7 Jan 2007 13:03:50 -0700 Subject: [Maxima] Attached: regression test files for Zeilberger. In-Reply-To: <45A14A07.8020608@uhasselt.be> References: <45A14A07.8020608@uhasselt.be> Message-ID: On 1/7/07, Michel Van den Bergh wrote: > Attached are two regression test files for Zeilberger. > The "extreme" tests take a long time to excecute so I have separated them > out in rtest_zeilberger_extreme.mac. > > rtest_zeilberger.mac contains 4 failing tests. The one with the unary minus > which was fixed by Andrej and three other bugs pointed out by Andrej. I've committed rtest_zeilberger.mac and rtest_zeilberger_extreme.mac in share/contrib/Zeilberger/. Thanks a lot for working on this. HTH Robert From fateman at cs.berkeley.edu Sun Jan 7 14:05:33 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 12:05:33 -0800 Subject: [Maxima] Extending maxima language In-Reply-To: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Message-ID: <007801c73297$30f76a80$05d09888@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Andrej Vodopivec > Sent: Sunday, January 07, 2007 11:51 AM > To: Maxima - list > Subject: [Maxima] Extending maxima language > > Since people are discussing a new case statement for maxima I propose > we add some more stuff at the same time. > > Currently I can think of three things which I would like to have in > maxima. I think I would like to have 2) and 3) even more that 1). > > 1) cond statement (with whatever syntax) The model for the case setup could be used to implement this. Maybe cond (a->b, c->d ....) > > 2) assignments to lists: > something like [a,b,c] == [1,2,3] would be equivalent to a:1, b:2, > c:3. This could be done by extending : to work in this case or adding > a new operator == or similar. I thought we already did this. Apparently it's not in by default, but the code is attached. Load it in to maxima and type mset_extension_operators:true; [a,b,c]:[1,2,3]; This was written by me, with suggestions by S. Macrakis and R. Dodier (according to the comments in the file). > > 3) unwind_protect: > I think Barton had an implementation which he posted to this list. From fateman at cs.berkeley.edu Sun Jan 7 14:06:42 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 12:06:42 -0800 Subject: [Maxima] Extending maxima language In-Reply-To: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Message-ID: <007901c73297$5a4a0780$05d09888@RJFE510> Oops, here is the code for msethack -------------- next part -------------- A non-text attachment was scrubbed... Name: msethack.lisp Type: application/octet-stream Size: 11462 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/0acc7e8e/attachment.obj From robert.dodier at gmail.com Sun Jan 7 14:10:10 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 7 Jan 2007 13:10:10 -0700 Subject: [Maxima] Extending maxima language In-Reply-To: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> References: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Message-ID: On 1/7/07, Andrej Vodopivec wrote: > 1) cond statement (with whatever syntax) I'm opposed to this. We already have if--then--else. > 2) assignments to lists: > something like [a,b,c] == [1,2,3] would be equivalent to a:1, b:2, > c:3. This could be done by extending : to work in this case or adding > a new operator == or similar. This is implemented by defstruct.lisp which is already in share/contrib. However there were problems with the defstruct stuff so it didn't get merged into src/. We should take another look at that and clear up any remaining problems. e.g. load (defstruct); [a, b, c] : [1, x, sin(y)]; values; => [a, b, c] [a, b, c]; => [1, x, sin(y)] > 3) unwind_protect: > I think Barton had an implementation which he posted to this list. Yes, this is a good idea. best Robert From willisb at unk.edu Sun Jan 7 14:23:11 2007 From: willisb at unk.edu (Barton Willis) Date: Sun, 7 Jan 2007 14:23:11 -0600 Subject: [Maxima] Extending maxima language In-Reply-To: Message-ID: > > 3) unwind_protect: > > I think Barton had an implementation which he posted to this list. For a non-CL programmer, 'unwind_protect' is a terrible name. But I didn't come up with something I liked better. Actually, something like: cleanup([clean up function1, clean up function2, ...], statement1, statement2, ....) might be better than what I first proposed. Thus cleanup([kill(doodlebob)], newcontext(doodlebob), assume(x > 1), sign(x)) --> pos. Barton From amca01 at gmail.com Sun Jan 7 15:05:23 2007 From: amca01 at gmail.com (Alasdair McAndrew) Date: Mon, 8 Jan 2007 08:05:23 +1100 Subject: [Maxima] Extending maxima language In-Reply-To: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> References: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Message-ID: <1d67a53c0701071305w55c6d8f6tdea7bc0077a7431f@mail.gmail.com> I'd like the "if" statement amended to include "elseif"; for example: if a=b then return(a) elseif a wrote: > > Since people are discussing a new case statement for maxima I propose > we add some more stuff at the same time. > > Currently I can think of three things which I would like to have in > maxima. I think I would like to have 2) and 3) even more that 1). > > 1) cond statement (with whatever syntax) > > 2) assignments to lists: > something like [a,b,c] == [1,2,3] would be equivalent to a:1, b:2, > c:3. This could be done by extending : to work in this case or adding > a new operator == or similar. > > 3) unwind_protect: > I think Barton had an implementation which he posted to this list. > > Andrej > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070108/6d5b53a9/attachment.htm From fateman at cs.berkeley.edu Sun Jan 7 17:06:04 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 15:06:04 -0800 Subject: [Maxima] Extending maxima language In-Reply-To: <1d67a53c0701071305w55c6d8f6tdea7bc0077a7431f@mail.gmail.com> Message-ID: <009501c732b0$6908dd50$05d09888@RJFE510> The cond statement in lisp is really very handy, and I find it far more useful than elseif, and indeed more useful than if-then-else which I use only if I can see immediately that the decision process is very simple. Lisp has all of these. You would write (cond ((= a b) a) ((< a b) (- b a)) (t b)) With the program attached, you could use this, in maxima: infix("->", 40,40); cond ( a=b ->a, a b-a, t -> b) With case and cond, many programs manipulating expressions can be written this way F(expr):= cond( atom(expr) ->dosomething(expr), T -> case(op(expr), "+" ->dosomethingsumrelated(expr), "*" -> dosomethingproductrelated(expr), .. [sin,cos,tan] -> dosomethingtrigrelated(expr), Otherwise -> error("what should I do with", expr, "?"))); I hope you agree with me that this is an improvement over if then else if then else.. The attached file implements both case and cond now. The use of "->" as a separator is actually not imposed by the file, and you can use any non-commuting binary or nary operators such as [ , , .] or : or :: or make up something else like --|> . RJF _____ From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Alasdair McAndrew Sent: Sunday, January 07, 2007 1:05 PM To: maxima list Subject: Re: [Maxima] Extending maxima language I'd like the "if" statement amended to include "elseif"; for example: if a=b then return(a) elseif a wrote: Since people are discussing a new case statement for maxima I propose we add some more stuff at the same time. Currently I can think of three things which I would like to have in maxima. I think I would like to have 2) and 3) even more that 1). 1) cond statement (with whatever syntax) 2) assignments to lists: something like [a,b,c] == [1,2,3] would be equivalent to a:1, b:2, c:3. This could be done by extending : to work in this case or adding a new operator == or similar. 3) unwind_protect: I think Barton had an implementation which he posted to this list. Andrej _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/27612a8d/attachment-0001.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: casemac.lisp Type: application/octet-stream Size: 2431 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/27612a8d/attachment-0001.obj From amca01 at gmail.com Sun Jan 7 17:22:04 2007 From: amca01 at gmail.com (Alasdair McAndrew) Date: Mon, 8 Jan 2007 10:22:04 +1100 Subject: [Maxima] Extending maxima language In-Reply-To: <009501c732b0$6908dd50$05d09888@RJFE510> References: <1d67a53c0701071305w55c6d8f6tdea7bc0077a7431f@mail.gmail.com> <009501c732b0$6908dd50$05d09888@RJFE510> Message-ID: <1d67a53c0701071522u298a835fyd9b66b23221c7726@mail.gmail.com> cond, elseif, case... it doesn't really matter, as they can all be used to do much the same thing. But whatever is chosen, it should be implemented in Maxima's own language, for the many bozos like myself who don't want to have to bother with the underlying language of whatever CAS they are using (C, C++, Lisp, etc). Besides which, I have no especial love for lisp. -Alasdair On 1/8/07, Richard Fateman wrote: > > The cond statement in lisp is really very handy, and I find it far more > useful than elseif, and indeed more useful than if-then-else which I use > only if I can see immediately that the decision process is very simple. > Lisp has all of these. > > > > You would write > > (cond ((= a b) a) > > ((< a b) (- b a)) > > (t b)) > > > > With the program attached, you could use this, in maxima: > > infix("->", 40,40); > > cond ( a=b ->a, > > a b-a, > > t -> b) > > > > With case and cond, many programs manipulating expressions can be written > this way > > > > F(expr):= cond( atom(expr) ->dosomething(expr), > > T -> case(op(expr), > > "+" ->dosomethingsumrelated(expr), > > "*" -> > dosomethingproductrelated(expr), > > ?. > > [sin,cos,tan] -> > dosomethingtrigrelated(expr), > > Otherwise -> error("what should I > do with", expr, "?"))); > > > > I hope you agree with me that this is an improvement over if then else if > then else?. > > > > The attached file implements both case and cond now. > > The use of "->" as a separator is actually not imposed by the file, and > you can use any non-commuting binary or nary operators such as [ , , ?] or : > or :: or make up something else like --|> ? > > > > RJF > > > > > ------------------------------ > > *From:* maxima-bounces at math.utexas.edu [mailto: > maxima-bounces at math.utexas.edu] *On Behalf Of *Alasdair McAndrew > *Sent:* Sunday, January 07, 2007 1:05 PM > *To:* maxima list > *Subject:* Re: [Maxima] Extending maxima language > > > > I'd like the "if" statement amended to include "elseif"; for example: > > if a=b then return(a) elseif a > Currently there's no way of doing this without placing a second "if" > statement inside a "block" which is clumsy. If there was no restriction on > the number of elseif's then this would obviate the need for a case > statement, and also fit nicely into Maxima's current syntax. > > -Alasdair > > On 1/8/07, *Andrej Vodopivec* wrote: > > Since people are discussing a new case statement for maxima I propose > we add some more stuff at the same time. > > Currently I can think of three things which I would like to have in > maxima. I think I would like to have 2) and 3) even more that 1). > > 1) cond statement (with whatever syntax) > > 2) assignments to lists: > something like [a,b,c] == [1,2,3] would be equivalent to a:1, b:2, > c:3. This could be done by extending : to work in this case or adding > a new operator == or similar. > > 3) unwind_protect: > I think Barton had an implementation which he posted to this list. > > Andrej > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070108/40061a5b/attachment.htm From sen1 at math.msu.edu Sun Jan 7 17:43:54 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Sun, 7 Jan 2007 18:43:54 -0500 (EST) Subject: [Maxima] question about sublists In-Reply-To: References: <1167932813.23968.21.camel@localhost> Message-ID: Where is the function 'definitely-so' ? Here is what happens when I try sublist_indices: [sen at gumbie .maxima]$ more sublist_indices.lisp (defun $sublist_indices (items pred) (let ((items (require-list items "$sublist_indices"))) (do ((i 0 (1+ i)) (xs items (cdr xs)) (acc '() (if (definitely-so (mfuncall pred (car xs))) (cons (1+ i) acc) acc))) ((endp xs) `((mlist) ,@(nreverse acc)))))) (%i1) load("sublist_indices"); (%o1) ./sublist_indices.lisp (%i2) sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = a)); Maxima encountered a Lisp error: Error in IF [or a callee]: The function DEFINITELY-SO is undefined. Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. TIA, -sen On Fri, 5 Jan 2007, Robert Dodier wrote: > On 1/4/07, Bill Wood wrote: > >> Here's a bare-bones CL function definition: >> >> (defun all-positions-if (items pred) >> (do ((i 0 (1+ i)) >> (xs items (cdr xs)) >> (acc '() (if (funcall pred (car xs)) (cons i acc) acc))) >> ((endp xs) (nreverse acc)))) > > Bill, thanks a lot for your help. I've modified the code as shown below. > > (defun $sublist_indices (items pred) > (let ((items (require-list items "$sublist_indices"))) > (do ((i 0 (1+ i)) > (xs items (cdr xs)) > (acc '() (if (definitely-so (mfuncall pred (car xs))) (cons > (1+ i) acc) acc))) > ((endp xs) `((mlist) ,@(nreverse acc)))))) > > A user could paste this into a Maxima session via > to_lisp(); > > (to-maxima) > > or copy it to a file and load it via load() . > > Examples: > > sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = a)); > => [1, 6, 10, 11] > sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = b)); > => [2, 7] > sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], lambda ([x], x = b > or x = a)); > => [1, 2, 6, 7, 10, 11] > P(x) := not (x = a); > sublist_indices ([a, b, c, e, d, a, b, e, s, a, a], P); > => [2, 3, 4, 5, 7, 8, 9] > > best > Robert > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From willisb at unk.edu Sun Jan 7 18:38:45 2007 From: willisb at unk.edu (Barton Willis) Date: Sun, 7 Jan 2007 18:38:45 -0600 Subject: [Maxima] question about sublists In-Reply-To: References: <1167932813.23968.21.camel@localhost> , Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >Where is the function 'definitely-so' ? The file 'matcom.lisp' has a function 'definitely-so', but its definition is commented out: (DEFUN DEFINITELY-SO (E) (EQ ($MAYBE E) T)) Barton From fateman at cs.berkeley.edu Sun Jan 7 19:22:45 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 7 Jan 2007 17:22:45 -0800 Subject: [Maxima] Extending maxima language In-Reply-To: <1d67a53c0701071522u298a835fyd9b66b23221c7726@mail.gmail.com> Message-ID: <00b601c732c3$80e9dc90$05d09888@RJFE510> I think that the expressiveness of the language is an issue for humans reading and writing programs. I agree that for the computer it doesn't make much difference. Case and cond could be implemented in the maxima language using macro definitions and buildq, but for me it's faster to use lisp. If you are saying that case and cond should be built in, then that's ok with me. Otherwise load("casemac.lisp") will insert them, if you've stored the file somewhere under the name "casemac.lisp" You don't have to love lisp :-) _____ From: Alasdair McAndrew [mailto:amca01 at gmail.com] Sent: Sunday, January 07, 2007 3:22 PM To: fateman at cs.berkeley.edu; maxima list Subject: Re: [Maxima] Extending maxima language cond, elseif, case... it doesn't really matter, as they can all be used to do much the same thing. But whatever is chosen, it should be implemented in Maxima's own language, for the many bozos like myself who don't want to have to bother with the underlying language of whatever CAS they are using (C, C++, Lisp, etc). Besides which, I have no especial love for lisp. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070107/04c7a029/attachment-0001.htm From robert.dodier at gmail.com Sun Jan 7 19:24:18 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 7 Jan 2007 18:24:18 -0700 Subject: [Maxima] question about sublists In-Reply-To: References: <1167932813.23968.21.camel@localhost> Message-ID: On 1/7/07, sen1 at math.msu.edu wrote: > Where is the function 'definitely-so' ? Here it is. (defun definitely-so (e) (eq (mfuncall '$maybe e) t)) Sorry for the bother. best Robert From michel.vandenbergh at uhasselt.be Mon Jan 8 01:40:06 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 08 Jan 2007 08:40:06 +0100 Subject: [Maxima] Attached: regression test files for Zeilberger. In-Reply-To: References: <45A14A07.8020608@uhasselt.be> Message-ID: <45A1F556.3090303@uhasselt.be> Robert, Can I ask you to replace the start of rtest_zeilberger.mac by kill(all); done$ (load(zeilberger),done); done$ /* New regression tests are at end */ <==== Addition! /*=================================================================*/ /* converted from testZeilberger.mac (mvdb) */ Currently it is unclear that this file is also intended for new regression tests. If you prefer it then I will simply post a new version. Michel From michel.vandenbergh at uhasselt.be Mon Jan 8 04:28:17 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 08 Jan 2007 11:28:17 +0100 Subject: [Maxima] Extending maxima language Message-ID: <45A21CC1.5050500@uhasselt.be> > > >The use of "->" as a separator is actually not imposed by the file, and you >can use any non-commuting binary or nary operators such as [ , , .] or : or >::/ or make up something else like --|> . >/ > > Richard, Could you please fix a separator (and test for it in your lisp code)? Otherwise people will start to use different ones which will make it harder to maintain backwards compatibility in case of implementation changes. I vote for ":" (like in c), "->" has an established meaning in other languages (accessing instance variables of objects). "::" has an established meaning as well. Michel > > From nmarais at sun.ac.za Mon Jan 8 07:38:11 2007 From: nmarais at sun.ac.za (Neilen Marais) Date: Mon, 08 Jan 2007 15:38:11 +0200 Subject: [Maxima] integrating trig functions with large constants, exponent out of range References: <000001c73150$572a4080$05d09888@RJFE510> Message-ID: Richard, On Fri, 05 Jan 2007 21:05:51 -0800, Richard Fateman wrote: > The Risch algorithm, which should not be called here, is apparently being > called. It would perhaps not happen if %i were not there. Removing %i results in a similarly slow integration. Is there any other way I can force Maxima not to use the Risch algorithm? Thanks Neilen > -- you know its kind of tragic we live in the new world but we've lost the magic -- Battery 9 (www.battery9.co.za) From miguel39123 at hotmail.com Mon Jan 8 07:39:06 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Mon, 8 Jan 2007 13:39:06 +0000 (UTC) Subject: [Maxima] Extending maxima language References: <45A21CC1.5050500@uhasselt.be> Message-ID: Michel Van den Bergh uhasselt.be> writes: > > I vote for ":" (like in c), "->" has an established meaning in other > languages (accessing instance variables of > objects). "::" has an established meaning as well. : is for assignament, I vote for "then" (like in if) cond( A then B, ...) I'm in favor of extending the language, also it must be sanitized. From miguel39123 at hotmail.com Mon Jan 8 08:04:20 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Mon, 8 Jan 2007 14:04:20 +0000 (UTC) Subject: [Maxima] case syntax Message-ID: I vote for something like case(A, of + then ..., of * then ...) that is I vote for being verbose: of and then to signal the beginning and end, this look to be coherent with the syntax of "if". By the way, I like Lisp, but perhaps is good for the casual user to see more tokens and less parentesis. From fateman at cs.berkeley.edu Mon Jan 8 09:10:27 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 8 Jan 2007 07:10:27 -0800 Subject: [Maxima] Extending maxima language In-Reply-To: <45A21CC1.5050500@uhasselt.be> Message-ID: <00dd01c73337$267024d0$05d09888@RJFE510> I don't understand why you would prefer ":" which is already used by maxima for assignment. "->" is used by "mlisp" (circa 1959), a syntax for the original Lisp for conditionals, approximately the way I showed it. It is also used by guarded commands. It is not used in Maxima at the moment. An entirely new delimiter like ":::" or "@@" could be invented for the purpose. The delimiter "*" is used in C for about 7 different purposes. The language C has something like 15 difference precedences among operators, and "*" appears in 5 classes. Re-using operators this way can only add to the confusion, it seems to me. Also, its precedence may be wrong, e.g. how to parse b->a:odd is not a problem. But b:a:odd is confusing. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Monday, January 08, 2007 2:28 AM > To: maxima at math.utexas.edu; fateman at cs.berkeley.edu > Subject: [Maxima] Extending maxima language > > > > > > >The use of "->" as a separator is actually not imposed by the file, and > you > >can use any non-commuting binary or nary operators such as [ , , .] or : > or > >::/ or make up something else like --|> . > >/ > > > > > Richard, > > Could you please fix a separator (and test for it in your lisp code)? > Otherwise people will start to use different ones > which will make it harder to maintain backwards compatibility in case of > implementation > changes. > > I vote for ":" (like in c), "->" has an established meaning in other > languages (accessing instance variables of > objects). "::" has an established meaning as well. > > Michel > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Mon Jan 8 09:25:17 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 08 Jan 2007 16:25:17 +0100 Subject: [Maxima] Extending maxima language In-Reply-To: <00dd01c73337$267024d0$05d09888@RJFE510> References: <00dd01c73337$267024d0$05d09888@RJFE510> Message-ID: <45A2625D.3090505@uhasselt.be> Richard Fateman wrote: >I don't understand why you would prefer ":" which is already used by maxima >for assignment. > Yes I had forgotten about maxima's crazy assignment syntax. -> or :: seem like the next best thing. Maybe :: is not so good if we ever want to use packages in maxima. So -> remains... Michel From macrakis at alum.mit.edu Mon Jan 8 10:42:20 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 8 Jan 2007 11:42:20 -0500 Subject: [Maxima] Extending maxima language In-Reply-To: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> References: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Message-ID: <8b356f880701080842r60c3f6c4l5b3d2fc3e66d779c@mail.gmail.com> On 1/7/07, Andrej Vodopivec wrote: > 1) cond statement (with whatever syntax) Maxima already has a cond statement: if a then b elseif c then d ... (any number of elseif clauses) else e (optional) The final "else" clause is exactly equivalent to elseif true then e The only difference with Lisp's cond statement is that the then-clauses contain only a single statement since there is no explicit syntactic bracketing: you could I suppose interpret if a then b, c elseif ... as if a then (b,c) elseif ... but how would you interpret if a then b, c ? If you want syntax that's completely parallel to Lisp cond, just always use the parens: if a then (b) elseif c then (d) ... (any number of elseif clauses) else (e) (optional) which allows you to have multiple comma-separated statements in the then-clauses. -s From sen1 at math.msu.edu Mon Jan 8 10:44:43 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Mon, 8 Jan 2007 11:44:43 -0500 (EST) Subject: [Maxima] doc for plot.lisp Message-ID: Hi, Is there any documentation for how to experiment with the routines in plot.lisp ? For instance, what do the following functions take as arguments and what do they do? show-open-plot with-output-to-string I would like to create a routine that opens a plot window, allows one to click on a point on the canvas to call another graphics routine. I have looked at the plotdf.lisp program, but I can't tell how to get mouse input from that. TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From edmond.orignac at wanadoo.fr Mon Jan 8 14:29:50 2007 From: edmond.orignac at wanadoo.fr (Edmond Orignac) Date: Mon, 08 Jan 2007 21:29:50 +0100 Subject: [Maxima] Maxima functions for linear differential equations Message-ID: <1168288190.2766.10.camel@sashimi> Hello, Below I am attaching a file for the solutions of various linear differential equations related to the Bessel functions. The functions solve the modified Bessel equation, the Airy equation, the Scorer equation and the Lommel/Struve/Anger-Weber equations. These equations are not integrated by ode2 or contrib_ode (but some of them can be integrated by odelin.lisp). I have tried to use existing maxima notations for the results, i.e. the struve function is represented as hstruve[n](x) as in the specint package. However, the order of the parameters in slommel is not indicated in the specint documentation, so there could be some incompatibility. Also, the scorer_gi, anger_j, weber_e functions are not defined anywhere in maxima. Another function is solving the Lam? equation in polynomial form. I hope these maxima functions can be polished and included in a future release. Best, E. Orignac -------------- next part -------------- A non-text attachment was scrubbed... Name: diffeq.tgz Type: application/x-compressed-tar Size: 2523 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070108/73c25c16/attachment.bin From nicolas.pettiaux at ael.be Mon Jan 8 14:40:48 2007 From: nicolas.pettiaux at ael.be (Nicolas Pettiaux) Date: Mon, 8 Jan 2007 21:40:48 +0100 Subject: [Maxima] Maxima functions for linear differential equations In-Reply-To: <1168288190.2766.10.camel@sashimi> References: <1168288190.2766.10.camel@sashimi> Message-ID: 2007/1/8, Edmond Orignac : > Below I am attaching a file for the solutions of various linear > differential equations related to the Bessel functions. In the name of all the Maxima users ,thank you. Nicolas -- Nicolas Pettiaux - email: nicolas.pettiaux at ael.be From macrakis at alum.mit.edu Mon Jan 8 16:48:00 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 8 Jan 2007 17:48:00 -0500 Subject: [Maxima] Semantics of "case" Message-ID: <8b356f880701081448w4f9bad68p7478071f014f26b6@mail.gmail.com> There has been a lot of discussion about the syntax of a Maxima case statement. Let's think about the semantics for a second. There are several issues. ==Kind of comparison== One is what kind of comparison to use. Is it syntactic equality (=) or semantic equality (equal)? In the case of operators (the use case that has been discussed the most), they come to the same thing. But how about: assume(equal(x,1))$ case x of 0 => und, 1 => und, 1/(x*(x-1)) endcase ==Evaluation of cases== Are the alternatives evaluated, or (implicitly) quoted? Probably implicitly quoted -- though as a general rule I think implicit quoting gets you into trouble, it seems to make sense here. Any arguments the other way? ==Result if not handled== What if none of the clauses are true, and there is no otherwise clause? In "carefree" languages (to invent a term) like Lisp, the result is usually to do nothing, or return nil. In "cautious" languages (like Ada or I think ML), this is an error. (Let's not even talk about case/switch semantics in "careless" languages like C.) I perfer the cautious approach because it makes it easy to write first-draft code that instead of failing silently on cases that it doesn't handle, lets you know there's a problem, e.g. inopx(ex):=block([inflag:true],if atom(expr) then false else op(ex))$ case opx(ex) of false => ex "+" => ... "*" => ... "^" => ... endcase This will work fine for algebraic expressions, but will just return false for sin(x) or a[2], which is almost never the right result. But given the disagreements in other cases about silent failure vs. error signalling, I am not sure we will agree on this.... ==Multiple matches== What about the (common) case where many alteratives are wanted in a branch, e.g. case op(x) of ["+", "-"] => ... or case sign(x) of [pos, pz, zero] => f(x), [neg, nz, zero] => -f(-x), [pnz, pn] => analyze(x) end case This sort of syntax is fine, unless you also want to allow compound objects (like lists and sets) in the selectors, e.g. case (list) of [] => ... /* handle empty list */ [0] => ... /* special case */ ... ==Order of testing== What if more than one branch can match? Do we evaluate them in order? Consider assume(equal(x,a),equal(x,b))$ case x of a => ... b => ... or the sign(x) example above (where zero is in more than one clause). The natural programming interpretation would be to evaluate the clauses sequentially, though the natural mathematical interpretation might be to consider the order irrelevant, and assume that if two cases overlap, it doesn't matter which one you choose. This also allows the implementation more freedom. It may also make it easier to treat unevaluated case statements (though more on that some other time). Thoughts? -s From David.Billinghurst at riotinto.com Mon Jan 8 17:00:41 2007 From: David.Billinghurst at riotinto.com (Billinghurst, David (RTATECH)) Date: Tue, 9 Jan 2007 10:00:41 +1100 Subject: [Maxima] Maxima functions for linear differential equations Message-ID: <026DCC31AB859648A6F16C0E5CD2580DADC032@calttsv025.cal.riotinto.org> > From: Edmond Orignac > > Hello, > > Below I am attaching a file for the solutions of various linear > differential equations related to the Bessel functions. > The functions solve the modified Bessel equation, the Airy equation, > the Scorer equation and the Lommel/Struve/Anger-Weber equations. > These equations are not integrated by ode2 or contrib_ode (but some of > them can be integrated by odelin.lisp). > I have tried to use existing maxima notations for the > results, i.e. the > struve function is represented as hstruve[n](x) as in the specint > package. However, the order of the parameters in slommel is not > indicated in the specint documentation, so there could be some > incompatibility. Also, the scorer_gi, anger_j, weber_e functions > are not defined anywhere in maxima. > > Another function is solving the Lam? equation in polynomial form. > > I hope these maxima functions can be polished and included in a future > release. > > Best, > > E. Orignac Hi Edmond, I will have a look at this and see how it fits into contrib_ode. I am just not sure when. Could be months :-( I have Barton Willis's odelin.lisp integrated into contrib_ode in my sandbox, but haven't found the time to finish that a few months. I will raise the issue of new special functions in a separate post. David NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. From fateman at cs.berkeley.edu Mon Jan 8 17:17:41 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 08 Jan 2007 15:17:41 -0800 Subject: [Maxima] Semantics of "case" In-Reply-To: <8b356f880701081448w4f9bad68p7478071f014f26b6@mail.gmail.com> References: <8b356f880701081448w4f9bad68p7478071f014f26b6@mail.gmail.com> Message-ID: <45A2D115.7050507@cs.berkeley.edu> I think the semantics for case can be taken from the lisp case definition. I think the answers are those interspersed below. Stavros Macrakis wrote: >There has been a lot of discussion about the syntax of a Maxima case >statement. Let's think about the semantics for a second. There are >several issues. > >==Kind of comparison== > >One is what kind of comparison to use. Is it syntactic equality (=) >or semantic equality (equal)? > syntactic. > In the case of operators (the use case >that has been discussed the most), they come to the same thing. But >how about: > > assume(equal(x,1))$ > case x of > 0 => und, > 1 => und, > 1/(x*(x-1)) > endcase > >==Evaluation of cases== > >Are the alternatives evaluated, or (implicitly) quoted? > implicitly quoted. > Probably >implicitly quoted -- though as a general rule I think implicit quoting >gets you into trouble, it seems to make sense here. Any arguments the >other way? > >==Result if not handled== > > >What if none of the clauses are true, and there is no otherwise >clause? In "carefree" languages (to invent a term) like Lisp, the >result is usually to do nothing, or return nil. In "cautious" >languages (like Ada or I think ML), this is an error. (Let's not even >talk about case/switch semantics in "careless" languages like C.) > the implementation I provided returns false. Requiring an "otherwise" clause could be done as a suggestion to the programmer. (What a cautious programmer would do). > >I perfer the cautious approach because it makes it easy to write >first-draft code that instead of failing silently on cases that it >doesn't handle, lets you know there's a problem, e.g. > >inopx(ex):=block([inflag:true],if atom(expr) then false else op(ex))$ > > case opx(ex) of > false => ex > "+" => ... > "*" => ... > "^" => ... > endcase > >This will work fine for algebraic expressions, but will just return >false for sin(x) or a[2], which is almost never the right result. > >But given the disagreements in other cases about silent failure vs. >error signalling, I am not sure we will agree on this.... > >==Multiple matches== > >What about the (common) case where many alteratives are wanted in a branch, e.g. > > case op(x) of > ["+", "-"] => ... > >or > > case sign(x) of > [pos, pz, zero] => f(x), > [neg, nz, zero] => -f(-x), > [pnz, pn] => analyze(x) > end case > >This sort of syntax is fine, unless you also want to allow compound >objects (like lists and sets) in the selectors, e.g. > > case (list) of > [] => ... /* handle empty list */ > [0] => ... /* special case */ > ... > The solution here is to use this: case () of [[]] => ..... matches the empty list only [[0]] => ..... matches the list [0] only > >==Order of testing== > >What if more than one branch can match? Do we evaluate them in order? > >Consider > > assume(equal(x,a),equal(x,b))$ > case x of > a => ... > b => ... > >or the sign(x) example above (where zero is in more than one clause). > >The natural programming interpretation would be to evaluate the >clauses sequentially, though the natural mathematical interpretation >might be to consider the order irrelevant, and assume that if two >cases overlap, it doesn't matter which one you choose. This also >allows the implementation more freedom. It may also make it easier to >treat unevaluated case statements (though more on that some other >time). > > Yes, but see guarded conditions programming where the order is (effectively) random: the program must operate correctly regardless of the order. RJF From robert.dodier at gmail.com Mon Jan 8 20:49:58 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 8 Jan 2007 19:49:58 -0700 Subject: [Maxima] Semantics of "case" In-Reply-To: <8b356f880701081448w4f9bad68p7478071f014f26b6@mail.gmail.com> References: <8b356f880701081448w4f9bad68p7478071f014f26b6@mail.gmail.com> Message-ID: On 1/8/07, Stavros Macrakis wrote: > There has been a lot of discussion about the syntax of a Maxima case > statement. Let's think about the semantics for a second. I'm not convinced case is needed, since we have if--then--elseif--else. > One is what kind of comparison to use. Is it syntactic equality (=) > or semantic equality (equal)? Not sure. I can see arguments both ways. > case x of > 0 => und, > 1 => und, > 1/(x*(x-1)) > endcase endcase is a bit of cruft that I hope we'll avoid, if we end up adopting case. (1) It's unneeded, since parentheses for grouping work just fine. (2) There are no other foo-endfoo constructs in Maxima at present, and for the sake of consistency I hope we're not going to stick endif, endfor, enddo, or whatever all around. I like the "=>" though, also the "of" before the list of alternatives. > Are the alternatives evaluated, or (implicitly) quoted? Probably > implicitly quoted -- though as a general rule I think implicit quoting > gets you into trouble, it seems to make sense here. Any arguments the > other way? Well, implicit quoting can lead to bad surprises here, just like implicit quoting in other contexts. Not sure I have a preference one way or another, though. > What if none of the clauses are true, and there is no otherwise clause? Should return false, like if--then without else. > ==Multiple matches== > > What about the (common) case where many alteratives are wanted in a branch, e.g. > > case op(x) of > ["+", "-"] => ... > > or > > case sign(x) of > [pos, pz, zero] => f(x), > [neg, nz, zero] => -f(-x), > [pnz, pn] => analyze(x) > end case > > This sort of syntax is fine, unless you also want to allow compound > objects (like lists and sets) in the selectors, e.g. > > case (list) of > [] => ... /* handle empty list */ > [0] => ... /* special case */ > ... Well, we could avoid sorting out all of this if we just stick to if--then--elseif---else, that way programmers can be explicit about what they want. > What if more than one branch can match? Do we evaluate them in order? Maybe any or all cases which match should be evaluated. That would be fun, and also more mathematical. FWIW Robert From robert.dodier at gmail.com Mon Jan 8 22:44:12 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 8 Jan 2007 21:44:12 -0700 Subject: [Maxima] Heun and Appell functions In-Reply-To: <1168091516.3008.12.camel@sashimi> References: <1168091516.3008.12.camel@sashimi> Message-ID: On 1/6/07, Edmond Orignac wrote: > I have tried to write some maxima functions to reduce > the Heun function and the Appell F1 hypergeometric function > of two variables to simpler expressions, similar to what the hgfred > function does with pFq hypergeometric functions. Edmond, thanks very much for taking the time to work on this topic. There does not appear to be anything about Heun and Appell functions at present -- looking for file names turns up nothing, and grep finds nothing for Heun and only some conjugations of 'appeler' for Appell. (But maybe someone whose French is stronger can review the stuff in maxima/share/sym/ and verify that.) So I would like, with your permission (and if no-one is opposed) to release these files under the terms of the GNU General Public License version 2 (Maxima's license) and include these files in maxima/share/contrib/. It would be best if we also have a test script, which has pairs of expressions (first an input and second the expected output), and also some documentation. Any plain-text notes you can put together would be very helpful; we can work on the formatting. I wonder if the identities in appelf1red.mac and heun_red.mac should be applied always or only at the explicit request of the user. We can arrange it either way -- maybe you can give us some guidance. All the best Robert Dodier From Daniel.L.Solomon at nasa.gov Mon Jan 8 23:04:08 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Tue, 9 Jan 2007 00:04:08 -0500 Subject: [Maxima] numerical sol'n of vector ODE Message-ID: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> I have a modestly complicated ODE in 3-space, complicated enough that there is no closed form solution. I would like to see a numerical solution through a given initial point. That is given dx/dt = A . x (where x is a 3 vector) and an initial point x0, I'd like to get maxima to compute the trajectory through x0 and show me a 3d plot. Does maxima know how to do this? thanks! From sen1 at math.msu.edu Mon Jan 8 23:42:34 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Tue, 9 Jan 2007 00:42:34 -0500 (EST) Subject: [Maxima] numerical sol'n of vector ODE In-Reply-To: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> References: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> Message-ID: You just want to plot parametrized curves in 3-space. plot3d lets you plot expressions of the form t -> [x(u,v), y(u,v), z(u,v)] If the functions x(u,v), y(u,v), z(u,v) do not depend on v, then you have a curve parametrized by u. so, e.g. plot3d([t, t^2, t^3], [t,0,1], [s,0,1]); gives a plot of the curve over the square [0,1] x [0,1] in 3-space. If you put the mouse in the window and move it, you can rotate the curve in 3-space. To solve your DE numerically, you would use a solver (e.g. like runge-kutte). There is a rk routine in the contrib packages written by Jaime Villate (I only have used it for 2-d vector fields). Try ? rk; HTH, -sen > I have a modestly complicated ODE in 3-space, complicated enough that > there is no closed form solution. I would like to see a numerical > solution through a given initial point. That is given dx/dt = A . x > (where x is a 3 vector) and an initial point x0, I'd like to get > maxima to compute the trajectory through x0 and show me a 3d plot. > Does maxima know how to do this? > > thanks! > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From gerhard.zintel at faurecia.com Tue Jan 9 03:13:25 2007 From: gerhard.zintel at faurecia.com (ZINTEL Gerhard) Date: Tue, 9 Jan 2007 10:13:25 +0100 Subject: [Maxima] how to make results more compact? Message-ID: Hello Stavros, Some notes about your reply to my mail "how to make results more compact?" >> EQ1: Zo*C*L+Zo*A*L-Zo*D*K+Zo*B*K-Zo*C*J-Zo*A*J-Zo*D*I+Zo*B*I+B*L-D*J >> >> Now I know the most compact form would be >> >> EQ2: Zo * ((C+A)*(L-J) + (B-D)*(K+I)) + B*L - D*J >> >> How to make MAXIMA finding EQ2 from EQ1? > > If you were able to analyze your expression manually, then you must > have followed some strategy which allowed you to master this > combinatorial blowup, which may be based on a priori knowledge of the > form of the result. You should be able to program this strategy in > Maxima. For example, if every term is of the form (v1+v2)*(v3-v4), > then you could try divide'ing the expression by all possible (vm+vn) > etc. In my mind the algorithm seems very simple - at least when doing it by hand. Goal is to reduce the overall number of multiplications and summations of an expression to its minimum. This is always preferable if you want to use a result of MAXIMA as code fragment in a computer program. (MAXIMA is surely often used for this?!) The algorithm seems to be straight forward (at least for that kind of combinatorial blow-up I used as an example at the end of my posting http://www.math.utexas.edu/pipermail/maxima/2007/004416.html ) The following should do it. 1. counting which variable appears most often (Zo in my example) 2. factor out this variable; you would get a system like Zo*[...] + [...] 3. Repeat steps 1, 2 in each part [...] recursively as long as you are able to factor out further variables; you'll get something like Zo (a(b+c) + d(-b-c) + e( ... ) + ... ) + ( ... ) 4. Substitute all inner summes like (a+b) by a new variable; with e.g. X=(b+c) this would lead to something like Zo (a X - d X + e( ... ) + ... ) + ( ... ) 5. Now repeat steps 1 to 4 until the result doesn't change any more. That should do the trick. Up to now I don't have any knowledge about how to program this algorithm in MAXIMA. But that may change in future. Maybe there is someone on the list who is also interested in that subject and could help me to start. Thanks Gerhard This electronic transmission (and any attachments thereto) is intended solely for the use of the addressee(s). It may contain confidential or legally privileged information. If you are not the intended recipient of this message, you must delete it immediately and notify the sender. Any unauthorized use or disclosure of this message is strictly prohibited. Faurecia does not guarantee the integrity of this transmission and shall therefore never be liable if the message is altered or falsified nor for any virus, interception or damage to your system. From ihep-2005 at yandex.ru Tue Jan 9 03:33:23 2007 From: ihep-2005 at yandex.ru (Andrey Siver) Date: Tue, 9 Jan 2007 12:33:23 +0300 (MSK) Subject: [Maxima] Are there any efforts to make MAXIMA interaction with java? Message-ID: <45A36163.000004.13847@camay.yandex.ru> Hello, ----- Original Message ----- From: "Robert Dodier" To: "Andrey Siver" Cc: Sent: Monday, January 01, 2007 4:02 AM Subject: Re: [Maxima] Are there any efforts to make MAXIMA interaction with java? > On 12/27/06, Andrey Siver wrote: > >> I have a question: were there any efforts to make MAXIMA interaction with >> java? > > I believe the best way to make this happen is for someone to write > a Java bytecode generator for Clisp. If I'm not mistaken that is an > item on the Clisp wish list. Clisp generates bytecodes for its own > interpreter so generating Java bytecodes seems like not too much > of a stretch .... It seems to me, that API from lisp to java would be enough. I think about the same thing as Mathematica jLink (when MAXIMA would be a server and every java application would be a client). >> And is there any success to make MAXIMA interaction with C/C++? > > Probably the best way to achieve that is to complete the GCL version > of CFFI -- it is reported to work already for Clisp, SBCL, and CMUCL. > I don't know if anyone is working on CFFI + GCL at the moment; > you would have to check in with the CFFI project. > > Hope this helps, & happy new year, Thank You, -Andrey From biomates at telefonica.net Tue Jan 9 06:07:52 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Tue, 09 Jan 2007 13:07:52 +0100 Subject: [Maxima] numerical sol'n of vector ODE In-Reply-To: References: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> Message-ID: <1168344473.7993.4.camel@localhost.localdomain> > There is a rk routine in the contrib packages written by Jaime > Villate (I only have used it for 2-d vector fields). There are also the (undocumented) functions of package diffeq (share/numeric/diffeq.mac), which were written in 1980: runge1, runge2 and rungen. -- Mario Rodriguez Riotorto www.biomates.net From willisb at unk.edu Tue Jan 9 08:14:16 2007 From: willisb at unk.edu (Barton Willis) Date: Tue, 9 Jan 2007 08:14:16 -0600 Subject: [Maxima] conditionals and bad plist In-Reply-To: <1168344473.7993.4.camel@localhost.localdomain> References: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> , <1168344473.7993.4.camel@localhost.localdomain> Message-ID: While we are on the topic of 'case' vs 'if then else', consider this bug (or these bugs): (%i1) prederror : false$ OK more or less: (%i2) if f(k) then 0 else %pi; (%o2) if unknown then 0 else %pi But not OK: (%i3) if f(k) + 1 then 0 else %pi; Incorrect syntax: Found algebraic expression where logical expression expected I see no reason for the syntax error. Definitely not OK: (%i3) if (f(k) + 1) then 0 else %pi; Maxima encountered a Lisp error: Error in PROGN [or a callee]: Bad plist ($K) The bad plist error seems to come from mevalp: OK: (%i6) ?mevalp(f(k)); (%o6) unknown Not OK: (%i7) ?mevalp(f(k)+1); Maxima encountered a Lisp error: Error in PROGN [or a callee]: Bad plist ($K) Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. Barton From raymond.toy at ericsson.com Tue Jan 9 08:48:07 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 09 Jan 2007 09:48:07 -0500 Subject: [Maxima] doc for plot.lisp In-Reply-To: (sen1@math.msu.edu's message of "Mon, 8 Jan 2007 11:44:43 -0500 (EST)") References: Message-ID: >>>>> "sen1" == sen1 writes: sen1> Hi, sen1> Is there any documentation for how to experiment with the routines in sen1> plot.lisp ? The only documentation I know of is the code itself, and the little bit that describe produces. sen1> For instance, what do the following functions take as arguments and what do sen1> they do? sen1> show-open-plot Based on a very quick reading of the code, show-open-plot seems to take a string which is then sent to the openmath plot program. sen1> with-output-to-string This is a standard Common Lisp function. It basically creates a new stream where you can write results to. When with-output-to-string is done, it returns a string containing everything you've written. sen1> I would like to create a routine that opens a plot window, allows one sen1> to click on a point on the canvas to call another graphics routine. Perhaps this could be done with xmaxima. I am not an xmaxima user, though. Ray From raymond.toy at ericsson.com Tue Jan 9 08:50:44 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 09 Jan 2007 09:50:44 -0500 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: (Neilen Marais's message of "Mon, 08 Jan 2007 15:38:11 +0200") References: <000001c73150$572a4080$05d09888@RJFE510> Message-ID: >>>>> "Neilen" == Neilen Marais writes: Neilen> Richard, Neilen> On Fri, 05 Jan 2007 21:05:51 -0800, Richard Fateman wrote: >> The Risch algorithm, which should not be called here, is apparently being >> called. It would perhaps not happen if %i were not there. Neilen> Removing %i results in a similarly slow integration. Is there any other Neilen> way I can force Maxima not to use the Risch algorithm? Maxima calls the Risch integrator when the arg of the trig function is not a plain variable. It might be possible to add another test to MONSTERTRIG (responsible for handling messy trig integrands) so that if the trig arg is of the form a*x to try the substitution y = a*x and integrate that. If it succeeds, we're done; if not, call the Risch integrator. This requires knowledge of Lisp to do, though. Ray From robert.dodier at gmail.com Tue Jan 9 09:47:51 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 9 Jan 2007 08:47:51 -0700 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: References: <000001c73150$572a4080$05d09888@RJFE510> Message-ID: On 1/9/07, Raymond Toy wrote: > It might be possible to add another test to MONSTERTRIG (responsible > for handling messy trig integrands) so that if the trig arg is of the > form a*x to try the substitution y = a*x and integrate that. If it > succeeds, we're done; if not, call the Risch integrator. Maxima knows integrate(sin(n*x)*x, x) with symbolic n. Maybe we can throw in a heuristic: replace literal constants with symbols and try to integrate it; if that fails then fall back on whatever is done now. I believe that this problem is not the only example for which Maxima knows the general solution but fails on a special case. FWIW Robert From robert.dodier at gmail.com Tue Jan 9 09:56:22 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 9 Jan 2007 08:56:22 -0700 Subject: [Maxima] conditionals and bad plist In-Reply-To: References: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> <1168344473.7993.4.camel@localhost.localdomain> Message-ID: On 1/9/07, Barton Willis wrote: > (%i3) if f(k) + 1 then 0 else %pi; > Incorrect syntax: Found algebraic expression where logical expression > expected Well, this comes from the parser, which wants to see a "clause" between if and then. It is easy to change that -- (DEF-RPOS $IF $ANY) is enough. Then Maxima is happy with stuff like 'if f(k)+1 then foo else bar; But as long as Maxima distinguishes Boolean values from arithmetic values, I don't see how f(k) + 1 could ever become a Boolean. So, although I am not usually in favor of error messages, it seems appropriate in this context. All the best Robert From fateman at cs.berkeley.edu Tue Jan 9 09:56:48 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 9 Jan 2007 07:56:48 -0800 Subject: [Maxima] how to make results more compact? In-Reply-To: Message-ID: <010201c73406$c62e7510$05d09888@RJFE510> I think this algorithm does not provide a minimum. Try it on ratsimp ((x+y+z)^4); There are many ways of rearranging expressions to minimize multiplications and additions, and while you may reduce the number somewhat by this technique, it is not a minimum. RJF From fateman at cs.berkeley.edu Tue Jan 9 10:06:55 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 9 Jan 2007 08:06:55 -0800 Subject: [Maxima] conditionals and bad plist In-Reply-To: Message-ID: <010d01c73408$2f9e6180$05d09888@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Barton Willis > Sent: Tuesday, January 09, 2007 6:14 AM > To: maxima at math.utexas.edu > Subject: [Maxima] conditionals and bad plist > > While we are on the topic of 'case' vs 'if then else', > consider this bug (or these bugs): > > (%i1) prederror : false$ > > OK more or less: > > (%i2) if f(k) then 0 else %pi; > (%o2) if unknown then 0 else %pi > > But not OK: > > (%i3) if f(k) + 1 then 0 else %pi; > Incorrect syntax: Found algebraic expression where logical expression > expected > > I see no reason for the syntax error. It is an error of some sort to expect xxx+1 to return true or false. The program's objection seems to me to be valid in a type-checking sense. Whether this is a syntax error or some other kind of error may be arguable. Definitely not OK: > > (%i3) if (f(k) + 1) then 0 else %pi; > Maxima encountered a Lisp error: > Error in PROGN [or a callee]: Bad plist ($K) > This error message is not helpful. The commercial macsyma objects to this as well, but the message is "error: circular plist". This presumably has to do with the violence done to expressions by mevalp and its related programs that deal with assumptions. RJF From Alain.Michaud at nrc-cnrc.gc.ca Tue Jan 9 10:24:31 2007 From: Alain.Michaud at nrc-cnrc.gc.ca (Alain Michaud) Date: Tue, 09 Jan 2007 11:24:31 -0500 Subject: [Maxima] Angular momentum operators Message-ID: <1168359872.3235.11.camel@33w06685a> Hi, I am new to symbolic manipulation software. I hope my questions will not be too dumb: - Is there a textbook, for Maxima? Is Maxima similar enough so that I can just go to he books written for Maple (or Mathematica)? - By any chance, is there a package where I find Clebsch-Gordan, Wigner, 3-j, 6-j coefficients, and all that jazz? - I am using linux on usual pentium computers. Which lisp compiler is the best (I have clisp right now)? Thank you Alain From macrakis at alum.mit.edu Tue Jan 9 10:48:51 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 9 Jan 2007 11:48:51 -0500 Subject: [Maxima] conditionals and bad plist In-Reply-To: References: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> <1168344473.7993.4.camel@localhost.localdomain> Message-ID: <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> > (%i1) prederror : false$ > OK more or less: > (%i2) if f(k) then 0 else %pi; > (%o2) if unknown then 0 else %pi No, this is worse than useless -- it seems that the unevaluated conditional experimentation has leaked into the production version. Why is it useless: 1) if this if-statement was being executed for side-effects, it would be a silent no-op. This is the main reason I object to conflating programming if-statements and expression conditional expressions. 2) if there are going to be unevaluated conditionals, then they should *preserve* things that cannot be evaluated completely, not replace them by less-informative conditions. After all, abs(x) where the sign of x is unknown does not and should not simplify to UND. > But not OK: > (%i3) if f(k) + 1 then 0 else %pi; > Incorrect syntax: Found algebraic expression where logical expression > expected This is as designed. The protasis must be a boolean expression. "+" cannot return a boolean result, so the syntax prevents this. > I see no reason for the syntax error. Definitely not OK: > (%i3) if (f(k) + 1) then 0 else %pi; > Maxima encountered a Lisp error: > Error in PROGN [or a callee]: Bad plist ($K) Now this one is clearly a bug. -s From fateman at cs.berkeley.edu Tue Jan 9 10:56:52 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 9 Jan 2007 08:56:52 -0800 Subject: [Maxima] conditionals and bad plist In-Reply-To: <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> Message-ID: <011801c7340f$29d46e50$05d09888@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Stavros Macrakis > Sent: Tuesday, January 09, 2007 8:49 AM > To: Barton Willis > Cc: maxima at math.utexas.edu > Subject: Re: [Maxima] conditionals and bad plist > > > (%i1) prederror : false$ > > OK more or less: > > (%i2) if f(k) then 0 else %pi; > > (%o2) if unknown then 0 else %pi > > No, this is worse than useless Good point. Commercial macsyma leaves it alone. > > > But not OK: > > (%i3) if f(k) + 1 then 0 else %pi; > > Incorrect syntax: Found algebraic expression where logical expression > > expected > > This is as designed. The protasis must be a boolean expression. "+" > cannot return a boolean result, so the syntax prevents this. Protasis!! A new word for my day!! > From robert.dodier at gmail.com Tue Jan 9 11:06:31 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 9 Jan 2007 10:06:31 -0700 Subject: [Maxima] conditionals and bad plist In-Reply-To: <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> References: <47B51B6B-61E8-4D0F-9F66-F8C075FDF167@nasa.gov> <1168344473.7993.4.camel@localhost.localdomain> <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> Message-ID: On 1/9/07, Stavros Macrakis wrote: > > (%i1) prederror : false$ > > OK more or less: > > (%i2) if f(k) then 0 else %pi; > > (%o2) if unknown then 0 else %pi > > No, this is worse than useless -- I agree this behavior is suboptimal. > it seems that the unevaluated conditional experimentation has > leaked into the production version. That is not the case. This behavior has been present at least since 5.9.1. > 2) if there are going to be unevaluated conditionals, then they should > *preserve* things that cannot be evaluated completely, Agreed. load (boolsimp); if f(k) then 0 else 1; => if f(k) then 0 else 1 Robert From raymond.toy at ericsson.com Tue Jan 9 11:12:27 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 09 Jan 2007 12:12:27 -0500 Subject: [Maxima] integrating trig functions with large constants, exponent out of range In-Reply-To: (Robert Dodier's message of "Tue, 9 Jan 2007 08:47:51 -0700") References: <000001c73150$572a4080$05d09888@RJFE510> Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/9/07, Raymond Toy wrote: >> It might be possible to add another test to MONSTERTRIG (responsible >> for handling messy trig integrands) so that if the trig arg is of the >> form a*x to try the substitution y = a*x and integrate that. If it >> succeeds, we're done; if not, call the Risch integrator. Robert> Maxima knows integrate(sin(n*x)*x, x) with symbolic n. Maybe we Robert> can throw in a heuristic: replace literal constants with symbols and Robert> try to integrate it; if that fails then fall back on whatever is done now. I didn't implement this heuristic, but did implement the substitution y = a*x. This seems to work and the test suite passes. I'm not sure this is the right place or way to fix this issue. It seems that the Risch integrator would be the right place to fix this, but I don't know anything about the Risch integrator. Ray If you want to play with this, use the following snippet in place of monstertrig. (defun simple-trig-arg (exp) (m2 exp '((mtimes) ((coefftt) (c freevar)) ((coefftt) (v varp))) nil)) (defun monstertrig (exp var *trigarg*) (declare (special *trigarg*)) ;; New stuff begins here, replacing existing code (when (not (atom *trigarg*)) (let ((arg (simple-trig-arg *trigarg*))) (cond (arg ;; We have trig(c*x). Use the substitution y=c*x to try ;; to compute the integral. Why? Because x*sin(n*x) ;; takes longer and longer as n gets larger and larger. ;; This is caused by the Risch integrator. This is a ;; work-around for this issue. (let ((c (cdras 'c arg)) (new-var (gensym "NEW-VAR-"))) (let ((new-int ($integrate (div (maxima-substitute (div new-var c) var exp) c) new-var))) (return-from monstertrig (maxima-substitute *trigarg* new-var new-int))))) (t (return-from monstertrig (rischint exp var)))))) ;; End of new stuff. (prog (*notsame* w *a* *b* y *d*) (declare (special *notsame*)) From raymond.toy at ericsson.com Tue Jan 9 11:19:29 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 09 Jan 2007 12:19:29 -0500 Subject: [Maxima] Angular momentum operators In-Reply-To: <1168359872.3235.11.camel@33w06685a> (Alain Michaud's message of "Tue, 09 Jan 2007 11:24:31 -0500") References: <1168359872.3235.11.camel@33w06685a> Message-ID: >>>>> "Alain" == Alain Michaud writes: Alain> Hi, Alain> I am new to symbolic manipulation software. I hope my questions will Alain> not be too dumb: Alain> - Is there a textbook, for Maxima? Is Maxima similar enough so that I Alain> can just go to he books written for Maple (or Mathematica)? You can find a reference manual and a tutorial at . There are probably other material elsewhere. I think maxima is sufficiently different that Maple and MMA books will not be that helpful. But I am not an Maple or MMA user. Alain> - I am using linux on usual pentium computers. Which lisp compiler is Alain> the best (I have clisp right now)? Any of the lisps supported by maxima (including clisp, cmucl, gcl, sbcl) should work. Ray From ko at research.att.com Tue Jan 9 10:36:49 2007 From: ko at research.att.com (Kostas Oikonomou) Date: Tue, 9 Jan 2007 16:36:49 +0000 (UTC) Subject: [Maxima] Strange behavior of atom() Message-ID: I read the documentation on atom() in the manual Returns true if expr is atomic (i.e. a number, name or string) else false. Thus atom(5) is true while atom(a[1]) and atom(sin(x)) are false (asuming a[1] and x are unbound). and then I try the following: Maxima 5.11.0 http://maxima.sourceforge.net Using Lisp SBCL 0.9.14 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) atom(sin(2)); (%o1) false (%i2) atom(sin(2.0)); (%o2) true (%i3) atom(sin(x)); (%o3) false (%i4) x:3; (%o4) 3 (%i5) atom(sin(x)); (%o5) false (%i6) atom(sin(x/2)); (%o6) false (%i7) atom(sin(0.1*x)); (%o7) true (%i8) It seems to me that the documentation not consistent with these results. Or am I missing something? Thanks for your help. Kostas From michel.vandenbergh at uhasselt.be Tue Jan 9 11:27:13 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 09 Jan 2007 18:27:13 +0100 Subject: [Maxima] Strange behavior of atom() Message-ID: <45A3D071.5050703@uhasselt.be> sin(2.0) is evaluated (as its argument is a float). The result is a float, hence an atom. sin(2) is not evaluated (as it cannot be evaluated exactly). Hence sin(2) is not an atom. If you want sin(2) to be evaluated put numer:true; Hope this helps. Michel From fateman at cs.berkeley.edu Tue Jan 9 11:34:34 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 9 Jan 2007 09:34:34 -0800 Subject: [Maxima] Strange behavior of atom() In-Reply-To: Message-ID: <011a01c73414$6e5dcda0$05d09888@RJFE510> > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Kostas Oikonomou > Sent: Tuesday, January 09, 2007 8:37 AM > To: maxima at math.utexas.edu > Subject: [Maxima] Strange behavior of atom() > .... > > > It seems to me that the documentation not consistent with these results. > Or am I missing something? Yes. You are missing "evaluation." Try typing sin(2.0) and see if it looks like an atom to you. Try sin(3/2), also. Is 2+2 an atom? If you first compute 4, then it is an atom. From sangwinc at for.mat.bham.ac.uk Tue Jan 9 11:36:17 2007 From: sangwinc at for.mat.bham.ac.uk (Chris Sangwin) Date: Tue, 9 Jan 2007 17:36:17 +0000 (GMT) Subject: [Maxima] Documentation, (was Angular momentum operators) In-Reply-To: References: <1168359872.3235.11.camel@33w06685a> Message-ID: I think Robert's "Minimal Maxima" is a useful place to start. http://maxima.sourceforge.net/docs/tutorial/en/minimal-maxima.pdf Chris >>>>>> "Alain" == Alain Michaud writes: > > Alain> - Is there a textbook, for Maxima? Is Maxima similar enough so that I > Alain> can just go to he books written for Maple (or Mathematica)? > From michel.vandenbergh at uhasselt.be Tue Jan 9 12:23:42 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 09 Jan 2007 19:23:42 +0100 Subject: [Maxima] Questions about maxima's source code Message-ID: <45A3DDAE.70501@uhasselt.be> Hi, I am trying to find my way in maxima's source code. To speed things up I have some questions. (1) Where is maxima's main loop located? (2) I assume that things type by the user are first translated into maxima's internal format and then evaluated. Is the evaluation done by meval? (3) Which is the routine which formats maxima's internal format for display? Any help is appreciated! Michel From willisb at unk.edu Tue Jan 9 12:28:00 2007 From: willisb at unk.edu (Barton Willis) Date: Tue, 9 Jan 2007 12:28:00 -0600 Subject: [Maxima] conditionals and bad plist In-Reply-To: <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> Message-ID: macrakis at gmail.com wrote on 01/09/2007 10:48:51 AM: > > (%i1) prederror : false$ > > OK more or less: > > (%i2) if f(k) then 0 else %pi; > > (%o2) if unknown then 0 else %pi > > No, this is worse than useless -- it seems that the unevaluated > conditional experimentation has leaked into the production version. boolsimp fixes this: (%i1) load(boolsimp)$ (%i2) if f(k) then 0 else %pi; (%o2) if f(k) then 0 else %pi Could we make boolsimp the standard in the next release? > This is as designed. The protasis must be a boolean expression. "+" > cannot return a boolean result, so the syntax prevents this. Of course 'true' shouldn't be in the range of "+", but it is: (%i3) f(k) := true - 1; (%o3) f(k):=true-1 (%i4) f(k) + 1; (%o4) true Barton From areiner at tph.tuwien.ac.at Tue Jan 9 10:26:41 2007 From: areiner at tph.tuwien.ac.at (Albert Reiner) Date: 09 Jan 2007 17:26:41 +0100 Subject: [Maxima] Semantics of "case" In-Reply-To: References: <8b356f880701081448w4f9bad68p7478071f014f26b6@mail.gmail.com> Message-ID: <86y7ocxj26.fsf@willehalm.reiner> ["Robert Dodier" , Mon, 8 Jan 2007 19:49:58 -0700]: > I'm not convinced case is needed, since we have if--then--elseif--else. +1, especially as anyone who wants "case" can easily provide one himself, with exactly the right semantics. For this to work well, however, we would need namespaces: a much more important addition to the Maxima language IMO, and unfortunately one much more difficult to implement. Just my EUR 0.02, Albert. From macrakis at alum.mit.edu Tue Jan 9 13:02:55 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 9 Jan 2007 14:02:55 -0500 Subject: [Maxima] conditionals and bad plist In-Reply-To: References: <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> Message-ID: <8b356f880701091102m70a9c4cdw8bb3934400f774bb@mail.gmail.com> > Could we make boolsimp the standard in the next release? There are four reasons I am strongly opposed to this: 1) Because "if" can be a no-op rather than an error in some cases. This may affect existing Maxima code, but it is also a trap for people writing new code. I find the unevaluated conditional a very valuable piece of functionality; I'm just not convinced it should be conflated with the programming construct. On the other hand, I have no problem with changing the boolean operators this way. 2) Because its compiled behavior is completely incompatible with its interpreted behavior. That is not acceptable for any core functionality in Maxima (though of course there are existing bugs...). Of course, it is just "a small matter of programming" to fix this.... 3) Because it does not shield simplification-time errors on unevaluated branches. I know that Robert considers this a problem with simplification, not with unevaluated conditionals, and I pretty much agree, but it needs to be fixed. E.g. if x then 1/0 should simplify to if x then raise(...appropriate exception...). 4) As a mathematical operation (as opposed to a programming operation), a conditional should be insensitive to the order of the clauses, like Dijkstra's guarded commands. This makes the formal properties much simpler and more conducive to further symbolic manipulation (which is why Dijkstra introduced this notation in the first place). I would propose that instead of changing "if", we introduce a new guarded command structure, e.g. cond(a => b, c => d, ...), which would be the "simplifying" version. We would still have to resolve the simplification-time error problem, but the other issues go away. -s From miguel39123 at hotmail.com Tue Jan 9 13:21:32 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Tue, 9 Jan 2007 19:21:32 +0000 (UTC) Subject: [Maxima] How to make results more compact Message-ID: For ZINTER. The following should do steps 1, 2,3 the rest by hand. Look to the example at the end. No more time to explain the code. 1. counting which variable appears most often (Zo in my example) 2. factor out this variable; you would get a system like Zo*[...] + [...] 3. Repeat steps 1, 2 in each part [...] recursively as long as you are able to factor out further variables; you'll get something like Zo (a(b+c) + d(-b-c) + e( ... ) + ... ) + ( ... ) inflag:true; mostoften(e):=block([c,el,maxi,lv,ae], if numberp(e) then return(false), lv:sort(listofvars(e)), ae:args(e), for x in lv do c[x]:0, for x in ae do if not(atom(x)) then for y in args(x) do if not(numberp(y)) then c[y]:c[y]+1, maxi:0, for x in lv do if c[x]>maxi then (maxi:c[x], el:x), if maxi > 1 then return(el) else return(false)); rompe(e):=block([y],y:mostoften(e), if y=false then false else [y,subst(1,y,e),subst(0,y,e)]); da(e):= block([l],l:rompe(e), if l=false then return(e) else return(l[1]*da(l[2]-l[3])+da(l[3]))); ---------------------------------------------------------------- Example: (%i103) e1:expand((a+b+c)*(d+e+f)*(g+h+i)); (%o103) c*f*i+b*f*i+a*f*i+c*e*i+b*e*i+a*e*i+c*d*i+b*d*i+a*d*i+ c*f*h+b*f*h+a*f*h+ c*e*h+b*e*h+a*e*h+c*d*h+b*d*h+a*d*h+c*f*g+b*f*g+a*f*g+c*e*g+b*e*g+ a*e*g+c*d*g+ b*d*g+a*d*g (%i104) da(e1); (%o104) c*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g))+b*(f*(i+h+g)+ e*(i+h+g)+d*(i+h+g))+a*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g)) (%i105) subst(C,i+h+g,%); (%o105) c*(f*C+e*C+d*C)+b*(f*C+e*C+d*C)+a*(f*C+e*C+d*C) (%i106) da(expand(%)); (%o106) (c*(f+e+d)+b*(f+e+d)+a*(f+e+d))*C (%i107) subst(B,f+e+d,%); (%o107) (c*B+b*B+a*B)*C (%i108) da(expand(%)); (%o108) (c+b+a)*B*C (%i109) subst(A,c+b+a,%); (%o109) A*B*C From ko at research.att.com Tue Jan 9 13:28:55 2007 From: ko at research.att.com (Kostas Oikonomou) Date: Tue, 9 Jan 2007 19:28:55 +0000 (UTC) Subject: [Maxima] Strange behavior of atom(), cont'd References: Message-ID: Thanks to Richard and Michel for clarifying. What gave rise to my question was that I was trying to find a way, from within a Maxima file that I load, to tell if a needed package had already been loaded, or if I needed to load it. I was trying to use atom() to see if a function in the package was defined, and if not, to load the package. Specifically, I was testing the function random_continuous_uniform(0,1,1) in "distrib". Is there a better way to detect if a package/file has already been loaded into Maxima? Kostas From raymond.toy at ericsson.com Tue Jan 9 13:41:52 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Tue, 09 Jan 2007 14:41:52 -0500 Subject: [Maxima] Questions about maxima's source code In-Reply-To: <45A3DDAE.70501@uhasselt.be> (Michel Van den Bergh's message of "Tue, 09 Jan 2007 19:23:42 +0100") References: <45A3DDAE.70501@uhasselt.be> Message-ID: >>>>> "Michel" == Michel Van den Bergh writes: Michel> Hi, Michel> I am trying to find my way in maxima's source code. Michel> To speed things up I have some questions. Michel> (1) Where is maxima's main loop located? cl-user::run, in src/init-cl.lisp, which basically runs macsyma-top-level, in src/macsys.lisp. Michel> (2) I assume that things type by the user are first translated into Michel> maxima's internal format and then evaluated. Michel> Is the evaluation done by meval? After some poking around, it's the function toplevel-macsyma-eval in macsys.lisp, which basically calls meval*. Michel> (3) Which is the routine which formats maxima's internal format for display? This is done by the function displa in src/displa.lisp. Ray From macrakis at alum.mit.edu Tue Jan 9 15:03:00 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 9 Jan 2007 16:03:00 -0500 Subject: [Maxima] How to make results more compact In-Reply-To: References: Message-ID: <8b356f880701091303o2ce0aaa7nf417757cc6802870@mail.gmail.com> On 1/9/07, miguel lopez wrote: > The following should do steps 1, 2,3 the rest by hand. You can use "optimize" for the rest: optimize ( c*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g))+b*(f*(i+h+g)+ e*(i+h+g)+d*(i+h+g))+a*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g)) ) => block([%1,%2], %1:i+h+g, %2:f*%1+e*%1+d*%1, c*%2+b*%2+a*%2) Note that optimize does *not* find subexpressions like a+b in a+b+c. -s From fateman at cs.berkeley.edu Tue Jan 9 17:08:42 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Tue, 09 Jan 2007 15:08:42 -0800 Subject: [Maxima] Questions about maxima's source code In-Reply-To: References: <45A3DDAE.70501@uhasselt.be> Message-ID: <45A4207A.5060407@cs.berkeley.edu> Raymond Toy wrote: >>>>>>"Michel" == Michel Van den Bergh writes: >>>>>> >>>>>> > > Michel> Hi, > Michel> I am trying to find my way in maxima's source code. > Michel> To speed things up I have some questions. > > Michel> (1) Where is maxima's main loop located? > >cl-user::run, in src/init-cl.lisp, which basically runs >macsyma-top-level, in src/macsys.lisp. > > Michel> (2) I assume that things type by the user are first translated into > Michel> maxima's internal format and then evaluated. > Michel> Is the evaluation done by meval? > >After some poking around, it's the function toplevel-macsyma-eval in >macsys.lisp, which basically calls meval*. > There is another important activity which is simplification, done by simplifya > > Michel> (3) Which is the routine which formats maxima's internal format for display? > >This is done by the function displa in src/displa.lisp. > You might want to look at nformat, which is an intermediate level between the internal form and the program that spews bits on a screen. > >Ray >_______________________________________________ >Maxima mailing list >Maxima at math.utexas.edu >http://www.math.utexas.edu/mailman/listinfo/maxima > > From andrej.vodopivec at gmail.com Tue Jan 9 17:38:29 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Wed, 10 Jan 2007 00:38:29 +0100 Subject: [Maxima] Extending maxima language In-Reply-To: References: <7775b21a0701071151i5bbdca02md81ad10945a278c9@mail.gmail.com> Message-ID: <7775b21a0701091538s1b0eeb6di1c6ef2f1a494d212@mail.gmail.com> > This is implemented by defstruct.lisp which is already in share/contrib. > However there were problems with the defstruct stuff so it didn't get > merged into src/. We should take another look at that and clear up > any remaining problems. > > e.g. > load (defstruct); > [a, b, c] : [1, x, sin(y)]; > values; > => [a, b, c] > [a, b, c]; > => [1, x, sin(y)] I also noticed a problem with mset: (%i1) i:1$ (%i2) b:[1,2]$ (%i3) b[i]:2$ (%i4) b; (%o4) [2,2] (%i5) load(defstruct)$ (%i6) b[i]:0$ (%i7) b; (%o7) [2,2] (%i8) i; (%o8) 0 Andrej From dan.stanger at ieee.org Tue Jan 9 18:12:45 2007 From: dan.stanger at ieee.org (Dan Stanger) Date: Tue, 09 Jan 2007 19:12:45 -0500 Subject: [Maxima] Strange behavior of atom(), cont'd In-Reply-To: References: Message-ID: <45A42F7D.7080807@ieee.org> One way is to define a variable in the package, and check if the variable is there when the package is needed. There are some examples of this in the share source code. Dan Stanger Kostas Oikonomou wrote: >Thanks to Richard and Michel for clarifying. > >What gave rise to my question was that I was trying to find a way, from within >a Maxima file that I load, to tell if a needed package had already been loaded, >or if I needed to load it. > >I was trying to use atom() to see if a function in the package was defined, >and if not, to load the package. Specifically, I was testing the function >random_continuous_uniform(0,1,1) in "distrib". > >Is there a better way to detect if a package/file has already been loaded into >Maxima? > >Kostas > > >_______________________________________________ >Maxima mailing list >Maxima at math.utexas.edu >http://www.math.utexas.edu/mailman/listinfo/maxima > > > > From lotnick at epf.pl Wed Jan 10 01:07:49 2007 From: lotnick at epf.pl (=?iso-8859-2?Q?Micha=B3_Tworek?=) Date: Wed, 10 Jan 2007 08:07:49 +0100 Subject: [Maxima] units Message-ID: <001001c73486$09efa1f0$5e0ba8c0@tworek> Hi,all :-) I've got troubles with units . I read http://maxima.sourceforge.net/docs/manual/pt/maxima_71.html . What am I doing? This is my example.First with mass,acceleration and force...everything OK. But from i7 you'll see that I have troubles with calculate [kg/s^2] to [N/m] .Sometimes I get outputs for q in these units, but I need outputs in N/m . I'm not going to explain everyone that these units are equal. By hand: [kg/s^2]=[ (N*s^2)/m / s^2 ]= [N/m] >From maxima: (%i1) load("unit")$ ******************************************************************* * Units version 0.50 * * Definitions based on the NIST Reference on * * Constants, Units, and Uncertainty * * Conversion factors from various sources including * * NIST and the GNU units package * ******************************************************************* Redefining necessary functions... Initializing unit arrays... Done. (%i2) Mass:70*kg; (%o2) 70*kg (%i3) acceleration:9.81*[m/s^2]; (%o3) [9.810000000000001*m/s^2] (%i4) Force:Mass*acceleration; (%o4) [686.7000000000001*(kg*m)/s^2] (%i5) setunits(N); (%o5) done (%i6) Force; (%o6) [6867/10*N] (%i7) q:287*[kg/s^2]; (%o7) [287*kg/s^2] (%i8) setunits(N,m); Too many arguments supplied to setunits(units): [N,m] -- an error. To debug this try debugmode(true); (%i9) setunits[(N,m)]; (%o9) setunits[m] (%i10) q; (%o10) [287*kg/s^2] (%i11) setunits[(N,m)]; (%o11) setunits[m] (%i12) q; (%o12) [287*kg/s^2] (%i13) setunits(N/m); Argument to `concat' not an atom: %force/%length #0: setunits(units=[N/m])(unit.mac line 606) #1: setunits(units=N/m)(unit.mac line 624) -- an error. To debug this try debugmode(true); (%i14) setunits[N/m]; (%o14) setunits[N/m] (%i15) q; (%o15) [287*kg/s^2] (%i16) ************************************************************************************************************ Anyone knows what to do? --------------------- Panorama Internetu - prognoza pogody, poczta e-mail z najwi?kszym za??cznikiem, SMS, wyszukiwarki: Gooru, Anonser, serwisy: randki, og?oszenia, wakacje, program TV, Kina, muzyka, DVD, newsy, inne. http://www.panoramainternetu.pl/ (http://www.epf.pl/) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070110/307ec7ce/attachment.htm From gerhard.zintel at faurecia.com Wed Jan 10 06:57:21 2007 From: gerhard.zintel at faurecia.com (ZINTEL Gerhard) Date: Wed, 10 Jan 2007 13:57:21 +0100 Subject: [Maxima] How to make results more compact Message-ID: > > The following should do steps 1, 2,3 the rest by hand. > > You can use "optimize" for the rest: > > optimize ( c*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g))+b*(f*(i+h+g)+ > e*(i+h+g)+d*(i+h+g))+a*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g)) ) => > > block([%1,%2], > %1:i+h+g, > %2:f*%1+e*%1+d*%1, > c*%2+b*%2+a*%2) > > Note that optimize does *not* find subexpressions like a+b in a+b+c. Obviously I'm a bit stubborn, but in my mind optimized should give: block([%1,%2], %1:i+h+g, %2:%1*(f+e+d), %2*(c+b+a) I know, it's all very well to say that but it's surely hard to code it. Thank you very much for your help! Gerhard This electronic transmission (and any attachments thereto) is intended solely for the use of the addressee(s). It may contain confidential or legally privileged information. If you are not the intended recipient of this message, you must delete it immediately and notify the sender. Any unauthorized use or disclosure of this message is strictly prohibited. Faurecia does not guarantee the integrity of this transmission and shall therefore never be liable if the message is altered or falsified nor for any virus, interception or damage to your system. From michel.vandenbergh at uhasselt.be Wed Jan 10 07:40:14 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 10 Jan 2007 14:40:14 +0100 Subject: [Maxima] rfc: a thin lexical layer for maxima Message-ID: <45A4ECBE.7080102@uhasselt.be> Hi, You are all bored to death by now about the lexical vs dynamic scope issues! I am still thinking about this and actually hope to do something about it, but currently I need to do other things urgently (like writing up some papers and preparing a course!). I also need to brush up my 20 year old lisp experience (I didn't think I would need *that* ever again:-) Nevertheless to fix my thought I have written down what I was thinking of. Look at www.bertold.org/lexical/whitepaper.txt I know many of you will not like this proposal. I don't mind since it is localized and can be implemented in an extension package. However if you see something I have overlooked (some behaviour that is obviously wrong) then I will be happy to learn about it. Michel From macrakis at alum.mit.edu Wed Jan 10 08:08:58 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 10 Jan 2007 09:08:58 -0500 Subject: [Maxima] How to make results more compact In-Reply-To: References: Message-ID: <8b356f880701100608j519c71c2n30812920370e2a38@mail.gmail.com> On 1/10/07, ZINTEL Gerhard wrote: > Obviously I'm a bit stubborn, but in my mind optimized should give:... > I know, it's all very well to say that but it's surely hard to code it. "Optimize" never performs any mathematical transformations (factorization, re-association...) to expressions; it simply looks for common subexpressions. I believe this is intentional, since transformations can change the floating-point result. But please feel free to develop code which *does* perform various transformations, and perhaps even does some sort of search among alternatives based on reasonable criteria (smallest number of multiplies, fastest overall speed, least susceptible to rounding errors, etc.). It is not trivial, but shouldn't be all that difficult, either. It would no doubt be a contribution that others would find useful. -s From fateman at cs.berkeley.edu Wed Jan 10 08:40:13 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 10 Jan 2007 06:40:13 -0800 Subject: [Maxima] How to make results more compact In-Reply-To: Message-ID: <016001c734c5$3dc79480$05d09888@RJFE510> I think the basic issue with methods that try to find a small form for an expression of many terms is that the only effective methods known (or possible, perhaps) involve a search in a space of exponential size. There are other issues too, such as recognizing the collapse of certain combinations of trigonometric or hypergeometric or algebraic expressions, the rearrangement of polynomial expressions in terms of their roots or factors, and probably other issues that do not appear strictly in the algebra, but come from the application domain, grouping terms by some external meaning. An example might be substituting E for m*c^2 in some expressions. There is also the concern that rearrangement will change the value of an expression if it is to be evaluated in floating-point. That is, expressions such as ((x-1)+y)+1 may be rather different from x+y. So all of this exploration is OK with me, but I think we have to be careful about claiming to have "the solution" unless we have also addressed the big picture. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of ZINTEL Gerhard > Sent: Wednesday, January 10, 2007 4:57 AM > To: Stavros Macrakis > Cc: maxima at math.utexas.edu > Subject: Re: [Maxima] How to make results more compact > > > > > > The following should do steps 1, 2,3 the rest by hand. > > > > You can use "optimize" for the rest: > > > > optimize ( c*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g))+b*(f*(i+h+g)+ > > e*(i+h+g)+d*(i+h+g))+a*(f*(i+h+g)+e*(i+h+g)+d*(i+h+g)) ) => > > > > block([%1,%2], > > %1:i+h+g, > > %2:f*%1+e*%1+d*%1, > > c*%2+b*%2+a*%2) > > > > Note that optimize does *not* find subexpressions like a+b in a+b+c. > > Obviously I'm a bit stubborn, but in my mind optimized should give: > block([%1,%2], > %1:i+h+g, > %2:%1*(f+e+d), > %2*(c+b+a) > > I know, it's all very well to say that but it's surely hard to code it. > > Thank you very much for your help! > Gerhard > > > This electronic transmission (and any attachments thereto) is intended > solely for the use of the addressee(s). It may contain confidential or > legally privileged information. If you are not the intended recipient of > this message, you must delete it immediately and notify the sender. > Any unauthorized use or disclosure of this message is strictly prohibited. > Faurecia does not guarantee the integrity of this transmission and shall > therefore never be liable if the message is altered or falsified nor for > any > virus, interception or damage to your system. > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From miguel39123 at hotmail.com Wed Jan 10 08:46:54 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Wed, 10 Jan 2007 14:46:54 +0000 (UTC) Subject: [Maxima] How to make results more compact References: Message-ID: ZINTEL Gerhard faurecia.com> writes: > > Obviously I'm a bit stubborn, but in my mind optimized should give: > block([%1,%2], > %1:i+h+g, > %2:%1*(f+e+d), > %2*(c+b+a) A little improvement: inflag:true; mostoften(e):=block([c,el,maxi,lv],lv:[], if atom(e) then return(false), if inpart(e,0)="*" then return(false), if inpart(e,0)#"+" then return(false), for x in args(e) do if not(atom(x)) then for y in args(x) do if not(numberp(y)) then (if numberp(subvar(c,y)) then ''(subvar(c,y)):subvar(c,y)+1 else (lv:cons(y,lv),''(subvar(c,y)):1)), maxi:0, for x in lv do if c[x] > maxi then (maxi:subvar(c,x), el:x), kill(c), if maxi > 1 then return(el) else return(false)); rompe(e):=block([y],y:mostoften(e), if y=false then false else [y,subst(1,y,e),subst(0,y,e)]); da(e):= block([l],if not(atom(e)) and inpart(e,0)="*" then map(da,e) else (l:rompe(e), if l=false then return(e) else return(l[1]*(da(l[2]-l[3]))+da(l[3])))); Example: (%i5) e1:expand((a+b+c)*(d+e+f)*(g+h+i)); (%o5) c*f*i+b*f*i+a*f*i+c*e*i+b*e*i+a*e*i+c*d*i+b*d*i+a*d*i+c*f*h+ b*f*h+a*f*h+c*e*h+b*e*h+a*e*h+c*d*h+b*d*h+a*d*h+c*f*g+b*f*g+a*f*g+ c*e*g+b*e*g+a*e*g+c*d*g+b*d*g+a*d*g (%i6) da(%); (%o6)((c+b+a)*f+(c+b+a)*e+(c+b+a)*d)*i+((c+b+a)*f+(c+b+a)*e+(c+b+a)*d)*h+ ((c+b+a)*f+(c+b+a)*e+(c+b+a)*d)*g (%i7) da(%); (%o7) ((c+b+a)*f+(c+b+a)*e+(c+b+a)*d)*(i+h+g) (%i8) da(%); (%o8) (c+b+a)*(f+e+d)*(i+h+g) -Miguel From miguel39123 at hotmail.com Wed Jan 10 09:19:28 2007 From: miguel39123 at hotmail.com (miguel lopez) Date: Wed, 10 Jan 2007 15:19:28 +0000 (UTC) Subject: [Maxima] How to make results more compact References: Message-ID: miguel lopez hotmail.com> writes: > A little improvement: ... Limitations: The above toy code is only for expressions with sums of products with no square or power in it, the code thinks that (a+b) and (-a-b) can't be grouped so it could be improved a little more, but i will not do it. Also,clearly the algorithm doesn't provides the minimum length expression, but in some easy cases it does. By the way for maxima the simplification -(a+b) = -a -b is automatic but -2*(a+b) is not automatic. This automatic simplification makes difficult to consider (-a-b) as (-1)*(a+b) in order to group this kind of terms. Feel free to use or improve the code if you want, easy things are easy to do but in order to make something really interesting the algorithm should be very much improved. The only aim doing this code is illustrating some easy techniques for the easy cases. By the way, in Z_2 any improvement (on expression without powers) could be used for simplifying logical circuits, and this is an NP-hard problem. -Miguel. From hillionfx at yahoo.fr Wed Jan 10 09:41:31 2007 From: hillionfx at yahoo.fr (Francois HILLION) Date: Wed, 10 Jan 2007 16:41:31 +0100 Subject: [Maxima] building dll from maxima to be called by Excel VBA Message-ID: <45A5092B.9030809@yahoo.fr> An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070110/fd3c7a73/attachment.htm From fateman at cs.berkeley.edu Wed Jan 10 09:49:15 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 10 Jan 2007 07:49:15 -0800 Subject: [Maxima] How to make results more compact In-Reply-To: Message-ID: <016101c734ce$e2616710$05d09888@RJFE510> Try cos(4*x)+2*cos(3*x)+cos(2*x)-2*cos(x)-2 see if you can get -2(sin(2*x)+sin(x))^2. From francois.hillion at realix.fr Wed Jan 10 09:43:27 2007 From: francois.hillion at realix.fr (=?ISO-8859-1?Q?Fran=E7ois_Hillion?=) Date: Wed, 10 Jan 2007 16:43:27 +0100 Subject: [Maxima] building dll from maxima to be called by Excel VBA Message-ID: <45A5099E.4030109@realix.fr> Hello, I have developped a small numerical model with Mathcad for the ease of upgrading and debugging. The model has now to run numerous calculations, which are always very tedious to trigger by-hand. My idea was to feed the model and get back results through Excel. Although it is working, it is really too slow. The only way to get it faster is to compile the model and have it as a dll. Unfortunately Mathcad does not offer option ... As I would prefer not rewriting everything in fortran or c++, I searched on the web for other softwares and found Maxima. I am rather tempted but first I would like to know if it is possible to compile a Maxima batch file (.mc, .mac) ? Thanks for your help, Francois ___________________________________________________________________________ D?couvrez une nouvelle fa?on d'obtenir des r?ponses ? toutes vos questions ! Profitez des connaissances, des opinions et des exp?riences des internautes sur Yahoo! Questions/R?ponses http://fr.answers.yahoo.com From fateman at cs.berkeley.edu Wed Jan 10 09:56:08 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Wed, 10 Jan 2007 07:56:08 -0800 Subject: [Maxima] building dll from maxima to be called by Excel VBA In-Reply-To: <45A5092B.9030809@yahoo.fr> Message-ID: <016601c734cf$d89a8b70$05d09888@RJFE510> Yes, maxima programs can be compiled and run faster in maxima. Putting maxima programs into the form of a dll (to be called from excel) would require some work, and some expertise. There are examples of how to do this in the documentation for Allegro Common Lisp (specifically, linking Excel to lisp), but most of the maxima community uses other lisp implementations. While compiled maxima may be faster than interpreted Mathcad, it would not be my first choice if speed were important and the program was ?small?. RJF _____ From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Francois HILLION Sent: Wednesday, January 10, 2007 7:42 AM To: maxima at math.utexas.edu Subject: [Maxima] building dll from maxima to be called by Excel VBA Hello, I have developped a small numerical model with Mathcad for the ease of upgrading and debugging. The model has now to run numerous calculations, which are always very tedious to trigger by-hand. My idea was to feed the model and get back results through Excel. Although it is working, it is really too slow. The only way to get it faster is to compile the model and have it as a dll. Unfortunately Mathcad does not offer option ... As I would prefer not rewriting everything in fortran or c++, I searched on the web for other softwares and found Maxima. I am rather tempted but first I would like to know if it is possible to compile a Maxima batch file (.mc, .mac) ? Thanks for your help, Francois ___________________________________________________________________________ D?couvrez une nouvelle fa?on d'obtenir des r?ponses ? toutes vos questions ! Profitez des connaissances, des opinions et des exp?riences des internautes sur Yahoo! Questions/R?ponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070110/9bd5fa3b/attachment.htm From smustudent1 at yahoo.com Wed Jan 10 10:07:10 2007 From: smustudent1 at yahoo.com (C Y) Date: Wed, 10 Jan 2007 08:07:10 -0800 (PST) Subject: [Maxima] units In-Reply-To: <001001c73486$09efa1f0$5e0ba8c0@tworek> Message-ID: <45500.85355.qm@web56706.mail.re3.yahoo.com> I should probably warn you that this units package was never really finished and is basically unsupported - Robert Dodier also has a units package and you might want to try that instead. That said, I think the command you want is: setunits([N,m]); CY --- Micha? Tworek wrote: > Hi,all :-) > I've got troubles with units . I read > http://maxima.sourceforge.net/docs/manual/pt/maxima_71.html . > > What am I doing? This is my example.First with mass,acceleration and > force...everything OK. But from i7 you'll see that I have troubles > with calculate [kg/s^2] to [N/m] .Sometimes I get outputs for q in > these units, but I need outputs in N/m . I'm not going to explain > everyone that these units are equal. > > By hand: [kg/s^2]=[ (N*s^2)/m / s^2 ]= [N/m] > > >From maxima: > > > > (%i1) load("unit")$ > ******************************************************************* > * Units version 0.50 * > * Definitions based on the NIST Reference on * > * Constants, Units, and Uncertainty * > * Conversion factors from various sources including * > * NIST and the GNU units package * > ******************************************************************* > > Redefining necessary functions... > Initializing unit arrays... > Done. > (%i2) Mass:70*kg; > (%o2) 70*kg > (%i3) acceleration:9.81*[m/s^2]; > (%o3) [9.810000000000001*m/s^2] > (%i4) Force:Mass*acceleration; > (%o4) [686.7000000000001*(kg*m)/s^2] > (%i5) setunits(N); > (%o5) done > (%i6) Force; > (%o6) [6867/10*N] > (%i7) q:287*[kg/s^2]; > (%o7) [287*kg/s^2] > (%i8) setunits(N,m); > Too many arguments supplied to setunits(units): > [N,m] > -- an error. To debug this try debugmode(true); > (%i9) setunits[(N,m)]; > (%o9) setunits[m] > (%i10) q; > (%o10) [287*kg/s^2] > (%i11) setunits[(N,m)]; > (%o11) setunits[m] > (%i12) q; > (%o12) [287*kg/s^2] > (%i13) setunits(N/m); > Argument to `concat' not an atom: %force/%length > #0: setunits(units=[N/m])(unit.mac line 606) > #1: setunits(units=N/m)(unit.mac line 624) > -- an error. To debug this try debugmode(true); > (%i14) setunits[N/m]; > (%o14) setunits[N/m] > (%i15) q; > (%o15) [287*kg/s^2] > (%i16) > ************************************************************************************************************ > Anyone knows what to do? > > > > --------------------- > Panorama Internetu - prognoza pogody, poczta e-mail z najwi?kszym > za??cznikiem, SMS, wyszukiwarki: Gooru, Anonser, serwisy: randki, > og?oszenia, wakacje, program TV, Kina, muzyka, DVD, newsy, inne. > http://www.panoramainternetu.pl/ (http://www.epf.pl/)> _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > ____________________________________________________________________________________ Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com From dlakelan at street-artists.org Wed Jan 10 10:46:28 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 10 Jan 2007 08:46:28 -0800 Subject: [Maxima] building dll from maxima to be called by Excel VBA In-Reply-To: <45A5099E.4030109@realix.fr> References: <45A5099E.4030109@realix.fr> Message-ID: <20070110164628.GJ25287@street-artists.org> On Wed, Jan 10, 2007 at 04:43:27PM +0100, Fran?ois Hillion wrote: > Hello, > > I have developped a small numerical model with Mathcad for the ease of > upgrading and debugging. The model has now to run numerous calculations, > which are always very tedious to trigger by-hand. My idea was to feed > the model and get back results through Excel. Why excel? is it because the data to feed in is already available in excel? is it because you have an existing excel sheet that needs this kind of calculation? I find that Excel has a super-quadratic annoyance curve... Initially when you want to do very simple things, there is no annoyance, but as you get progressively more demanding, annoyance rises rapidly. With something like maxima, the opposite is true. When you want to do something simple, like add a list of numbers, the annoyance is somewhat high (to make the calculation repeatable you have to open a text file, type the numbers into a list, tell maxima to calculate the sum, load the text file from maxima, convert the answer to floating point...) But as you start to become more demanding, maxima has more of a logarithmic annoyance level... by the time you're wanting to do long derivations of ODEs from differential principles of physics, you're very happy to have maxima and Excel would be completely useless. Perhaps you can describe your numerical process in general terms, and we can tell you whether this would be easy from entirely within maxima. Welding maxima, or anything, to Excel sounds like a very steep annoyance curve. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From dlakelan at street-artists.org Wed Jan 10 14:53:54 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 10 Jan 2007 12:53:54 -0800 Subject: [Maxima] substitutions within a function Message-ID: <20070110205354.GM25287@street-artists.org> I know there's something I don't understand about maxima evaluation... I have an expression "fma_steady" and I want to create a function which has 2 parameters which returns the result of substituting those parameters into the expression fma_steady. Residfma(h,v) := block([expr:subst(v,vx(x), subst(h,h(x),lhs(fma_steady)))], ev(expr,diff)); Here's what happens when I call it with an example set of arguments: (%i54) Residfma(1+a*x,1+b*x); h evaluates to a*x+1 Improper name or value in functional position. #0: Residfma(h=a*x+1,v=b*x+1) -- an error. Quitting. To debug this try debugmode(true); what's going on? -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From macrakis at alum.mit.edu Wed Jan 10 15:01:54 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 10 Jan 2007 16:01:54 -0500 Subject: [Maxima] substitutions within a function In-Reply-To: <20070110205354.GM25287@street-artists.org> References: <20070110205354.GM25287@street-artists.org> Message-ID: <8b356f880701101301u3bcbb876j866770c42081e3bb@mail.gmail.com> When the Maxima evaluator encounters f(x), it first checks whether f has a function-value. If so, it uses that function-value. If not, it evaluates f as a symbol, and tries to use *that* value as a function. So: f: x+1$ f(t) tries to apply (x+1) to the argument t; but (x+1) is not a function. The purpose of this evaluation is to support things like foo(f,x):= f(x-1)$ foo(sqrt,y^2) => sqrt(y^2-1) Personally, I'd prefer to make that syntactically different, e.g. (f)(x-1) (which also works), but.... -s On 1/10/07, Daniel Lakeland wrote: > I know there's something I don't understand about maxima > evaluation... I have an expression "fma_steady" and I want to create a > function which has 2 parameters which returns the result of > substituting those parameters into the expression fma_steady. > > Residfma(h,v) := block([expr:subst(v,vx(x), subst(h,h(x),lhs(fma_steady)))], > ev(expr,diff)); > > Here's what happens when I call it with an example set of arguments: > > (%i54) Residfma(1+a*x,1+b*x); > > h evaluates to a*x+1 > Improper name or value in functional position. > #0: Residfma(h=a*x+1,v=b*x+1) > -- an error. Quitting. To debug this try debugmode(true); > > what's going on? > > > -- > Daniel Lakeland > dlakelan at street-artists.org > http://www.street-artists.org/~dlakelan > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From robert.dodier at gmail.com Wed Jan 10 15:09:47 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 10 Jan 2007 14:09:47 -0700 Subject: [Maxima] conditionals and bad plist In-Reply-To: <8b356f880701091102m70a9c4cdw8bb3934400f774bb@mail.gmail.com> References: <8b356f880701090848h67fdf800mbc8693f3fa1ed27b@mail.gmail.com> <8b356f880701091102m70a9c4cdw8bb3934400f774bb@mail.gmail.com> Message-ID: On 1/9/07, Stavros Macrakis wrote: > > Could we make boolsimp the standard in the next release? > > There are four reasons I am strongly opposed to this: > > 1) Because "if" can be a no-op rather than an error in some cases. > This may affect existing Maxima code, but it is also a trap for people > writing new code. I'm convinced that attempting to prevent stupidity has the unwelcome side effect of preventing cleverness as well. Incidentally at present the stuff in boolsimp still respects prederror when it is true. So you can recover the current behavior (namely to complain about undecided predicates) by prederror : true. > On the other hand, I have no problem > with changing the boolean operators this way. OK, I'll work on separating the stuff for Boolean expressions from the conditional expressions. > 2) Because its compiled behavior is completely incompatible with its > interpreted behavior. I don't think this is an issue at present. In recent versions of boolsimp.lisp the translation property of MCOND is simply clobbered, so conditionals in translated functions turn into (MEVAL '((MCOND) ...)) which evaluates the same way as interpreted stuff. It seems feasible to exploit Boolean declarations to construct (COND ...) instead of ((MCOND) ...) but I haven't done that. > 3) Because it does not shield simplification-time errors on > unevaluated branches. I know that Robert considers this a problem with > simplification, not with unevaluated conditionals, and I pretty much > agree, but it needs to be fixed. E.g. if x then 1/0 should simplify > to if x then raise(...appropriate exception...). Yes, I'd rather avoid 1/0 and 0^0 errors in simplification but if x then throw(FOO(1/0)) (where FOO prevents simplification) would be OK too. > 4) As a mathematical operation (as opposed to a programming > operation), a conditional should be insensitive to the order of the > clauses, like Dijkstra's guarded commands. This makes the formal > properties much simpler and more conducive to further symbolic > manipulation (which is why Dijkstra introduced this notation in the > first place). I dunno. Do we need to give up something generally useful, which is now working, in hopes of having something that won't interest most people, and which doesn't yet exist? > I would propose that instead of changing "if", we introduce a new > guarded command structure, e.g. cond(a => b, c => d, ...), which would > be the "simplifying" version. We would still have to resolve the > simplification-time error problem, but the other issues go away. A different notation for a concept similar to if--then--else is going to lead to confusion and dismay. All the best Robert From dlakelan at street-artists.org Wed Jan 10 17:40:54 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 10 Jan 2007 15:40:54 -0800 Subject: [Maxima] Differential Equation blues... Message-ID: <20070110234054.GN25287@street-artists.org> I know this isn't the math-help mailing list, but I'm using maxima for a problem that's just a little too complicated to complete symbolically. So I need some help figuring out what to do next. I'm trying to solve two coupled nonlinear ODEs with boundary conditions to find two functions h(x) and vx(x). Maxima has been very helpful so far in formulating the problem. However now I'm having difficulty solving it and I'm hoping someone has suggestions both for strategies, and for tools in maxima that can help :-) ----------- detailed description of problem below ----- I know a whole bunch of input parameters, one of them is Q, I know h(0)*vx(0) = Q, I know that a certain integral involving h(x) from 0 to the first positive root of h(x) = Q also (maxima calculates this integral easily if I choose an upper bound... see below about the upper bound) Ultimately what I am looking for is to find the first x value where h(x) = 0 under differing conditions. I know that my differential equation may not work well near where h(x) = 0 (it's got an h(x) in the denominator but it's removable if vx(x)/h(x) has a finite limit when h(x) -> 0 which it should) I tried using two polynomials in x for the two unknown functions h(x) and vx(x). In order to make things go to zero nicely I multiplied a general 2nd order polynomial by a factor of (1-x). The idea is if I solve the problem for the interval [0,1] then I can rescale x and look for the scale factor that has some minimum potential energy to get the real value (hopefully, I'm a bit concerned about x essentially being measured in incompatible units. My parameters are all in SI units). Now I have 2 equations and 6 unknowns. So following the lead of the estimable John Boyd who kindly put his book online: http://www-personal.engin.umich.edu/~jpboyd/BOOK_Spectral2000.html I tried calculating (x^i,Residfma) and (x^i,Residcont) where the residual functions are formed by substituting my polynomials into the ODEs and the inner products are the standard (a(x),b(x)) = integrate(a(x)*b(x),x,0,len) However, the integrals require me to answer a long series of unknown questions about the signs of various extremely complicated things. Eventually I killed maxima. Because x^i over-weights the residual error towards the end of the interval, probably a better choice is some other weight functions anyway like 1-x^i or the chebyshev polynomials. Any suggestions as to what method I might try next, and what tools maxima has to help? (did anyone get down here??) :-) -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From robert.dodier at gmail.com Wed Jan 10 20:10:47 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 10 Jan 2007 19:10:47 -0700 Subject: [Maxima] substitutions within a function In-Reply-To: <20070110205354.GM25287@street-artists.org> References: <20070110205354.GM25287@street-artists.org> Message-ID: On 1/10/07, Daniel Lakeland wrote: > I know there's something I don't understand about maxima > evaluation... I have an expression "fma_steady" and I want to create a > function which has 2 parameters which returns the result of > substituting those parameters into the expression fma_steady. Not sure what you want to accomplish but here is an idea. make_lambda (expr, L) := buildq ([expr, L], lambda (L, expr)); foo : a*x^2 + b*y^2; F : make_lambda (foo, [x, y]); => lambda([x, y], b*y^2 + a*x^2) G : make_lambda (foo, [a, b]); => lambda([a, b], b*y^2 + a*x^2) F(10, - 2); => 4*b + 100*a G(10, - 2); => 10*x^2 - 2*y^2 HTH Robert From Harald.Geyer at gmx.at Wed Jan 10 21:24:13 2007 From: Harald.Geyer at gmx.at (Harald Geyer) Date: Thu, 11 Jan 2007 04:24:13 +0100 Subject: [Maxima] rfc: a thin lexical layer for maxima In-Reply-To: <45A4ECBE.7080102@uhasselt.be> References: <45A4ECBE.7080102@uhasselt.be> Message-ID: Hi Michel! I kind of like your proposal. If nothing else, it is at least a nice experiment. There is one thing I didn't understand: In the introduction you talk about only affecting "symbols explicitly declared to be 'lexical'", while other parts of the proposal seem to suggest that the lexical layer would once loaded always be in effect. Which way do you want to go? I think I would like the first possibility. I.e. something like with_lexical([x], f(x):=x[1]); Regards, Harald From sen1 at math.msu.edu Wed Jan 10 23:05:10 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 11 Jan 2007 00:05:10 -0500 (EST) Subject: [Maxima] gnuplot and maxima on a MacBook Pro Message-ID: Hello, I recently decided to try out maxima and xmaima on a MacBook Pro. There were several minor problems installing it. 1. gcl would not install, and cmucl did not seem available with the package managers. I did not try to build from the sources. 2. gnuplot is installed and works in the interpretive mode. But I can't plot with gnuplot. Nothing happens. There are no complains, just nothing shows up on the screen. So, e.g., plot2d does not work with the gnuplot format. 3. I have no problem with openmath, openplot_curves, etc. Any ideas? TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From michel.vandenbergh at uhasselt.be Thu Jan 11 05:12:52 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 11 Jan 2007 12:12:52 +0100 Subject: [Maxima] rfc: a thin lexical layer for maxima Message-ID: <45A61BB4.1060805@uhasselt.be> Harald Geyer wrote: >There is one thing I didn't understand: In the introduction you talk >about only affecting "symbols explicitly declared to be 'lexical'", >while other parts of the proposal seem to suggest that the lexical >layer would once loaded always be in effect. Which way do you want >to go? > > Hi Harald, Thanks for the feedback. I added a section about syntax to the proposal which will hopefully make things clearer. See http://maxima.sourceforge.net/wiki/index.php/LexicalLayer Please let me know if you think it is still unclear. Regards, Michel From michel.vandenbergh at uhasselt.be Thu Jan 11 08:04:35 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 11 Jan 2007 15:04:35 +0100 Subject: [Maxima] rfc: a thin lexical layer for maxima Message-ID: <45A643F3.3020408@uhasselt.be> Hmm, this is a hard to win battle (as I was warned about!). It seems that my rule that an unbound gensym evaluates to the symbol it replaces has some problems! Consider block([y],y::1); The sanitized version of this block([gxxxxx],gxxxxx::1) together with my rule would create a global variable y with value 1! This is clearly not sane behaviour. So it seems that my rule should only apply when scope has left the block statement (to deal with things like block([y],y); ) Which entails a change to how meval evaluates block statements... Is this the beginning of the end? Michel From michel.vandenbergh at uhasselt.be Thu Jan 11 08:23:00 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 11 Jan 2007 15:23:00 +0100 Subject: [Maxima] rfc: a thin lexical layer for maxima Message-ID: <45A64844.7040700@uhasselt.be> > > >So it seems that my rule should only apply when scope has left the block >statement >(to deal with things like block([y],y); ) > >Which entails a change to how meval evaluates block statements... > >Is this the beginning of the end? > Maybe it is not so bad... Inside the block statement the gensym seems to have the value property. When scope has left the block this is no longer true. So my rule should only apply to gensyms which, besides being unbound, are also not values. Still things are becoming fragile... Michel From biomates at telefonica.net Thu Jan 11 09:02:49 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 11 Jan 2007 16:02:49 +0100 Subject: [Maxima] gnuplot and maxima on a MacBook Pro In-Reply-To: References: Message-ID: <1168527769.7997.8.camel@localhost.localdomain> > 2. gnuplot is installed and works in the interpretive mode. But I > can't plot with gnuplot. Nothing happens. There are no complains, > just nothing shows up on the screen. > So, e.g., plot2d does not work with the gnuplot format. > 3. I have no problem with openmath, openplot_curves, etc. > Is the 'plot_format' option set to 'gnuplot' or to 'gnuplot_pipes'? If it is set to 'gnuplot_pipes', write set_plot_option([plot_format,gnuplot])$ and try plot2d again. Mario -- Mario Rodriguez Riotorto www.biomates.net From camm at enhanced.com Thu Jan 11 14:15:28 2007 From: camm at enhanced.com (Camm Maguire) Date: 11 Jan 2007 15:15:28 -0500 Subject: [Maxima] windows-only read patch (was: error in ./configure when building gcl 2.6.7 onUbuntu) In-Reply-To: <008001c735b8$a85f7030$6900a8c0@asus> References: <008001c735b8$a85f7030$6900a8c0@asus> Message-ID: <54y7o98gm7.fsf@intech19.enhanced.com> Greetings! "Bill Page" writes: > Camm, > > What are the symptoms of this change? What problem is it > intended to correct? How can I test it? Is it sufficient > if I can build Axiom on windows after this change? > The code is intended to fix read-char-no-hang, which had been broken for a long time. This caused Mike Thomas some problem of which I do not know the details, hence his ifdef patch with the comment: revision 1.14.4.1.2.2.2.4.6.1.6.1.4.3 date: 2006-06-15 22:26:22 -0400; author: mjthomas; state: Exp; lines: +2 -1 Band aid fix to stop build failure on Windows. ---------------------------- Vadim found the discrepancy in testing maxima: http://www.mail-archive.com/gcl-devel at gnu.org/msg01408.html Ideally, I'd like to know that reverting the patch works for both of you. I'd really be pleased if someone could try acl2 as well. Alas, due to email chaos, I seem to be disconnected from Vadim. Take care, > Regards, > Bill Page. > > > -----Original Message----- > > From: Camm Maguire [mailto:camm at enhanced.com] > > Sent: January 11, 2007 10:51 AM > > To: Bill Page > > Cc: gcl-devel at gnu.org; axiom-developer at nongnu.org > > Subject: Re: [Gcl-devel] Re: error in ./configure when > > building gcl 2.6.7 onUbuntu > > > > > > Greetings, and thanks so much! > > > > Could you please try reverting: > > > > cvs -z9 -q diff -u -r 1.14.4.1.2.2.2.4.6.1.6.1.4.2 -r > > 1.14.4.1.2.2.2.4.6.1.6.1.4.3 read.d > > Index: read.d > > =================================================================== > > RCS file: /cvsroot/gcl/gcl/o/read.d,v > > retrieving revision 1.14.4.1.2.2.2.4.6.1.6.1.4.2 > > retrieving revision 1.14.4.1.2.2.2.4.6.1.6.1.4.3 > > diff -u -r1.14.4.1.2.2.2.4.6.1.6.1.4.2 -r1.14.4.1.2.2.2.4.6.1.6.1.4.3 > > --- read.d 7 Jun 2006 15:09:38 -0000 > > 1.14.4.1.2.2.2.4.6.1.6.1.4.2 > > +++ read.d 16 Jun 2006 02:26:22 -0000 > > 1.14.4.1.2.2.2.4.6.1.6.1.4.3 > > @@ -256,6 +256,7 @@ > > > > x = read_object(in); > > vs_push(x); > > +#ifndef _WIN32 > > while (listen_stream(in)) { > > object c=read_char(in); > > if (cat(c)!=cat_whitespace) { > > @@ -263,7 +264,7 @@ > > break; > > } > > } > > - > > +#endif > > if (sharp_eq_context_max > 0) > > x = vs_head = patch_sharp(x); > > > > Take care, > > > > > > > > "Bill Page" writes: > > > > > Camm, > > > > > > On January 10, 2007 11:12 AM you wrote: > > > > ... > > > > export CVSROOT=:pserver:anonymous at cvs.sv.gnu.org:/sources/gcl > > > > cvs -z9 -q co -d gcl-2.6.8pre -r Version_2_6_8pre > > > > > > > > This is way past due for release. I am only waiting on a > > volunteer > > > > to test a windows-only read patch -- alas our heroic windows > > > > volunteer has resigned. If anyone here can help please let me > > > > know. > > > > ... > > > > > > Both Gaby and I have successfully built Axiom on Windows from a > > > recent version of gcl-2.6.8pre. What is required in order to test > > > this "windows-only read patch"? > > > > > > Regards, > > > Bill Page. > > > > > > > > > > > > > > > > > > > -- > > Camm Maguire > > camm at enhanced.com > > ============================================================== > > ============ > > "The earth is but one country, and mankind its citizens." -- > > Baha'u'llah > > > > > > > > > -- Camm Maguire camm at enhanced.com ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah From michel.vandenbergh at uhasselt.be Thu Jan 11 14:30:05 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 11 Jan 2007 21:30:05 +0100 Subject: [Maxima] Are compiled maxima functions lexically scoped???? Message-ID: <45A69E4D.7030608@uhasselt.be> Sigh.... I thought interpreted and compiled maxima functions were supposed to behave identically but now I see they do not even on very simple examples. My very rudimentary testing shows that my favorite examples f(s,t):=s[t] and f(s):=s[1] seem to behave as expected when compiled whereas they behave strangely when interpreted (see http://maxima.sourceforge.net/wiki/index.php/LexicalLayer). Michel From fateman at cs.berkeley.edu Thu Jan 11 15:20:27 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Thu, 11 Jan 2007 13:20:27 -0800 Subject: [Maxima] Are compiled maxima functions lexically scoped???? In-Reply-To: <45A69E4D.7030608@uhasselt.be> References: <45A69E4D.7030608@uhasselt.be> Message-ID: <00b201c735c6$51144c70$30d09888@RJFE510> I think that compiled and interpreted maxima programs should work correctly on correct input. Otherwise it is a bug in one or the other. On incorrect input they may behave differently, and that would not, in my opinion, be a bug in the compiler. The example being used repeatedly as a benchmark for the behavior of maxima, namely f(s,t):=s[t] is itself an erroneous program, in my view. Maxima operates generally as a "Lisp-2" and you want to make it into a "Lisp-1". For the distinction, see http://www.dreamsongs.com/Separation.html When s is a function in maxima, it has a bunch of properties possibly including a simplification operator, an arithmetic operator, a compiler operator, a number of arguments, notions like "linear", "additive", a derivative property and taylor series definitions, etc. s can simultaneously have a value. Rebinding of the name s, as in foo(s):= .... access to s ... [at least by analogy with common lisp and the lisp-2 model], means that foo(43) masks only the global value of s with the value of 43 during its access within foo. You are entitled to use the value of s, namely 43, inside foo. If you call s within foo, by s(1234), what does this mean? Does it mean you are calling 43(1234), presumably an error? NO. The FUNCTION s has not been rebound, and so the global function s should be called, not the value of s. Now you CAN pass a function in to foo, say cos, and apply that function... you can do so this way: Foo(s):= apply(s,[1234]). Foo(cos); Compare that to a definition foo(cos):=cos(0), in the Lisp-2 model, foo(43) gets cos(0) or 1. This is what maxima does. There is a further nuance, in that items with no current function definition become expressions like s(1234), and then it is possible to move these expressions around into arbitrary environments in which there may be local functions, or repeated evaluations, eg. S is bound to r is bound to cos... while this confuses the situation, I think that your premise that an erroneous program should be the basis for revising the underlying programming language should be re-examined. Another possible way out of this morass is to look at programming variables, say p,q,r,s that are traditional in some sense, like those you see in fortran and pascal, as a separate set of objects from indeterminates. These latter objects might be names like x, y, z. It is forbidden to assign them values. That is x:3 is an error. If you want to know what x^2 when x=3, then do something like subst(x=3,x^2). The programming variables can only be bound to expressions. You cannot (for example), compute a derivative with respect to a programming variable p. You could, of course, set p:x, and compute diff(sin(x),p) ... which would be cos(x). The name cos is like an indeterminate in this sense. You cannot assign to it or bind it. That is foo(cos):= ... IS AN ERROR. In foo(s):=s(0), IT IS AN ERROR to use a programming variable as a function. This model is not entirely consistent with Maxima right now. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Thursday, January 11, 2007 12:30 PM > To: maxima at math.utexas.edu > Subject: [Maxima] Are compiled maxima functions lexically scoped???? > > Sigh.... > > I thought interpreted and compiled maxima functions were supposed > to behave identically but now I see they do not even on very simple > examples. > > My very rudimentary testing shows that my favorite examples > > f(s,t):=s[t] > > and > > f(s):=s[1] > > seem to behave as expected when compiled whereas they behave strangely > when interpreted (see > http://maxima.sourceforge.net/wiki/index.php/LexicalLayer). > > Michel > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From willisb at unk.edu Thu Jan 11 18:20:33 2007 From: willisb at unk.edu (Barton Willis) Date: Thu, 11 Jan 2007 18:20:33 -0600 Subject: [Maxima] simplification amusement Message-ID: (%i125) (r-1)*(r+2)^2 = 16*t^2$ (%i126) rhs(last(solve(%,r)))$ (%i127) e : %-subst(t=-t,%)$ For real t, the expression e vanishes. Is there a way to get Maxima to crunch it to zero? One term of factor(e) looks like junk^(1/3) * mess^(1/3) - 1. And junk * mess = 1, but what Maxima command does junk^(1/3) * mess^(1/3) -> (junk * mess)^(1/3)? Barton PS. For a planet in parabolic orbit (inverse square law force), the equation (r-1)*(r+2)^2 = 16*t^2 determines the radial distance as a function of time. From fateman at cs.berkeley.edu Thu Jan 11 18:54:12 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Thu, 11 Jan 2007 16:54:12 -0800 Subject: [Maxima] Are compiled maxima functions lexically scoped???? In-Reply-To: <45A6C5F5.5070200@uhasselt.be> References: <45A6C5F5.5070200@uhasselt.be> Message-ID: <00c801c735e4$2d5ffef0$30d09888@RJFE510> > -----Original Message----- > From: Michel Van den Bergh [mailto:michel.vandenbergh at uhasselt.be] > Sent: Thursday, January 11, 2007 3:19 PM > For example in python it is perfectly legal to write > > def f(s,t): > return s(t) > Presumably Python is modeled after Lisp-1 semantics, like scheme, a dialect of lisp. To elaborate on the difference here... In scheme you can write (define (f s t)(s t)) It is also possible then to do (define (f s t u)(s t u)) In which case (f '* 2 3) returns 6. In common lisp, by contrast (defun f (s t u)(s t u)) (f '* 2 3) would say "s undefined function", because the parameter s and the function s are unrelated. To connect them, (defun f (s t u)(funcall s t u)) (f '* 2 3) returns 6. . From milan at eskimo.com Thu Jan 11 22:14:01 2007 From: milan at eskimo.com (Milan Lukic) Date: Thu, 11 Jan 2007 20:14:01 -0800 Subject: [Maxima] simplification amusement In-Reply-To: ; from willisb@unk.edu on Thu, Jan 11, 2007 at 06:20:33PM -0600 References: Message-ID: <20070111201401.D11234@eskimo.com> I tried rootscontract on factor(e) and it did return 0. H.T.H. Milan * Barton Willis <willisb at unk.edu> [2007-01-11 18:20:33 -0600]: > > (%i125) (r-1)*(r+2)^2 = 16*t^2$ > (%i126) rhs(last(solve(%,r)))$ > (%i127) e : %-subst(t=-t,%)$ > > For real t, the expression e vanishes. Is there a way to get > Maxima to crunch it to zero? One term of factor(e) > looks like junk^(1/3) * mess^(1/3) - 1. And junk * mess = 1, > but what Maxima command does junk^(1/3) * mess^(1/3) -> > (junk * mess)^(1/3)? > > Barton > > PS. For a planet in parabolic orbit (inverse square law force), > the equation (r-1)*(r+2)^2 = 16*t^2 determines the radial distance > as a function of time. > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- From robert.dodier at gmail.com Thu Jan 11 22:41:34 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 11 Jan 2007 21:41:34 -0700 Subject: [Maxima] Are compiled maxima functions lexically scoped???? In-Reply-To: <45A69E4D.7030608@uhasselt.be> References: <45A69E4D.7030608@uhasselt.be> Message-ID: On 1/11/07, Michel Van den Bergh wrote: > I thought interpreted and compiled maxima functions were supposed > to behave identically Yes, that is correct. They are *supposed* to behave the same. > but now I see they do not even on very simple examples. Well, that's a bug. > f(s,t):=s[t] > > and > > f(s):=s[1] > > seem to behave as expected when compiled whereas they behave strangely > when interpreted I've lost track of what's expected and not expected here -- anyway I see the following. (I'm using Maxima + GCL here; Clisp would be OK too, but SBCL compiles everything so you can't see the function definitions.) f(s,t):=s[t]; g(s) := s[1]; translate (f, g); :lisp #'$f => (LAMBDA-BLOCK $F ($S $T) (DECLARE (SPECIAL $T $S)) (MAREF $S $T)) :lisp #'$g => (LAMBDA-BLOCK $G ($S) (DECLARE (SPECIAL $S)) (MAREF $S 1)) The special declarations make the arguments dynamically bound instead of lexical. Maybe something else accounts for the different behavior -- maybe the array referencing isn't the same. Hmm, tracing MAREF1 (since MAREF is a macro which expands into MAREF1) I see that MAREF1 is not called from interpreted code. So that's different. Hope this helps, Robert From robert.dodier at gmail.com Thu Jan 11 23:15:56 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 11 Jan 2007 22:15:56 -0700 Subject: [Maxima] functions from add-on packages, was: Newbie question: testing for lvalue In-Reply-To: <459CFE15.7055.4A3FEF@van.nek.arcor.de> References: <4598404E.3010204@uhasselt.be> <459CFE15.7055.4A3FEF@van.nek.arcor.de> Message-ID: Hi Volker, sorry for the late reply. > if there is no example included in the documentation of a function, > which shows that a load("add-on") is necessary, the user in a lot of > cases gets no information, that this function is from an add-on package. >This is true for stringproc and a lot of others. I think we can afford to be much more liberal with the autoload mechanism. The only reason that I can see to make the user explicitly enter load(foo) is to prevent name collisions, so, e.g. if the user has some foo(x) in an expression it doesn't cause some obscure share package to be loaded. Name collisions are a real problem, but on the balance I think more share packages can be autoloaded, including stringproc. linearalgebra is another candidate. > Should we revise the add-on package documentations and add > a "please load(xyz) first" to every function definition or is there a > possibility, that describe itself gives a short information, like > > (%i1) ? stringp > 0: lstringp (Definitions for strings, add-on package stringproc) > 1: stringp (Definitions for strings, add-on package stringproc) I guess I'm hesitant to put the package name in the @node title, because if we make more functions autoload as I've suggested above, there isn't any visible consequence of the package organization from the user's point of view; it's all just "Maxima". For packages which aren't autoloaded ... well, we should be more careful to put "Hey, load(foo)" in the text. Hope this helps Robert From bfulg at pacbell.net Thu Jan 11 23:33:51 2007 From: bfulg at pacbell.net (Brent Fulgham) Date: Thu, 11 Jan 2007 21:33:51 -0800 Subject: [Maxima] Request for Patches Message-ID: Could someone please apply patch #1573497 so that Maxima can build under OpenMCL? Thanks, -Brent From michel.vandenbergh at uhasselt.be Fri Jan 12 03:20:23 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 12 Jan 2007 10:20:23 +0100 Subject: [Maxima] Are compiled maxima functions lexically scoped???? Message-ID: <45A752D7.40605@uhasselt.be> Hi, I am going to go quiet on this issue for a while since I think the limit has been reached of what can be achieved by looking at small toy examples. I will need to produce some proof of concept code. But as said I currently have other things to do. To Robert: ======== Well the difference is that f(s,t):=s[t] throws an error on f(t,1) (when t is unbound) in interpreted code whereas it does not in translated code (it returns (in my point of view correctly) t_1). However changing the definition to f(s,t):=ev(s[t]) (which Richard will consider as supremely evil:-) gives an error both in interpreted and translated code. This is because now the translated code calls meval (mevil?) in the wrong scope. When sanitized this new definition would still behave as expected (i.e. returning t_1 for f(t,1)). I am going to look at more translated code to possibly get some useful ideas. To Richard: ======== Thanks for explaining clearly that f(s,t):=s[t] is from a lisp-2 philosophy an incorrect program, so its interpreted and compiled version are allowed to behave differently. I do not agree (if it is illegal then maxima should always give an error). Nevertheless it is good to know this. I like your proposal for program variables (which live in a different name space) and replacing evaluation by explicit substitution and explicit simplification (so that its effect is deterministic). I think this can currently perhaps be achieved in lisp (by avoiding to call meval and friends as much as possible), but not in the maxima language. It seems to me it would require a complete redesign of the maxima language which would not be backwards incompatible. Nevertheless when going down that road I think one should make the maxima language an object oriented language where expressions are simply instances of an appropriate class. This would allow one for example to unify all the different number systems which are now treated more or less distinctly in maxima. One should also create a proper package system so that not every extension dumps all its garbage in the global scope. Ideally one should not have to create a new language but simply create bindings to an existing object oriented language (I would vote for python, but java makes probably more sense). The issue on how to interface with legacy code is a major one however. Michel From aeder at arcor.de Fri Jan 12 11:10:04 2007 From: aeder at arcor.de (Andreas Eder) Date: Fri, 12 Jan 2007 18:10:04 +0100 Subject: [Maxima] cleanup of defopt.lisp Message-ID: <70563.1168621804@staffa.eder.local> Hi, I did a cleanup of the file defopt.lisp. I removed all the unnecessary conditional (old) code and what remains ist not very much. --------------------------------------------- cut here -------------------- ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;; ;;; (c) Copyright 1980 Massachusetts Institute of Technology ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :maxima) (macsyma-module defopt macro) ;; For defining optimizers which run on various systems. ;; Q: What is an optimizer? ;; A: A transformation which takes place in the compiler. ;; ***==> Right now, DEFOPT is used just like you would a DEFMACRO <==*** ;; (defopt ) (defmacro defopt (&rest other) `(#-gcl define-compiler-macro #+gcl si::define-compiler-macro , at other)) --------------------------------------------- cut here -------------------- Unfortunately I have no gcl available so I don't know wether the conditionalization for gcl is still needed. If not we could just get rid of the whole file and directly replace 'defopt' in the few places it is used with 'define-compiler-macro'. Since I have again some free time at hand, I intend to do a few further cleanups in the code (there are quite a few candidate files). Where should I send the patches to? How to get write access to the cvs archive? I hope someone finds all this useful 'Andreas -- Wherever I lay my .emacs, there's my $HOME. From raymond.toy at ericsson.com Fri Jan 12 13:12:37 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 12 Jan 2007 14:12:37 -0500 Subject: [Maxima] Request for Patches In-Reply-To: (Brent Fulgham's message of "Thu, 11 Jan 2007 21:33:51 -0800") References: Message-ID: >>>>> "Brent" == Brent Fulgham writes: Brent> Could someone please apply patch #1573497 so that Maxima can build Brent> under OpenMCL? I said I would do that, didn't I? Sorry about that. I'll apply the patch shortly. Please test when you get a chance. Ray From raymond.toy at ericsson.com Fri Jan 12 13:14:58 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 12 Jan 2007 14:14:58 -0500 Subject: [Maxima] cleanup of defopt.lisp In-Reply-To: <70563.1168621804@staffa.eder.local> (Andreas Eder's message of "Fri, 12 Jan 2007 18:10:04 +0100") References: <70563.1168621804@staffa.eder.local> Message-ID: >>>>> "Andreas" == Andreas Eder writes: Andreas> (defmacro defopt (&rest other) Andreas> `(#-gcl define-compiler-macro #+gcl si::define-compiler-macro , at other)) Andreas> --------------------------------------------- cut here -------------------- Andreas> Unfortunately I have no gcl available so I don't know wether the Andreas> conditionalization for gcl is still needed. Andreas> If not we could just get rid of the whole file and directly replace 'defopt' in the Andreas> few places it is used with 'define-compiler-macro'. GCL (2.6.8pre) doesn't have define-compiler-macro, but it does have si:define-compiler-macro. If we assume si:define-compiler-macro is really the same as define-compiler-macro, then perhaps we should just import si:define-compiler-macro into either the CL or MAXIMA package and then we can remove this conditionalization. And also push the gcl folks to implement this. (Along with ENSURE-DIRECTORIES-EXIST!) Ray From raymond.toy at ericsson.com Fri Jan 12 13:28:52 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 12 Jan 2007 14:28:52 -0500 Subject: [Maxima] Request for Patches In-Reply-To: (Brent Fulgham's message of "Thu, 11 Jan 2007 21:33:51 -0800") References: Message-ID: >>>>> "Brent" == Brent Fulgham writes: Brent> Could someone please apply patch #1573497 so that Maxima can build Brent> under OpenMCL? That patch is all mangled. Can you send a context or unified diff to the mailing list? It would probably good to report this issue to the upstream defsystem on clocc.sf.net, if you haven't already. Do you also need patch 1573534? Ray From spluque at gmail.com Fri Jan 12 17:41:27 2007 From: spluque at gmail.com (Seb) Date: Fri, 12 Jan 2007 17:41:27 -0600 Subject: [Maxima] error on first line sent to maxima Message-ID: <871wlzak48.fsf@patagonia.sebmags.homelinux.org> Hi, I posted this in the emacs-help ng last week, but there were no followups, so hopefully someone here might have some suggestions. I'm using the maxima-emacs and emacs-snapshot Debian packages and am encountering the following trace. This happens with a fresh maxima process, upon sending the first line of code to the process, either from a script file or while in the process buffer. I'm not sure where the source of the issue is so I'd be grateful for any pointers. Thanks. Debugger entered--Lisp error: (error "Marker does not point anywhere") ansi-color-apply-on-region(# #) ansi-color-process-output("") run-hook-with-args(ansi-color-process-output "") comint-send-input() inferior-maxima-comint-send-input() (if (maxima-check-parens pt1 pt) (inferior-maxima-comint-send-input)) (progn (save-excursion (re-search-backward inferior-maxima-prompt) (setq pt1 ...)) (if (maxima-check-parens pt1 pt) (inferior-maxima-comint-send-input))) (if ok (progn (save-excursion ... ...) (if ... ...)) (inferior-maxima-comint-send-input)) (let ((ok nil) (pt ...) pt1) (save-excursion (end-of-line) (skip-chars-backward " ") (forward-char -1) (when ... ... ...)) (if ok (progn ... ...) (inferior-maxima-comint-send-input))) inferior-maxima-check-and-send-line() call-interactively(inferior-maxima-check-and-send-line) Cheers, -- Seb From bfulg at pacbell.net Fri Jan 12 22:06:11 2007 From: bfulg at pacbell.net (Brent Fulgham) Date: Fri, 12 Jan 2007 20:06:11 -0800 Subject: [Maxima] Request for Patches In-Reply-To: References: Message-ID: <4613544F-C34F-42A1-83A2-852C3AD958B0@pacbell.net> On Jan 12, 2007, at 11:28 AM, Raymond Toy wrote: >>>>>> "Brent" == Brent Fulgham writes: > > Brent> Could someone please apply patch #1573497 so that Maxima > can build > Brent> under OpenMCL? > > That patch is all mangled. Can you send a context or unified diff to > the mailing list? It would probably good to report this issue to the > upstream defsystem on clocc.sf.net, if you haven't already. See attached. > Do you also need patch 1573534? It looks like this was refactored in the current release, and is no longer an issue. The #, reader macro seems to be gone. Thanks, -Brent -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-lisp-utils-defsystem.lisp Type: application/octet-stream Size: 518 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070112/e358aff5/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070112/e358aff5/attachment.pgp From miguel39123 at hotmail.com Sat Jan 13 04:53:19 2007 From: miguel39123 at hotmail.com (Miguel Lopez) Date: Sat, 13 Jan 2007 10:53:19 +0000 (UTC) Subject: [Maxima] function arguments and gensym Message-ID: About sanitizing Maxima via gensym. The function arguments may have very different bindings: as a function, as an array, property list, etc. So I suggest one of these two options: 1.- When replacing an argument s with gensym copy all these properties before evaluating the argument. 2.- Define the functions like in this example: f(s_Array, g_Function) := ... This way is clear what the symbol s stand for. In other languages this problem doesn't exists because each symbol has only one binding: In C, int i char j int *k In Maxima the only way to make a function with argument "s" is to pass to the function all the information about symbol "s", so clearly you can't pass the function a value and then try to use it as a function. Best Regards -Miguel. From michel.vandenbergh at uhasselt.be Sat Jan 13 05:25:33 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 13 Jan 2007 12:25:33 +0100 Subject: [Maxima] function arguments and gensym Message-ID: <45A8C1AD.2020002@uhasselt.be> > > > The function arguments may have very different bindings: > > as a function, as an array, property list, etc. > Yes this is very confusing. I have added another section to my wiki article (http://maxima.sourceforge.net/wiki/index.php/LexicalLayer) which discusses the behaviour of arrays versus lists passed as an argument to a function. Briefly (using identical syntax) array elements seem to be passed by value and list elements by reference. While I now understand this can be explained somewhat rationally it is still needlessly confusing, and different from what people will expect (except perhaps for people with an indepth knowledge of lisp). Michel From michel.vandenbergh at uhasselt.be Sat Jan 13 06:13:10 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 13 Jan 2007 13:13:10 +0100 Subject: [Maxima] function arguments and gensym Message-ID: <45A8CCD6.3000909@uhasselt.be> > > > The function arguments may have very different bindings: > > as a function, as an array, property list, etc. > > We have to be clear here: I think this issue has nothing to do with lexical versus dynamic scoping. I think it is usually (always) clear from the use of a symbol what property the user wants. I.e. if he writes f(-) he means the function property of f (it it exists). If he writes f[-] and f is not a list he means the array property of f. I think the use of the lisp-2 model on the maxima level is needlessly confusing. I there anything to be gained by it? Michel From miguel39123 at hotmail.com Sat Jan 13 06:32:51 2007 From: miguel39123 at hotmail.com (Miguel Lopez) Date: Sat, 13 Jan 2007 12:32:51 +0000 (UTC) Subject: [Maxima] function arguments and gensym References: <45A8CCD6.3000909@uhasselt.be> Message-ID: Michel Van den Bergh uhasselt.be> writes: > I think it is usually (always) clear from the use of a symbol what > property the > user wants. Yes the user knows what he wants, but *maxima* not: Look this: f(s,t):=s[t]; w:x; x[4]:5; f(w,4); it gives 5 but I, the user, suppose the definition f(s,t):=s[t] means for f(w,4) w[4] and not x[4]. The global value of w as a symbol is incorrect here, we want to use the array w. Similar refletions for the function, etc. Summarizing: s value is incorrect (from an user point of view) when you say s[t] or s(t) you don't want x[t] or x(t), you want to get the array property or the function property of symbol s and not first the global value and then look for the properties. -Miguel. From michel.vandenbergh at uhasselt.be Sat Jan 13 07:09:35 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 13 Jan 2007 14:09:35 +0100 Subject: [Maxima] function arguments and gensym Message-ID: <45A8DA0F.2000803@uhasselt.be> > > >f(s,t):=s[t]; >w:x; >x[4]:5; >f(w,4); > >it gives 5 but I, the user, suppose the definition f(s,t):=s[t] means for > f(w,4) w[4] and not x[4]. > The global value of w as a symbol is incorrect here, we >want to use the array w. > Is the function definition relevant here? Otherwise I would simplify the example to w:x; x[4]:5; w[4]; which gives 5 as expected. The meaning of w[4] is I think: (1) w has no array property and is not a list so evaluate it. (2) We now get x[4]. Since x has an array property we can evaluate x[4] to get 5. This seems to be confirmed by the following experiments. w:x; x[4]:5; w:1; w[4]; This give an error as evaluation of w yields 1[4]. w:x; x[4]:5; x:1; w[4]; Now we get 5. w evaluates to x and since x has the array property, x[4] evaluates to 5. w:x; x[4]:5; x:[1,1,1,1,1,1,1,1]; w[4]; This is tricky! Now we still get 5. So maxima seems to prefer the array property of x above its value which is a list. w:x; x:[1,1,1,1,1,1,1,1]; w[4]; Now x has no array property so its value is inspected. We get 1. x[4]:5; x:[1,1,1,1,1,1,1,1]; x[4]; We get 5. Maxima prefers again the array property. Michel From toy.raymond at gmail.com Sat Jan 13 09:25:44 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Sat, 13 Jan 2007 10:25:44 -0500 Subject: [Maxima] Request for Patches In-Reply-To: <4613544F-C34F-42A1-83A2-852C3AD958B0@pacbell.net> References: <4613544F-C34F-42A1-83A2-852C3AD958B0@pacbell.net> Message-ID: <45A8F9F8.7040105@gmail.com> Brent Fulgham wrote: > > On Jan 12, 2007, at 11:28 AM, Raymond Toy wrote: > >>>>>>> "Brent" == Brent Fulgham writes: >> >> Brent> Could someone please apply patch #1573497 so that Maxima >> can build >> Brent> under OpenMCL? >> >> That patch is all mangled. Can you send a context or unified diff to >> the mailing list? It would probably good to report this issue to the >> upstream defsystem on clocc.sf.net, if you haven't already. > > See attached. > Patch applied. Thanks! Ray From fateman at cs.berkeley.edu Sat Jan 13 09:59:34 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sat, 13 Jan 2007 07:59:34 -0800 Subject: [Maxima] function arguments and gensym In-Reply-To: <45A8DA0F.2000803@uhasselt.be> References: <45A8DA0F.2000803@uhasselt.be> Message-ID: <015d01c7372b$d28f0c20$30d09888@RJFE510> 1. There is nothing to prevent you from writing an entirely different top level for Maxima. Using the existing framework as a start, if you wish, you can design a different programming language, a compiler, etc. With such a rewrite you can revisit all kinds of questions from capitalization to binding, to the treatment of arrays. There is, in commercial Macsyma, a feature that allows you to write in Matlab syntax. 2. It is probably a bad idea to make incompatible changes to the existing language. 3. The examples given of errors continue, I think, to illustrate "user error" though perhaps Maxima has confusing semantics with regard to arrays. Lisp had confusing array semantics too, at least in 1966. Consider h[1]; is h[1]. H has no value or properties and so is "quoted". h:r+s; h[1]; is (r+s)[1]. H is neither an array nor a list, but a value. array(h,3); h[1]; is h[1]. H has an array property so h[1] is a reference into it. h; is still r+s. h:[a,b,c] sets the value of h to a list h[1]; is h[1] because the array property takes preference. The deficiency here is related to using the same syntax [] for at least 4 things. 1. defining a list as [a,b,c]. 2. extracting from a list h[1]. 3. extracting from an array h[1]. 4. having a subscripted variable. The confusion that some users may have from this is understandable. The user confusion should not be corrected by taking the view that erroneous user programs should be adopted as a model for correct programs. A program that uses x as a subscripted indeterminate, e.g. x[1], x[2], UNEVALUATED, should not, every so often, try to do X[i]: some value Or X: some value. This is probably a error, since x[1] then becomes ambiguous in the user's mind. It is of course not ambiguous to Maxima, which does something specific, but perhaps not what the user had in mind. Here's a way out of the situation. Never use the syntax [] to extract from a list. That is, choose another syntax. For example, H:[a,b,c] H[[1]] -> a. In the array-accessing expression Q[1], the name Q is not evaluated. If Q is an array, Q[1] is found and returned. If Q is not an array, Q[1] is a subscripted name. If you want to make an array S, and assign Q:S and refer indirectly to S through Q, then do something like arrayref(Q,1). Arrayref evaluates its arguments. RJF .... > w:x; > x[4]:5; > x:[1,1,1,1,1,1,1,1]; > w[4]; > > This is tricky! Now we still get 5. So maxima seems to prefer > the array property of x above its value which is a list. No, the value of x is a list. X has no array property. The notation > > w:x; > x:[1,1,1,1,1,1,1,1]; > w[4]; > > Now x has no array property so its value is inspected. We get 1. > > x[4]:5; > x:[1,1,1,1,1,1,1,1]; > x[4]; > > We get 5. Maxima prefers again the array property. No, the value of x is a list. From michel.vandenbergh at uhasselt.be Sat Jan 13 10:10:19 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 13 Jan 2007 17:10:19 +0100 Subject: [Maxima] function arguments and gensym In-Reply-To: <015d01c7372b$d28f0c20$30d09888@RJFE510> References: <45A8DA0F.2000803@uhasselt.be> <015d01c7372b$d28f0c20$30d09888@RJFE510> Message-ID: <45A9046B.90204@uhasselt.be> Thanks for the reply. To make sure I did the examples again > > .... > >> w:x; >> x[4]:5; >> x:[1,1,1,1,1,1,1,1]; >> w[4]; >> >> This is tricky! Now we still get 5. So maxima seems to prefer >> the array property of x above its value which is a list. >> > > No, the value of x is a list. X has no array property. > But we do get 5! :lisp (describe '$x); $X - internal symbol in MAXIMA package value: ((MLIST SIMP) 1 1 1 1 1 1) property MPROPS: (NIL HASHAR #:G32536) <====== > The notation > >> w:x; >> x:[1,1,1,1,1,1,1,1]; >> w[4]; >> >> Now x has no array property so its value is inspected. We get 1. >> >> x[4]:5; >> x:[1,1,1,1,1,1,1,1]; >> x[4]; >> >> We get 5. Maxima prefers again the array property. >> > > No, the value of x is a list. > > > But we do get 5! :lisp (describe '$x) $X - internal symbol in MAXIMA package value: ((MLIST SIMP) 1 1 1 1 1 1) property MPROPS: (NIL HASHAR #:G32537) <===== Michel From fateman at cs.berkeley.edu Sat Jan 13 10:29:23 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sat, 13 Jan 2007 08:29:23 -0800 Subject: [Maxima] function arguments and gensym In-Reply-To: <45A9046B.90204@uhasselt.be> References: <45A8DA0F.2000803@uhasselt.be> <015d01c7372b$d28f0c20$30d09888@RJFE510> <45A9046B.90204@uhasselt.be> Message-ID: <017601c7372f$fcc15df0$30d09888@RJFE510> Ah, I too was caught in this confusion. The point remains: You can use x as an array, either by array(x,3), or ... as in the example ... assigning as a hash array element, x[4]:5. Or you can give x a value of a list, by x:[1,1,1,1]. Or you can do BOTH. And what should w[4] mean? The user may not know. I didn't.. either 1. look for an array property on w if w is a local name Or 2. evaluate w to x and look for an array property on x Or 3. evaluate w to x and look for a value that is a list on x Or 4. evaluate w to x and make a "complicated name" of a subscripted x Or 5. if w has no value, make a "complicated name" of a subscripted w. The discussion of whether x or w is to be treated differently if w is a formal parameter to a function or the name of a locally bound variable in a block is related perhaps. Foo(w):= Block([], array(w,100), is this the same w? what does w[10]:300 really do? How about return(w), does it return w's value or its array property? In Fortran, there is some confusion about an array w(10), since the syntax for a function call is the same... w(10). But no one considers that w(10) means x(10) because w is assigned the name x. (There is the "equivalence" statement, to confuse old Fortran hands, but this is not an incentive to learn Fortran.) RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Saturday, January 13, 2007 8:10 AM > To: fateman at cs.berkeley.edu; maxima at math.utexas.edu > Subject: Re: [Maxima] function arguments and gensym > > Thanks for the reply. To make sure I did the examples again > > > > .... > > > >> w:x; > >> x[4]:5; > >> x:[1,1,1,1,1,1,1,1]; > >> w[4]; > >> > >> This is tricky! Now we still get 5. So maxima seems to prefer > >> the array property of x above its value which is a list. > >> > > > > No, the value of x is a list. X has no array property. > > > But we do get 5! > > :lisp (describe '$x); > > $X - internal symbol in MAXIMA package > value: > ((MLIST SIMP) 1 1 1 1 1 1) > property MPROPS: > (NIL HASHAR #:G32536) <====== > From robert.dodier at gmail.com Sat Jan 13 10:55:50 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 13 Jan 2007 09:55:50 -0700 Subject: [Maxima] cleanup of defopt.lisp In-Reply-To: <70563.1168621804@staffa.eder.local> References: <70563.1168621804@staffa.eder.local> Message-ID: Hello Andreas, > Unfortunately I have no gcl available so I don't know wether the > conditionalization for gcl is still needed. Well, if that's the case then the prudent thing to do is just leave the gcl conditionalizations in place. > Since I have again some free time at hand, I intend to do a few further > cleanups in the code (there are quite a few candidate files). Before you get started, let's consider what can be done here. I can see a few tasks: (1) Identify conditionalizations for non-CL Lisp varieties and remove them. (2) Locate commented-out blocks of code and remove them. (3) Locate functions which cannot be called from Maxima and remove them. It looks to me that making conditional code into unconditional (e.g. changing #+gcl (foo) to just (foo)) is not a change in the same league as these others; it requires much more care. So at this point I would rather not attempt it. Andreas, maybe you can outline the changes you are planning to make. Maybe others want to add or subtract items from the list above. > Where should I send the patches to? > How to get write access to the cvs archive? You can post patches the Sourceforge patch manager, http://sourceforge.net/tracker/?group_id=4933&atid=304933 Or if you have access to some other website you could post them there. It seems likely these patches will be too big for the mailing list. Let's see how it goes and if the patches submitted meet general approval then I can give you cvs write access. All the best, Robert Dodier From andu at inbox.ru Sat Jan 13 11:47:50 2007 From: andu at inbox.ru (Andrei Dubovik) Date: Sat, 13 Jan 2007 18:47:50 +0100 Subject: [Maxima] find_root Message-ID: <200701131847.50941.andu@inbox.ru> Hello, may be someone can help me with using find_root function as an ordinary function. Here is what I was trying to do: g(a) := find_root(f(x,a),x,xmin,xmax); g(0.5); --> should give the appropriate numerical solution (this works with the above definition) g(z+z); --> should give g(2z), at(%,z=0.25); --> should give the number immidiately plot2d(g(z),[z,zmin,zmax]); --> should work Somehow there seems to be nothing in the documentation on it (I tried everything I could imagine with ' and '' and was trying to make a wrapper that returns just a symbol when the argument is not a number, but I didn't succeed to make everything work.) I.e. I'd like to have a function just like an ordinary one, say, sin(x). Andrei. From michel.vandenbergh at uhasselt.be Sat Jan 13 12:24:51 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 13 Jan 2007 19:24:51 +0100 Subject: [Maxima] find_root Message-ID: <45A923F3.6070607@uhasselt.be> I don't really know the solution but here are some remarks. First of all you probably need to quote the first argument plot2d('(g(z)),[z,zmin,zmax]); Otherwise g(z) will be immediately evaluated at the symbol z which may have some unintended consequences. Secondly, you can put print statements in the body of g(z). That way you can find out if g(z) is really doing what you think it is. Michel From robert.dodier at gmail.com Sat Jan 13 12:34:27 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 13 Jan 2007 11:34:27 -0700 Subject: [Maxima] find_root In-Reply-To: <200701131847.50941.andu@inbox.ru> References: <200701131847.50941.andu@inbox.ru> Message-ID: On 1/13/07, Andrei Dubovik wrote: > g(a) := find_root(f(x,a),x,xmin,xmax); > g(0.5); --> should give the appropriate numerical solution (this works with > the above definition) > g(z+z); --> should give g(2z), > at(%,z=0.25); --> should give the number immidiately > plot2d(g(z),[z,zmin,zmax]); --> should work Well, if all you want is for the plot to succeed, you can write: plot2d (g, [z, , ]); which postpones the evaluation of g until it has a numeric argument. g(z) is evaluated before plot2d is called, so plot2d cannot even get started (because g(z) with symbolic argument fails). > Somehow there seems to be nothing in the documentation on it (I tried > everything I could imagine with ' and '' and was trying to make a wrapper > that returns just a symbol when the argument is not a number, but I didn't > succeed to make everything work.) I.e. I'd like to have a function just like > an ordinary one, say, sin(x). OK, I guess what you want is for find_root(, x, xmin, xmax) to return the unevaluated expression find_root(, x, xmin, xmax) when is not a function of x alone (or something like that). Unfortunately find_root is a strictly numerical function; if evaluates to something other than a number, it barfs. (Although find_root could be modified to return the unevaluated expression.) So you'll have to handle the different cases in your wrapper function. How about: g(a) := if numberp(a) then find_root(f(x,a),x,xmin,xmax) else funmake(g, [a]); Then: (f(x, a) := x^a - 2, xmin : 0, xmax : 10); /* e.g. */ g(0.5); => 4.0 g(z + z); => g(2*z) at(%, z=0.25); => g(0.5) ''%; => 4.0 plot2d (g(z), [z, 0.5, 2]); => makes a plot plot2d (g, [z, 0.5, 2]); => makes a plot A note for everyone else -- find_root evaluates its arguments in a nonstandard way, and that has caused problems in the recent past, but I don't think that's a factor here. Hope this helps Robert Dodier From tkosan at yahoo.com Sat Jan 13 13:40:44 2007 From: tkosan at yahoo.com (Ted Kosan) Date: Sat, 13 Jan 2007 11:40:44 -0800 (PST) Subject: [Maxima] plot2d discrete mode Bad Range error Message-ID: <850342.10929.qm@web31808.mail.mud.yahoo.com> Hello, I am working my through the plotting chapter of the maxima reference manual ( http://maxima.sourceforge.net/docs/manual/en/maxima_8.html#SEC32 ) and I am encountering a "Bad Range" error when I execute the plot2d function in discrete mode. An example maxima session that shows the error is included below. Does anyone have any thoughts on what I may be doing wrong? Thanks in advance :-) Ted ======== tkosan at hpb ~ $ rmaxima Maxima 5.9.1 http://maxima.sourceforge.net Using Lisp CMU Common Lisp CVS 19c 19c-release + minimal debian patches (19C) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) xy:makelist([x,x*x],x,0,5)$ (%i2) xy; (%o2) [[0, 0], [1, 1], [2, 4], [3, 9], [4, 16], [5, 25]] (%i3) plot2d([discrete,xy])$ Bad Range FALSE must be of the form [variable,min,max] -- an error. Quitting. To debug this try DEBUGMODE(TRUE); (%i4) ======== From robert.dodier at gmail.com Sat Jan 13 14:22:29 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 13 Jan 2007 13:22:29 -0700 Subject: [Maxima] plot2d discrete mode Bad Range error In-Reply-To: <850342.10929.qm@web31808.mail.mud.yahoo.com> References: <850342.10929.qm@web31808.mail.mud.yahoo.com> Message-ID: Ted, > tkosan at hpb ~ $ rmaxima > Maxima 5.9.1 http://maxima.sourceforge.net Discrete plots were implemented after 5.9.1 -- I recommend pretty strongly to update to the most recent version (5.11.0) since there have been many improvements since 5.9.1. best Robert Dodier From Daniel.L.Solomon at nasa.gov Sat Jan 13 14:56:36 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 13 Jan 2007 15:56:36 -0500 Subject: [Maxima] updating maxima In-Reply-To: References: <850342.10929.qm@web31808.mail.mud.yahoo.com> Message-ID: <8A925535-534A-439C-BF33-793E526944B7@nasa.gov> i used fink to get maxima on my mac last month. Which turned out to be 5.9.0. I'd prefer not to compile it from source if possible. Is there a 5.11 executable for mac? On Jan 13, 2007, at 3:22 PM, Robert Dodier wrote: > Ted, > >> tkosan at hpb ~ $ rmaxima >> Maxima 5.9.1 http://maxima.sourceforge.net > > Discrete plots were implemented after 5.9.1 -- I recommend pretty > strongly to update to the most recent version (5.11.0) since there > have been many improvements since 5.9.1. > > best > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Sat Jan 13 16:49:12 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 13 Jan 2007 23:49:12 +0100 Subject: [Maxima] function arguments and gensym Message-ID: <45A961E8.8010106@uhasselt.be> > > >Foo(w):= Block([], > > array(w,100), > is this the same w? what does w[10]:300 really do? How about >return(w), does it return w's value or its array property? > > > I guess in any algol like language array(w,100) would be a local variable declaration which would shield the parameter w.... In maxima it gives the symbol w an array property, which is global since as you say Foo(w):=... only puts the *value* of w on the stack.....That's why I assume return(w) only returns the value of w but I have not checked it. Also in an algol like language (if you omit the declaration array(w,100)), w[10]:300 would change the tenth element of the array passed in w (array elements are passed by reference as an array is really a pointer). In maxima this happens for lists (as lists are values) but not for arrays. I find this a little bit depressing as in my mind arrays and lists are both sequence types and they should be treated in the same way as much as possible. If you set use_fast_arrays:true then arrays are saved in the value cell (as lisp arrays), but then such arrays have limitations compared to standard maxima arrays (this is probably just an implementation issue). I assume the decision to have a separate function cell in Common Lisp was for efficiency reasons. I don't seem any reason why that has been carried through to the maxima level (as maxima functions are not lisp functions anyway). Michel From fateman at cs.berkeley.edu Sat Jan 13 17:21:02 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sat, 13 Jan 2007 15:21:02 -0800 Subject: [Maxima] function arguments and gensym In-Reply-To: <45A961E8.8010106@uhasselt.be> References: <45A961E8.8010106@uhasselt.be> Message-ID: <018101c73769$7e6042c0$30d09888@RJFE510> This explanation is more based on history than optimal design. The decision to have a separate function cell in Common Lisp was probably based on the history of Maclisp and Interlisp. The Scheme dialect broke with that tradition. The tradition of Maclisp was used in Macsyma/Maxima. The notion of an abstract object like a matrix or a sparse matrix as a value of a variable V seems fine in isolation. The notion of a storage system like an array, a hashed array, an array of functions ... associated with a scalar name A is different. Or at least has been different historically. Because it is possible to store a matrix in an array, these ideas have been conflated in a number of programming languages, but they are different. For example, square matrices of a particular size, say 4X4, with elements that are from a commutative ring form a ring, with the usual notion of matrix multiplication and with a left (or right) multiplicative identity the 4x4 matrix with 1's on the diagonal, etc. Arrays do not have such mathematical baggage. Multiplying 2 arrays might be done element by element. If they are conformable, at least. Or might be undefined. After all, an array might store social security numbers, and another might store salaries. Why multiply them? Lists used as 1Xn matrices are structure-abstraction puns, and invite misuses. If it is any consolation, Mathematica ignored several decades of experience with this problem and even went so far as to fail to distinguish between row and column vectors. Arrays should be used for storing information. A matrix-valued variable is a member of a non-commutative ring... RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Saturday, January 13, 2007 2:49 PM > To: maxima at math.utexas.edu > Subject: [Maxima] function arguments and gensym > > > > > > >Foo(w):= Block([], > > > > array(w,100), > > is this the same w? what does w[10]:300 really do? How about > >return(w), does it return w's value or its array property? > > > > > > > I guess in any algol like language array(w,100) would be a local > variable declaration which would shield > the parameter w.... In maxima it gives the symbol w an array property, > which is global since as you say > Foo(w):=... only puts the *value* of w on the stack.....That's why I > assume return(w) only returns the value > of w but I have not checked it. > > Also in an algol like language (if you omit the declaration > array(w,100)), w[10]:300 would change the tenth element > of the array passed in w (array elements are passed by reference as an > array is really a pointer). > > In maxima this happens for lists (as lists are values) but not for > arrays. I find this a little bit depressing as in my > mind arrays and lists are both sequence types and they should be treated > in the same way as much as possible. > If you set use_fast_arrays:true then arrays are saved in the value cell > (as lisp arrays), but then such arrays > have limitations compared to standard maxima arrays (this is probably > just an implementation issue). > > I assume the decision to have a separate function cell in Common Lisp > was for efficiency reasons. I don't > seem any reason why that has been carried through to the maxima level > (as maxima functions are not > lisp functions anyway). > > Michel > > > > > > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From robert.dodier at gmail.com Sat Jan 13 17:22:59 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 13 Jan 2007 16:22:59 -0700 Subject: [Maxima] finishing Airy function cleanup Message-ID: Hello, Over the past few releases David Billinghurst has revised and extended the treatment of Airy functions and their derivatives. Many thanks to David for his excellent work. There remains the function $AIRY in src/bessel.lisp which I'll quote here in extenso -- (defun $airy ($arg) (cond ((numberp $arg) (slatec:dai (float $arg))) (t (list '($airy simp) $arg)))) There are no other Airy functions (neither Bi nor anything else) in src/bessel.lisp. The new stuff is all in src/airy.lisp, including $AIRY_AI which implements the above behavior. So I'd like to replace $AIRY with something to print a message to say $AIRY has been replaced by $AIRY_AI, and cut out the documentation for $AIRY. So far as I can tell $AIRY is not called from anywhere in src/, share/, or tests/. Comments? best Robert From toy.raymond at gmail.com Sat Jan 13 20:48:02 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Sat, 13 Jan 2007 21:48:02 -0500 Subject: [Maxima] finishing Airy function cleanup In-Reply-To: References: Message-ID: <45A999E2.1030606@gmail.com> Robert Dodier wrote: > So I'd like to replace $AIRY with something to print a message > to say $AIRY has been replaced by $AIRY_AI, > and cut out the documentation for $AIRY. > > So far as I can tell $AIRY is not called from anywhere in src/, > share/, or tests/. > > Comments? > > I'm pretty sure this implementation of $AIRY using SLATEC is there because there was already an implementation, and I just replaced it with a SLATEC version. I have no objections to your change. Ray From belanger at truman.edu Sat Jan 13 21:03:57 2007 From: belanger at truman.edu (Jay Belanger) Date: Sat, 13 Jan 2007 21:03:57 -0600 Subject: [Maxima] error on first line sent to maxima In-Reply-To: <871wlzak48.fsf@patagonia.sebmags.homelinux.org> (Seb's message of "Fri\, 12 Jan 2007 17\:41\:27 -0600") References: <871wlzak48.fsf@patagonia.sebmags.homelinux.org> Message-ID: <87ac0mgvhe.fsf@vh213602.truman.edu> Seb writes: ... > I'm using the maxima-emacs and emacs-snapshot Debian packages and am > encountering the following trace. This happens with a fresh maxima > process, upon sending the first line of code to the process, either from a > script file or while in the process buffer. I'm not sure where the source > of the issue is so I'd be grateful for any pointers. Thanks. Since things work fine here, could you supply more details? What version of maxima-emacs? Is emacs-snapshot the same as cvs emacs? What exactly did you type in? If you work with a newly started emacs, start maxima (M-x maxima, say) and type in a simple command (2+2; RET, for example), do you have the problem? Thanks, Jay From michel.vandenbergh at uhasselt.be Sun Jan 14 03:15:44 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 14 Jan 2007 10:15:44 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? Message-ID: <45A9F4C0.5010700@uhasselt.be> Hi, I was thinking of writing a wiki article on maxima's treatment of arrays and functions as this is conceptually very different from other languages (except Common Lisp). I wonder however if this would duplicate explanations already available elsewhere. I originally confused the (in my opinion) strange behaviour of maxima with regard to arrays and functions with the lexical versus dynamic binding issue. Thanks to Richard's explanations I now see these two issues are distinct. Since it took me a long time to understand this I assume it must be the same for other people new to maxima. I still think the decision not to store functions and arrays in the value cell was bad, but since that's the way it is now, it should at least be explained clearly. Michel From willisb at unk.edu Sun Jan 14 06:19:08 2007 From: willisb at unk.edu (Barton Willis) Date: Sun, 14 Jan 2007 06:19:08 -0600 Subject: [Maxima] tellsimp and abs Message-ID: Consider: (%i1) tellsimp(abs(a),a-1)$ (%i2) abs(a); (%o2) a-1 <-- OK (%i3) abs([a]); (%o3) [abs(a)] <-- not OK (%i4) expand(%,0); <-- shouldn't need to expand (%o4) [a-1] I believe this (putative) bug is caused by the fact that 'simpabs' calls itself instead of calling 'simplifya.' As a general rule, 'simplifya' is the only function that should directly call a simplifying function. True or false? Three more things: (1) Since Maxima lists don't correspond to any one particular mathematical object, I think it's wrong for 'abs' to automatically map over a list. When listarith == true, then OK map 'abs' over lists. Agree or disagree? (2) The reflection simplification for abs doesn't work when the CL special 'expandp' is 't' (look at signum1). I don't have an example where this causes a problem. Nevertheless, we could change simpabs to use the reflection rule scheme defined in trigi.lisp. The test suite is OK with this change. OK or gratuitous? (3) Do we really want abs to call cabs whenever the expression contains an %i? Consider these 'simplifications' (yeech!) (%i1) abs(asin(x+%i)); Is x positive, negative, or zero? pos; (%o1) abs(log((x-sqrt(sqrt((2-x^2)^2+4*x^2)+x^2-2)/sqrt(2))^2+(sqrt(sqrt((2-x^2)^2+4*x^2)-x^2+2)/sqrt(2)-1)^2))/2 (%i2) abs((x+%i)^7); (%o2) sqrt((x^7-21*x^5+35*x^3-7*x)^2+(7*x^6-35*x^4+21*x^2-1)^2) (%i3) Barton From fateman at cs.berkeley.edu Sun Jan 14 08:40:48 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 14 Jan 2007 06:40:48 -0800 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? In-Reply-To: <45A9F4C0.5010700@uhasselt.be> References: <45A9F4C0.5010700@uhasselt.be> Message-ID: <01b101c737e9$fc5f7350$30d09888@RJFE510> My suggested approach to some of these issues is to provide a model for a program that works, essentially deprecating certain features that you think will be confusing. Especially if those features have been supplanted by better features. That way you don't have to go through a long explanation, at least at that spot, why something is "bad". Thus I might recommend that it is good to separate your indeterminates from your program variables. Maybe refer to a discussion of evaluation and scope and such, somewhere else. Or why subst is preferable to ev, or how to extract pieces of an expression using inpart rather than part or []. RJF > -----Original Message----- > From: maxima-bounces at math.utexas.edu [mailto:maxima- > bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh > Sent: Sunday, January 14, 2007 1:16 AM > To: maxima at math.utexas.edu > Subject: [Maxima] Wiki article about maxima's treatment of arrays and > functions? > > Hi, > > I was thinking of writing a wiki article on maxima's treatment of arrays > and functions as this is > conceptually very different from other languages (except Common Lisp). I > wonder however if this would > duplicate explanations already available elsewhere. > > I originally confused the (in my opinion) strange behaviour of maxima > with regard to arrays > and functions with the lexical versus dynamic binding issue. Thanks to > Richard's explanations I now see > these two issues are distinct. > > Since it took me a long time to understand this I assume it must be the > same for other people new to maxima. > I still think the decision not to store functions and arrays in the > value cell was bad, but since that's the way > it is now, it should at least be explained clearly. > > Michel > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Sun Jan 14 09:23:24 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 14 Jan 2007 16:23:24 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? Message-ID: <45AA4AEC.1070309@uhasselt.be> > > >My suggested approach to some of these issues is to provide a model for a >program that works, essentially deprecating certain features that you think >will be confusing. Especially if those features have been supplanted by >better features. That way you don't have to go through a long explanation, >at least at that spot, why something is "bad". > >Thus I might recommend that it is good to separate your indeterminates from >your program variables. Maybe refer to a discussion of evaluation and scope >and such, somewhere else. > > Or why subst is preferable to ev, or how to extract pieces of an >expression using inpart rather than part or []. > I think as long as the lexical vs dynamic binding issue is not resolved it will be impossible to write robust programs in the maxima language anyway. So I don't think there is much point in trying to explaining why some constructs work somewhat better than others. Lexical binding will make the evaluation issue moot since it will be clear from the syntactic structure of a program in which scope expressions will be evaluated. The functions/array issue is different. This is manageable as long as you know what goes on. That's why I would like to explain that. Creating a namespace for program variables is what I do currently. I write my variables as "some_identifier__", hoping that the user will not use these symbols in his expressions (maybe some type of freeof test could enforce this, but it's messy). Michel From michel.vandenbergh at uhasselt.be Sun Jan 14 10:04:25 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 14 Jan 2007 17:04:25 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? In-Reply-To: <45AA509F.8070401@ieee.org> References: <45AA4AEC.1070309@uhasselt.be> <45AA509F.8070401@ieee.org> Message-ID: <45AA5489.60707@uhasselt.be> Dan Stanger wrote: > While a single namespace is bothersome, it is really quite simple to > replace all variables > appearing in input expressions, with ones which cannot occur in users > input. This is another way to simulate lexical binding. I don't think the user should have to deal with it. > While arrays > can be a problem in Macsyma, there are ways to deal with them. > Perhaps you should describe > these methods. There seems to be a misundertanding. I do not want to describe how but why. I.e. why does f(s):=s[1] not work as expected? Michel From robert.dodier at gmail.com Sun Jan 14 11:10:41 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 14 Jan 2007 10:10:41 -0700 Subject: [Maxima] tellsimp and abs In-Reply-To: References: Message-ID: Barton, If matchdeclare is not called, tellsimp(foo(a), ...) only matches the literal argument a. Maybe the following yields the behavior you expected ... matchdeclare (a, all); tellsimp (abs(a), a - 1); abs(a); => a - 1 abs([a]); => [a - 1] > As a general rule, 'simplifya' is the only function > that should directly call a simplifying function. True or false? Hmm, maybe so. But I don't really have an opinion on this point. > (1) Since Maxima lists don't correspond to any one > particular mathematical object, I think it's wrong for 'abs' to > automatically map over a list. When listarith == true, then OK > map 'abs' over lists. Agree or disagree? OK by me to make the behavior of abs w.r.t. lists depend on listarith. Better still would be to have some kind of "foo distributes over bar" declaration. > (2) The reflection simplification for abs doesn't work when the CL > special 'expandp' is 't' (look at signum1). I don't have an example > where this causes a problem. Nevertheless, we could change simpabs > to use the reflection rule scheme defined in trigi.lisp. The test > suite is OK with this change. OK or gratuitous? OK by me to change it if you want. > (3) Do we really want abs to call cabs whenever the expression > contains an %i? Well, cabs, realpart, and imagpart could all stand to be revised. Maybe it wouldn't be so bad to punt to cabs if cabs were a little better behaved. Be that as it may, the policy "punt to cabs when %i is present" is faulty, right? Because expressions containing %i might or might not be complex, and complex expressions might or might not contain %i. Thanks for thinking about this stuff -- Robert From fateman at cs.berkeley.edu Sun Jan 14 11:13:25 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 14 Jan 2007 09:13:25 -0800 Subject: [Maxima] explanations vs. examples vs. design In-Reply-To: <45AA5489.60707@uhasselt.be> References: <45AA4AEC.1070309@uhasselt.be> <45AA509F.8070401@ieee.org> <45AA5489.60707@uhasselt.be> Message-ID: <01b701c737ff$4db31a80$30d09888@RJFE510> > There seems to be a misundertanding. I do not want to describe how but > why. I.e. why does > f(s):=s[1] not work as expected? You can do so, but my belief is that few people care about why. They only want to get something to work. (that is, how.) Furthermore, they don't want to read manuals or explanations. Often they will learn from random trials or maybe by reading examples. The learn-by-example is the (very successful) theory behind the 1,000 page books that have titles like "Excel for Dummies". The learn-from-random-trials is the theory that a well-designed language or interface will be so natural that people will use it correctly without needing an explanation. An example of this approach in the mathematical computation domain is the Macintosh Graphing Calculation by Ron Avitzur, also see www.nucalc.com for a version for windows, also. It is natural for academics, to believe in rational logical explanations. They tend to thrive on more abstract "symbolic" reasoning. Most people, even mathematicians, do better with visual metaphors. My tilu web site does symbolic integrals. There have been about 300,000 visits. The link to the instructions is essentially unused. RJF From michel.vandenbergh at uhasselt.be Sun Jan 14 11:37:19 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 14 Jan 2007 18:37:19 +0100 Subject: [Maxima] explanations vs. examples vs. design In-Reply-To: <01b701c737ff$4db31a80$30d09888@RJFE510> References: <45AA4AEC.1070309@uhasselt.be> <45AA509F.8070401@ieee.org> <45AA5489.60707@uhasselt.be> <01b701c737ff$4db31a80$30d09888@RJFE510> Message-ID: <45AA6A4F.6030608@uhasselt.be> Richard Fateman wrote: > > >>There seems to be a misundertanding. I do not want to describe how but >>why. I.e. why does >>f(s):=s[1] not work as expected? >> >> > >The learn-from-random-trials is the theory that a well-designed language or >interface will be so natural that people will use it correctly without >needing an explanation. > But I believe you are not being entirely consistent here. According to the previous paragraph f(s):=s[1] should do what it does in any other language (except CL perhaps). I.e s[1] (as an rvalue) should be made syntactic sugar for arrayapply(s,[1]). But that you don't seem to like either. If you insist f(s):=s[1] should stay as it is but is bad programming then people do deserve an explanation why. Michel From fateman at cs.berkeley.edu Sun Jan 14 16:12:50 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 14 Jan 2007 14:12:50 -0800 Subject: [Maxima] explanations vs. examples vs. design In-Reply-To: <45AA6A4F.6030608@uhasselt.be> References: <45AA4AEC.1070309@uhasselt.be> <45AA509F.8070401@ieee.org> <45AA5489.60707@uhasselt.be> <01b701c737ff$4db31a80$30d09888@RJFE510> <45AA6A4F.6030608@uhasselt.be> Message-ID: <000401c73829$27f12c40$30d09888@RJFE510> > -----Original Message----- > From: Michel Van den Bergh [mailto:michel.vandenbergh at uhasselt.be] > Sent: Sunday, January 14, 2007 9:37 AM > If you insist f(s):=s[1] should stay as it is but is bad programming > then people do deserve an > explanation why. Yes, they may deserve it, but they probably won't read it and if they read it they may not understand it. A better approach, I think, is to say: How do you pass / and use/ an array, or function array or ..... F(s):= arrayapply(s,1). Don't use s[1]. Etc. RJF > > Michel From dlakelan at street-artists.org Sun Jan 14 16:32:54 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Sun, 14 Jan 2007 14:32:54 -0800 Subject: [Maxima] explanations vs. examples vs. design In-Reply-To: <000401c73829$27f12c40$30d09888@RJFE510> References: <45AA4AEC.1070309@uhasselt.be> <45AA509F.8070401@ieee.org> <45AA5489.60707@uhasselt.be> <01b701c737ff$4db31a80$30d09888@RJFE510> <45AA6A4F.6030608@uhasselt.be> <000401c73829$27f12c40$30d09888@RJFE510> Message-ID: <20070114223254.GP25287@street-artists.org> On Sun, Jan 14, 2007 at 02:12:50PM -0800, Richard Fateman wrote: > > > If you insist f(s):=s[1] should stay as it is but is bad programming > > then people do deserve an > > explanation why. > > Yes, they may deserve it, but they probably won't read it and if they read > it they may not understand it. > > A better approach, I think, is to say: > > How do you pass / and use/ an array, or function array or ..... > > F(s):= arrayapply(s,1). Don't use s[1]. I think warnings "not to do x" always work better if the consequences are at least generally described. For example, if your product says "do not store near heat" the purchaser will respond in a more appropriate manner if your warning continues such as "because it causes spoilage and reduces the life of the product" or "because it causes explosive combustion". In this case, the because phrase should be short and relatively understandable to the unsophisticated. Having not really followed this thread, I think I'd be very interested to see such a description. Although I would probably also read and try to understand a more in depth description, I do agree that a simple one must come first and foremost because the target audience of maxima is the mathematically sophisticated, but not necessarily the computer language sophisticated. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From fateman at cs.berkeley.edu Sun Jan 14 20:09:05 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Sun, 14 Jan 2007 18:09:05 -0800 Subject: [Maxima] multiprecision gaussian quadrature Message-ID: <000501c7384a$22b103b0$30d09888@RJFE510> This note explains the use of multi-precision quadrature using MPFR / lisp on windows, Allegro CL 8.0 (possibly the free "Express" version), and generic arithmetic. The programs could probably be converted with modest effort to any other common lisp with a foreign function interface, though I suspect that Allegro is particularly adept at doing this efficiently. First, make a directory somewhere. call it "generic". Download all the files that are mentioned below. For the case of fasl files, they should probably be produced locally to correspond to the exact version of Lisp that you are using. To produce it: in Lisp, assuming the directory is c:\generic... :cd c:/generic :cf ga.lisp :cf mpfr.lisp :cf quad-fast.lisp Next, here's what to do for running quadrature. Load the program and set the package to mpfr :cd c:/generic :ld mysysquad.lisp :pa :mpfr (int_gs_l5bf #'exp 10) ;; use gaussian 10-point integration for -1 to 1 of exp(x). 53 bits (set-prec 600) ;; set precision to 600 bits (int_gs_l5bf #'exp 10) ;; try again (int_gs_l5bf #'exp 80) ;; try again (time (int_gs_l5bf #'exp 80)) ;; l5 is the 5th legendre version I wrote... This should be exp(1)-exp(-1), approx. The program "memoizes" the weights etc to high precision, so you can use the integration function with the same points for other integrands. I do not include programs that attempt to achieve a particular bound by using two or more number of nodes or precisions. The program is about 4 pages long and could be rewritten in maxima bigfloats, but would be slower. If someone is interested in rewriting in Maxima or in lisp+bigfloats, the source code and the documentation should be helpful. Or look up Gaussian integration with Legendre polynomials. The details From robert.dodier at gmail.com Sun Jan 14 23:46:53 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 14 Jan 2007 22:46:53 -0700 Subject: [Maxima] proposal to change message when load(foo) fails to find foo Message-ID: Hello, at present if you enter load(foo) and Maxima can't find foo, an error message is printed which contains the names of all the share directories smashed together. Since there are so many directories, the message is pretty much incomprehensible. I would like to change that so it just mentions the global variables file_search_lisp and file_search_maxima. E.g. before: (%i2) load(foo); Could not find `foo' using paths in file_search_maxima,file_search_lisp (combined values: [/home/robert/.maxima/###.{mac,mc}, /home/robert/tmp/maxima-head/maxima/share/###.{mac,mc}, /home/ro\ bert/tmp/maxima-head/maxima/share/{affine,algebra,algebra/charse\ ts,algebra/solver,calculus,combinatorics,contrib,contrib/boolsim\ p,contrib/descriptive,contrib/diffequations,contrib/diffequation\ s/tests,contrib/distrib,contrib/dynamics,contrib/ezunits,contrib\ /format,contrib/fractals,contrib/gentran,contrib/gentran/test,co\ ntrib/Grobner,contrib/lurkmathml,contrib/maximaMathML,contrib/mc\ clim,contrib/numericalio,contrib/pdiff,contrib/prim,contrib/rand\ ,contrib/sarag,contrib/simplex,contrib/simplex/Tests,contrib/sol\ ve_rec,contrib/state,contrib/stats,contrib/stringproc,contrib/un\ it,contrib/Zeilberger,diff_form,diffequations,lapack,lbfgs,linea\ ralgebra,integequations,integration,macro,matrix,misc,numeric,or\ thopoly,physics,simplification,sym,tensor,tensor/tests,trigonome\ try,utils,vector}/###.{mac,mc}, /home/robert/.maxima/###.{o,lisp,lsp}, /home/robert/tmp/maxima-head/maxima/share/###.{o,lisp,lsp}, /hom\ e/robert/tmp/maxima-head/maxima/share/{affine,algebra,algebra/ch\ arsets,algebra/solver,calculus,combinatorics,contrib,contrib/boo\ lsimp,contrib/descriptive,contrib/diffequations,contrib/diffequa\ tions/tests,contrib/distrib,contrib/dynamics,contrib/ezunits,con\ trib/format,contrib/fractals,contrib/gentran,contrib/gentran/tes\ t,contrib/Grobner,contrib/lurkmathml,contrib/maximaMathML,contri\ b/mcclim,contrib/numericalio,contrib/pdiff,contrib/prim,contrib/\ rand,contrib/sarag,contrib/simplex,contrib/simplex/Tests,contrib\ /solve_rec,contrib/state,contrib/stats,contrib/stringproc,contri\ b/unit,contrib/Zeilberger,diff_form,diffequations,lapack,lbfgs,l\ inearalgebra,integequations,integration,macro,matrix,misc,numeri\ c,orthopoly,physics,simplification,sym,tensor,tensor/tests,trigo\ nometry,utils,vector}/###.{o,lisp,lsp}, /home/robert/tmp/maxima-head/maxima/src/###.{o,lisp,lsp}] ) -- an error. To debug this try debugmode(true); After: (%i1) load(foo); Could not find `foo' using paths in file_search_maxima,file_search_lisp. -- an error. To debug this try debugmode(true); I suppose an alternative is to print the list of directories more legibly but even so it would be verbose and messy. Comments? Hope this helps, Robert From michel.vandenbergh at uhasselt.be Mon Jan 15 00:30:21 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 15 Jan 2007 07:30:21 +0100 Subject: [Maxima] proposal to change message when load(foo) fails to find foo Message-ID: <45AB1F7D.5000309@uhasselt.be> Seems like a very good idea. I have often cursed this message. Is there a some construct which expands to the maxima installation directory? That would make file_search_maxima more generic. Michel From linux_milano at yahoo.it Mon Jan 15 02:52:40 2007 From: linux_milano at yahoo.it (pol) Date: Mon, 15 Jan 2007 09:52:40 +0100 Subject: [Maxima] logging session automatically Message-ID: I would like to log sessions automatically, saving to a file created at the start, then closing before exiting maxima. (both on linux and on mswindows) I have tried using 'writefile', but i wasn't able to execute maxima batch commands without exiting in the end. Moreover, i wasn't able to create the file exploiting system utilities to include date in the filename. Any suggestions? Thank you -- Pol From areiner at tph.tuwien.ac.at Sun Jan 14 15:52:17 2007 From: areiner at tph.tuwien.ac.at (Albert Reiner) Date: 14 Jan 2007 22:52:17 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? In-Reply-To: <45AA5489.60707@uhasselt.be> References: <45AA4AEC.1070309@uhasselt.be> <45AA509F.8070401@ieee.org> <45AA5489.60707@uhasselt.be> Message-ID: <86vej9uvhq.fsf@willehalm.reiner> > Dan Stanger wrote: > > > While a single namespace is bothersome, it is really quite simple > > to replace all variables appearing in input expressions, with ones > > which cannot occur in users input. (Disclaimer: It seems I didn't get Dan's original mail, so maybe I missed some discussion.) Is this really so simple? I suppose this refers to gensyms, in which case I see two issues: - If a gensym is part of something that is returned, the user can get hold of it by inpart() and similar operations; however, this is only a concern with a malicious user who tries to break things. I would not be concerned with this, but other people's notion of robustness may differ. - If you write an expression containing gensyms to a file, they will appear with their (not necessarily unique) names. Again reading that file into Maxima creates Maxima variables that are not gensyms. When I started to work with Maxima and used it a lot, I wrote quite a bit of code to add the kind of constructs that fit my way of thinking. The two main definitions for dealing with gensyms were - a simple macro with_gensyms() to evaluate some body after binding some symbols to gensyms; these gensyms had names derived from the original symbols (important for readability) and recorded the original symbol recorded as a property - and function degensymify() that takes an expression and replaces all gensyms by interned Maxima symbols (with names obtained from the symbol originally given to with_gensyms()), optionally wrapping the whole thing in a with_gensyms() form. The result is safe for writing to a file, as far as I can tell. In case of interest, I can put up my utilities.max somewhere. Regards, Albert. From michel.vandenbergh at uhasselt.be Mon Jan 15 07:51:53 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 15 Jan 2007 14:51:53 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? References: 45AA5489.60707@uhasselt.be Message-ID: <45AB86F9.5040208@uhasselt.be> > > - a simple macro with_gensyms() to evaluate some body after binding > some symbols to gensyms; these gensyms had names derived from the > original symbols (important for readability) and recorded the > original symbol recorded as a property > > - and function degensymify() that takes an expression and replaces all > gensyms by interned Maxima symbols (with names obtained from the > symbol originally given to with_gensyms()), optionally wrapping the > whole thing in a with_gensyms() form. The result is safe for > writing to a file, as far as I can tell. This is a little bit of I am proposing in my wiki article http://maxima.sourceforge.net/wiki/index.php/LexicalLayer I would like to build it into maxima however. I am not sure it will work. Maybe I am overlooking something obvious. I need to find some time to hack up a prototype. Michel From michel.vandenbergh at uhasselt.be Mon Jan 15 08:26:34 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Mon, 15 Jan 2007 15:26:34 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? References: 45AA5489.60707@uhasselt.be Message-ID: <45AB8F1A.7010507@uhasselt.be> > > - a simple macro with_gensyms() to evaluate some body after binding > some symbols to gensyms; these gensyms had names derived from the > original symbols (important for readability) and recorded the > original symbol recorded as a property > > - and function degensymify() that takes an expression and replaces all > gensyms by interned Maxima symbols (with names obtained from the > symbol originally given to with_gensyms()), optionally wrapping the > whole thing in a with_gensyms() form. The result is safe for > writing to a file, as far as I can tell. I assume this is also meant as protection if the user uses a reserved word in his expressions? I just noticed that do+1; in maxima toplevel puts maxima into an infinite loop! Michel From mmarco at unizar.es Mon Jan 15 09:22:40 2007 From: mmarco at unizar.es (Miguel Marco) Date: Mon, 15 Jan 2007 16:22:40 +0100 Subject: [Maxima] plot animations In-Reply-To: <45AB8F1A.7010507@uhasselt.be> References: <45AB8F1A.7010507@uhasselt.be> Message-ID: <200701151622.40433.mmarco@unizar.es> Hi I needed an animation of implicit curves, so i made a small program in maxima to create 200 .ps images (using the implicit_plot package), then converted then to jpg and finally used mencoder to create a video file. But i wonder if there is alreadya command for that. And, if there is not, if it could be possible to write a package (maybe the dependency of external programas such as image converters and encoder would be an issue. ?any clue about this? Miguel Angel Marco Buzunariz Departamento de matematicas Universidad de Zaragoza From robert.dodier at gmail.com Mon Jan 15 09:43:39 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 15 Jan 2007 08:43:39 -0700 Subject: [Maxima] logging session automatically In-Reply-To: References: Message-ID: Pol, > I would like to log sessions automatically, saving to a file created > at the start, then closing before exiting maxima. (both on linux and on > mswindows) I think writefile & closefile should do the job. However the underlying Lisp stuff (DRIBBLE + i/o streams) is not implemented the same by all Lisps. In particular writefile + GCL + Windows doesn't work correctly. (I tried it the other day and found that end of line characters were not put in the right places; makes the file more or less unreadable.) Also writefile + SBCL + Linux seems to not capture input (only output). Since DRIBBLE + SBCL works OK, I'm guessing this has to do with which streams are pointing where ... A console log seems to be a fairly common request; we (Maxima) might want to get writefile to work the same for all Lisp varieties. > I have tried using 'writefile', but i wasn't able to execute > maxima batch commands without exiting in the end. I'm sorry, I don't understand what you mean by this. Can you be more specific? > Moreover, i wasn't able to create the file exploiting system utilities > to include date in the filename. Hmm. Maybe this is helpful: ; put this in a file and load it (defun $timestamp () (multiple-value-bind (second minute hour date month year day-of-week dst-p tz) (get-decoded-time) (format nil "~d-~2,'0d-~2,'0d-~2,'0d-~2,'0d-~2,'0d" year month date hour minute second))) /* now in your Maxima session ... */ timestamp(); => 2007-01-15-08-15-02 filename: concat ("/tmp/maxima-log-", timestamp()); => /tmp/maxima-log-2007-01-15-08-16-08 writefile (filename); closefile (); Hope this helps Robert Dodier From petegus at spaceshipone.engin.umich.edu Mon Jan 15 09:50:21 2007 From: petegus at spaceshipone.engin.umich.edu (Peter Gustafson) Date: Mon, 15 Jan 2007 10:50:21 -0500 Subject: [Maxima] mactex-utilities: Problem with tex() and matrices. Message-ID: <45ABA2BD.50500@spaceshipone.engin.umich.edu> Hi all, I'm encountering a lisp error when trying to use mactex-utilities and the tex() function. This began with the new 5.11.0 release, and I'm pretty sure that I got mactex-utilities off this list a few months ago, at least it worked with 5.10.x. (I'm sorry I can't be more specific, it has been a while since I've used maxima although I've updated in the meantime) In trying to have the latex style tex() fractions, I'm loading mactex-utilities to get this. However it errors when I feed it a matrix and refers to a list problem, as demonstrated below. Does anybody know why this is occurring? Thanks a bunch, Peter Gustafson --------------------------------- (%i1) constitutivecoeffs_a:matrix( [(va13*va31-1)/Ea11,(va23*va31+va21)/Ea22,0, -alphaa33*va31-alphaa11], [(va13*va32+va12)/Ea11,(va23*va32-1)/Ea22,0, -alphaa33*va32-alphaa22],[0,0,-1/Ga12,0])$ (%i2) define(ea11(x), -constitutivecoeffs_a[1].[Sa11(x),Sa22(x,y),Sa12(x,y),DT])$ (%i3) tex(ea11(x))$ $$\left(\alphaathreethree\,\vathreeone+\alphaaoneone\right)\,\DT-{{ \left(\vatwothree\,\vathreeone+\vatwoone\right)\,\Satwotwo\left(x , y\right)}\over{\Eatwotwo}}-{{\left(\vaonethree\,\vathreeone-1\right) \,\Saoneone\left(x\right)}\over{\Eaoneone}}$$ /* NOTE: everything is working so far, except as follows...... */ (%i4) load("mactex-utilities")$ (%i5) tex(ea11(x))$ $$ Maxima encountered a Lisp error: APPEND: A proper list must not end with " " Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i6) ----------------------------------- From willisb at unk.edu Mon Jan 15 10:05:25 2007 From: willisb at unk.edu (Barton Willis) Date: Mon, 15 Jan 2007 10:05:25 -0600 Subject: [Maxima] tellsimp and abs In-Reply-To: References: , Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >If matchdeclare is not called, tellsimp(foo(a), >...) only matches the literal argument a. Maybe the following >yields the behavior you expected ... > >matchdeclare (a, all); >tellsimp (abs(a), a - 1); >abs(a); > => a - 1 >abs([a]); > => [a - 1] Other than trying to illustrate a putative bug, I wasn't trying to do anything useful. Let's try again: As intended, this rule does a literal match to 'a' (%i1) tellsimp(abs(a),a)$ Why doesn't abs(5*a) simplify to 5 * a ? I think this is a bug (%i2) abs(5*a); (%o2) 5*abs(a) To simplify this to 5 * a requires trickery (%i3) expand(%,0); (%o3) 5*a The cause of this bug is that simpabs tries to save a few steps by not going through simplifya to simplify terms in a product -- instead it calls simpabs directly. New version of simpabs that fixes this putative bug (%i1) load("simp.lisp")$ (%i2) tellsimp(abs(a),a)$ (%i3) abs(5*a); (%o3) 5*a Barton From nmarais at sun.ac.za Mon Jan 15 10:11:43 2007 From: nmarais at sun.ac.za (Neilen Marais) Date: Mon, 15 Jan 2007 18:11:43 +0200 Subject: [Maxima] Getting multivariate polynomial coefficents Message-ID: Hi, If I have multivariate polynomials, how can I get extract the coefficients of the homogeneous terms? E.g. (%i138) expand((x1+x2)^2 + x2); (%o138) x2^2+2*x1*x2+x2+x1^2 Now I'm looking for the coeffs of x2^2, x1*x2, x^1, c, preferably as a list. So for this example I'd want [1, 2, 1, 0]. What I actually want to do is get the weights needed to represent any polynomial of a given homogeneous degree i.t.o. another polynomial basis of the same function space. I'm representing a finite element approximation as a weighted sum of a set of basis functions, set A. Given a basis function set B that covers the same function space as set A I'd like to find the needed weights for set B given the weights for set A. My thinking went along the lines of representing the basis functions of each set i.t.o. their homogeneous coefficients thereby turning it into a matrix problem. Is there a better way to do this that I'm missing? Thanks Neilen -- you know its kind of tragic we live in the new world but we've lost the magic -- Battery 9 (www.battery9.co.za) From robert.dodier at gmail.com Mon Jan 15 10:44:27 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 15 Jan 2007 09:44:27 -0700 Subject: [Maxima] mactex-utilities: Problem with tex() and matrices. In-Reply-To: <45ABA2BD.50500@spaceshipone.engin.umich.edu> References: <45ABA2BD.50500@spaceshipone.engin.umich.edu> Message-ID: Peter, > (%i3) tex(ea11(x))$ > $$\left(\alphaathreethree\,\vathreeone+\alphaaoneone\right)\,\DT-{{ > \left(\vatwothree\,\vathreeone+\vatwoone\right)\,\Satwotwo\left(x , > y\right)}\over{\Eatwotwo}}-{{\left(\vaonethree\,\vathreeone-1\right) > \,\Saoneone\left(x\right)}\over{\Eaoneone}}$$ Hmm, this is strange ... I wonder why the indices are spelled out (one, two, three) instead of being written as numerals. What does build_info() report? About mactex-utilities, I don't know what the problem is. Maybe it's enough just to put the following bit in a separate file and load it (assuming what you want is \frac instead of \over). (defun tex-mquotient (x l r) (if (or (null (cddr x)) (cdddr x)) (wna-err (caar x))) (setq l (tex (cadr x) (append l '("\\frac{")) nil 'mparen 'mparen) r (tex (caddr x) (list "}{") (append '("}") r) 'mparen 'mparen)) (append l r)) Hope this helps, Robert From fateman at cs.berkeley.edu Mon Jan 15 10:47:16 2007 From: fateman at cs.berkeley.edu (Richard Fateman) Date: Mon, 15 Jan 2007 08:47:16 -0800 Subject: [Maxima] tellsimp and abs In-Reply-To: References: Message-ID: <003d01c738c4$d1054f00$30d09888@RJFE510> This appears to be a bug in abs simplification. See the attached fix. Some simplifications require the use of "tellsimpafter", but that seems not to make any different with this bug. -------------- next part -------------- A non-text attachment was scrubbed... Name: simpabs.lisp Type: application/octet-stream Size: 850 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070115/132be898/attachment.obj From petegus at spaceshipone.engin.umich.edu Mon Jan 15 11:23:48 2007 From: petegus at spaceshipone.engin.umich.edu (Peter Gustafson) Date: Mon, 15 Jan 2007 12:23:48 -0500 Subject: [Maxima] mactex-utilities: Problem with tex() and matrices. In-Reply-To: References: <45ABA2BD.50500@spaceshipone.engin.umich.edu> Message-ID: <45ABB8A4.1090509@spaceshipone.engin.umich.edu> Robert Dodier wrote: > Hmm, this is strange ... I wonder why the indices are spelled out > (one, two, three) instead of being written as numerals. > What does build_info() report? > > About mactex-utilities, I don't know what the problem is. > Maybe it's enough just to put the following bit in a separate file > and load it (assuming what you want is \frac instead of \over). > > (defun tex-mquotient (x l r) > (if (or (null (cddr x)) (cdddr x)) (wna-err (caar x))) > (setq l (tex (cadr x) (append l '("\\frac{")) nil 'mparen 'mparen) > r (tex (caddr x) (list "}{") (append '("}") r) 'mparen 'mparen)) > (append l r)) > > Hope this helps, > Robert Hi Robert, yes it does help. The behavior is as expected when I simply add that bit to my maxima-init.lisp file. Curious as that appears to be same code as is in the mactex-utilities file, so I wonder where it breaks. With regard to the indices... I guess I should have mentioned I use a maxima-init.mac to texput the output as I want it. It is an upstream conflict, where I have defined \newcommand{\alphaathreethree}{...} etc. In latex it seems commands cannot have numeric characters so I had to spell them out. Thanks a bunch! Pete From sen1 at math.msu.edu Mon Jan 15 11:54:17 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Mon, 15 Jan 2007 12:54:17 -0500 (EST) Subject: [Maxima] Getting multivariate polynomial coefficents In-Reply-To: References: Message-ID: I don't know if there are routines to deal with homogeneous polynomials, but, for the problem you mentioned, you can write your own routine which makes successive use of the function coeff For instance, (%i12) p1: expand((x1 + x2)^2 +x2); 2 2 (%o12) x2 + 2 x1 x2 + x2 + x1 (%i13) coeff(p1,x2^2); (%o13) 1 (%i14) coeff(p1,x2); (%o14) 2 x1 + 1 (%i15) coeff( coeff(p1,x2),x1); (%o15) 2 (%i10) p1: expand((x1 + x2)^2 +x2); 2 2 (%o10) x2 + 2 x1 x2 + x2 + x1 (%i11) coeff( coeff(p1,x2),x1); (%o11) 2 (%i12) p1: expand((x1 + x2)^2 +x2); (%i22) p2: expand((x1 + x2)^3); 3 2 2 3 (%o22) x2 + 3 x1 x2 + 3 x1 x2 + x1 (%i23) makelist(coeff(p2, x1^i),i,1,3); 2 (%o23) [3 x2 , 3 x2, 1] -sen On Mon, 15 Jan 2007, Neilen Marais wrote: > Hi, > > If I have multivariate polynomials, how can I get extract the > coefficients of the homogeneous terms? E.g. > > (%i138) expand((x1+x2)^2 + x2); > (%o138) x2^2+2*x1*x2+x2+x1^2 > > Now I'm looking for the coeffs of x2^2, x1*x2, x^1, c, preferably as a > list. So for this example I'd want [1, 2, 1, 0]. > > What I actually want to do is get the weights needed to represent > any polynomial of a given homogeneous degree i.t.o. another > polynomial basis of the same function space. I'm representing a finite > element approximation as a weighted sum of a set of basis functions, set > A. Given a basis function set B that covers the same function space as set > A I'd like to find the needed weights for set B given the weights for set > A. > > My thinking went along the lines of representing the basis functions of > each set i.t.o. their homogeneous coefficients thereby turning it into a > matrix problem. Is there a better way to do this that I'm missing? > > Thanks > Neilen > > > > > > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From dlakelan at street-artists.org Mon Jan 15 14:52:13 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Mon, 15 Jan 2007 12:52:13 -0800 Subject: [Maxima] ODEs: rk routing with derivs on rhs Message-ID: <20070115205213.GQ25287@street-artists.org> In my further attempts to understand my differential equations, I tried to use the "rk" routine. I used "? rk" to get info about it but it seems that I am limited as follows. The system is 2 coupled 2nd order ODEs. It's only second order in h, therefore I need an expression for h', h'', and v' for the integrator and h, h', v will be my solution variables. i can write these equations semi-explicitly... h' depends on h, h'' v, v' v' depends on h, h', h'', v h'' depends on h h' v' It seems as though the rk routine is not happy with this, preferring the rhs to be free of all derivatives. (the error I get is something about attempting to take derivative with respect to a number) Am I missing something? Does maxima have another numerical integrator that can handle this type of coupling by some iterative method? Bloody ODEs :-) -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From raymond.toy at ericsson.com Mon Jan 15 15:12:48 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Mon, 15 Jan 2007 16:12:48 -0500 Subject: [Maxima] ODEs: rk routing with derivs on rhs In-Reply-To: <20070115205213.GQ25287@street-artists.org> (Daniel Lakeland's message of "Mon, 15 Jan 2007 12:52:13 -0800") References: <20070115205213.GQ25287@street-artists.org> Message-ID: >>>>> "Daniel" == Daniel Lakeland writes: Daniel> In my further attempts to understand my differential equations, I Daniel> tried to use the "rk" routine. I used "? rk" to get info about it but Daniel> it seems that I am limited as follows. Daniel> The system is 2 coupled 2nd order ODEs. It's only second order in h, Daniel> therefore I need an expression for h', h'', and v' for the integrator Daniel> and h, h', v will be my solution variables. Daniel> i can write these equations semi-explicitly... Daniel> h' depends on h, h'' v, v' Daniel> v' depends on h, h', h'', v Daniel> h'' depends on h h' v' Daniel> It seems as though the rk routine is not happy with this, preferring Daniel> the rhs to be free of all derivatives. (the error I get is something Daniel> about attempting to take derivative with respect to a number) It's not exactly clear here, but aren't you supposed to convert your two 2nd-order ODEs into four 1st order ODEs? Then rk should be able to solve them. But I've never used rk before, and I haven't done ODEs in ages. Ray From raymond.toy at ericsson.com Mon Jan 15 15:22:05 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Mon, 15 Jan 2007 16:22:05 -0500 Subject: [Maxima] logging session automatically In-Reply-To: (Robert Dodier's message of "Mon, 15 Jan 2007 08:43:39 -0700") References: Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> Pol, >> I would like to log sessions automatically, saving to a file created >> at the start, then closing before exiting maxima. (both on linux and on >> mswindows) Robert> I think writefile & closefile should do the job. However the Robert> underlying Lisp stuff (DRIBBLE + i/o streams) is not implemented Robert> the same by all Lisps. In particular writefile + GCL + Windows Robert> doesn't work correctly. (I tried it the other day and found that end Robert> of line characters were not put in the right places; makes the file Robert> more or less unreadable.) Robert> Also writefile + SBCL + Linux seems to not capture input (only output). Robert> Since DRIBBLE + SBCL works OK, I'm guessing this has to do with Robert> which streams are pointing where ... This seems to work ok with cmucl, but if you try to describe something, maxima throws an error. Something about calling clear-input on the stream being used to save the log. Robert> A console log seems to be a fairly common request; we (Maxima) Robert> might want to get writefile to work the same for all Lisp varieties. Yes, we should probably fix this. Not sure how, yet. Ray From wdjoyner at gmail.com Mon Jan 15 15:35:07 2007 From: wdjoyner at gmail.com (David Joyner) Date: Mon, 15 Jan 2007 16:35:07 -0500 Subject: [Maxima] logging session automatically In-Reply-To: References: Message-ID: <8cf963450701151335q68665ac6i3d800e072036e714@mail.gmail.com> Since your email address is "linux_milano", I assume you use linux. In that case, before you open maxima, open a konsole, then select "settings" then "history" then "select unlimited". Now start maxima and do your work. When you are done, select "edit" then "save history as...". +++++++++++++++++++++++++++++++++++++++++ On 1/15/07, pol wrote: > I would like to log sessions automatically, saving to a file created > at the start, then closing before exiting maxima. (both on linux and on > mswindows) > > I have tried using 'writefile', but i wasn't able to execute > maxima batch commands without exiting in the end. > Moreover, i wasn't able to create the file exploiting system utilities > to include date in the filename. > > Any suggestions? > > Thank you > > -- > Pol > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From biomates at telefonica.net Mon Jan 15 16:43:02 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Mon, 15 Jan 2007 23:43:02 +0100 Subject: [Maxima] plot animations In-Reply-To: <200701151622.40433.mmarco@unizar.es> References: <45AB8F1A.7010507@uhasselt.be> <200701151622.40433.mmarco@unizar.es> Message-ID: <1168900982.14417.7.camel@localhost.localdomain> El lun, 15-01-2007 a las 16:22 +0100, Miguel Marco escribi?: > Hi > > I needed an animation of implicit curves, so i made a small program in maxima > to create 200 .ps images (using the implicit_plot package), then converted > then to jpg and finally used mencoder to create a video file. > > But i wonder if there is alreadya command for that. And, if there is not, if > it could be possible to write a package (maybe the dependency of external > programas such as image converters and encoder would be an issue. > > ?any clue about this? > Hola, I'm not sure if this is exactly what you want. For this animation to work you need ImageMagick installed in your system. I have tested this in Linux: for i:1 thru 10 step 1 do block([a], a:i*0.1, plot2d(a*x^2, [x,-3,3], [gnuplot_preamble, sconcat("set xrange [-3:3]; set yrange [0:9]; set terminal png;set out 'file",i,".png'")])) $ system("animate -delay 20 file?.png file??.png")$ You can change the parametric function to be plotted, of course. -- Mario Rodriguez Riotorto www.biomates.net From toy.raymond at gmail.com Mon Jan 15 19:47:29 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 15 Jan 2007 20:47:29 -0500 Subject: [Maxima] updating maxima In-Reply-To: <8A925535-534A-439C-BF33-793E526944B7@nasa.gov> References: <850342.10929.qm@web31808.mail.mud.yahoo.com> <8A925535-534A-439C-BF33-793E526944B7@nasa.gov> Message-ID: <45AC2EB1.9050503@gmail.com> Dan Solomon wrote: > i used fink to get maxima on my mac last month. Which turned out to > be 5.9.0. I'd prefer not to compile it from source if possible. Is > there a 5.11 executable for mac? > Mac ppc or intel? I could supply a ppc version, but it would be built with either recent CMUCL (2007-01) or very old clisp (2.38). Ray From sen1 at math.msu.edu Mon Jan 15 20:34:28 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Mon, 15 Jan 2007 21:34:28 -0500 (EST) Subject: [Maxima] Darwin anyone? Message-ID: Hi, Anyone out there running maxima on Darwin? If so, are you using gcl or cmucl? I wanted to put maxima on a MacBook Pro. I got sbcl and clisp to compile, but could not install gcl or cmucl. Thanks for any info. -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From toy.raymond at gmail.com Mon Jan 15 21:11:57 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 15 Jan 2007 22:11:57 -0500 Subject: [Maxima] Darwin anyone? In-Reply-To: References: Message-ID: <45AC427D.3040504@gmail.com> sen1 at math.msu.edu wrote: > Hi, > Anyone out there running maxima on Darwin? If so, are you using gcl > or cmucl? I wanted to put maxima on a MacBook Pro. I got sbcl and > clisp to compile, but could not install gcl or cmucl. > > If a MacBook Pro is using an x86 processor, then cmucl won't run there. CMUCL only runs on darwin/ppc. I can compile gcl 2.6.8pre on darwin/ppc, but for some reason when I'm compiling maxima with it, it gets an error. Clisp or sbcl should be just fine. Ray From Daniel.L.Solomon at nasa.gov Mon Jan 15 21:18:27 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Mon, 15 Jan 2007 22:18:27 -0500 Subject: [Maxima] updating maxima In-Reply-To: <45AC2EB1.9050503@gmail.com> References: <850342.10929.qm@web31808.mail.mud.yahoo.com> <8A925535-534A-439C-BF33-793E526944B7@nasa.gov> <45AC2EB1.9050503@gmail.com> Message-ID: <1D313FAE-5E06-4EE6-A408-392D01F728E3@nasa.gov> I guess it's ppc. I'm using OS X.4.8 This is only an iBook, not a Power Book. It definitely isn't intel. On Jan 15, 2007, at 8:47 PM, Raymond Toy wrote: > Dan Solomon wrote: >> i used fink to get maxima on my mac last month. Which turned out to >> be 5.9.0. I'd prefer not to compile it from source if possible. Is >> there a 5.11 executable for mac? >> > Mac ppc or intel? I could supply a ppc version, but it would be built > with either recent CMUCL (2007-01) or very old clisp (2.38). > > Ray > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From dlakelan at street-artists.org Tue Jan 16 00:04:20 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Mon, 15 Jan 2007 22:04:20 -0800 Subject: [Maxima] ODEs: rk routing with derivs on rhs In-Reply-To: <20070115205213.GQ25287@street-artists.org> References: <20070115205213.GQ25287@street-artists.org> Message-ID: <20070116060420.GC15125@localhost.localdomain> Many thanks to sheldon who helped me reformulate the equations. It turned out with the appropriate carefulness maxima could rearrange the equations to be free of derivatives on the rhs. I think this is a case of "you should have printed it out". Sometimes math is easier to do on paper. Now, here's a simpler question: Why does "? rk" work on my machine at work (windows maxima 5.10) but not at home (debian 5.10 with maxima-share package) On windows it tells me about the runge kutta routine in the "dynamics" package. But even though everything is up to date on the debian machine, ? rk only gives me ? rk -- System variable: tensorkill Variable indicating if the tensor package has been initialized. Set and used by `csetup', reset by `init_ctensor'. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From michel.vandenbergh at uhasselt.be Tue Jan 16 03:44:38 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 16 Jan 2007 10:44:38 +0100 Subject: [Maxima] Unsimplification??? Message-ID: <45AC9E86.6080702@uhasselt.be> Hi, I am trying to learn about evless programming. According to Richard Fateman one should replace evaluation by substitution and simplification since the effect of the latter steps is deterministic. Unfortunately I seem to be running into a little problem. subst appears not to remove the simp flag from an expression. So subsequent simplificiation steps do nothing. So how does one remove the simp flag? Michel From michel.vandenbergh at uhasselt.be Tue Jan 16 04:45:25 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 16 Jan 2007 11:45:25 +0100 Subject: [Maxima] Unsimplification??? Message-ID: <45ACACC5.7000400@uhasselt.be> Maybe I should give the specific problem I was looking at. The model is an expression (i.e. bfloat(t)) in which you substitute values for certain variables and then you want to "evaluate it" to get a numeric result, if possible. How to do this without invoking ev? Michel From caruso at dm.unipi.it Tue Jan 16 07:41:58 2007 From: caruso at dm.unipi.it (Fabrizio Caruso) Date: Tue, 16 Jan 2007 14:41:58 +0100 (CET) Subject: [Maxima] students involved in Maxima In-Reply-To: Message-ID: Hi In the near future I could have one or two computer science students work on a software project here at the University of Pisa (300-450 hours of work for each student). I could have them implement something in/for Maxima. Any suggestions? It should be something not too mathematically complicated. Fabrizio From linux_milano at yahoo.it Tue Jan 16 08:35:12 2007 From: linux_milano at yahoo.it (linux_milano at yahoo.it) Date: Tue, 16 Jan 2007 15:35:12 +0100 Subject: [Maxima] logging session automatically In-Reply-To: References: Message-ID: <20070116143512.GA26001@finn> >From Robert Dodier, Jan 15 at 8:43: >>I have tried using 'writefile', but i wasn't able to execute >>maxima batch commands without exiting in the end. >I'm sorry, I don't understand what you mean by this. >Can you be more specific? I would like the 'writefile' command be entered automatically, as maxima starts, before the interactive session. This way, students don't have to bother with entering that command and choosing the proper file name. >>Moreover, i wasn't able to create the file exploiting system utilities >>to include date in the filename. > >Hmm. Maybe this is helpful: Thank you, i will try that later and let you know Pol From linux_milano at yahoo.it Tue Jan 16 08:38:11 2007 From: linux_milano at yahoo.it (linux_milano at yahoo.it) Date: Tue, 16 Jan 2007 15:38:11 +0100 Subject: [Maxima] logging session automatically In-Reply-To: <8cf963450701151335q68665ac6i3d800e072036e714@mail.gmail.com> References: <8cf963450701151335q68665ac6i3d800e072036e714@mail.gmail.com> Message-ID: <20070116143811.GB26001@finn> >From David Joyner, Jan 15 at 16:35: >Since your email address is "linux_milano", I assume >you use linux. In that case, before you open maxima, >open a konsole, then select "settings" then "history" >then "select unlimited". Now start maxima and do >your work. When you are done, select "edit" then "save history as...". Thank for your hints; my desktop environment is kde indeed. But i am setting up maxima for students, who have installed ms-windows wxmaxima on their laptop. Pol From rdmoores at gmail.com Sun Jan 14 19:56:19 2007 From: rdmoores at gmail.com (Dick Moores) Date: Sun, 14 Jan 2007 17:56:19 -0800 Subject: [Maxima] newbie, and need a start Message-ID: Using wxMaxima, how would I calculate log(640320**3 + 744)/163**.5, where log is the natural logarithm? I'd really appreciate a push in the right direction. Or just the right section of the manual would do, I think. Thanks, Dick Moores From petegus at example.com Sun Jan 14 21:44:59 2007 From: petegus at example.com (petegus at example.com) Date: Sun, 14 Jan 2007 22:44:59 -0500 (EST) Subject: [Maxima] mactex-utilities: Problem with tex() and matrices. Message-ID: <62675.68.40.180.52.1168832699.squirrel@raptor.engin.umich.edu> Hi all, I'm encountering a lisp error. I think this began with the new 5.11.0 release, and I'm pretty sure that I got mactex-utilities off this list a few months ago, corresponding to an earlier release of maxima. (I'm sorry I can't be more specific, it has been a while since I've used maxima although I've updated in the meantime) In trying to have the latex style tex() fractions, I'm loading mactex-utilities. However it errors when I feed it a matrix and refers to a list problem, as demonstrated below: (%i1) constitutivecoeffs_a:matrix( [(va13*va31-1)/Ea11,(va23*va31+va21)/Ea22,0, -alphaa33*va31-alphaa11], [(va13*va32+va12)/Ea11,(va23*va32-1)/Ea22,0, -alphaa33*va32-alphaa22],[0,0,-1/Ga12,0])$ (%i2) define(ea11(x), -constitutivecoeffs_a[1].[Sa11(x),Sa22(x,y),Sa12(x,y),DT])$ (%i3) tex(ea11(x))$ $$\left(\alphaathreethree\,\vathreeone+\alphaaoneone\right)\,\DT-{{ \left(\vatwothree\,\vathreeone+\vatwoone\right)\,\Satwotwo\left(x , y\right)}\over{\Eatwotwo}}-{{\left(\vaonethree\,\vathreeone-1\right) \,\Saoneone\left(x\right)}\over{\Eaoneone}}$$ /* NOTE: everything is working so far, except as follows...... */ (%i4) load("mactex-utilities")$ WARNING: DEFUN/DEFMACRO: redefining function TEX-MQUOTIENT in /usr/share/maxima/5.11.0/share/utils/mactex-utilities.lisp, was defined in /var/tmp/portage/maxima-5.11.0/work/maxima-5.11.0/src/binary-clisp/mactex.fas WARNING: DEFUN/DEFMACRO: redefining function TEX-MATRIX in /usr/share/maxima/5.11.0/share/utils/mactex-utilities.lisp, was defined in /var/tmp/portage/maxima-5.11.0/work/maxima-5.11.0/src/binary-clisp/mactex.fas WARNING: DEFUN/DEFMACRO: redefining function TEX-LIMIT in /usr/share/maxima/5.11.0/share/utils/mactex-utilities.lisp, was defined in /var/tmp/portage/maxima-5.11.0/work/maxima-5.11.0/src/binary-clisp/mactex.fas (%i5) tex(ea11(x))$ $$ Maxima encountered a Lisp error: APPEND: A proper list must not end with " " Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i6) Does anybody know why this is occurring? Thanks a bunch, Peter Gustafson From Stewart.Hodges at wbs.ac.uk Mon Jan 15 10:07:02 2007 From: Stewart.Hodges at wbs.ac.uk (Stewart Hodges) Date: Mon, 15 Jan 2007 16:07:02 +0000 Subject: [Maxima] bugs in special functions?&In-Reply-To=8b356f880610281329y6e426a31ve27ff74496af8224@mail.gm Message-ID: For Kummer's function, have you tried hgfred([1],[1],x); ? This is what is used in Tests\rtesthyp.mac, and seems to work fine. Powerful package! Stewart Hodges -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070115/46f527d4/attachment.htm From robert.dodier at gmail.com Tue Jan 16 09:00:50 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 16 Jan 2007 08:00:50 -0700 Subject: [Maxima] Unsimplification??? In-Reply-To: <45ACACC5.7000400@uhasselt.be> References: <45ACACC5.7000400@uhasselt.be> Message-ID: On 1/16/07, Michel Van den Bergh wrote: > Maybe I should give the specific problem I was looking at. > The model is an expression (i.e. bfloat(t)) in which you substitute > values for certain variables and then you want to > "evaluate it" to get a numeric result, if possible. How to do this > without invoking ev? I guess I don't understand the point of avoiding MEVAL. That is not something I would recommend to users, and it's not clear to me why it was recommended to you. Maxima calls MEVAL left and right; you really have to go to extremes to avoid it completely, and clog up your program with a lot of circumlocutions. If ev and/or MEVAL have some specific problems, then let's fix them. That said, maybe buildq + a simplification rule for the functions of interest have the effect you want. buildq carries out the substitution, simplification emulates the function call. E.g. pseudo-evaluation of foo(x) for a specific value of x: matchdeclare (a, all); tellsimpafter (foo(a), 1 - a); buildq ([x : %pi], foo(x)); => 1 - %pi But trace(?meval) shows that MEVAL is being called even in this case. All the best, Robert From macrakis at alum.mit.edu Tue Jan 16 09:05:45 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 16 Jan 2007 10:05:45 -0500 Subject: [Maxima] Unsimplification??? In-Reply-To: <45ACACC5.7000400@uhasselt.be> References: <45ACACC5.7000400@uhasselt.be> Message-ID: <8b356f880701160705neccee1dtffb1e216a7dc5e66@mail.gmail.com> On 1/16/07, Michel Van den Bergh wrote: > Maybe I should give the specific problem I was looking at. > The model is an expression (i.e. bfloat(t)) in which you substitute > values for certain variables and then you want to > "evaluate it" to get a numeric result, if possible. How to do this > without invoking ev? Well, here we run into the subtle and often confusing distinction between *mathematical expressions* and *programming expressions* in Maxima. Mathematical functions such as sin, gamma, abs, floor, max, etc. are dealt with by the simplifier. On the other hand, programming functions (perhaps we should call them routines or subroutines or procedures or something for clarity) are dealt with by the evaluator. Examples of routines are factor, bfloat, partfrac, etc. Simplification knows nothing about these routines. Then there are some functions which are *both* mathematical functions and routines -- the famous noun/verb system. Examples are limit, integrate, diff, etc. Some transformations are done by the simplifier: 'integrate(1.x) => x, but others are not: 'integrate(x,x) => 'integrate(x,x) vs. integrate(x,x) => x^2/2. For both mathematical functions and routines, there are global variables (such as numer, expop, etc.) which affect the value. Resimplifying " bfloat(x) " has no effect, because bfloat is not a mathematical function. -s From mmarco at unizar.es Tue Jan 16 09:09:19 2007 From: mmarco at unizar.es (Miguel Marco) Date: Tue, 16 Jan 2007 16:09:19 +0100 Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: <200701161609.20293.mmarco@unizar.es> El Martes, 16 de Enero de 2007 14:41, Fabrizio Caruso escribi?: > Hi > > In the near future I could have > one or two computer science students > work on a software project here > at the University of Pisa > (300-450 hours of work for each student). > > I could have them implement something > in/for Maxima. > Any suggestions? > It should be something not too > mathematically complicated. > > Fabrizio > Well, i don't know if it fits in what you had in mind, but ?what about some package for creating animations of a family of curves given by a parameter?. Something like the solution that Mario gave me before, but handling the auxiliary image files created, and as platform-independent as possible. ?Maybe it could be possible to implement the "animate" command with the usual options of the "plot" ones? Miguel Angel Marco Buzunariz. Universidad de Zaragoza. Departamento de Matem?ticas. From mmarco at unizar.es Tue Jan 16 09:11:49 2007 From: mmarco at unizar.es (Miguel Marco) Date: Tue, 16 Jan 2007 16:11:49 +0100 Subject: [Maxima] newbie, and need a start In-Reply-To: References: Message-ID: <200701161611.50006.mmarco@unizar.es> El Lunes, 15 de Enero de 2007 02:56, Dick Moores escribi?: > Using wxMaxima, how would I calculate log(640320**3 + 744)/163**.5, > where log is the natural logarithm? I'd really appreciate a push in > the right direction. Or just the right section of the manual would do, > I think. > If what you are looking for is a decimal approximation, use the command "float". From michel.vandenbergh at uhasselt.be Tue Jan 16 09:22:18 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 16 Jan 2007 16:22:18 +0100 Subject: [Maxima] Unsimplification??? In-Reply-To: References: <45ACACC5.7000400@uhasselt.be> Message-ID: <45ACEDAA.8010503@uhasselt.be> Robert Dodier wrote: > On 1/16/07, Michel Van den Bergh wrote: > >> Maybe I should give the specific problem I was looking at. >> The model is an expression (i.e. bfloat(t)) in which you substitute >> values for certain variables and then you want to >> "evaluate it" to get a numeric result, if possible. How to do this >> without invoking ev? > > > I guess I don't understand the point of avoiding MEVAL. > That is not something I would recommend to users, > and it's not clear to me why it was recommended to you. I assume Richard will explain this since this is his opinion. Certainly explicitly calling ev is tricky since evaluation may happen in the wrong scope (I struggled with this in levin). I.e. the expression given by the user may contain names of local variables or parameters. In his earlier emails Richard seemed to impy that one could get by without ev and replace it by substitution. I was just testing this. Michel From macrakis at alum.mit.edu Tue Jan 16 09:25:01 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 16 Jan 2007 10:25:01 -0500 Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> That would be great! There are many areas where they could contribute without deep mathematics. What are their strengths and areas they want to develop? Lisp? GUIs? Graphics? Scripting? Systems programming? ... -s From sen1 at math.msu.edu Tue Jan 16 09:30:29 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Tue, 16 Jan 2007 10:30:29 -0500 (EST) Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: Obviously, each person will have his or her needs. I would like to see the plotting utilities enhanced to give, for instance, the following. If your students are lisp-literate, these things should not be too hard to do. I apologize if some of these things are already available. At least, I don't know how to do them. 1. options to use plot2d to plot several functions with different ranges. For instance, cox(x), [x,0,2*%pi] and exp(x), [x,0,1]. At present one has to put them both on the same interval. 2. Allowing several 3d plots on the same canvas. 3. allowing mouse input to call certain commands. For instance, if one has a vector field in 3-dim space (system of ode's). One should be able to set the time scale, the number of time steps to compute, and to select you favorite integrator (e.g. 4th order Runge-Kutta) and click with the mouse to set an initial condition and see a plot of the orbit with that initial condition. -sen On Tue, 16 Jan 2007, Fabrizio Caruso wrote: > Hi > > In the near future I could have > one or two computer science students > work on a software project here > at the University of Pisa > (300-450 hours of work for each student). > > I could have them implement something > in/for Maxima. > Any suggestions? > It should be something not too > mathematically complicated. > > Fabrizio > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From caruso at dm.unipi.it Tue Jan 16 09:39:30 2007 From: caruso at dm.unipi.it (Fabrizio Caruso) Date: Tue, 16 Jan 2007 16:39:30 +0100 (CET) Subject: [Maxima] students involved in Maxima In-Reply-To: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: Hi The first two students I have followed are math students and did the following: (1) implementation of 3sat-polycracker in Maxima - done, is it of any interest to anyone? (2) optimizing (gf) finite field library for Maxima - almost done, it is going to be way faster The next students (if they appear but it is very likely that they do) are computer science students. These might also implement something mathematical as long as it is understandable. I might also have more math students in the future who want to work on a software project, as well. On Tue, 16 Jan 2007, Stavros Macrakis wrote: > That would be great! There are many areas where they could contribute > without deep mathematics. > > What are their strengths and areas they want to develop? Lisp? GUIs? > Graphics? Scripting? Systems programming? ... I don't know, yet. I'll let you know when they show up. It should also be something I must be able to follow... I use to code in Scheme lots of time ago but I am not a Lisp-expert. If you have a Lisp related suggestion I might need some help. My personal wishes: Personally I would like to see a better and interactive gnuplot support in Maxima: the user should be able to draw on the same gnuplot more than once. As far as the lisp is concerned I would like to have Maxima be compiled with a Lisp version that does not have an unreasonably low limit on the number of arguments for functions (CLISP is no affected but the other lisps fail with as few arguments as about 200). Could this be fixed by setting an appropriate parameter before compilation? Regards Fabrizio From rjerrard at math.concordia.ab.ca Tue Jan 16 09:33:13 2007 From: rjerrard at math.concordia.ab.ca (bob) Date: Tue, 16 Jan 2007 08:33:13 -0700 Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: <1168961593.8820.2.camel@penrose.math.concordia.ab.ca> On Tue, 2007-01-16 at 14:41 +0100, Fabrizio Caruso wrote: > Hi > > In the near future I could have > one or two computer science students > work on a software project here > at the University of Pisa > (300-450 hours of work for each student). > > I could have them implement something > in/for Maxima. > Any suggestions? > It should be something not too > mathematically complicated. > > Fabrizio Hi Fabrizio, I am a user of Maxima and would like to see an implementation of the plot3d command that allow multiple surfaces on a single plot. At present, I do not believe Maxima has this capability. -- Dr. Robert J. Jerrard, Professor of Mathematics, Concordia University College of Alberta, 7128 Ada Blvd., Edmonton, Alberta, T5B 4E4, Canada. Phone: (780) 479-9291, Fax: (780) 474-1933. From sangwinc at for.mat.bham.ac.uk Tue Jan 16 10:11:04 2007 From: sangwinc at for.mat.bham.ac.uk (Chris Sangwin) Date: Tue, 16 Jan 2007 16:11:04 +0000 (GMT) Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: You could think about a "student package" which provide functions which help students work through calculations step by step. Chris On Tue, 16 Jan 2007, Fabrizio Caruso wrote: > Hi > > In the near future I could have > one or two computer science students > work on a software project here > at the University of Pisa > (300-450 hours of work for each student). > > I could have them implement something > in/for Maxima. > Any suggestions? > It should be something not too > mathematically complicated. > > Fabrizio > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From fateman at EECS.Berkeley.EDU Tue Jan 16 11:18:47 2007 From: fateman at EECS.Berkeley.EDU (Richard Fateman) Date: Tue, 16 Jan 2007 17:18:47 GMT Subject: [Maxima] Unsimplification??? In-Reply-To: <45ACEDAA.8010503@uhasselt.be> References: <45ACACC5.7000400@uhasselt.be> <45ACEDAA.8010503@uhasselt.be> Message-ID: I'm not arguing about the use of meval internal to Maxima. I think it is a mistake to use the maxima command ev(...) unless there is no alternative. ev() as has been pointed out, evaluates expressions to symbols in different and unexpected scopes sometimes. I can't test it now (I'm travelling) but resimplification should be possible after a subst, if necessary, by simplify(). RJF ----- Original Message ----- From: Michel Van den Bergh Date: Tuesday, January 16, 2007 3:22 pm Subject: Re: [Maxima] Unsimplification??? > Robert Dodier wrote: > > > On 1/16/07, Michel Van den Bergh > wrote: > > > >> Maybe I should give the specific problem I was looking at. > >> The model is an expression (i.e. bfloat(t)) in which you substitute > >> values for certain variables and then you want to > >> "evaluate it" to get a numeric result, if possible. How to do this > >> without invoking ev? > > > > > > I guess I don't understand the point of avoiding MEVAL. > > That is not something I would recommend to users, > > and it's not clear to me why it was recommended to you. > > I assume Richard will explain this since this is his opinion. > Certainly explicitly calling ev is tricky since evaluation may > happen in > the wrong scope > (I struggled with this in levin). I.e. the expression given by the > user > may contain names of local variables > or parameters. In his earlier emails Richard seemed to impy that > one > could get by without ev and > replace it by substitution. I was just testing this. > > Michel > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From ryanlists at gmail.com Tue Jan 16 11:37:11 2007 From: ryanlists at gmail.com (Ryan Krauss) Date: Tue, 16 Jan 2007 11:37:11 -0600 Subject: [Maxima] diff(y,t) where y=f(z) and z=f(t) Message-ID: I need to differentiate a variable that is indirectly a function of t. For example, consider y=3*z^2, where z is a not yet specified function of t. I need to evaluate the derivative of y with respect to t and then substitute an expression for z later. I will finally want a numeric answer at a specific value of t. I have tried several different variations that seem to lead to similar results: (%i1) depends(z,t); (%o1) [z(t)] (%i2) y:3*z^2; (%o2) 3*z^2 (%i3) ydot:diff(y,t); (%o3) 6*z*('diff(z,t,1)) (%i4) ydot, z=0.4-0.08*t^2; (%o4) 6*(0.4-0.08*t^2)*('diff((0.4-0.08*t^2),t,1)) (%i5) ratsimp(%); `rat' replaced 0.4 by 2/5 = 0.4 `rat' replaced -0.08 by -2/25 = -0.08 `rat' replaced 0.4 by 2/5 = 0.4 `rat' replaced -0.08 by -2/25 = -0.08 (%o5) -((12*t^2-60)*('diff((-(2*t^2-10)/25),t,1)))/25 (%i6) radcan(%); (%o6) -((12*t^2-60)*('diff((-(2*t^2-10)/25),t,1)))/25 The main problem is that Maxima keeps outputting an answer that contains a derivative with repect to time which should be simple to evaluate. But Maxima refuses to evaluate it and I don't know how to make it. As I copy and paste from wxMaxima, I see the ' in front of the diff that forces the non-evaluation. How would I make that go away? Is there a better way to go about this? I want to be able to use the intermediate results for different expressions for z(t), so just making y and explicit function of t at the beginning isn't a very satisfying solution. I am attaching the wxMaxima script if anyone wants to look at it that way. Thanks, Ryan -------------- next part -------------- /* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [wxMaxima: input start ] */ depends(z,t); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ y:3*z^2; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ ydot:diff(y,t); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ ydot, z=0.4-0.08*t^2; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ ratsimp(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ radcan(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ ev(%); /* [wxMaxima: input end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$ From go.maxima at gmail.com Tue Jan 16 12:04:01 2007 From: go.maxima at gmail.com (=?ISO-2022-JP?B?GyRCOEVDKzlkQDgbKEI=?=) Date: Wed, 17 Jan 2007 03:04:01 +0900 Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: Hi Fabrizio For math students, I think there are many interesting areas that we had not developped well in maxima. Maybe Yong Tableaux is one of sufficient easy and interesting theme. there is partition function in Set and schur (kostka,too) in Symmetries. So by using them,your students may implemnt Young diagram,semi standard Young tableau (SSYT),skew schur functions ,their generic functions. see math.mit/edu/~plamen/tables/samsi06-2.pdf many applications will be derived from these implementation,because we can use it with other maxima's packages. For example,Vicious random walkers have deep relations to this. thanks Gosei Furuya 2007/1/17, Fabrizio Caruso : > > Hi > > The first two students I have followed are > math students and did the following: > > (1) implementation of 3sat-polycracker in Maxima > - done, is it of any interest to anyone? > > (2) optimizing (gf) finite field library for Maxima > - almost done, it is going to be way faster > > The next students (if they appear but it is > very likely that they do) are computer science students. > These might also implement something mathematical > as long as it is understandable. > I might also have more math students in the future > who want to work on a software project, as well. > > On Tue, 16 Jan 2007, Stavros Macrakis wrote: > > > That would be great! There are many areas where they could contribute > > without deep mathematics. > > > > What are their strengths and areas they want to develop? Lisp? GUIs? > > Graphics? Scripting? Systems programming? ... > > I don't know, yet. > I'll let you know when they show up. > It should also be something I must be able > to follow... > I use to code in Scheme lots of time ago > but I am not a Lisp-expert. > If you have a Lisp related suggestion I might > need some help. > > > My personal wishes: > > Personally I would like to see a better > and interactive gnuplot support in Maxima: > the user should be able to draw on the same > gnuplot more than once. > > As far as the lisp is concerned I would like > to have Maxima be compiled with a Lisp version > that does not have an unreasonably low limit > on the number of arguments for functions > (CLISP is no affected but the other lisps > fail with as few arguments as about 200). > Could this be fixed by setting an appropriate > parameter before compilation? > > Regards > > Fabrizio > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070117/db925f3e/attachment.htm From macrakis at alum.mit.edu Tue Jan 16 12:19:55 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 16 Jan 2007 13:19:55 -0500 Subject: [Maxima] Unsimplification??? In-Reply-To: <45AC9E86.6080702@uhasselt.be> References: <45AC9E86.6080702@uhasselt.be> Message-ID: <8b356f880701161019nf1f1524p9523738736166ed9@mail.gmail.com> > Unfortunately I seem to be running into a little problem. subst appears > not to remove the simp flag from an expression. subst *does* resimplify any parts of the expression it has changed. It does *not* resimplify other parts of the expression. For example: expr: abs(x)+abs(b)$ assume(a>0,b>0)$ subst(a,x,expr) => abs(b)+a /* resimplifies abs(a) but not abs(b) */ Unfortunately, there is a little glitch/bug in this optimization.... subst(b,b,expr) => abs(x)+abs(b) Subst notices that the result of substituting is the same as the input, so doesn't resimplify. You can construct more perverse examples of this (where checking for subst(x,x,...) won't suffice), e.g. resimplify(ex):=expand(ex,0,0) expr: sin(2*min(x,-x))$ trigexpand:true$ a simplification flag resimplify(expr) => 2*cos(min(-x,x))*sin(min(-x,x)) OK subst(-x,x,expr) => sin(2*min(-x,x)) didn't resimplify because subexpr is unchanged I wonder if instead of checking whether the result is the same as the input, it should instead check whether any substitutions have been performed in the subexpression? Not a very common or prominent case, but.... -s From macrakis at alum.mit.edu Tue Jan 16 12:23:16 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 16 Jan 2007 13:23:16 -0500 Subject: [Maxima] diff(y,t) where y=f(z) and z=f(t) In-Reply-To: References: Message-ID: <8b356f880701161023k787ad9fwb0c592fffbc13bf8@mail.gmail.com> On 1/16/07, Ryan Krauss wrote: > The main problem is that Maxima keeps outputting an answer that > contains a derivative with repect to time which should be simple to > evaluate. But Maxima refuses to evaluate it and I don't know how to > make it. As I copy and paste from wxMaxima, I see the ' in front of > the diff that forces the non-evaluation. How would I make that go > away? expr: 'diff(x^2,x) ev(expr,diff) => 2*x From dlakelan at street-artists.org Tue Jan 16 12:43:29 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Tue, 16 Jan 2007 10:43:29 -0800 Subject: [Maxima] augmented_lagrangian_method on purely computational / numeric functions? Message-ID: <20070116184329.GY25287@street-artists.org> Now that I have figured out how to runge-kutta my ODEs I've built a little numerical function which gives me a boundary condition error estimate. I'd like to find initial conditions that minimize this bc error subject to constraints on the initial conditions. I tried something like: augmented_lagrangian_method(bcerror(h0,v0,hp0),[h0,v0,hp0],[h0*v0-q0],[.005,.005,.001]); but I get an error about unable to evaluate a predicate: Maxima was unable to evaluate the predicate: errexp1 Maxima was unable to evaluate the predicate: h0 < 0 #0: lambda([x],is(second(x) < 0 or third(x) < 0 or last(x) < 0))(x=[0,h0,v0,hp0,hp0]) #1: bcerror(h0=h0,v0=v0,hp0=hp0) -- an error. Quitting. To debug this try debugmode(true); If I wrap the bcerror term in a lambda, I get an error about differentiation with respect to a number. Does augmented_lagrangian_method require that its FOM argument be symbolically differentiable? If so, does maxima have a constrained minimization routine that is purely numerical? -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From robert.dodier at gmail.com Tue Jan 16 12:43:47 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 16 Jan 2007 11:43:47 -0700 Subject: [Maxima] diff(y,t) where y=f(z) and z=f(t) In-Reply-To: References: Message-ID: On 1/16/07, Ryan Krauss wrote: > But Maxima refuses to evaluate it and I don't know how to > make it. As I copy and paste from wxMaxima, I see the ' in front of > the diff that forces the non-evaluation. How would I make that go > away? The ' marks so-called noun expressions -- the nouns flag of ev causes all nouns to be evaluated. Naming one noun causes that one to be evaluated. e.g. expr : 'diff(foo(x), x) + 'integrate(foo(x), x); => noun expression ev(expr, nouns); => both diff and integrate are evaluated ev(expr, diff); => only diff evaluated, integrate still a noun ev(expr, integrate); => diff still a noun, integrate evaluated HTH Robert Dodier From ryanlists at gmail.com Tue Jan 16 12:59:29 2007 From: ryanlists at gmail.com (Ryan Krauss) Date: Tue, 16 Jan 2007 12:59:29 -0600 Subject: [Maxima] diff(y,t) where y=f(z) and z=f(t) In-Reply-To: References: Message-ID: Thanks to Robert and Stavros I am over my hump. Ryan On 1/16/07, Robert Dodier wrote: > On 1/16/07, Ryan Krauss wrote: > > > But Maxima refuses to evaluate it and I don't know how to > > make it. As I copy and paste from wxMaxima, I see the ' in front of > > the diff that forces the non-evaluation. How would I make that go > > away? > > The ' marks so-called noun expressions -- the nouns flag of ev > causes all nouns to be evaluated. Naming one noun causes that > one to be evaluated. > > e.g. > expr : 'diff(foo(x), x) + 'integrate(foo(x), x); > => noun expression > ev(expr, nouns); > => both diff and integrate are evaluated > ev(expr, diff); > => only diff evaluated, integrate still a noun > ev(expr, integrate); > => diff still a noun, integrate evaluated > > HTH > Robert Dodier > From fateman at EECS.Berkeley.EDU Tue Jan 16 13:27:52 2007 From: fateman at EECS.Berkeley.EDU (Richard Fateman) Date: Tue, 16 Jan 2007 19:27:52 GMT Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: It is easy to look at the documentation for Maple, Mathematica, or commercial Macsyma and find features that could be suitable student projects. These projects have the following positive features. 1. The design has been debugged at least once. 2. The calculation is feasible. 3. The answers from Maxima can be compared to the other system. \ Other thoughts There are a number of kinds of arithmetic mentioned previously here that fit under a common generic framework, that I've written in common lisp, and posted. Including automatic differentiation of programs, interval arithmetic, quad-double arithmetic (very fast 64 decimal digit floats), bigfloat Gaussian quadrature... Handwriting input, mouse selection of displayed subexpressions... for people who want to do user interfaces. RJF -------------- next part -------------- Hi Fabrizio For math students, I think there are many interesting areas that we had not developped well in maxima. Maybe Yong Tableaux is one of sufficient easy and interesting theme. there is partition function in Set and schur (kostka,too) in Symmetries. So by using them,your students may implemnt Young diagram,semi standard Young tableau (SSYT),skew schur functions ,their generic functions. see math.mit/edu/~plamen/tables/samsi06-2.pdf many applications will be derived from these implementation,because we can use it with other maxima's packages. For example,Vicious random walkers have deep relations to this. thanks Gosei Furuya 2007/1/17, Fabrizio Caruso : > > Hi > > The first two students I have followed are > math students and did the following: > > (1) implementation of 3sat-polycracker in Maxima > - done, is it of any interest to anyone? > > (2) optimizing (gf) finite field library for Maxima > - almost done, it is going to be way faster > > The next students (if they appear but it is > very likely that they do) are computer science students. > These might also implement something mathematical > as long as it is understandable. > I might also have more math students in the future > who want to work on a software project, as well. > > On Tue, 16 Jan 2007, Stavros Macrakis wrote: > > > That would be great! There are many areas where they could contribute > > without deep mathematics. > > > > What are their strengths and areas they want to develop? Lisp? GUIs? > > Graphics? Scripting? Systems programming? ... > > I don't know, yet. > I'll let you know when they show up. > It should also be something I must be able > to follow... > I use to code in Scheme lots of time ago > but I am not a Lisp-expert. > If you have a Lisp related suggestion I might > need some help. > > > My personal wishes: > > Personally I would like to see a better > and interactive gnuplot support in Maxima: > the user should be able to draw on the same > gnuplot more than once. > > As far as the lisp is concerned I would like > to have Maxima be compiled with a Lisp version > that does not have an unreasonably low limit > on the number of arguments for functions > (CLISP is no affected but the other lisps > fail with as few arguments as about 200). > Could this be fixed by setting an appropriate > parameter before compilation? > > Regards > > Fabrizio > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070116/59386887/attachment-0001.htm -------------- next part -------------- _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From michel.vandenbergh at uhasselt.be Tue Jan 16 13:52:26 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 16 Jan 2007 20:52:26 +0100 Subject: [Maxima] Unsimplification??? In-Reply-To: <8b356f880701160705neccee1dtffb1e216a7dc5e66@mail.gmail.com> References: <45ACACC5.7000400@uhasselt.be> <8b356f880701160705neccee1dtffb1e216a7dc5e66@mail.gmail.com> Message-ID: <45AD2CFA.1060601@uhasselt.be> > > Resimplifying " bfloat(x) " has no effect, because bfloat is not a > mathematical function. > > -s Hmm, Is there some way to say: evaluate all bfloat(-) constructs in this expression, but nothing else? Michel From willisb at unk.edu Tue Jan 16 14:30:21 2007 From: willisb at unk.edu (Barton Willis) Date: Tue, 16 Jan 2007 14:30:21 -0600 Subject: [Maxima] CL arrays Message-ID: Given a CL array as an argument, many Maxima functions misbehave: (%i2) f : make_array('any,3); (%i4) sign(f); Maxima encountered a Lisp error: (%i5) is(equal(f,0)); Maxima encountered a Lisp error: Internally, the functions mop and margs also have problems with CL arrays as arguments. Question: How hard should we work to expunge these bugs? Or should the use of CL arrays in Maxima be completely re-examined? Barton From nicolas.pettiaux at ael.be Tue Jan 16 14:51:21 2007 From: nicolas.pettiaux at ael.be (Nicolas Pettiaux) Date: Tue, 16 Jan 2007 21:51:21 +0100 Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: 2007/1/16, Richard Fateman : > It is easy to look at the documentation for Maple, Mathematica, or > commercial Macsyma and find features that could be suitable student > projects. These projects have the following positive features. > 1. The design has been debugged at least once. > 2. The calculation is feasible. > 3. The answers from Maxima can be compared to the other system. What about putting all these good ideas in the wiki, close to the ideas that were proposed for the Google summer of code, and with some comment about the people that this could reach / help, the bagage needed to program the new features ... and the accomplishment that was realised, and the published paper for examples. THis could help other start similar projects in their education institutions / universities, while also prevent some duplication of effort (but proofreading of the new features would be encouraged) Without any specific idea, I would be in favor of any project that could help with the fact that other people would use more / more easily maxima, especially with respect to the proprietary CAS. I still have some ideas: 1/ help develop some "notebook" program, 2/ help develop the links with the SAGE project (that puts together octave, maxima and others with the help of python) 2/ help develop the plotting capabilities and easiness of maxima, in 2D and 3D through interactive gnuplot or other packages (like VTK for 3D, plplot ...) THanks anyway for the efforts you have moving more students to use and develop for maxima. Nicolas -- Nicolas Pettiaux - email: nicolas.pettiaux at ael.be From amca01 at gmail.com Tue Jan 16 15:25:13 2007 From: amca01 at gmail.com (Alasdair McAndrew) Date: Wed, 17 Jan 2007 08:25:13 +1100 Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: <1d67a53c0701161325r242802a8k1412d2ec412c747f@mail.gmail.com> I'll just take the liberty of copying here my wish list for Maxima (from a posting I made late in 2005): 1) Good number theory package. Since Maxima uses arbitrary precision arithmetic, this should be accompanied by a good computational number theory package: modular powers, inverses, extended euclidean algorithm, chinese remainder theorem, factorization (using all the best methods, up to and including the number field sieve), discrete logarithms, modular square and nth roots, primitive roots. 2) Graph theory. Creating graphs (weighted, unweighted, directed, undirected), drawing graphs (this may require another plotting package to gnuplot), modifying graphs, testing for planarity, euler and hamiltonian paths and circuits. Minimal spanning trees, shortest paths, coloring and matching, flow algorithms. 3) Boolean algebra and logic. Simplification of boolean expressions, truth tables, satisfyability, disjuntive and conjunctive canonical forms, checking for tautologies and contradictions. 4) Linear Algebra. I'd like to be able to compute reduced row echelon form, and some matrix decompositions (LU, QR, Cholesky etc). 5) User interface. This isn't a problem for me (I switch between maxima, xmaxima, imaxima in emacs, maxima in TeXmacs), but it could be a problem for teaching. One nice modern-ish interface would be nice. Let us know how you and your students get on! -Alasdair On 1/17/07, Fabrizio Caruso wrote: > > Hi > > In the near future I could have > one or two computer science students > work on a software project here > at the University of Pisa > (300-450 hours of work for each student). > > I could have them implement something > in/for Maxima. > Any suggestions? > It should be something not too > mathematically complicated. > > Fabrizio > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070117/e7eb1a31/attachment.htm From michel.vandenbergh at uhasselt.be Tue Jan 16 15:53:11 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Tue, 16 Jan 2007 22:53:11 +0100 Subject: [Maxima] CL arrays Message-ID: <45AD4947.8090101@uhasselt.be> > > >Given a CL array as an argument, many Maxima functions misbehave: > >(%i2) f : make_array('any,3); > > > Hey I wasn't even aware that this was possible! Is this the same as what happens when you put use_fast_arrays:true? It is really crazy how many array idioms there are in maxima! Storing arrays in the value cell of symbol instead of in a property seems to be more consistent with what happens in other languages. Michel From willisb at unk.edu Tue Jan 16 15:56:43 2007 From: willisb at unk.edu (Barton Willis) Date: Tue, 16 Jan 2007 15:56:43 -0600 Subject: [Maxima] while Message-ID: I wrote a new taylorinfo function and attached it to SF bug 904522. My code uses 'while', but I see that 'while' is unknown to hayat.lisp. At least building under sbcl says so. I'm guessing this has something to do with the build process. Maybe somebody can make 'while' available to hayat for me --- I don't understand most of the build process, and would likely make a mess. Barton From macrakis at alum.mit.edu Tue Jan 16 17:15:09 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 16 Jan 2007 18:15:09 -0500 Subject: [Maxima] bfloat on symbolic expressions Message-ID: <8b356f880701161515l59af2efbkef1627549b056f9@mail.gmail.com> Michel and I have discussed the interaction of bfloat and Levin offline, and one of the issues seems to be this: If you use bfloat on a symbolic expression, it normally converts all included numbers into bfloats, e.g. bfloat(9*(x-2/3)*(x+2/3)) => 9.0b0 (x - 6.6667b-1) (x + 6.6667b-1) bfloat(3.4*x) => 3.4b0*x bfloat(sin(x+%pi*6/7)) => sin(x + 2.6928b0) etc. But exponents are protected from this if the base is not a number: bfloat(2^(x+2/3)) => 2.0b0^(x+6.6666667b-1) but bfloat(q^(x+2/3)) => q^(x+2/3) bfloat(q^2.3) => q^2.3 This is presumably to avoid things like bfloat(x^-1) => x^-1.0b0 (not current behavior) bfloat(sqrt(x)) => x^0.5b0 (not current behavior) etc. But it seems as though it would be better to continue to convert all *approximate* numbers (not integers and rationals) in the exponent since they contain an implicit precision. By the way, the behavior of 'float' is not entirely consistent with that of bfloat in cases like this.... -s From michel.vandenbergh at uhasselt.be Tue Jan 16 17:42:56 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 17 Jan 2007 00:42:56 +0100 Subject: [Maxima] CL arrays Message-ID: <45AD6300.8030101@uhasselt.be> > > >>/ >/>/ >/>/Given a CL array as an argument, many Maxima functions misbehave: >/>/ >/>/(%i2) f : make_array('any,3); >/>/ >/>/ >/>/ >/Hey I wasn't even aware that this was possible! Is this the same as what >happens when you put use_fast_arrays:true? It is really crazy how >many array idioms there are in maxima! > >Storing arrays in the value cell of symbol instead of in a property seems >to be more consistent with what happens in other languages. > >Michel > I guess what I want to say is. Why not deprecate the old maxima arrays? There is no reason to have so many different idioms for accessing arrays. Michel From David.Billinghurst at riotinto.com Tue Jan 16 19:03:25 2007 From: David.Billinghurst at riotinto.com (Billinghurst, David (RTATECH)) Date: Wed, 17 Jan 2007 12:03:25 +1100 Subject: [Maxima] while Message-ID: <026DCC31AB859648A6F16C0E5CD2580D736C18@calttsv025.cal.riotinto.org> > From: Barton Willis > > I wrote a new taylorinfo function and attached it to SF bug 904522. > My code uses 'while', but I see that 'while' is unknown to hayat.lisp. > At least building under sbcl says so. > > I'm guessing this has something to do with the build process. Maybe > somebody can make 'while' available to hayat for me --- I don't > understand most of the build process, and would likely make a mess. > > Barton 'while' is defined in nset.lisp, which is after hayat.lisp in maxima.system One solution is to shift the definition of 'while'. src/utils.lisp seems a good place. Comments say it is for "General purpose lisp utilities." If you do this it should be seen by hayat.lisp with no other changes, but if you want to use it in mhayat.lisp we will need to tweak maxima.system. I could commit this in the next 24 hours. David NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. From willisb at unk.edu Tue Jan 16 20:19:21 2007 From: willisb at unk.edu (Barton Willis) Date: Tue, 16 Jan 2007 20:19:21 -0600 Subject: [Maxima] while In-Reply-To: <026DCC31AB859648A6F16C0E5CD2580D736C18@calttsv025.cal.riotinto.org> References: <026DCC31AB859648A6F16C0E5CD2580D736C18@calttsv025.cal.riotinto.org> Message-ID: All my changes go into hayat.lisp, not mhayat.lisp. So moving 'while' to utils.lisp should be OK. Thanks for the offer, but I should be able take care of moving 'while' out of nset.lisp. Thanks for the advice. Barton -----maxima-bounces at math.utexas.edu wrote: ----- 'while' is defined in nset.lisp, which is after hayat.lisp in maxima.system One solution is to shift the definition of 'while'. src/utils.lisp seems a good place. Comments say it is for "General purpose lisp utilities." If you do this it should be seen by hayat.lisp with no other changes, but if you want to use it in mhayat.lisp we will need to tweak maxima.system. I could commit this in the next 24 hours. David NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From robert.dodier at gmail.com Tue Jan 16 21:58:13 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 16 Jan 2007 20:58:13 -0700 Subject: [Maxima] CL arrays In-Reply-To: References: Message-ID: On 1/16/07, Barton Willis wrote: > Given a CL array as an argument, many Maxima functions misbehave: > > (%i2) f : make_array('any,3); > > (%i4) sign(f); > Maxima encountered a Lisp error: > > (%i5) is(equal(f,0)); > Maxima encountered a Lisp error: > > Internally, the functions mop and margs also have problems with CL arrays > as arguments. > > Question: How hard should we work to expunge these bugs? Or should > the use of CL arrays in Maxima be completely re-examined? I think I'd prefer to make Lisp arrays invisible from the user's point of view. I'd like to rework lists and matrices to use arrays for storage, but without exposing the underlying array. Of course, the user would still be free to call Lisp functions to allocate arrays, but then it becomes their own problem; Maxima wouldn't be obligated to handle arrays gracefully, any more than any other Lisp-only data type. So I am inclined to say let's not fix the bugs mentioned above. For what it's worth, Robert From robert.dodier at gmail.com Tue Jan 16 22:02:10 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 16 Jan 2007 21:02:10 -0700 Subject: [Maxima] Unsimplification??? In-Reply-To: References: <45ACACC5.7000400@uhasselt.be> <45ACEDAA.8010503@uhasselt.be> Message-ID: On 1/16/07, Richard Fateman wrote: > I'm not arguing about the use of meval internal to Maxima. > I think it is a mistake to use the maxima command ev(...) > unless there is no alternative. Sorry, I misunderstood what was under discussion. > I can't test it now (I'm travelling) but resimplification should > be possible after a subst, if necessary, by simplify(). I think ?resimplify is the function to call. There isn't a function named simplify. Robert From robert.dodier at gmail.com Tue Jan 16 23:04:39 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 16 Jan 2007 22:04:39 -0700 Subject: [Maxima] augmented_lagrangian_method on purely computational / numeric functions? In-Reply-To: <20070116184329.GY25287@street-artists.org> References: <20070116184329.GY25287@street-artists.org> Message-ID: On 1/16/07, Daniel Lakeland wrote: > Does augmented_lagrangian_method require that its FOM argument be > symbolically differentiable? Yes, augmented_lagrangian_method assumes that it is going to compute the necessary derivatives by symbolic differentiation. The point of that was to remove the derivatives from the problem formulation since they can be obtained mechanically. > If so, does maxima have a constrained minimization routine that is > purely numerical? Well, augmented_lagrangian_method constructs an unconstrained problem and then calls the LBFGS function (translated from Fortran) which is purely numerical. There's no reason derivatives couldn't be computed by a user-supplied function, I just didn't think to make that an option. Let me think about it and I'll try to work on the code this weekend. best Robert From A.G.Grozin at inp.nsk.su Tue Jan 16 23:15:43 2007 From: A.G.Grozin at inp.nsk.su (Andrey G. Grozin) Date: Wed, 17 Jan 2007 11:15:43 +0600 (NOVT) Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: On Tue, 16 Jan 2007, Nicolas Pettiaux wrote: > I still have some ideas: > > 1/ help develop some "notebook" program, There is a "notebook" interface to maxima already: GNU TeXmacs. Rather than re-inventing all the relevant weels again, it would be better to improve it. TeXmacs is used as a common interface to a number of free and commercial CASs (maxima, axiom, yacas, giac, mathemagix, gtybalt, macaulay, mathematica, maple, mupad, reduce...) and numerical and graphical programs (octave, scilab, R, gnuplot, graphviz, ...). A user can cut-and-paste between them. Improvements made to TeXmacs will be useful not only to maxima, but to many other systems. A good project is a smart line-splitting in long output expressions. > 2/ help develop the links with the SAGE project (that puts together > octave, maxima and others with the help of python) > > 2/ help develop the plotting capabilities and easiness of maxima, in > 2D and 3D through interactive gnuplot or other packages (like VTK for > 3D, plplot ...) Here we definitely should use interfaces to existing plotting packages, not to re-invent the weel. The problem is there are so many of them. Many are good, but none is ideal (gnuplot, in particular, is not ideal). We should review the existing possibilities and choose one (or two) which seems the best, and then write some interface code on the maxima side. Andrey From dlakelan at street-artists.org Tue Jan 16 23:30:46 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Tue, 16 Jan 2007 21:30:46 -0800 Subject: [Maxima] augmented_lagrangian_method on purely computational / numeric functions? In-Reply-To: References: <20070116184329.GY25287@street-artists.org> Message-ID: <20070117053046.GC29279@localhost.localdomain> On Tue, Jan 16, 2007 at 10:04:39PM -0700, Robert Dodier wrote: > On 1/16/07, Daniel Lakeland wrote: > > > Does augmented_lagrangian_method require that its FOM argument be > > symbolically differentiable? > > Yes, augmented_lagrangian_method assumes that it is going to > compute the necessary derivatives by symbolic differentiation. > The point of that was to remove the derivatives from the problem > formulation since they can be obtained mechanically. It's a good idea if the argument is symbolic. If it's a computational/numerical function then it might be possible for the user to supply a numerical differentiator as you suggested. However the user may have no way of supplying a derivative for some very complex functions. I assume without derivatives the LBFGS can't work because it's a quasi-newton method. perhaps it's possible to use a secant method internally? A minimizer without derivative computations would be fantastic. perhaps it's a good topic for the student projects mentioned in a previous email? -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From dlakelan at street-artists.org Tue Jan 16 23:43:41 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Tue, 16 Jan 2007 21:43:41 -0800 Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: <20070117054341.GD29279@localhost.localdomain> On Tue, Jan 16, 2007 at 02:41:58PM +0100, Fabrizio Caruso wrote: > Hi > > In the near future I could have > one or two computer science students ... > I could have them implement something > in/for Maxima. > Any suggestions? > It should be something not too > mathematically complicated. How about a minimization routine that doesn't require computing derivatives and would work for purely numerical/computational functions, preferrably with constraints? Something out of Richard Brent "Algorithms for Minimization Without Derivatives" perhaps? I haven't read it but it's at least available cheaply and looks to be understandable by Ugrad students. Optimization is an extremely useful tool for all sorts of fields. I'm extremely grateful for augmented_lagrangian_method from Robert Dodier, but when the input is a numerical result (such as trying to minimize some numerical integral) that sort of routine isn't usable. maxima has some valuable tools which might make for a clever optimization algorithm which could try local least squares fits, or interpolation, or do smart things with constraints. just a thought. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From Raffaele.Vitolo at unile.it Wed Jan 17 00:24:09 2007 From: Raffaele.Vitolo at unile.it (Raffaele Vitolo) Date: Wed, 17 Jan 2007 07:24:09 +0100 Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: <20070117062409.GG22001@poincare.unile.it> Hi Fabrizio, The old Macsyma was especially good in the computations of symmetries of PDEs. The package symmgrp.max, writteb by Champagne, Hereman and Winternitz, was among the best softwares for that purpose. Now this package lies in the website of W. Hereman http://www.mines.edu/fs_home/whereman/ (together with its documentation) and it seems that the possibility of porting it into the actual Maxima has never been considered by the authors. I guess that it would be worth doing this effort, and it could be a nice job for a batchelor or master thesis in applied math (according to italian standards). The math is not so complicated, and almost all is explained in the documentation of symmgrp.max itself. If you think that this idea is interesting, the steps would be: 1 Ask the authors the permission of taking their code in Maxima under GPL; 2 Check the code against the new maxima and do possible modification to make it run with the new maxima; 3 Add new features to the code (there are a lot of possibilities in this sense). There are a number of packages about group analysis of ODEs and PDEs around, most of them are for Maple. One of the most famous is Vessiot, by I. Anderson and coworkers (http://www.math.usu.edu/~fg_mp), unfortunately *not* available with the source code (but I could ask for it). There is another one whose source is available, Jets (http://diffiety.ac.ru). I could help very much in steps 1 and 3, but I could be just be a beta-tester as for 2, as I do not know lisp and maxima internals. I wait for your comments. Best, raf. -- Raffaele Vitolo, Dipartimento di Matematica 'E. De Giorgi' Universita' di Lecce, via per Arnesano 73100 Lecce ITALY tel.: +39 0832 297425 (office) fax.: +39 0832 297594 home page: http://poincare.unile.it/vitolo From robert.dodier at gmail.com Wed Jan 17 00:38:01 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 16 Jan 2007 23:38:01 -0700 Subject: [Maxima] students involved in Maxima In-Reply-To: References: Message-ID: Hi Fabrizio, > In the near future I could have > one or two computer science students > work on a software project here > at the University of Pisa > (300-450 hours of work for each student). Wow, that would be really terrific. Everyone has a lot of good ideas. I've added these items to the wish list on the Maxima wiki (http://maxima.sourceforge.net/wiki/index.php/Design%20Notes) which contains items we have been accumulating for a couple of years. best, Robert Dodier From michel.vandenbergh at uhasselt.be Wed Jan 17 02:44:43 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 17 Jan 2007 09:44:43 +0100 Subject: [Maxima] CL arrays Message-ID: <45ADE1FB.70800@uhasselt.be> > > >I think I'd prefer to make Lisp arrays invisible from the user's point >of view. I'd like to rework lists and matrices to use arrays for >storage, but without exposing the underlying array. > > My experiments show that lists and matrices are stored in the value cell of a symbol. Now I learn it is apparently also possible to store arrays in the value cell (without using use_fast_arrays:true). Perhaps it is time to make this the default and lay the old maxima arrays (which are stored on the property list and have confusing semantics) to rest. This would make maxima much closer to other languages. Michel From michel.vandenbergh at uhasselt.be Wed Jan 17 03:00:32 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 17 Jan 2007 10:00:32 +0100 Subject: [Maxima] CL arrays In-Reply-To: <45ADE1FB.70800@uhasselt.be> References: <45ADE1FB.70800@uhasselt.be> Message-ID: <45ADE5B0.6020307@uhasselt.be> I wrote > > Perhaps it is time to make this the default and lay the old maxima > arrays (which are stored on the property list and have confusing > semantics) > to rest. This would make maxima much closer to other languages. But I see that CL arrays have some limitations compared to maxima arrays. Like it seems you have to declare their dimension (size I should say). I wonder then what the point is of declaring a CL array to be "hashed". It's all very messy! Michel From j.spies at hccnet.nl Wed Jan 17 04:35:31 2007 From: j.spies at hccnet.nl (Jaap Spies) Date: Wed, 17 Jan 2007 11:35:31 +0100 Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: <45ADFBF3.6020801@hccnet.nl> Nicolas Pettiaux wrote: > > I still have some ideas: > > 1/ help develop some "notebook" program, > > 2/ help develop the links with the SAGE project (that puts together > octave, maxima and others with the help of python) > SAGE has a very interesting notebook() already! See http://modular.math.washington.edu/sage/ Jaap From andrej.vodopivec at gmail.com Wed Jan 17 04:40:20 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Wed, 17 Jan 2007 11:40:20 +0100 Subject: [Maxima] Graph theory package Message-ID: <7775b21a0701170240h1cafb64fw72a05a549a2b5702@mail.gmail.com> > 2) Graph theory. Creating graphs (weighted, unweighted, directed, > undirected), drawing graphs (this may require another plotting > package to gnuplot), modifying graphs, testing for planarity, euler > and hamiltonian paths and circuits. Minimal spanning trees, shortest > paths, coloring and matching, flow algorithms. I have a graph theory package for maxima which I wrote when I needed it for my work. I think it has most of what you list here implemented. If anyone would find it useful I can send a copy. Andrej From sen1 at math.msu.edu Wed Jan 17 07:32:51 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 17 Jan 2007 08:32:51 -0500 (EST) Subject: [Maxima] simple derivative function question Message-ID: Hello, I want to consider derivatives as functions. How does maxima do this? For instance, (%i14) f(x):= diff(x^3,x); 3 (%o14) f(x) := diff(x , x) (%i15) f(2); Non-variable 2nd argument to diff: 2 #0: f(x=2) -- an error. To debug this try debugmode(true); How does one define the derivative as a function, so one can compute values, plots, etc? TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From macrakis at alum.mit.edu Wed Jan 17 07:57:05 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 08:57:05 -0500 Subject: [Maxima] Unsimplification??? In-Reply-To: References: <45ACACC5.7000400@uhasselt.be> <45ACEDAA.8010503@uhasselt.be> Message-ID: <8b356f880701170557m430db5f0xadccbf54dcb842b0@mail.gmail.com> On 1/16/07, Robert Dodier wrote: > On 1/16/07, Richard Fateman wrote: > > > I'm not arguing about the use of meval internal to Maxima. > > I think it is a mistake to use the maxima command ev(...) > > unless there is no alternative. More precisely, I think what is being talked about is using ev to substitute particular values in expressions, for example ev(..., a=3) instead of subst(3,a,...). The temptation is strong of course because of the convenient command line syntax "..., a=3". > I think ?resimplify is the function to call. > There isn't a function named simplify. The Maxima-level equivalent of resimplify is precisely expand(...,0.0). I suppose it would make sense to predefine resimplify as that. On the other hand, I think it would be a bad idea to call it "simplify", which implies that it does something other than what the system does automatically. -s From michel.vandenbergh at uhasselt.be Wed Jan 17 08:15:42 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 17 Jan 2007 15:15:42 +0100 Subject: [Maxima] simple derivative function question Message-ID: <45AE2F8E.8060009@uhasselt.be> How about: f(x) := block([y], subst(x, y, diff(y^3 , y)))$ f(10); 300 f(x); 3x^2 Michel From go.maxima at gmail.com Wed Jan 17 08:16:02 2007 From: go.maxima at gmail.com (=?ISO-2022-JP?B?GyRCOEVDKzlkQDgbKEI=?=) Date: Wed, 17 Jan 2007 23:16:02 +0900 Subject: [Maxima] simple derivative function question In-Reply-To: References: Message-ID: hi (%i9) f(_x):=block([t],subst([t=_x],diff(t^3,t)))$ (%i10) f(9); (%o10) 243 Gosei Furuya 2007/1/17, sen1 at math.msu.edu : > > Hello, > I want to consider derivatives as functions. > > How does maxima do this? > > For instance, > > (%i14) f(x):= diff(x^3,x); > 3 > (%o14) f(x) := diff(x , x) > (%i15) f(2); > > Non-variable 2nd argument to diff: > 2 > #0: f(x=2) > -- an error. To debug this try debugmode(true); > > How does one define the derivative as a function, so one can compute > values, plots, etc? > > TIA, > -sen > > > > -- > > --------------------------------------------------------------------------- > | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu > | > | Mathematics Department | > | > | Michigan State University | telephone: > 517-355-9684 | > | E. Lansing, MI 48824-1027 USA | FAX: > 517-432-1562 | > > --------------------------------------------------------------------------- > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070117/d8befa91/attachment.htm From michel.vandenbergh at uhasselt.be Wed Jan 17 08:24:35 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Wed, 17 Jan 2007 15:24:35 +0100 Subject: [Maxima] Unsimplification??? In-Reply-To: <8b356f880701170557m430db5f0xadccbf54dcb842b0@mail.gmail.com> References: <45ACACC5.7000400@uhasselt.be> <45ACEDAA.8010503@uhasselt.be> <8b356f880701170557m430db5f0xadccbf54dcb842b0@mail.gmail.com> Message-ID: <45AE31A3.2040709@uhasselt.be> Stavros Macrakis wrote: > On 1/16/07, Robert Dodier wrote: > >> On 1/16/07, Richard Fateman wrote: >> >> > I'm not arguing about the use of meval internal to Maxima. >> > I think it is a mistake to use the maxima command ev(...) >> > unless there is no alternative. > > > More precisely, I think what is being talked about is using ev to > substitute particular values in expressions, for example ev(..., a=3) > instead of subst(3,a,...). The temptation is strong of course because > of the convenient command line syntax "..., a=3". > >> I think ?resimplify is the function to call. >> There isn't a function named simplify. > > > The Maxima-level equivalent of resimplify is precisely > expand(...,0.0). I suppose it would make sense to predefine > resimplify as that. On the other hand, I think it would be a bad idea > to call it "simplify", which implies that it does something other than > what the system does automatically. > Maybe because of that there is not much point in defining it.... It thought that working out bfloat(...) was a simplification but it has been pointed out to me that it is not. Michel > -s From macrakis at alum.mit.edu Wed Jan 17 08:29:36 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 09:29:36 -0500 Subject: [Maxima] simple derivative function question In-Reply-To: References: Message-ID: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> On 1/17/07, sen1 at math.msu.edu wrote: > I want to consider derivatives as functions. > (%i14) f(x):= diff(x^3,x);... > How does one define the derivative as a function, so one can compute > values, plots, etc? Presumably you only want to calculate the derivative once, not on each function call. You can do this using the ''(...) construction (that's two single-quotes, not one double-quote), which evaluates its contents when the expression is read. Examples: ddd(x):=''(print(x)); x The x is printed during function *definition*, not evaluation => ddd(x) := x This is the resulting definition, which has no "print" eee(x):=''(diff(x^3,x)); => eee(x):=3*x^2 Resulting definition You can also calculate the formula first: fff: diff(x^3,x); => 3*x^2 ggg(x):=''fff => ggg(x):=3*x^2 ggg(2) => 12 I trust this is what you had in mind. -s From coolens at kahosl.be Wed Jan 17 08:48:31 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Wed, 17 Jan 2007 15:48:31 +0100 (CET) Subject: [Maxima] [newbie question]prime counting function In-Reply-To: <45AE2F8E.8060009@uhasselt.be> References: <45AE2F8E.8060009@uhasselt.be> Message-ID: Does maxima have a prime counting function? regards, hugo From coolens at kahosl.be Wed Jan 17 09:55:55 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Wed, 17 Jan 2007 16:55:55 +0100 (CET) Subject: [Maxima] [newbie question] solving fifth order polynomial equation In-Reply-To: References: <45AE2F8E.8060009@uhasselt.be> Message-ID: When solving the following equation solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0); Maxima shows two real solutions and three complex ones in stead of five real solutions. Besides the solutions s=-1 and s=-1/3, I think there are also a real solutions around s=-2.63024e-01, s=-4.08991e-01 and s=-1.32799 Can anyone explain what is going wrong and how to solve it? reagards, hugo From sen1 at math.msu.edu Wed Jan 17 09:53:33 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 17 Jan 2007 10:53:33 -0500 (EST) Subject: [Maxima] simple derivative function question In-Reply-To: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: Thanks to all who responded with tips on how to define derivative functions. Some more questions: 1. What does maxima actually do with the next definition? (A) f(x):= diff(f(x),x) I thought that the right hand side remained unevaluated by using (B) f(x):= 'diff(f(x),x) as in writing differential equations. So, what would the meaning of statement (A) ? Is diff(f(x),x) simply a string of symbols? 2. What is the meaning of the following words in the manual on "diff" The noun form of `diff' is required in some contexts, such as stating a differential equation. What is a "noun form" in maxima? TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From macrakis at alum.mit.edu Wed Jan 17 10:07:42 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 11:07:42 -0500 Subject: [Maxima] [newbie question] solving fifth order polynomial equation In-Reply-To: References: <45AE2F8E.8060009@uhasselt.be> Message-ID: <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> On 1/17/07, Hugo Coolens wrote: > When solving the following equation > solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0); > > Maxima shows two real solutions and three complex ones in stead of five > real solutions. Actually, Maxima is showing five real solutions -- it's just that the *form* of some of the real solutions includes %i. To simplify these expressions to purely real expressions, use radcan: radcan(solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0)) => [s = -1/3,s = -1, s = -(sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3) +cos((atan(9/(13*sqrt(3)))-%pi)/3)+2) /3, s = (sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3) -cos((atan(9/(13*sqrt(3)))-%pi)/3)-2) /3,s = (2*cos((atan(9/(13*sqrt(3)))-%pi)/3)-2)/3] If all you care about is the numeric values of the real solutions, you can use realroots to get approximations to any desired precision, even for non-factorizable polynomials: realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0, 10^-30) realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0, 10^-30); [s = -3366842668502188682920157364511 /2535301200456458802993406410752,s = -1, s = -1036915250298305044736277999857 /2535301200456458802993406410752, s = -845100400152152934331135470251 /2535301200456458802993406410752, s = -666844482112423878330377457135 /2535301200456458802993406410752] bfloat(%),fpprec:30; [s = -1.327985277605681767796032025b0,s = -1.0b0, s = -4.08990951493896474542054282001b-1, s = -3.33333333333333333333333333333b-1, s = -2.63023770900421757661913692994b-1] That one was factorizable into polynomials of degree <= 4, so roots can be given as radical expressions: factor(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5) => (s+1)*(3*s+1)*(7*s^3+14*s^2+7*s+1) Example not factorizable over the rationals: realroots(x^5+x+3) => [x = -38017089/33554432] -s From sen1 at math.msu.edu Wed Jan 17 10:06:32 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 17 Jan 2007 11:06:32 -0500 (EST) Subject: [Maxima] [newbie question] solving fifth order polynomial equation In-Reply-To: <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> References: <45AE2F8E.8060009@uhasselt.be> <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> Message-ID: It seems that "realroots" with no other argument gives rational solutions. (%i19) realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5); 44559791 13723459 11184811 (%o19) [s = - --------, s = - 1, s = - --------, s = - --------, 33554432 33554432 33554432 8825613 s = - --------] 33554432 I presume, but did not check, that this means that the roots are rational. Or, are these just approximate values? -sen On Wed, 17 Jan 2007, Stavros Macrakis wrote: > On 1/17/07, Hugo Coolens wrote: >> When solving the following equation >> solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0); >> >> Maxima shows two real solutions and three complex ones in stead of five >> real solutions. > > Actually, Maxima is showing five real solutions -- it's just that the > *form* of some of the real solutions includes %i. To simplify these > expressions to purely real expressions, use radcan: > > radcan(solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0)) => > [s = -1/3,s = -1, > s = -(sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3) > +cos((atan(9/(13*sqrt(3)))-%pi)/3)+2) > /3, > s = (sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3) > -cos((atan(9/(13*sqrt(3)))-%pi)/3)-2) > /3,s = (2*cos((atan(9/(13*sqrt(3)))-%pi)/3)-2)/3] > > If all you care about is the numeric values of the real solutions, you > can use realroots to get approximations to any desired precision, even > for non-factorizable polynomials: > > realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0, 10^-30) > > realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0, 10^-30); > [s = -3366842668502188682920157364511 > /2535301200456458802993406410752,s = -1, > s = -1036915250298305044736277999857 > /2535301200456458802993406410752, > s = -845100400152152934331135470251 > /2535301200456458802993406410752, > s = -666844482112423878330377457135 > /2535301200456458802993406410752] > bfloat(%),fpprec:30; > [s = -1.327985277605681767796032025b0,s = -1.0b0, > s = -4.08990951493896474542054282001b-1, > s = -3.33333333333333333333333333333b-1, > s = -2.63023770900421757661913692994b-1] > > That one was factorizable into polynomials of degree <= 4, so roots > can be given as radical expressions: > > factor(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5) => > (s+1)*(3*s+1)*(7*s^3+14*s^2+7*s+1) > > Example not factorizable over the rationals: > realroots(x^5+x+3) => [x = -38017089/33554432] > > -s > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From dlakelan at street-artists.org Wed Jan 17 10:17:59 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 08:17:59 -0800 Subject: [Maxima] Graph theory package In-Reply-To: <7775b21a0701170240h1cafb64fw72a05a549a2b5702@mail.gmail.com> References: <7775b21a0701170240h1cafb64fw72a05a549a2b5702@mail.gmail.com> Message-ID: <20070117161759.GE29279@localhost.localdomain> On Wed, Jan 17, 2007 at 11:40:20AM +0100, Andrej Vodopivec wrote: > I have a graph theory package for maxima which I wrote when I needed > it for my work. I think it has most of what you list here implemented. > If anyone would find it useful I can send a copy. I think this would be a good thing to add as a share package to the maxima distribution. Graphs are an extremely common and useful thing to be able to compute with. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From macrakis at alum.mit.edu Wed Jan 17 10:18:27 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 11:18:27 -0500 Subject: [Maxima] simple derivative function question In-Reply-To: References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: <8b356f880701170818h14f7e69bl33754f8dd9640b0e@mail.gmail.com> On 1/17/07, sen1 at math.msu.edu wrote: > 1. What does maxima actually do with the next definition? > (A) f(x):= diff(f(x),x) If you try to evaluate this, you will get an infinite recursion, since f(y) requires first calculating f(y) and then taking its derivative, which requires first calculating f(y) and then.... Perhaps you meant f(x):= diff( g(x), x) When you call this with an argument, e.g. f(a), Maxima binds the variable x to the variable a (the symbolic value -- we're assuming that a hasn't been assigned a value). It then calculates the value of the arguments to the "diff" function, which are g(a) (a symbolic expression) and a (a symbolic expression. Then it calculates the diff, which in this case is a "noun form", that is, the symbolic representation of a derivative: 'diff(g(a),a,1). If on the other hand you tried f(3), then it would try to take the derivative of g(3) with respect to 3, which is not meaningful, hence the error message. > I thought that the right hand side remained unevaluated by using The right hand side of a function definition is evaluated when you *call* the function. > 2. What is the meaning of the following words in the manual on "diff" > > The noun form of `diff' is required in some contexts, such as > stating a differential equation. > > What is a "noun form" in maxima? There are certain functions in Maxima, notably diff, integrate, limit, etc. which have a dual meaning. They can be operations on symbolic expressions (domain and range are trees of symbols, essentially) or they can be themselves part of an expression tree. Thus: integrate(x^2,x) => x^3/3 The expression x^2 == "^"(x,2) is transformed into the expression x^3/3 = "/"("^"(x,3),3). But 'integrate(x^2,x) is itself an expression, namely "integrate-noun"(x^2,x). You can ask Maxima to re-convert the integrate-noun into an operation using the ev(...,integrate) mechanism: ex: 'integrate(x^2,x) => 'integrate(x^2,x) ev(ex,integrate) => x^3/3 Maxima suppots many operations on noun operators just like other operators, and also does some simple simplifications on them: 'integrate(2*x,x) => 2*'integrate(x,x) subst(y,x,ex) => 'integrate(y^2,y) subst(x^2,x,ex) => 'integrate(x^2,x^2) *ERROR* meaningless expression. Perhaps this helps.... -s From macrakis at alum.mit.edu Wed Jan 17 10:20:52 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 11:20:52 -0500 Subject: [Maxima] [newbie question] solving fifth order polynomial equation In-Reply-To: References: <45AE2F8E.8060009@uhasselt.be> <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> Message-ID: <8b356f880701170820j7bc56164if772c2e2c8b71d14@mail.gmail.com> On 1/17/07, sen1 at math.msu.edu wrote: > It seems that "realroots" with no other argument gives rational > solutions.... > I presume, but did not check, that this means that the roots are > rational. > Or, are these just approximate values? They are approximate values. Realroots uses rational arithmetic to support variable precision -- that is, as the Sturm sequence is evaluated, it is using more and more precision. This could be done with bfloats, but a) bfloats didn't exist when realroots was written and b) varying the precision is messy and not very efficient. It would probably make sense, on the other hand, to return the values as bfloats of appropriate precision. -s From dlakelan at street-artists.org Wed Jan 17 10:24:13 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 08:24:13 -0800 Subject: [Maxima] simple derivative function question In-Reply-To: References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: <20070117162413.GF29279@localhost.localdomain> On Wed, Jan 17, 2007 at 10:53:33AM -0500, sen1 at math.msu.edu wrote: > Thanks to all who responded with tips on how to define derivative > functions. > > Some more questions: > > 1. What does maxima actually do with the next definition? > > (A) f(x):= diff(f(x),x) maxima creates a "noun form" for the derivative.. Because maxima doesn't know what f(x) means, it simply echos back the fact that you mean "the derivative of f(x)" as a symbolic construct, namely 'diff(f(x),x). When defining a function, the right hand side of the := operator is automatically quoted as far as I can tell. Noun forms are symbolic representations of a thing which could in principle be computed if more information were known. 'diff(x^2,x) => noun form (due to quotes) diff(x^2,x) => 2*x (evaluated by the top level read-eval-print loop) -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From richard at exstrom.com Wed Jan 17 11:34:44 2007 From: richard at exstrom.com (Richard Hollos) Date: Wed, 17 Jan 2007 10:34:44 -0700 Subject: [Maxima] Maxima wiki wish list Message-ID: <20070117173444.GC15737@exstrom.com> >I've added these items to the wish list on the Maxima wiki >(http://maxima.sourceforge.net/wiki/index.php/Design%20Notes) >which contains items we have been accumulating for a couple of years. I noticed the wish list contains the Euler phi function. This is already in Maxima as totient(). Richard Hollos From ps at twin.jikos.cz Wed Jan 17 11:54:58 2007 From: ps at twin.jikos.cz (ps at twin.jikos.cz) Date: Wed, 17 Jan 2007 18:54:58 +0100 Subject: [Maxima] result of solve Message-ID: <20070117175458.GA10464@atrey.karlin.mff.cuni.cz> hello, using maxima function solve i sometimes get as a result "ALL" and sometimes [x = x]. i just wanted to ask whether these two results means the same (or what is the difference between these two outputs ?) thanks pavel From coolens at kahosl.be Wed Jan 17 12:23:58 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Wed, 17 Jan 2007 19:23:58 +0100 (CET) Subject: [Maxima] [newbie question] solving fifth order polynomial equation In-Reply-To: <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> References: <45AE2F8E.8060009@uhasselt.be> <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> Message-ID: Thanks for the helpful and interesting reply, I just have one little problem mentioned below: On Wed, 17 Jan 2007, Stavros Macrakis wrote: > On 1/17/07, Hugo Coolens wrote: >> When solving the following equation >> solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0); >> >> Maxima shows two real solutions and three complex ones in stead of five >> real solutions. > > Actually, Maxima is showing five real solutions -- it's just that the > *form* of some of the real solutions includes %i. To simplify these > expressions to purely real expressions, use radcan: > > radcan(solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0)) => > [s = -1/3,s = -1, > s = -(sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3) > +cos((atan(9/(13*sqrt(3)))-%pi)/3)+2) > /3, > s = (sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3) > -cos((atan(9/(13*sqrt(3)))-%pi)/3)-2) > /3,s = (2*cos((atan(9/(13*sqrt(3)))-%pi)/3)-2)/3] Strange enough my system does not give me the "real" values as you can see here, any idea why?: radcan(solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0)); (%o10) [s = -1/3,s = -1, s = -((9*%I-13*SQRT(3))^(2/3)*(SQRT(3)*%I+1) +4*2^(1/3)*3^(1/6)*7^(1/3)*(9*%I-13*SQRT(3))^(1/3) -2^(2/3)*3^(5/6)*7^(2/3)*%I+2^(2/3)*3^(1/3)*7^(2/3)) /(6*2^(1/3)*3^(1/6)*7^(1/3)*(9*%I-13*SQRT(3))^(1/3)), s = ((9*%I-13*SQRT(3))^(2/3)*(SQRT(3)*%I-1) -4*2^(1/3)*3^(1/6)*7^(1/3)*(9*%I-13*SQRT(3))^(1/3) -2^(2/3)*3^(5/6)*7^(2/3)*%I-2^(2/3)*3^(1/3)*7^(2/3)) /(6*2^(1/3)*3^(1/6)*7^(1/3)*(9*%I-13*SQRT(3))^(1/3)), s = ((9*%I-13*SQRT(3))^(2/3)-2*2^(1/3)*3^(1/6)*7^(1/3) *(9*%I-13*SQRT(3))^(1/3) +2^(2/3)*3^(1/3)*7^(2/3)) /(3*2^(1/3)*3^(1/6)*7^(1/3)*(9*%I-13*SQRT(3))^(1/3))] From macrakis at alum.mit.edu Wed Jan 17 12:33:21 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 13:33:21 -0500 Subject: [Maxima] [newbie question] solving fifth order polynomial equation In-Reply-To: References: <45AE2F8E.8060009@uhasselt.be> <8b356f880701170807we0d21f9i3483e96a2d1864d1@mail.gmail.com> Message-ID: <8b356f880701171033o14253173p79df193e1bb0749f@mail.gmail.com> On 1/17/07, Hugo Coolens wrote: > Strange enough my system does not give me the "real" values as you can see > here, any idea why?: > radcan(solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0)); Sorry, I must have made some mistake in copying my solution.. Try radcan(rectform(solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0))); From areiner at tph.tuwien.ac.at Wed Jan 17 11:10:17 2007 From: areiner at tph.tuwien.ac.at (Albert Reiner) Date: 17 Jan 2007 18:10:17 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? In-Reply-To: <45AB8F1A.7010507@uhasselt.be> References: <45AB8F1A.7010507@uhasselt.be> Message-ID: <86zm8ha8au.fsf@willehalm.reiner> [Michel Van den Bergh , Mon, 15 Jan 2007 15:26:34 +0100]: > I just noticed that > > do+1; > > in maxima toplevel puts maxima into an infinite loop! As it should: After all, you ask it to re-evaluate +1 in an infinite loop. `do ;' is the programming construct for an infinite loop (that can be left by return() or throw()). Albert. From areiner at tph.tuwien.ac.at Wed Jan 17 11:07:25 2007 From: areiner at tph.tuwien.ac.at (Albert Reiner) Date: 17 Jan 2007 18:07:25 +0100 Subject: [Maxima] Wiki article about maxima's treatment of arrays and functions? In-Reply-To: <45AB86F9.5040208@uhasselt.be> References: <45AB86F9.5040208@uhasselt.be> Message-ID: <864pqpbn02.fsf@willehalm.reiner> [Michel Van den Bergh , Mon, 15 Jan 2007 14:51:53 +0100]: > > - a simple macro with_gensyms() to evaluate some body after ... > > > > - and function degensymify() that takes an expression and ... > > This is a little bit of I am proposing in my wiki article > > http://maxima.sourceforge.net/wiki/index.php/LexicalLayer The main difference I see is that you want sanitization to be automatic. with_gensyms() and kin must be invoked explicitly, and they are mainly used for writing macros. Considering the case of f(x) := 'x, I think that it is really the author of the definition who ought to say what s/he wants. For the infamous s[t] example, I would have to write with my utilities: ,---- | (%i16) reeval(with_gensyms([s,t], buildq([s,t], f(s,t) := s[t]))); | (%o16) f(s$1754, t$1755) := s$1754 | t$1755 `---- The above definition obviously works for a literal t as first argument: ,---- | (%i18) f(t,1); | (%o18) t | 1 `---- Of course, as Maxima functions are not opaque, I can easily extract the gensym and re-create the error formerly triggered by f(t,1): ,---- | (%i20) f(inpart(fundef(f),1,2), 1); | | t\$1755 evaluates to 1 | Improper name or value in functional position. | #0: f(s\$1754=t\$1755,t\$1755=1) | -- an error. Quitting. To debug this try debugmode(true); `---- Best regards, Albert. From willisb at unk.edu Wed Jan 17 13:15:48 2007 From: willisb at unk.edu (Barton Willis) Date: Wed, 17 Jan 2007 13:15:48 -0600 Subject: [Maxima] new simpabs and... Message-ID: I finished making some changes to simp.lisp (simpabs), appended a regression test for abs, fixed some bugs in conjugate, moved the while macro from nset to utils, and wrote a new taylorinfo function. While these changes are still fresh in my mind, maybe some of you could test CVS Maxima. My build seems to be OK. Because of sloth, the new taylorinfo function is a defun function, not a defmfun: Thus (%i2) taylorinfo(taylor(x,[x,y],0,[5,6],z,b,42)); (%o2) [[x,y],[0,0],[5,6],[z,b,42]] <--- OK! Given the wrong number of arguments, I think if it were a defmfun the error message might be nicer: (%i3) taylorinfo(); Maxima encountered a Lisp error: Error in $TAYLORINFO [or a callee]: $TAYLORINFO [or a callee] requires more than zero arguments. With the new taylorinfo function: (%i10) p : taylor(sqrt(1+x+y)-1,[x,y],0,2)$ (%i11) sin(p); (%o11) (x+y)/2-(x^2+2*y*x+y^2)/8+... Yippee! ( an error in 5.11). Barton From andrej.vodopivec at gmail.com Wed Jan 17 13:37:45 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Wed, 17 Jan 2007 20:37:45 +0100 Subject: [Maxima] Graph theory package In-Reply-To: <7775b21a0701170240h1cafb64fw72a05a549a2b5702@mail.gmail.com> References: <7775b21a0701170240h1cafb64fw72a05a549a2b5702@mail.gmail.com> Message-ID: <7775b21a0701171137v2c77234ak9d9c50f87b585171@mail.gmail.com> > I have a graph theory package for maxima which I wrote when I needed > it for my work. I think it has most of what you list here implemented. > If anyone would find it useful I can send a copy. I have uploaded it to http://wxmaxima.sf.net/graphs.zip if you try it let me know what you think. Andrej From biomates at telefonica.net Wed Jan 17 13:46:11 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Wed, 17 Jan 2007 20:46:11 +0100 Subject: [Maxima] Graph theory package In-Reply-To: <20070117161759.GE29279@localhost.localdomain> References: <7775b21a0701170240h1cafb64fw72a05a549a2b5702@mail.gmail.com> <20070117161759.GE29279@localhost.localdomain> Message-ID: <1169063172.11037.10.camel@localhost.localdomain> > I think this would be a good thing to add as a share package to the > maxima distribution. Graphs are an extremely common and useful thing > to be able to compute with. > There is also a Maxima graphs package written by Martin Rubey in 2002: http://www.mat.univie.ac.at/~rubey/Maxima/graphs.lisp I'm not sure if it's fully compatible with Maxima's latests versions. Maybe someone would like to test it and clean it, if necessary. -- Mario Rodriguez Riotorto www.biomates.net From robert.dodier at gmail.com Wed Jan 17 14:40:51 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 17 Jan 2007 13:40:51 -0700 Subject: [Maxima] simple derivative function question In-Reply-To: References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: On 1/17/07, sen1 at math.msu.edu wrote: > 1. What does maxima actually do with the next definition? > > (A) f(x):= diff(f(x),x) The body of a function defined by := is neither evaluated nor simplified. Each time the function is called, the body is evaluated and simplified. This particular function definition is going to cause a stack overflow when it is called (from recursively calling f). > 2. What is the meaning of the following words in the manual on "diff" > > The noun form of `diff' is required in some contexts, such as > stating a differential equation. > > What is a "noun form" in maxima? A noun is a function which isn't called even if it could be. E.g. foo(x) := x^2; foo(10) => 100, but 'foo(10) => 'foo(10). This is useful because functions manipulating expressions can look for specific function names (e.g. foo) and take special action when they appear. In the case of differential equations, you don't want Maxima to actually try to compute diff(y, x), you just want dy/dx to float around as an unevaluated symbol. So you write 'diff(y, x). Hope this helps Robert From sen1 at math.msu.edu Wed Jan 17 15:56:52 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 17 Jan 2007 16:56:52 -0500 (EST) Subject: [Maxima] simple derivative function question In-Reply-To: References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: As Stavros noted, I actually meant that to write the function. g(x):= diff(f(x),x); I would like to understand the difference between the functions g(x) and h(x) defined below. In particular, lines (%i3) and (%i6) seem to produce the same output to the screen, but give different outputs when $x$ is set to be 2. TIA, -sen (%i1) f(x):= x^3; 3 (%o1) f(x) := x (%i2) h(x):= ''(diff(f(x),x)); 2 (%o2) h(x) := 3 x (%i3) h(x); 2 (%o3) 3 x (%i4) h(2); (%o4) 12 (%i5) g(x):= diff(f(x),x); (%o5) g(x) := diff(f(x), x) (%i6) g(x); 2 (%o6) 3 x (%i7) g(2); Non-variable 2nd argument to diff: 2 #0: g(x=2) -- an error. To debug this try debugmode(true); On Wed, 17 Jan 2007, Robert Dodier wrote: > On 1/17/07, sen1 at math.msu.edu wrote: > >> 1. What does maxima actually do with the next definition? >> >> (A) f(x):= diff(f(x),x) > > The body of a function defined by := is neither evaluated nor > simplified. Each time the function is called, the body is > evaluated and simplified. > > This particular function definition is going to cause a stack overflow > when it is called (from recursively calling f). > >> 2. What is the meaning of the following words in the manual on "diff" >> >> The noun form of `diff' is required in some contexts, such as >> stating a differential equation. >> >> What is a "noun form" in maxima? > > A noun is a function which isn't called even if it could be. > E.g. foo(x) := x^2; foo(10) => 100, but 'foo(10) => 'foo(10). > This is useful because functions manipulating expressions can > look for specific function names (e.g. foo) and take special action > when they appear. In the case of differential equations, you don't > want Maxima to actually try to compute diff(y, x), you just want > dy/dx to float around as an unevaluated symbol. > So you write 'diff(y, x). > > Hope this helps > Robert > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From macrakis at alum.mit.edu Wed Jan 17 16:18:26 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 17 Jan 2007 17:18:26 -0500 Subject: [Maxima] simple derivative function question In-Reply-To: References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: <8b356f880701171418x6f1a99f4ie3b382513341efd0@mail.gmail.com> > I would like to understand the difference between the functions g(x) > and h(x) defined below. In particular, lines > (%i3) and (%i6) seem to produce the same output to the screen, but > give different outputs when $x$ is set to be 2. They produce the same output with the argument 'x', but not with the argument '2'. That is because you can differentiate with respect to 'x', but not with respect to '2'. -s From dlakelan at street-artists.org Wed Jan 17 16:26:27 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 14:26:27 -0800 Subject: [Maxima] simple derivative function question In-Reply-To: References: <8b356f880701170629m1ed8a81rb0444ec5ada99546@mail.gmail.com> Message-ID: <20070117222627.GZ25287@street-artists.org> On Wed, Jan 17, 2007 at 04:56:52PM -0500, sen1 at math.msu.edu wrote: > I would like to understand the difference between the functions g(x) > and h(x) defined below. In particular, lines > (%i2) h(x):= ''(diff(f(x),x)); > 2 > (%o2) h(x) := 3 x What maxima does is read in h(x) then := then ''(diff(f(x),x)). because of the '' the last thing is immediately evaluated at READ TIME to 3*x^2. then h(x) is defined to be the function which takex x and computes 3*x^2 > (%i5) g(x):= diff(f(x),x); > (%o5) g(x) := diff(f(x), x) > (%i6) g(x); > 2 > (%o6) 3 x > (%i7) g(2); > > Non-variable 2nd argument to diff: > 2 g(x) is now defined to be the function which takes x, substitutes it into the expressions diff(f(x),x) and then computes that derivative. g(foo) -> diff(f(foo),foo) -> diff(foo^3,foo) -> 3*foo^2 g(2) -> diff(f(2),2) -> diff(2^3,2) -> error where -> could be read as "becomes" Hope this helps. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From fateman at EECS.Berkeley.EDU Wed Jan 17 16:24:37 2007 From: fateman at EECS.Berkeley.EDU (Richard Fateman) Date: Wed, 17 Jan 2007 14:24:37 -0800 Subject: [Maxima] students involved in Maxima In-Reply-To: References: <8b356f880701160725r520bbcdeq4ccbfe5eeb20787d@mail.gmail.com> Message-ID: until texmacs runs on windows without cygwin etc, I think it will have limited usefulness. At least that has been my impression, and I have cygwin.. RJF ----- Original Message ----- From: "Andrey G. Grozin" Date: Tuesday, January 16, 2007 9:15 pm Subject: Re: [Maxima] students involved in Maxima > On Tue, 16 Jan 2007, Nicolas Pettiaux wrote: > > I still have some ideas: > > > > 1/ help develop some "notebook" program, > There is a "notebook" interface to maxima already: GNU TeXmacs. > Rather > than re-inventing all the relevant weels again, it would be better > to > improve it. TeXmacs is used as a common interface to a number of > free and > commercial CASs (maxima, axiom, yacas, giac, mathemagix, gtybalt, > macaulay, mathematica, maple, mupad, reduce...) and numerical and > graphical programs (octave, scilab, R, gnuplot, graphviz, ...). A > user can > cut-and-paste between them. Improvements made to TeXmacs will be > useful > not only to maxima, but to many other systems. A good project is a > smart > line-splitting in long output expressions. > > > 2/ help develop the links with the SAGE project (that puts together > > octave, maxima and others with the help of python) > > > > 2/ help develop the plotting capabilities and easiness of > maxima, in > > 2D and 3D through interactive gnuplot or other packages (like > VTK for > > 3D, plplot ...) > Here we definitely should use interfaces to existing plotting > packages, > not to re-invent the weel. The problem is there are so many of > them. Many > are good, but none is ideal (gnuplot, in particular, is not > ideal). We > should review the existing possibilities and choose one (or two) > which > seems the best, and then write some interface code on the maxima side. > > Andrey > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From dlakelan at street-artists.org Wed Jan 17 17:56:59 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 15:56:59 -0800 Subject: [Maxima] Frechet derivative of a differential operator in maxima? Message-ID: <20070117235659.GI29279@localhost.localdomain> Is there a package that computes the Frechet derivative of a differential operator? I think it would be relatively easy to define such a thing, but I admit I'm just beginning to get my head around the definition. It seems as though defining such a maxima function requires that a series of "depends" clauses be used to force diff to emit noun forms for certain derivatives. eg: depends(U,x); depends(delta,x); operator: diff(U,x,2) - diff(U,x) + U^2 ; foo: (subst(U+eps*delta,U,operator)-operator)/eps; ev(foo,diff); ratexpand(%,eps); limit(%,eps,0); 2 d delta ddelta (%o17) ------- - ------ + 2 delta U 2 dx dx How would one go about implementing this in general in maxima while remaining both idempotent, and "referentially transparent" (that is your program wouldn't alter the global environment or behave differently the second time through etc) It seems that the depends clauses make it difficult. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From David.Billinghurst at riotinto.com Wed Jan 17 19:00:27 2007 From: David.Billinghurst at riotinto.com (Billinghurst, David (RTATECH)) Date: Thu, 18 Jan 2007 12:00:27 +1100 Subject: [Maxima] Frechet derivative of a differential operator in maxima? Message-ID: <026DCC31AB859648A6F16C0E5CD2580DADC03E@calttsv025.cal.riotinto.org> > From: Daniel Lakeland > > Is there a package that computes the Frechet derivative of a > differential operator? I think it would be relatively easy to define > such a thing, but I admit I'm just beginning to get my head around the > definition. It seems as though defining such a maxima function > requires that a series of "depends" clauses be used to force diff to > emit noun forms for certain derivatives. > > eg: > > depends(U,x); > depends(delta,x); > operator: diff(U,x,2) - diff(U,x) + U^2 ; > > foo: (subst(U+eps*delta,U,operator)-operator)/eps; > ev(foo,diff); > ratexpand(%,eps); > limit(%,eps,0); > > 2 > d delta ddelta > (%o17) ------- - ------ + 2 delta U > 2 dx > dx > > > How would one go about implementing this in general in maxima while > remaining both idempotent, and "referentially transparent" (that is > your program wouldn't alter the global environment or behave > differently the second time through etc) It seems that the depends > clauses make it difficult. I think the pdiff package will do what you want. Some playing around below. See the docs in share/contrib/pdiff (%i1) load('pdiff); (%o1) /usr/local/share/maxima/5.11.0/share/contrib/pdiff/pdiff.lisp (%i2) op(U,x):=diff(U,x,2)-diff(U,x)+U^2; 2 (%o2) op(U, x) := diff(U, x, 2) - diff(U, x) + U (%i3) limit((op(U(x)+eps*d(x),x)-op(U(x),x))/eps,eps,0); (%o3) 2 d(x) U(x) + d (x) - d (x) (2) (1) (%i4) convert_to_diff(%); 2 d d (%o4) - -- (d(x)) + --- (d(x)) + 2 d(x) U(x) dx 2 dx NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. From dlakelan at street-artists.org Wed Jan 17 19:20:33 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 17:20:33 -0800 Subject: [Maxima] Frechet derivative of a differential operator in maxima? In-Reply-To: <026DCC31AB859648A6F16C0E5CD2580DADC03E@calttsv025.cal.riotinto.org> References: <026DCC31AB859648A6F16C0E5CD2580DADC03E@calttsv025.cal.riotinto.org> Message-ID: <20070118012033.GJ29279@localhost.localdomain> On Thu, Jan 18, 2007 at 12:00:27PM +1100, Billinghurst, David (RTATECH) wrote: > I think the pdiff package will do what you want. Some playing around below. > See the docs in share/contrib/pdiff woohoo, thanks. only problem, I can't load pdiff: load('pdiff); Could not find `mactex' using paths in file_search_maxima,file_search_lisp (combined values: [/home/dlakelan/.maxima/###.{mac,mc}, /usr/share/maxima/5.10.0/share/###.{mac,mc}, /usr/share/maxima/5.10.0/share/{a\ ....... etc On Debian, using the 5.10.0-6 packages for amd64 -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From David.Billinghurst at riotinto.com Wed Jan 17 19:48:43 2007 From: David.Billinghurst at riotinto.com (Billinghurst, David (RTATECH)) Date: Thu, 18 Jan 2007 12:48:43 +1100 Subject: [Maxima] Frechet derivative of a differential operator inmaxima? Message-ID: <026DCC31AB859648A6F16C0E5CD2580D736C24@calttsv025.cal.riotinto.org> > From: Daniel Lakeland > > > I think the pdiff package will do what you want. Some > playing around below. > > See the docs in share/contrib/pdiff > > woohoo, thanks. only problem, I can't load pdiff: > > load('pdiff); > > Could not find `mactex' using paths in > file_search_maxima,file_search_lisp > (combined values: [/home/dlakelan/.maxima/###.{mac,mc}, > /usr/share/maxima/5.10.0/share/###.{mac,mc}, > /usr/share/maxima/5.10.0/share/{a\ > ....... etc Works for me with (uninstalled) 5.10.0 (%i1) load('pdiff); (%o1) /usr/local/src/maxima-5.10.0/share/contrib/pdiff/pdiff.lisp and (%i1) load('mactex); (%o1) /usr/local/src/maxima-5.10.0/src/mactex.lisp NOTICE This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments. This notice should not be removed. From dlakelan at street-artists.org Wed Jan 17 20:36:51 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 18:36:51 -0800 Subject: [Maxima] General instability and segfaults etc Message-ID: <20070118023650.GK29279@localhost.localdomain> I've been using maxima heavily for the last week or two, mostly generating equations symbolically, and then doing numerical computations on them. I've been experiencing a lot of unstable behavior, getting errors like "memory might be damaged" or just segfaults. Unfortunately there isn't a common easily re-produceable factor. I believe that one factor is when I interrupt a maxima running in emacs using C-c C-c there is a small probability that the maxima session will crash (say between p = .1 and .2). I assume this is mostly a gcl problem. Does anyone interested in debugging want core files or what have you? -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From robert.dodier at gmail.com Wed Jan 17 22:00:47 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 17 Jan 2007 21:00:47 -0700 Subject: [Maxima] bfloat on symbolic expressions In-Reply-To: <8b356f880701161515l59af2efbkef1627549b056f9@mail.gmail.com> References: <8b356f880701161515l59af2efbkef1627549b056f9@mail.gmail.com> Message-ID: On 1/16/07, Stavros Macrakis wrote: > If you use bfloat on a symbolic expression, it normally converts all > included numbers into bfloats, e.g. > > bfloat(9*(x-2/3)*(x+2/3)) => 9.0b0 (x - 6.6667b-1) (x + 6.6667b-1) > bfloat(3.4*x) => 3.4b0*x > bfloat(sin(x+%pi*6/7)) => sin(x + 2.6928b0) > etc. > > But exponents are protected from this if the base is not a number: > > bfloat(2^(x+2/3)) => 2.0b0^(x+6.6666667b-1) > but > bfloat(q^(x+2/3)) => q^(x+2/3) > bfloat(q^2.3) => q^2.3 > > This is presumably to avoid things like > > bfloat(x^-1) => x^-1.0b0 (not current behavior) > bfloat(sqrt(x)) => x^0.5b0 (not current behavior) > etc. > > But it seems as though it would be better to continue to convert all > *approximate* numbers (not integers and rationals) in the exponent > since they contain an implicit precision. Inconsistency of the kind noted above is really one of the weakest aspects of Maxima. How about if just go ahead and bfloat every literal number, without exception? If it's really painful to see bfloat(sqrt(x)) => x^0.5b0 then we could rework bfloat to act on display representations instead of internal representations or something like that. > By the way, the behavior of 'float' is not entirely consistent with > that of bfloat in cases like this.... Well, we should try to get float and bfloat to act the same. I know that's easier said than done. I'm pretty sure there are bug reports in which, for some values of foo, exp(foo) doesn't yield a number even when numer and float are true. That kind of stuff is really frustrating, but it could be resolved pretty simply by cutting out the special cases for ?mexpt(%e, foo) and other special cases. For what it's worth, Robert From dlakelan at street-artists.org Wed Jan 17 23:38:22 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 17 Jan 2007 21:38:22 -0800 Subject: [Maxima] strange behavior in "rk": unable to evaluate the predicate errexp1 Message-ID: <20070118053822.GL29279@localhost.localdomain> I was working with the "rk" function just fine, then I re-derived my expressions using a hopefully more numerically stable expression, and now: (%i60) rknumeric; 2 1.5 2 2 1.5 (%o60) [hp, (- 0.016 (hp + 1) vx + 8900. hp vx - 55.62 h hp (hp + 1) 2 1.5 2 1.5 + 0.041 hp (hp + 1) + 0.29 h (hp + 1) + 55.62 h hp + 0.041 hp) 2 1.5 /(5.67 h (hp + 1) vx - 8900. h hp), - 2.1522E+7 hp vx - 2.1522E+7 h vp - 134500. h - 100.0] (%i61) solns:rk(rknumeric, [h,vx,hp], ev([h0*3,v0/3,-3e-4],ourproperties,numer,infeval), [x,0,1,.00002]); Maxima was unable to evaluate the predicate: errexp1 (%o61) [[0, 0.0011, 1.9964E-4, - 3.0E-4]] Any suggestions as to what this means? There is a bit of a pause before the error. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From sen1 at math.msu.edu Thu Jan 18 03:17:18 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 18 Jan 2007 04:17:18 -0500 (EST) Subject: [Maxima] strange behavior in "rk": unable to evaluate the predicate errexp1 In-Reply-To: <20070118053822.GL29279@localhost.localdomain> References: <20070118053822.GL29279@localhost.localdomain> Message-ID: Some comments: 1. Looking at your equations, it is hard to see where the commas are. It would be better to write the 3-vector of variables on three lines with the commas at the end of each line. 2. You didn't describe what ev([h0*3,v0/3,-3e-4],ourproperties,numer,infeval), means. Presumably, this sets some initial conditions. 3. The fractional powers may cause problems. I would guess that one of the following cases occurs. (a) the equations or initial conditions are not formed properly (again, it is hard to see from the output), (b) the solution starts to blow up (c) the solution reaches points where the right hand side gets large or is not defined. Since the documentation for "rk" states that if the solution gets large, then some list results whose length is the number time steps achieved so far, my guess is that situation (a) occurs. You only get a very short list--which indicates that not many steps were taken. HTH, -sen On Wed, 17 Jan 2007, Daniel Lakeland wrote: > I was working with the "rk" function just fine, then I re-derived my > expressions using a hopefully more numerically stable expression, and > now: > > (%i60) rknumeric; > 2 1.5 2 2 1.5 > (%o60) [hp, (- 0.016 (hp + 1) vx + 8900. hp vx - 55.62 h hp (hp + 1) > 2 1.5 2 1.5 > + 0.041 hp (hp + 1) + 0.29 h (hp + 1) + 55.62 h hp + 0.041 hp) > 2 1.5 > /(5.67 h (hp + 1) vx - 8900. h hp), > - 2.1522E+7 hp vx - 2.1522E+7 h vp - 134500. h - 100.0] > > (%i61) solns:rk(rknumeric, > [h,vx,hp], > ev([h0*3,v0/3,-3e-4],ourproperties,numer,infeval), > [x,0,1,.00002]); > > Maxima was unable to evaluate the predicate: > errexp1 > (%o61) [[0, 0.0011, 1.9964E-4, - 3.0E-4]] > > Any suggestions as to what this means? There is a bit of a pause > before the error. > > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From dlakelan at street-artists.org Thu Jan 18 09:30:52 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Thu, 18 Jan 2007 07:30:52 -0800 Subject: [Maxima] strange behavior in "rk": unable to evaluate the predicate errexp1 In-Reply-To: <20070118053822.GL29279@localhost.localdomain> References: <20070118053822.GL29279@localhost.localdomain> Message-ID: <20070118153052.GN29279@localhost.localdomain> On Wed, Jan 17, 2007 at 09:38:22PM -0800, Daniel Lakeland wrote: .... > - 2.1522E+7 hp vx - 2.1522E+7 h vp - 134500. h - 100.0] The error was with the "vp" above, which is one of the derivatives. I needed to re-substitute that expression during the re-derivation. With a little help from Robert Dodier I figured out what the error meant and when I looked in the variable "errexp1" it was obvious. > Maxima was unable to evaluate the predicate: > errexp1 I think this error message is confusing. I agree with not immediately dumping what might be a very long predicate, however perhaps a more helpful error message would be: Maxima was unable to evaluate a predicate. The predicate expression may be examined in the global variable "errexp1" -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From villate at fe.up.pt Thu Jan 18 11:38:30 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Thu, 18 Jan 2007 17:38:30 +0000 Subject: [Maxima] ODEs: rk routing with derivs on rhs In-Reply-To: <20070116060420.GC15125@localhost.localdomain> References: <20070115205213.GQ25287@street-artists.org> <20070116060420.GC15125@localhost.localdomain> Message-ID: <1169141910.5515.35.camel@localhost.localdomain> On Mon, 2007-01-15 at 22:04 -0800, Daniel Lakeland wrote: > Many thanks to sheldon who helped me reformulate the equations. It > turned out with the appropriate carefulness maxima could rearrange the > equations to be free of derivatives on the rhs. I think this is a case > of "you should have printed it out". Sometimes math is easier to do on > paper. > > Now, here's a simpler question: > > Why does "? rk" work on my machine at work (windows maxima 5.10) but > not at home (debian 5.10 with maxima-share package) > > On windows it tells me about the runge kutta routine in the "dynamics" > package. But even though everything is up to date on the debian > machine, ? rk only gives me > > ? rk > > -- System variable: tensorkill > Variable indicating if the tensor package has been initialized. > Set and used by `csetup', reset by `init_ctensor'. > > From raymond.toy at ericsson.com Thu Jan 18 11:38:37 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Thu, 18 Jan 2007 12:38:37 -0500 Subject: [Maxima] CL arrays In-Reply-To: (Robert Dodier's message of "Tue, 16 Jan 2007 20:58:13 -0700") References: Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> I think I'd prefer to make Lisp arrays invisible from the user's point Robert> of view. I'd like to rework lists and matrices to use arrays for Robert> storage, but without exposing the underlying array. I can understand having matrices stored in arrays instead of lists of lists, but why would you want lists to use arrays for storage? Ray From villate at fe.up.pt Thu Jan 18 12:05:14 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Thu, 18 Jan 2007 18:05:14 +0000 Subject: [Maxima] [Fwd: Re: ODEs: rk routing with derivs on rhs] Message-ID: <1169143514.5515.38.camel@localhost.localdomain> -------------- next part -------------- An embedded message was scrubbed... From: "Jaime E. Villate" Subject: Re: [Maxima] ODEs: rk routing with derivs on rhs Date: Thu, 18 Jan 2007 18:03:40 +0000 Size: 1628 Url: http://www.math.utexas.edu/pipermail/maxima/attachments/20070118/93211a54/attachment.eml From thilts33 at telus.net Thu Jan 18 14:55:25 2007 From: thilts33 at telus.net (Ted Hilts) Date: Thu, 18 Jan 2007 13:55:25 -0700 Subject: [Maxima] Release 5_11_0 base requirements -- Re: gcc-3.3.1 Message-ID: <45AFDEBD.9000405@telus.net> Is anyone looking into the issue with GCC. If the more recent GCC releases won't run with Maxima we need to communicate with the GCC team so that all the components in Maxima build are recent otherwise we are building releases on old source and this can lead to difficulties up the road? Re: ~/maxima/INSTALL.win32. The install instructions require that 3.3.1 and specific bin utils versions be installed. I had difficulty in even finding a 3.3.1 binary package to install for win32 because it is now obsolete. Have a great day, Ted From thilts33 at telus.net Thu Jan 18 15:08:08 2007 From: thilts33 at telus.net (Ted Hilts) Date: Thu, 18 Jan 2007 14:08:08 -0700 Subject: [Maxima] Multiple Releases Anyone? Message-ID: <45AFE1B8.8030804@telus.net> Has anyone installed and maintained multiple versions of Maxima on the same machine and partition? I want to compare various versions of Maxima while keeping a unique path for each while bringing several versions up all in different windows. Is this easily achievable? Otherwise it looks like a not so nice alternative would be Xen virtualizing different instances of Maxima taken from different partitions. I don't think the latter would run into any problems and access would be on the same machine using a single console for each instance. Thanks -- Ted From toy.raymond at gmail.com Thu Jan 18 18:46:50 2007 From: toy.raymond at gmail.com (Raymond Toy) Date: Thu, 18 Jan 2007 19:46:50 -0500 Subject: [Maxima] Multiple Releases Anyone? In-Reply-To: <45AFE1B8.8030804@telus.net> References: <45AFE1B8.8030804@telus.net> Message-ID: <45B014FA.4040908@gmail.com> Ted Hilts wrote: > Has anyone installed and maintained multiple versions of Maxima on the > same machine and partition? > > I want to compare various versions of Maxima while keeping a unique > path for each while bringing several versions up all in different > windows. Is this easily achievable? Otherwise it looks like a not so > I just stick them in different directories. I see from the maxima script that different versions are installed in different directories anyway, so you should be able to use different versions using the --use-version option. Ray From sen1 at math.msu.edu Thu Jan 18 21:40:44 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 18 Jan 2007 22:40:44 -0500 (EST) Subject: [Maxima] Multiple Releases Anyone? In-Reply-To: <45AFE1B8.8030804@telus.net> References: <45AFE1B8.8030804@telus.net> Message-ID: > Has anyone installed and maintained multiple versions of Maxima on the > same machine and partition? > > I want to compare various versions of Maxima while keeping a unique > path for each while bringing several versions up all in different > windows. Is this easily achievable? Otherwise it looks like a not so > nice alternative would be Xen virtualizing different instances of Maxima > taken from different partitions. I don't think the latter would run > into any problems and access would be on the same machine using a single > console for each instance. > > Thanks -- Ted > Are you doing this in Unix, or in Windows. With the Win installer, you automatically get different versions in your program list. In unix, I unpack the source tar.gz files. That puts them in different directories. You can do a configure, make install in one directory, say /usr/local/src/maxima-5.10.0 . This puts the three files maxima, xmaxima, and rmaxima in /usr/local/bin. Now, you can go into /usr/local/bin and make copies of these files, say to maxima-5.10.0, rmaxima-5.10.0, and xmaxima-5.10.0 Now, go back to /usr/local/src/maxima-5.10.0 and do make uninstall Then, go into, say /usr/local/src/maxima-5.11.0 and repeat the configure; make install Go into /usr/local/bin and make copies of the files maxima, rmaxima, xmaxima to maxima-5.11.0, rmaxima-5.11.0, xmaxima-5.11.0 You now have both versions installed and ready to go. It may be easier to use Ray's suggestion of "use-version". I don't know. The method I just described is what I use for setting things up with different lisp versions. Again, there is a way to choose the lisp version at run time. I prefer what I suggested so I don't get confused in doing many runs. You can, of course, find out which version you are using by the build_info() command. -sen > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From vvzhy at mail.ru Thu Jan 18 23:27:16 2007 From: vvzhy at mail.ru (Vadim V. Zhytnikov) Date: Fri, 19 Jan 2007 08:27:16 +0300 Subject: [Maxima] Release 5_11_0 base requirements -- Re: gcc-3.3.1 In-Reply-To: <45AFDEBD.9000405@telus.net> References: <45AFDEBD.9000405@telus.net> Message-ID: <45B056B4.8060101@mail.ru> Ted Hilts writes: > Is anyone looking into the issue with GCC. If the more recent GCC > releases won't run with Maxima we need to communicate with the GCC team > so that all the components in Maxima build are recent otherwise we are > building releases on old source and this can lead to difficulties up the > road? Re: ~/maxima/INSTALL.win32. The install instructions require that > 3.3.1 and specific bin utils versions be installed. I had difficulty in > even finding a 3.3.1 binary package to install for win32 because it is > now obsolete. > Do you mean GCL or MinGW team? I was involved a bit in testing GCL on Windows and I have to say 1. Getting stable GCL build on Windows is a tricky business. By stable I mean version which not only compile but also doesn't crash sporadically. These old gcc and binutils pair was the only acceptable combination found. I don't claim that other more up to date gcc/binutils will not work. Someone have to test it and possess enough skill to find a fix if something goes wrong. But 2. AFAIK GCL at present lack Windows maintainer. Former Windows maintainer Mike Thomas resigned from the project a few weeks ago. -- Vadim V. Zhytnikov From robert.dodier at gmail.com Thu Jan 18 23:59:19 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 18 Jan 2007 22:59:19 -0700 Subject: [Maxima] CL arrays In-Reply-To: References: Message-ID: On 1/18/07, Raymond Toy wrote: > Robert> I think I'd prefer to make Lisp arrays invisible from the user's point > Robert> of view. I'd like to rework lists and matrices to use arrays for > Robert> storage, but without exposing the underlying array. > > I can understand having matrices stored in arrays instead of lists of > lists, but why would you want lists to use arrays for storage? Well, time to access an element is constant (I hope) but time to access a list element depends on the position of the element -- it takes longer to get to the elements at the end of the list. The time to get the n-th element might be logarithmic or linear or something else, but for various Lisp implementations that I've looked at, it's not constant. I'm not sure at this point if constant- time access for lists is worth the trouble, but I also don't want to rule it out. best Robert From william.wood3 at comcast.net Fri Jan 19 01:36:44 2007 From: william.wood3 at comcast.net (Bill Wood) Date: Fri, 19 Jan 2007 01:36:44 -0600 Subject: [Maxima] CL arrays In-Reply-To: References: Message-ID: <1169192205.3067.14.camel@localhost> On Thu, 2007-01-18 at 22:59 -0700, Robert Dodier wrote: . . . > Well, time to access an element is constant (I hope) but time > to access a list element depends on the position of the element -- > it takes longer to get to the elements at the end of the list. > The time to get the n-th element might be logarithmic or linear > or something else, but for various Lisp implementations that I've > looked at, it's not constant. I'm not sure at this point if constant- > time access for lists is worth the trouble, but I also don't want to > rule it out. But, but, isn't that why lisp has arrays? When you want random access with constant access time and static size, use an array; when you want sequential access and dynamic size, use a (usually singly-linked) list. Think of the number of times an array is used in a loop with an index blithely marching up from 0 -- why not cdr down a list instead. The language provides two different data structures with different characteristics; the programmer's job is to make the right choice. I'm using Python a little now, and its decision to call arrays lists drives me nuts. List operations are provided with unknown and unreliable performance characteristics. Part of the problem with Python's "list" type is that dynamic operations are provided, but the representation is a C array; as a result when dynamic operations are used copying with resizing occurs under the hood, at great cost. To my mind that makes Python a bad choice for any application where predictable performance matters at all (not just performance critical tasks). -- Bill Wood From coolens at kahosl.be Fri Jan 19 04:21:05 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Fri, 19 Jan 2007 11:21:05 +0100 (CET) Subject: [Maxima] [newbie-question] How to import a datafile for lsquares In-Reply-To: <1169192205.3067.14.camel@localhost> References: <1169192205.3067.14.camel@localhost> Message-ID: I'd like to perform quadratic regression analysis on a datafile which is made as follows: 2 -3.33333e-01 3 -5.00000e-01 4 -7.23607e-01 5 -1.00000e+00 6 -1.32799e+00 . . . I already found in the archives that regression analysis can be performed by means of the lsquares package. Can anyone tell me how to import the datafile in maxima (preferably without the need of another package)? regards, hugo From kirr at landau.phys.spbu.ru Fri Jan 19 05:56:18 2007 From: kirr at landau.phys.spbu.ru (Kirill Smelkov) Date: Fri, 19 Jan 2007 14:56:18 +0300 Subject: [Maxima] [newbie] Question about quoting Message-ID: <20070119115618.GA14195@landau.phys.spbu.ru> Hello All, I have a quistion about quoting. (%i1) G(x) := x^3 + x^2; 3 2 (%o1) G(x) := x + x (%i2) F: G$ *** The question is: how to construct 'G(x) using F? A seems-to-be-right for me answer is wrong: (%i3) noundisp: true$ (%i4) '(''F)(x); (%o4) G(x) (%i5) 'G(x) - '(''F)(x); (%o5) 'G(x) - G(x) From lisp point of view they are different (note %g vs $g): (%i6) :lisp #$'G(x)$; ((%g SIMP) $X) (%i7) :lisp #$'(''F)(x)$; (($g SIMP) $X) extra quoting doesn't help: (%i8) 'G(x) - '('(''F))(x); (%o8) 'G(x) - 'G(x) (%i9) ev(%); (%o9) 'G(x) - G(x) but (%i10) 'G(x) - 'G(x); (%o10) 0 and (%i11) :lisp #$'('(''F))(x)$; ((MQAPPLY SIMP) ((MQUOTE SIMP) $g) $X) Please help! -- ????? ????????, ??????. http://landau.phys.spbu.ru/~kirr/aiv/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070119/46671b79/attachment-0001.pgp From michel.vandenbergh at uhasselt.be Fri Jan 19 06:21:25 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 19 Jan 2007 13:21:25 +0100 Subject: [Maxima] CL arrays References: eb9c4b9a0701182159j6ac00e0bq47b1e9264dd95966@mail.gmail.com Message-ID: <45B0B7C5.1020003@uhasselt.be> > > I'm using Python a little now, and its decision to call arrays lists > drives me nuts. List operations are provided with unknown and unreliable > performance characteristics. Part of the problem with Python's "list" > type is that dynamic operations are provided, but the representation is > a C array; as a result when dynamic operations are used copying with > resizing occurs under the hood, at great cost. To my mind that makes > Python a bad choice for any application where predictable performance > matters at all (not just performance critical tasks). > > If you want to use python for numeric applications you should use Numeric python (import Numeric). This package has genuine arrays. Michel From willisb at unk.edu Fri Jan 19 06:25:10 2007 From: willisb at unk.edu (Barton Willis) Date: Fri, 19 Jan 2007 06:25:10 -0600 Subject: [Maxima] CL arrays In-Reply-To: <1169192205.3067.14.camel@localhost> References: , <1169192205.3067.14.camel@localhost> Message-ID: Mostly off topic, but here are timings for three ways to sum the members of a list or an array. (%i1) p : makelist(k,k,0,9999)$ (%i2) s : 0$ (%i3) showtime : all$ (%i4) for pk in p do s : s + pk; Evaluation took 00.60 seconds (00.60 elapsed) (%i6) s : 0$ (%i7) for i : 1 thru 10000 do s : s + p[i]; Evaluation took 5.47 seconds (5.47 elapsed) (%i9) f : make_array('fixnum,10000)$ (%i10) fillarray(f,p)$ (%i11) s : 0$ (%i12) for i : 0 thru 9999 do s : s + f[i]; Evaluation took 0.11 seconds (0.11 elapsed) Barton From michel.vandenbergh at uhasselt.be Fri Jan 19 06:30:23 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 19 Jan 2007 13:30:23 +0100 Subject: [Maxima] CL arrays References: eb9c4b9a0701182159j6ac00e0bq47b1e9264dd95966@mail.gmail.com Message-ID: <45B0B9DF.2050506@uhasselt.be> > > I'm using Python a little now, and its decision to call arrays lists > drives me nuts. List operations are provided with unknown and unreliable > performance characteristics. Part of the problem with Python's "list" > type is that dynamic operations are provided, but the representation is > a C array; as a result when dynamic operations are used copying with > resizing occurs under the hood, at great cost. To my mind that makes > Python a bad choice for any application where predictable performance > matters at all (not just performance critical tasks). Oh I see: you are not complaining about arrays but about lists! Making a list class in python whose instances behave like lisp list objects (constant cons time) is easy if you really need that. Its probably not even hard to hard to implement a subset of lisp in python. Python is really quite powerful. Michel From willisb at unk.edu Fri Jan 19 06:34:47 2007 From: willisb at unk.edu (Barton Willis) Date: Fri, 19 Jan 2007 06:34:47 -0600 Subject: [Maxima] [newbie] Question about quoting In-Reply-To: <20070119115618.GA14195@landau.phys.spbu.ru> References: <20070119115618.GA14195@landau.phys.spbu.ru> Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >I have a quistion about quoting. > >(%i1) G(x) := x^3 + x^2; > 3 2 >(%o1) G(x) := x + x >(%i2) F: G$ > > >*** The question is: how to construct 'G(x) using >F? Maybe the function 'nounify' will help: (%i1) G(x) := x^3 + x^2$ (%i2) F : G$ (%i3) nounify(F)(x); (%o3) G(x) (%i4) ?print(%); ((|%g| SIMP) $X) (%o4) G(x) (%i5) 'G(x); (%o5) G(x) (%i6) ?print(%); ((|%g| SIMP) $X) (%o6) G(x) Barton From kirr at landau.phys.spbu.ru Fri Jan 19 07:39:03 2007 From: kirr at landau.phys.spbu.ru (Kirill Smelkov) Date: Fri, 19 Jan 2007 16:39:03 +0300 Subject: [Maxima] [newbie] Question about quoting In-Reply-To: References: <20070119115618.GA14195@landau.phys.spbu.ru> Message-ID: <20070119133902.GA16290@landau.phys.spbu.ru> On Fri, Jan 19, 2007 at 06:34:47AM -0600, Barton Willis wrote: > >I have a quistion about quoting. > > > >(%i1) G(x) := x^3 + x^2; > > 3 2 > >(%o1) G(x) := x + x > >(%i2) F: G$ > > > > > >*** The question is: how to construct 'G(x) using > >F? > > Maybe the function 'nounify' will help: > > (%i1) G(x) := x^3 + x^2$ > (%i2) F : G$ > (%i3) nounify(F)(x); > (%o3) G(x) > (%i4) ?print(%); > ((|%g| SIMP) $X) > (%o4) G(x) > (%i5) 'G(x); > (%o5) G(x) > (%i6) ?print(%); > ((|%g| SIMP) $X) > (%o6) G(x) > > Barton Thanks Barton, nounify helps! -- ????? ????????, ??????. http://landau.phys.spbu.ru/~kirr/aiv/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070119/def906fe/attachment.pgp From raymond.toy at ericsson.com Fri Jan 19 07:40:23 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 19 Jan 2007 08:40:23 -0500 Subject: [Maxima] CL arrays In-Reply-To: (Robert Dodier's message of "Thu, 18 Jan 2007 22:59:19 -0700") References: Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/18/07, Raymond Toy wrote: Robert> I think I'd prefer to make Lisp arrays invisible from the user's point Robert> of view. I'd like to rework lists and matrices to use arrays for Robert> storage, but without exposing the underlying array. >> >> I can understand having matrices stored in arrays instead of lists of >> lists, but why would you want lists to use arrays for storage? Robert> Well, time to access an element is constant (I hope) but time Robert> to access a list element depends on the position of the element -- Robert> it takes longer to get to the elements at the end of the list. Robert> The time to get the n-th element might be logarithmic or linear Robert> or something else, but for various Lisp implementations that I've Robert> looked at, it's not constant. I'm not sure at this point if constant- Robert> time access for lists is worth the trouble, but I also don't want to Robert> rule it out. Ok, but then the time to insert an element at the beginning of a list isn't constant anymore. Hmm. But I see that I don't know the maxima equivalent of Lisp's cons and/or push, so maybe insertion at the beginning of a list can't be done in constant time like in Lisp. Ray From nicolas.pettiaux at ael.be Fri Jan 19 08:15:10 2007 From: nicolas.pettiaux at ael.be (Nicolas Pettiaux) Date: Fri, 19 Jan 2007 15:15:10 +0100 Subject: [Maxima] Maxima and encarta Message-ID: Some of you may now the microsoft encyclopedia Encarta. I have seen yesterday a demo of the new version that includes a CAS. There are 2 front ends, one conventional and another one that looks like a small digit computing platform (like the old TI30). One interesting point is that it provides the solution of an equation but also, optionnally, some tracing of the needed operations to go from the problem to the solution, helping the user (eventually a student) to grasp the method that has been used. I was wondering if any such tool for tracing and providing textual explanation of the method exist in maxima or would be difficult to write. I was yesterday evidently dreaming that maxima replace encarta asap :-) Thanks, Nicolas -- Nicolas Pettiaux - email: nicolas.pettiaux at ael.be From sen1 at math.msu.edu Fri Jan 19 09:17:19 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Fri, 19 Jan 2007 10:17:19 -0500 (EST) Subject: [Maxima] another question about maxima and lisp Message-ID: Hello, I am just learning lisp, so I have some (possibly very naive) questions about how maxima interacts with various lisps. It seems that there are standard macro defintions somewhere, but I don't know where they are. So, here is something very simple I would like to understand. In maxima, one can get the following lines (%i5) f(x):= x^2; 2 (%o5) f(x) := x (%i6) ?print(%); ((MDEFINE SIMP) (($F) $X) ((MEXPT) $X 2)) So, the function (latex notation) $f(x) = x^2$ has the (I suppose) maxima lisp representation as ((MDEFINE SIMP) (($F) $X) ((MEXPT) $X 2)) In gcl, one would define this function as (defun f (x) (expt x 2)) Of course there is a similarity, but these are *not* the same. Where are the definitions of MDEFINE, MPLUS, MEXPT etc. in the maxima package. Or, are they somewhere else? Also, what does the SIMP symbol mean? TIA, -sen -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From macrakis at alum.mit.edu Fri Jan 19 09:30:43 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 19 Jan 2007 10:30:43 -0500 Subject: [Maxima] CL arrays In-Reply-To: References: Message-ID: <8b356f880701190730m54ac932fk57670f483455450a@mail.gmail.com> Some operations that are efficient on lists and less efficient on arrays: cons(q,l) append(l1,l2) (also shares structure of l2 with other uses) delete(b,l) merge sort Some operations that are efficient on arrays and less efficient on lists: l[n] l[n]: 5 binary search in-place sort For small lists/arrays, in many applications, it simply doesn't matter. I agree with Robert that we should move to a system where the abstract concept is primary, and the underlying implmentation secondary. Ideally, we would have representation be "advice" to the system which does not change semantics, only performance, e.g. declare( li, listarray) declare( ar, arrayarray) li: ar: [1,2,3]$ length(li) = length(ar) = 3 li => [1,2,3] ar => [1,2,3] append(li,ar) => [1,2,3,1,2,3] (what are the sharing semantics here?) (what is the representation of the intermediate result?) etc. -s From robert.dodier at gmail.com Fri Jan 19 09:57:19 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 19 Jan 2007 08:57:19 -0700 Subject: [Maxima] [newbie-question] How to import a datafile for lsquares In-Reply-To: References: <1169192205.3067.14.camel@localhost> Message-ID: On 1/19/07, Hugo Coolens wrote: > I already found in the archives that regression analysis can be performed > by means of the lsquares package. Can anyone tell me how to import the > datafile in maxima (preferably without the need of another package)? I think what you want is read_matrix, in the numericalio package. So you have to enter load(numericalio) before calling read_matrix. (%i8) ? read_matrix -- Function: read_matrix () -- Function: read_matrix (, ) Reads the file and returns its entire content as a matrix. If is not specified, the file is assumed space-delimited. `read_matrix' infers the size of the matrix from the input data. Each line of the file becomes one row of the matrix. If some lines have different lengths, `read_matrix' complains. Hope this helps, Robert Dodier From spluque at gmail.com Fri Jan 19 10:32:31 2007 From: spluque at gmail.com (Seb) Date: Fri, 19 Jan 2007 10:32:31 -0600 Subject: [Maxima] error on first line sent to maxima References: <871wlzak48.fsf@patagonia.sebmags.homelinux.org> <87ac0mgvhe.fsf@vh213602.truman.edu> Message-ID: <874pqngeow.fsf@patagonia.sebmags.homelinux.org> On Sat, 13 Jan 2007 21:03:57 -0600, Jay Belanger wrote: [...] > Since things work fine here, could you supply more details? What > version of maxima-emacs? Is emacs-snapshot the same as cvs emacs? What > exactly did you type in? If you work with a newly started emacs, start > maxima (M-x maxima, say) and type in a simple command (2+2; RET, for > example), do you have the problem? Sorry for the delay, I couldn't get back earlier. Yes, emacs-snapshot is the same as cvs emacs. Basically, _any_ expression I type in at the first maxima prompt (or send to the process from a script file) causes the problem. I think I may have isolated the issue, and it's related to this code in my ~/.emacs: (require 'ansi-color) (setq ansi-color-for-comint-mode t) Checking further: ,-----[ C-h v ansi-color-for-comint-mode RET ] | ansi-color-for-comint-mode is a variable defined in `ansi-color.el'. | Its value is t | | | Documentation: | Determines what to do with comint output. | If nil, do nothing. | If the symbol `filter', then filter all SGR control sequences. | If anything else (such as t), then translate SGR control sequences | into text-properties. | | In order for this to have any effect, `ansi-color-process-output' must | be in `comint-output-filter-functions'. | | This can be used to enable colorized ls --color=yes output | in shell buffers. You set this variable by calling one of: | M-x ansi-color-for-comint-mode-on | M-x ansi-color-for-comint-mode-off | M-x ansi-color-for-comint-mode-filter | | You can customize this variable. | | [back] `----- and: ,-----[ C-h v comint-output-filter-functions RET ] | comint-output-filter-functions is a variable defined in `comint.el'. | Its value is | (inferior-maxima-output-filter ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) | | | | Documentation: | Functions to call after output is inserted into the buffer. | One possible function is `comint-postoutput-scroll-to-bottom'. | These functions get one argument, a string containing the text as originally | inserted. Note that this might not be the same as the buffer contents between | `comint-last-output-start' and the buffer's `process-mark', if other filter | functions have already modified the buffer. | | See also `comint-preoutput-filter-functions'. | | You can use `add-hook' to add functions to this list | either globally or locally. | | [back] `----- So I wonder if inferior-maxima-output-filter should be after ansi-color-process-output? Thanks, -- Seb From michel.vandenbergh at uhasselt.be Fri Jan 19 10:44:29 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 19 Jan 2007 17:44:29 +0100 Subject: [Maxima] CL arrays References: sxdmz4f16ew.fsf@rtp.ericsson.se Message-ID: <45B0F56D.7040702@uhasselt.be> Stavros wrote > For small lists/arrays, in many applications, it simply doesn't > matter. I agree with Robert that we should move to a system where the > abstract concept is primary, and the underlying implmentation > secondary. Ideally, we would have representation be "advice" to the > system which does not change semantics, only performance, e.g. > > If you do this ***please*** get rid of the current maxima arrays which are stored in the property list. Lists are stored in the value cell. If you do not unify this it will be very hard to give arrays and lists similar semantics. Michel From spluque at gmail.com Fri Jan 19 10:47:01 2007 From: spluque at gmail.com (Seb) Date: Fri, 19 Jan 2007 10:47:01 -0600 Subject: [Maxima] error on first line sent to maxima References: <871wlzak48.fsf@patagonia.sebmags.homelinux.org> <87ac0mgvhe.fsf@vh213602.truman.edu> <874pqngeow.fsf@patagonia.sebmags.homelinux.org> Message-ID: <87sle7ezga.fsf@patagonia.sebmags.homelinux.org> On Fri, 19 Jan 2007 10:32:31 -0600, Seb wrote: [...] > Sorry for the delay, I couldn't get back earlier. Yes, emacs-snapshot > is the same as cvs emacs. Basically, _any_ expression I type in at the > first maxima prompt (or send to the process from a script file) causes > the problem. I should have mentioned that this occurs only with the first input in a maxima session; further input is processed without problem. [...] > So I wonder if inferior-maxima-output-filter should be after > ansi-color-process-output? I think inferior-maxima-output-filter is put at the front of ansi-color-process-output by maxima.el, as I have not customized this variable. Cheers, -- Seb From raymond.toy at ericsson.com Fri Jan 19 11:24:14 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 19 Jan 2007 12:24:14 -0500 Subject: [Maxima] another question about maxima and lisp In-Reply-To: (sen1@math.msu.edu's message of "Fri, 19 Jan 2007 10:17:19 -0500 (EST)") References: Message-ID: >>>>> "sen1" == sen1 writes: sen1> In gcl, one would define this function as sen1> (defun f (x) (expt x 2)) sen1> Of course there is a similarity, but these are *not* the same. Yes, they would only do the samething if x is a real number. sen1> Where are the definitions of sen1> MDEFINE, MPLUS, MEXPT etc. in the maxima package. This is how maxima represents things; they are not functions. MPLUS is just a symbol to say that the following objects are added. So the Lisp list ((mplus) '$x 2) is how maxima represents x + 2. sen1> Also, what does the sen1> SIMP sen1> symbol mean? I think it's a indicator to maxima's simplifier that the expression has already been simplified so there's no need to (recursively) look at the rest of the list to simplify more. This stuff is partially documented at http://maxima.sourceforge.net/wiki/index.php/Maxima%20internals Ray From raymond.toy at ericsson.com Fri Jan 19 11:29:21 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 19 Jan 2007 12:29:21 -0500 Subject: [Maxima] CL arrays In-Reply-To: <8b356f880701190730m54ac932fk57670f483455450a@mail.gmail.com> (Stavros Macrakis's message of "Fri, 19 Jan 2007 10:30:43 -0500") References: <8b356f880701190730m54ac932fk57670f483455450a@mail.gmail.com> Message-ID: >>>>> "Stavros" == Stavros Macrakis writes: Stavros> For small lists/arrays, in many applications, it simply doesn't Stavros> matter. I agree with Robert that we should move to a system where the Stavros> abstract concept is primary, and the underlying implmentation Stavros> secondary. Ideally, we would have representation be "advice" to the I agree with this abstract concept. Except I think lists should be lists and arrays should be arrays. Perhaps because I know Lisp far better than I know Maxima, so I like lists that are lists. :-) Stavros> system which does not change semantics, only performance, e.g. Stavros> declare( li, listarray) Stavros> declare( ar, arrayarray) Stavros> li: ar: [1,2,3]$ Stavros> length(li) = length(ar) = 3 Stavros> li => [1,2,3] Stavros> ar => [1,2,3] Stavros> append(li,ar) => [1,2,3,1,2,3] Stavros> (what are the sharing semantics here?) Stavros> (what is the representation of the intermediate result?) Stavros> etc. While this might be a nice idea, I, for one, would be way to lazy to modify all the functions that take lists to also accept arrays and vice versa and making them work reasonably fast for lists and arrays. Ray From macrakis at alum.mit.edu Fri Jan 19 11:37:56 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 19 Jan 2007 12:37:56 -0500 Subject: [Maxima] another question about maxima and lisp In-Reply-To: References: Message-ID: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> > In maxima, one can get the following lines > (%i5) f(x):= x^2; > 2 > (%o5) f(x) := x > (%i6) ?print(%); > ((MDEFINE SIMP) (($F) $X) ((MEXPT) $X 2)) > > So, the function (latex notation) $f(x) = x^2$ has the (I suppose) > maxima lisp representation as > > ((MDEFINE SIMP) (($F) $X) ((MEXPT) $X 2)) I'm not sure what the relevance of the Latex form is here, but... > In gcl, one would define this function as > (defun f (x) (expt x 2)) > Of course there is a similarity, but these are *not* the same. They are very different. In Lisp, "expt" is a function which gets executed. In Maxima, mexpt is an expression constructor which is simplified. There is not mexpt function in Maxima -- it *represents* exponentiation. To evaluate (expt x 2), Lisp calls an internal function on the value of x (which must be a number) and 2. To evaluate ((mexpt) x 2), Maxima first substitutes the value of x into that expression giving, e.g. ((mexpt) 3 2). The main simplifier routine looks up the simplification routine for mexpt, which is on its property list. simpexpt then transforms that expression to 9. In the case of a symbolic expression, Lisp of course will simply give an error. The Maxima expression f(2*y) first evaluates and simplifies the argument 2*y, giving ((mtimes simp) 2 $y) It then substitutes that value for the formal variable $x, giving ((mexpt) ((mtimes simp) 2 $y) 2) Conceptually, the simpexpt routine transforms this to ((mtimes) ((mexpt) 2 2) ((mexpt simp) $y 2)) The inner ((mexpt) 2 2) is simplified to 4, and the overall expression is simplified by simptimes to ((mtimes simp) 4 ((mexpt simp) $y 2)) I hope that makes things clearer. If you want to see this in action, try f(x):=x^2$ ?trace(?meval,?simplifya,?simptimes,?simplus)$ f(2*y)$ To turn off Lisp tracing, ?untrace() -s From macrakis at alum.mit.edu Fri Jan 19 11:39:40 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 19 Jan 2007 12:39:40 -0500 Subject: [Maxima] another question about maxima and lisp In-Reply-To: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> References: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> Message-ID: <8b356f880701190939w7a5848a3j7d26a104ea0ac468@mail.gmail.com> > ?trace(?meval,?simplifya,?simptimes,?simplus)$ Sorry, I meant ?trace(?meval,?simplifya,?simptimes,?simpexpt)$ From sen1 at math.msu.edu Fri Jan 19 15:58:45 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Fri, 19 Jan 2007 16:58:45 -0500 (EST) Subject: [Maxima] another question about maxima and lisp In-Reply-To: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> References: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> Message-ID: On Fri, 19 Jan 2007, Stavros Macrakis wrote: [snip] >> >> So, the function (latex notation) $f(x) = x^2$ has the (I suppose) >> maxima lisp representation as The latex form is simply so we don't get confused in thinking that the expression is in some form representable in lisp or maxima. I could have written simply f(x) = x^2 -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From sen1 at math.msu.edu Fri Jan 19 16:11:43 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Fri, 19 Jan 2007 17:11:43 -0500 (EST) Subject: [Maxima] another question about maxima and lisp In-Reply-To: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> References: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> Message-ID: Thanks for the information. I would still like to know where SIMP, MEXPT, MDEFINE etc are defined in the source files. -sen On Fri, 19 Jan 2007, Stavros Macrakis wrote: >> In maxima, one can get the following lines >> (%i5) f(x):= x^2; >> 2 >> (%o5) f(x) := x >> (%i6) ?print(%); >> ((MDEFINE SIMP) (($F) $X) ((MEXPT) $X 2)) >> >> So, the function (latex notation) $f(x) = x^2$ has the (I suppose) >> maxima lisp representation as >> >> ((MDEFINE SIMP) (($F) $X) ((MEXPT) $X 2)) > > I'm not sure what the relevance of the Latex form is here, but... > >> In gcl, one would define this function as >> (defun f (x) (expt x 2)) >> Of course there is a similarity, but these are *not* the same. > > They are very different. In Lisp, "expt" is a function which gets > executed. In Maxima, mexpt is an expression constructor which is > simplified. There is not mexpt function in Maxima -- it *represents* > exponentiation. > > To evaluate (expt x 2), Lisp calls an internal function on the value > of x (which must be a number) and 2. > > To evaluate ((mexpt) x 2), Maxima first substitutes the value of x > into that expression giving, e.g. ((mexpt) 3 2). The main simplifier > routine looks up the simplification routine for mexpt, which is on its > property list. simpexpt then transforms that expression to 9. > > In the case of a symbolic expression, Lisp of course will simply give an error. > > The Maxima expression f(2*y) first evaluates and simplifies the > argument 2*y, giving > ((mtimes simp) 2 $y) > It then substitutes that value for the formal variable $x, giving > ((mexpt) ((mtimes simp) 2 $y) 2) > Conceptually, the simpexpt routine transforms this to > ((mtimes) ((mexpt) 2 2) ((mexpt simp) $y 2)) > The inner ((mexpt) 2 2) is simplified to 4, and the overall expression > is simplified by simptimes to > ((mtimes simp) 4 ((mexpt simp) $y 2)) > > I hope that makes things clearer. > > If you want to see this in action, try > > f(x):=x^2$ > ?trace(?meval,?simplifya,?simptimes,?simplus)$ > f(2*y)$ > > To turn off Lisp tracing, ?untrace() > > -s > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From raymond.toy at ericsson.com Fri Jan 19 16:47:18 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Fri, 19 Jan 2007 17:47:18 -0500 Subject: [Maxima] another question about maxima and lisp In-Reply-To: (sen1@math.msu.edu's message of "Fri, 19 Jan 2007 17:11:43 -0500 (EST)") References: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> Message-ID: >>>>> "sen1" == sen1 writes: sen1> Thanks for the information. sen1> I would still like to know where sen1> SIMP, MEXPT, MDEFINE sen1> etc are defined in the source files. They're Lisp symbols used only as symbols. So they're not really "defined" anywhere.[1] Ray Footnotes: [1] Well, the symbol will get created the first time the reader finds it, so I guess it's defined in the first file that's compiled that contains that symbol. In a more modern style, there would be a defpackage form that would list exported symbols, and these symbols would probably be there. From macrakis at alum.mit.edu Fri Jan 19 17:28:55 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 19 Jan 2007 18:28:55 -0500 Subject: [Maxima] another question about maxima and lisp In-Reply-To: References: <8b356f880701190937m184e170eg9083905abdfd4919@mail.gmail.com> Message-ID: <8b356f880701191528j74bbebb3ra508271cfc3e0e09@mail.gmail.com> On 1/19/07, Raymond Toy wrote: > sen1> I would still like to know where > sen1> SIMP, MEXPT, MDEFINE > sen1> etc are defined in the source files. MDEFINE is the only one of these which is actually an executable function. I'd recommend you use etags with Emacs to find symbols in the source easily, but... it is defined in mlisp.lisp. All it really does is set the function property of the relevant symbol, just like Lisp's Defun. It is a bit more complicated because it also handles memoizing functions like f[i](x):=.... It has nothing to do with *applying* the function. MEXPT and SIMP are not defined in one place. They are defined by their behavior. I suppose you could say that MEXPT is defined by simpexpt (in simp.lisp), but there are many other functions that "know about" MEXPT. So, for example, log(x^2) simplifies to 2*log(x) in simpln. The SIMP flag is in some sense it is 'defined' by simplifya (also in simp.lisp), in that most of the differences between expressions with SIMP and those without are handled there. In general, simplifying constructors (like MPLUS, MEXPT, etc.) are mostly handled by the simplifying function found in their operators property, which is invoked by simplifya. -s From jules.stocks at gmail.com Fri Jan 19 19:42:40 2007 From: jules.stocks at gmail.com (Jules Gilbert) Date: Fri, 19 Jan 2007 20:42:40 -0500 Subject: [Maxima] thousands of years ago... Message-ID: <605054D4-CD9C-43B1-B71B-2794DFD9AC35@gmail.com> When Macsyma was being developed, the plans included building other symbolic manipulators, for example for chemistry, allowing users to define complex substances (for example,) proteins and further to define rules governing chemical activity. With such a system, expression evaluation could mimic the interaction of one chemical substance with another; Though modeling such interactions would tax even the fastest machines we use today (consider what happens when a penicillin molecular complex meets a microbe, then expression evaluation burden is substantial.) Still, If kids are going to be exposed to computer algebra, it might be a good idea to facilitate their understanding of the underpinnings -- not to dwell on the underlying mechanics but merely to make sure that sometime users realize that mathematics is but one application, (albeit an important one!,) and that by building other ruleset tools, one can attack problems in other disciplines. --jg From: nicolas.pettiaux at ael.be Subject: [Maxima] Maxima and encarta Date: January 19, 2007 9:15:10 AM EST To: maxima at math.utexas.edu Reply-To: nicolas.pettiaux at ael.be Some of you may now the microsoft encyclopedia Encarta. I have seen yesterday a demo of the new version that includes a CAS. There are 2 front ends, one conventional and another one that looks like a small digit computing platform (like the old TI30). One interesting point is that it provides the solution of an equation but also, optionnally, some tracing of the needed operations to go from the problem to the solution, helping the user (eventually a student) to grasp the method that has been used. I was wondering if any such tool for tracing and providing textual explanation of the method exist in maxima or would be difficult to write. I was yesterday evidently dreaming that maxima replace encarta asap :-) Thanks, Nicolas -- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070119/e2df5fc3/attachment.htm From michel.vandenbergh at uhasselt.be Sat Jan 20 05:03:36 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 20 Jan 2007 12:03:36 +0100 Subject: [Maxima] Interpreter vs compiler Message-ID: <45B1F708.4030609@uhasselt.be> How strongly do people actually feel about the translator to lisp in maxima? Having two totally different code bases which are supposed to have identical behavior seems like a maintenance nightmare. It might well impede progress. A different model could be that one keeps only the interpreter and that people write performance critical functions in lisp (which seems to be the defacto standard anyway as far as I can tell). A similar model is followed in perl and python (of course programs are byte compiled to an internal form). In maxima it is even easier as the underlying lisp system is very accessible. Michel From devrim.erdem at gmail.com Sat Jan 20 09:48:28 2007 From: devrim.erdem at gmail.com (Devrim Erdem) Date: Sat, 20 Jan 2007 16:48:28 +0100 Subject: [Maxima] Solving a Cross Product Message-ID: Hello, I have tried to solve a cross product equation with maxima. I have tried: w: [] r: [] v=cross_product(w,r) solve( [v], [w] ) This didn't get me anywhere. Could anyone give me some hints (search keywords will also be fine, I was lost in the manual ). Thanks in advance, Devrim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070120/a0236744/attachment-0001.htm From Daniel.L.Solomon at nasa.gov Sat Jan 20 11:55:17 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 20 Jan 2007 12:55:17 -0500 Subject: [Maxima] 3d plot of a curve Message-ID: The manual tells how to get a plot of a surface in 3 space (torus, klein bottle, moebius band), but how do I get a plot of a curve? Preferably parametrized by t: x[1]:.5; x[2]:sqrt(1-x[1]^2) * cos(2*t); x[3]:sqrt(1-x[1]^2) * sin(2*t); plot3d([parametric, x[1],x[2],x[3], [t,0,2*%pi]]); gives: Bad Range FALSE must be of the form [variable,min,max] -- an error. Quitting. To debug this try DEBUGMODE(TRUE);) thanks From Daniel.L.Solomon at nasa.gov Sat Jan 20 12:09:10 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 20 Jan 2007 13:09:10 -0500 Subject: [Maxima] 3d plot of a curve Message-ID: <06FDB48E-F8CA-4A47-9DB5-0BAF1C4F85AA@nasa.gov> trying a simple one x[1]:.5; x[2]:sqrt(1-x[1]^2) * cos(2*t); x[3]:sqrt(1-x[1]^2) * sin(2*t); plot3d([x[1],x[2],x[3]], [t,0,2*%pi],[s,0,1]); causes a zero divide, which I don't understand, since I am not dividing anything. thanks From dlakelan at street-artists.org Sat Jan 20 12:38:36 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Sat, 20 Jan 2007 10:38:36 -0800 Subject: [Maxima] Memory use, forcing GC, %oXX vars keeping references Message-ID: <20070120183836.GV29279@localhost.localdomain> I've been using the "rk" function with very small step sizes, I tend to get back lists of several thousand or a million entries. After a while, gcl eventually crashes. I'm running on an AMD64 machine with 2G of memory, but I'm not convinced that gcl is able to use the entire address space since it tends to stay below about 500MB before crashing. I do "kill(solns)" (the variable that stores the output) at each iteration, but I'm thinking perhaps that the %o1,%o2 type variables keep a handle to these big lists so they aren't gc'ed. Short of manually typing in kill(%o42) and soforth for each iteration, how can I ensure that these lists get GCed and hence keep my system running longer between crashes (maybe)? -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From willisb at unk.edu Sat Jan 20 12:53:20 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 20 Jan 2007 12:53:20 -0600 Subject: [Maxima] Solving a Cross Product In-Reply-To: References: Message-ID: Maybe this will get you started: (%i1) load(vect)$ (%i2) r : [r1,r2,r3]$ (%i3) w : [w1,w2,w3]$ (%i4) v : [v1,v2,v3]$ (%i5) express(v - w ~ r); (%o5) [r2*w3-r3*w2+v1,-r1*w3+r3*w1+v2,r1*w2-r2*w1+v3] (%i6) algsys(%,[w1,w2,w3,r3]); (%o6) [[w1=%r1,w2=(%r1*r2-v3)/r1,w3=-(%r1*(r2*v2+r1*v1)-v2*v3)/(r1*v3),r3=-(r2*v2+r1*v1)/v3]] If r1 or v3 vanishes, that's another case. Barton -----maxima-bounces at math.utexas.edu wrote: ----- >To: maxima at math.utexas.edu >From: "Devrim Erdem" >Sent by: maxima-bounces at math.utexas.edu >Date: 01/20/2007 09:48AM >Subject: [Maxima] Solving a Cross Product > >Hello, > > >I have tried to solve a cross product equation >with maxima. I have tried: > > >w: [] > >r: [] > >v=cross_product(w,r) > > >solve( [v], [w] ) > > >This didn't get me anywhere. Could anyone give me >some hints (search keywords will also be fine, I >was lost in the manual ). > > >Thanks in advance, > > >Devrim > > > >_______________________________________________ >Maxima mailing list >Maxima at math.utexas.edu >http://www.math.utexas.edu/mailman/listinfo/maxim >a From macrakis at alum.mit.edu Sat Jan 20 12:54:25 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sat, 20 Jan 2007 13:54:25 -0500 Subject: [Maxima] Interpreter vs compiler In-Reply-To: <45B1F708.4030609@uhasselt.be> References: <45B1F708.4030609@uhasselt.be> Message-ID: <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> On 1/20/07, Michel Van den Bergh wrote: > How strongly do people actually feel about the translator to lisp > in maxima? > > Having two totally different code bases which are supposed to have > identical behavior seems like a maintenance nightmare. It might well > impede progress. My guess is that the most common use of the translator and compiler is to speed up numeric calculations where the formulas have been derived using Maxima's symbolic facilities. It would be completely unacceptable in this case to require that users rewrite their code in Lisp. They could, I suppose, use the Fortran subsystem, which is in effect a tiny subset of the translator where the target language is Fortran rather than Lisp. But then they'd still have to deal with the systems issues of compiling the Fortran and linking it back into Maxima, which is painful and not standardized across Lisp implementations. Having written the first version of the translator in the early 70's (I was either in high school or a freshman), I can tell you that a basic translator is not that complicated. The current translator (which contains none of my code as far as I know) is much more elaborate partly because it is better, but also because it is over-engineered, and handles many more special cases. Having an interpreter and a compatible compiler is standard practice in the Lisp world, and I see no reason that we can't do a good job in Maxima without inordinate effort. There are certain constructions which are very difficult to compile effectively, but that's not fatal, because the interpreter is always available as backup. And perhaps some of the messier semantics need to be reevaluated -- for example dynamic vs. static scope. In fact, all functions which try to be clever about evaluating their arguments in special contexts (e.g. cf, ev) are rather a mess. It seems important to me that users need learn only one new language to take advantage of Maxima and anyway, few users nowadays know Lisp or are willing to invest in it. Not to mention that the Lisp style used in Maxima internals is rather... um... dated... and um... hard to read. In fact, I would go in the opposite direction, and try to make it easier for users writing in the Maxima language to do more, notably to write simplifiers for mathematical functions. -s From willisb at unk.edu Sat Jan 20 12:58:42 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 20 Jan 2007 12:58:42 -0600 Subject: [Maxima] Memory use, forcing GC, %oXX vars keeping references In-Reply-To: <20070120183836.GV29279@localhost.localdomain> References: <20070120183836.GV29279@localhost.localdomain> Message-ID: ----maxima-bounces at math.utexas.edu wrote: ----- >Short of manually typing in kill(%o42) and >soforth for each iteration, >how can I ensure that these lists get GCed and >hence keep my system >running longer between crashes (maybe)? Try nolabels : false. I recall a discussion about nolabels on the list some time ago. I think nolabels is (or was) broken -- not sure if it was fixed. Barton From macrakis at alum.mit.edu Sat Jan 20 12:58:52 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sat, 20 Jan 2007 13:58:52 -0500 Subject: [Maxima] Memory use, forcing GC, %oXX vars keeping references In-Reply-To: <20070120183836.GV29279@localhost.localdomain> References: <20070120183836.GV29279@localhost.localdomain> Message-ID: <8b356f880701201058n391710bfo90a0f273830b220b@mail.gmail.com> > Short of manually typing in kill(%o42) and soforth for each iteration, > how can I ensure that these lists get GCed and hence keep my system > running longer between crashes (maybe)? The "labels" variable has a list of all the %i/%o variables. You can write code to kill them individually, or simply kill(labels). You can also set nolabels:true, which continues to *display* %i/%o labels, but does not set them to results, so they can be garbage collected. -s From sen1 at math.msu.edu Sat Jan 20 13:00:52 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Sat, 20 Jan 2007 14:00:52 -0500 (EST) Subject: [Maxima] 3d plot of a curve In-Reply-To: References: Message-ID: plot3d([0.5, sqrt(1 - 0.5^2) + cos(2*t), sqrt(1 - 0.5^2) + sin(2*t)],[t,0,2*%pi], [s,-2,2]); Basically, you use plot3d([x1[s,t],x2[s,t],x3[s,t]],[s,a,b],[t,c,d]); where the xi[ ] are functions of s and t (or whatever you want to call them) and one of s or t is not in the functions xi[ ] -sen On Sat, 20 Jan 2007, Dan Solomon wrote: > The manual tells how to get a plot of a surface in 3 space (torus, > klein bottle, moebius band), but how do I get a plot of a curve? > Preferably parametrized by t: > > x[1]:.5; x[2]:sqrt(1-x[1]^2) * cos(2*t); x[3]:sqrt(1-x[1]^2) * sin(2*t); > plot3d([parametric, x[1],x[2],x[3], [t,0,2*%pi]]); > gives: > > Bad Range > FALSE must be of the form [variable,min,max] > -- an error. Quitting. To debug this try DEBUGMODE(TRUE);) > > thanks > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From vadim at vkonovalov.ru Thu Jan 18 17:19:34 2007 From: vadim at vkonovalov.ru (Vadim) Date: Fri, 19 Jan 2007 02:19:34 +0300 Subject: [Maxima] what graphs plotting possibilities are Maxima? Message-ID: <45B00086.5080804@vkonovalov.ru> There are functions in maxima plot2d and plot3d which are very well demonstrated from xmaxima, etc. These are using gnuplot. However there are several external tools capable of advanced plottings, for example "labplot" and "octave" and "scilab". Can you please share experience on using these from Maxima? Is this possible? Which are preferred ones? What other possibilities on drawing graphs? BTW for some reason I can't rotate resulting plot in Linux but can rotate it in Windows, what I am misunderstanding? Thanks for all advises! Vadim. From macrakis at alum.mit.edu Sat Jan 20 15:24:54 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sat, 20 Jan 2007 16:24:54 -0500 Subject: [Maxima] plot3d fatal error in wgnuplot Message-ID: <8b356f880701201324q625e402fgd65c7be2c3a33f6b@mail.gmail.com> Some plot3d plots blow up, but some very similar ones have no problem: plot3d(x*y,[x,0,1],[y,0,1]) => the instruction at xxx referenced memory at yyy Unhandled exception in wgnuplot.exe (CRTDLL.DLL): 0xC0000005: Access violation Same problem with: plot3d(x,[x,-2,2],[y,-2,2]); plot3d(x+y,[x,-2,2],[y,-2,2]); plot3d(x+x*y,[x,-2,2],[y,-2,2]); On the other hand, plot3d(signum(x)*abs(x)*y,[x,-2,2],[y,-2,2]); => no problem (values the same everywhere!) plot3d(x*y*1.0000000000001,[x,-2,2],[y,-2,2]) => no problem plot3d(x*y+1.0e-200,[x,-2,2],[y,-2,2]) => no problem plot3d(x*abs(y),[x,0,1],[y,0,1]) => no problem plot3d(0,[x,-2,2],[y,-2,2]) => no problem plot3d(x+y+x*y,[x,-2,2],[y,-2,2]); => no problem I have Visual Studio installed on my machine, but apparently wgnuplot doesn't include symbols, so I can't give a stack trace. What's going on, and how can I get better debugging info? -s Maxima 5.11.0 GCL 2.6.8 W2k Athlon From robert.dodier at gmail.com Sat Jan 20 17:31:54 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 20 Jan 2007 16:31:54 -0700 Subject: [Maxima] plot3d fatal error in wgnuplot In-Reply-To: <8b356f880701201324q625e402fgd65c7be2c3a33f6b@mail.gmail.com> References: <8b356f880701201324q625e402fgd65c7be2c3a33f6b@mail.gmail.com> Message-ID: On 1/20/07, Stavros Macrakis wrote: > plot3d(x*y,[x,0,1],[y,0,1]) => > the instruction at xxx referenced memory at yyy > Unhandled exception in wgnuplot.exe (CRTDLL.DLL): 0xC0000005: Access violation Hmm, this example is OK in Maxima 5.11.0cvs + GCL 2.6.7 + Linux, both with plot_fomat = gnuplot_pipes (default on Linux) and plot_format = gnuplot (writes a file instead of a pipe). Aside from recompiling wgnuplot to get the debugging symbols, the only thing I can think of is to inspect the maxout.gnuplot file which is created by plot3d -- it is written to the folder named by maxima_tempdir. Hope this helps Robert From aeder at arcor.de Sat Jan 20 17:43:04 2007 From: aeder at arcor.de (Andreas Eder) Date: Sun, 21 Jan 2007 00:43:04 +0100 Subject: [Maxima] Interpreter vs compiler In-Reply-To: <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> References: <45B1F708.4030609@uhasselt.be> <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> Message-ID: <40495.1169336584@staffa.eder.local> Stavros Macrakis wrote: > Not to mention that the Lisp style > used in Maxima internals is rather... um... dated... and um... hard to > read. That is certainly true, but with a little effort it can be changed. Currently (as Robert Dodier knowa) I'm in the process of cleaning up the maxima sources. First I'll remove any old code that is continionalized for dead LIsp dialects and machines, like Franz Lisp or the PDP10. Once that is doen I hope to bring the code closer to modern Common LIsp coding standards - all without changing the semantics of the code. You can have look at a few cleaned up files on the sourceforge maxima patch site. 'Andreas From van.nek at arcor.de Sat Jan 20 18:05:22 2007 From: van.nek at arcor.de (van Nek) Date: Sun, 21 Jan 2007 01:05:22 +0100 Subject: [Maxima] plot3d fatal error in wgnuplot In-Reply-To: <8b356f880701201324q625e402fgd65c7be2c3a33f6b@mail.gmail.com> Message-ID: <45B2BC52.6051.34EA1F9@van.nek.arcor.de> Am 20 Jan 2007 um 16:24 hat Stavros Macrakis geschrieben: > Some plot3d plots blow up, but some very similar ones have no problem: > > plot3d(x*y,[x,0,1],[y,0,1]) => > the instruction at xxx referenced memory at yyy > Unhandled exception in wgnuplot.exe (CRTDLL.DLL): 0xC0000005: Access violation > > Same problem with: > plot3d(x,[x,-2,2],[y,-2,2]); > plot3d(x+y,[x,-2,2],[y,-2,2]); > plot3d(x+x*y,[x,-2,2],[y,-2,2]); > > > What's going on, and how can I get better debugging info? > > -s > > Maxima 5.11.0 GCL 2.6.8 W2k Athlon Windows 2000 SP4 Intel Pentium and on Windows 2000 SP4 Intel Centrino Maxima 5.11.0 http://maxima.sourceforge.net Using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka GCL) (%i1) plot3d(x*y,[x,0,1],[y,0,1]); (%o1) (%i2) plot3d(x,[x,-2,2],[y,-2,2]); (%o2) (%i3) plot3d(x+y,[x,-2,2],[y,-2,2]); (%o3) (%i4) plot3d(x+x*y,[x,-2,2],[y,-2,2]); (%o4) No problems. Could this seriously be a question of processor type? Hard to believe. My OS is updated on both computers. Yours too? Directly in gnuplot I can reproduce the first plot with set pm3d; set isosamples 30; set xtics 0.1; set ytics 0.1; set ztics 0.1; splot [x=0:1] [y=0:1] x*y with lines 3 Perhaps you can try if this is possible. Volker -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070121/6bd3b9f6/attachment.htm From michel.vandenbergh at uhasselt.be Sat Jan 20 18:04:57 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sun, 21 Jan 2007 01:04:57 +0100 Subject: [Maxima] Interpreter vs compiler References: 8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com Message-ID: <45B2AE29.4080201@uhasselt.be> > > That is certainly true, but with a little effort it can be changed. > Currently (as Robert Dodier knowa) I'm in the process of cleaning up the > maxima sources. First I'll remove any old code that is continionalized > for dead LIsp dialects and machines, like Franz Lisp or the PDP10. Once > that is doen I hope to bring the code closer to modern Common LIsp > coding standards - all without changing the semantics of the code. > > You can have look at a few cleaned up files on the sourceforge maxima > patch site. I had a look but it is somewhat hard to look at patches. I hope you are not removing the few comments that are in the sources! It would be nice to comment some critical routines in the maxima sources (like meval1). These seem to be mostly in mlisp. I had thought of doing so myself but time is a scarce resource for the moment. I read through some these routines and it is not all that bad, especially when you can use trace. Unfortunately many things are defined as macros and this is somewhat harder to track. Michel From biomates at telefonica.net Sun Jan 21 06:35:54 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Sun, 21 Jan 2007 13:35:54 +0100 Subject: [Maxima] A note on graphics In-Reply-To: <45B00086.5080804@vkonovalov.ru> References: <45B00086.5080804@vkonovalov.ru> Message-ID: <1169382954.12070.9.camel@localhost.localdomain> Hello, There was a discussion in this mailing list some months back regarding new Maxima-Gnuplot and Maxima-Openmath interfaces. I've been working the last weeks on the Maxima-Gnuplot part. The project is in its very very infancy, but I think it's not a bad idea to make public the directions I took. All the relevant information is here: http://www.telefonica.net/web2/biomates/maxima/gpdraw Comments are welcome, specially those related to syntax and/or new capabilities. Best wishes. -- Mario Rodriguez Riotorto www.biomates.net From sen1 at math.msu.edu Sun Jan 21 07:18:21 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Sun, 21 Jan 2007 08:18:21 -0500 (EST) Subject: [Maxima] A note on graphics In-Reply-To: <1169382954.12070.9.camel@localhost.localdomain> References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: Hi Mario, I am very happy that you are developing this package. It will be very nice tool for many projects. I tried to load and do the first example. (%i1) build_info(); Maxima version: 5.11.0 Maxima build date: 15:12 1/10/2007 host type: i686-pc-linux-gnu lisp-implementation-type: GNU Common Lisp (GCL) lisp-implementation-version: GCL 2.6.7 (%o1) (%i2) load("gpdraw"); (%o2) ./gpdraw.lisp (%i3) gpdraw_pipes: false; (%o3) false (%i4) gpdraw2d(explicit(u^2,u,-3,3))$ Cannot open load file 'maxout.gnuplot' line 0: util.c: No such file or directory Any suggestions? -sen On Sun, 21 Jan 2007, Mario Rodriguez wrote: > Hello, > > There was a discussion in this mailing list some months back regarding > new Maxima-Gnuplot and Maxima-Openmath interfaces. I've been working the > last weeks on the Maxima-Gnuplot part. > > The project is in its very very infancy, but I think it's not a bad idea > to make public the directions I took. > > All the relevant information is here: > > http://www.telefonica.net/web2/biomates/maxima/gpdraw > > Comments are welcome, specially those related to syntax and/or new > capabilities. > > Best wishes. > > -- --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From devrim.erdem at gmail.com Sun Jan 21 10:43:14 2007 From: devrim.erdem at gmail.com (Devrim Erdem) Date: Sun, 21 Jan 2007 17:43:14 +0100 Subject: [Maxima] Solving a Cross Product In-Reply-To: References: Message-ID: Hi Sheldon, I have forgotten to define v and w, sorry. v and w are 3d vectors, they stand for velocity and angular velocity in my current context. v is defined as: v = w x r ( where x is the cross product operator ). I am trying to find the w in terms of r and v. Thanks, Devrim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070121/fa02a0ad/attachment.htm From biomates at telefonica.net Sun Jan 21 10:52:06 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Sun, 21 Jan 2007 17:52:06 +0100 Subject: [Maxima] A note on graphics In-Reply-To: References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: <1169398326.8336.16.camel@localhost.localdomain> Hello, > I am very happy that you are developing this package. It will be very > nice tool for many projects. > I hope so :) > I tried to load and do the first example. > > > (%i1) build_info(); > > Maxima version: 5.11.0 > Maxima build date: 15:12 1/10/2007 > host type: i686-pc-linux-gnu > lisp-implementation-type: GNU Common Lisp (GCL) > lisp-implementation-version: GCL 2.6.7 > > (%o1) > (%i2) load("gpdraw"); > (%o2) ./gpdraw.lisp > (%i3) gpdraw_pipes: false; > (%o3) false > (%i4) gpdraw2d(explicit(u^2,u,-3,3))$ > Cannot open load file 'maxout.gnuplot' > line 0: util.c: No such file or directory > > Any suggestions? There was a bug found by Andrej. I've uploaded the fixed version. Try it again, please. I think that your problem is now solved. Let me know if it works now. Mario -- Mario Rodriguez Riotorto www.biomates.net From nicolas.pettiaux at ael.be Sun Jan 21 11:12:11 2007 From: nicolas.pettiaux at ael.be (Nicolas Pettiaux) Date: Sun, 21 Jan 2007 18:12:11 +0100 Subject: [Maxima] A note on graphics In-Reply-To: <1169382954.12070.9.camel@localhost.localdomain> References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: 2007/1/21, Mario Rodriguez : > Hello, > > There was a discussion in this mailing list some months back regarding > new Maxima-Gnuplot and Maxima-Openmath interfaces. I've been working the > last weeks on the Maxima-Gnuplot part. thank you very, very much for this. > The project is in its very very infancy, but I think it's not a bad idea > to make public the directions I took. > > All the relevant information is here: > > http://www.telefonica.net/web2/biomates/maxima/gpdraw > > Comments are welcome, specially those related to syntax and/or new > capabilities. As with gnuplot 4 it is for example possible to select with the mouse and do some zoom, this is very promising. I think that the hability to do some interactions with the mouse (zoom, slide, rotation ... ) will be very appreciated by the users. Just 2 ideas (unfortunately, I do not have the expertise to do the actual developpement myself) 1/ plplot allows to do much scientific plotting and can already today by linked to many programming languages as shown in http://plplot.sourceforge.net/examples/index.html Maybe maxima could be in the list without too much efforts. 3/ for 3D, the hability to rotate online the model would be very very welcome. I don't know how good gnuplot can be at this but I think the VTK (http://public.kitware.com/VTK/index.php) toolkit could be useful. THanks again, NIcolas -- Nicolas Pettiaux - email: nicolas.pettiaux at ael.be From biomates at telefonica.net Sun Jan 21 12:18:35 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Sun, 21 Jan 2007 19:18:35 +0100 Subject: [Maxima] A note on graphics In-Reply-To: References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: <1169403515.11689.34.camel@localhost.localdomain> Nicolas, > As with gnuplot 4 it is for example possible to select with the mouse > and do some zoom, this is very promising. > > I think that the hability to do some interactions with the mouse > (zoom, slide, rotation ... ) will be very appreciated by the users. You can rotate 3d scenes in windows + Maxima 5.11. In Linux, you need current cvs Maxima to rotate the objects. > Just 2 ideas (unfortunately, I do not have the expertise to do the > actual developpement myself) > > 1/ plplot allows to do much scientific plotting and can already today > by linked to many programming languages as shown in > http://plplot.sourceforge.net/examples/index.html > Maybe maxima could be in the list without too much efforts. > I'm not familiar with plplot, but someone made some suggestions about plplot in this mailing list. Well, I concentrate my efforts in gnuplot, and I think Jaime is working in something similar on openmath. The door is open to new projects, of course. > 3/ for 3D, the hability to rotate online the model would be very very > welcome. As said before, this is not a problem any more. I could copy the necessary lines of code in src/plot.lisp to gpdraw.lisp for those users who run Maxima 5.11 in Linux. I think it should work. > I don't know how good gnuplot can be at this but I think the > VTK (http://public.kitware.com/VTK/index.php) toolkit could be useful. > Gnuplot is not very good for 3d modeling, I'm affraid. For example, I'd like to plot polyhedra; I know how to plot the edges (with gpdraw's 'point' object and property 'points_joined' set to 'true' this is very easy once you know the coordinates of the vertices), but I don't know how to plot the faces (does anybody know?), so that you only see those which are closer to the view point. On the other hand, I have tried to incorporate colors to surfaces (setting pm3d), but found some problems in rendering multiple objects; I have to investigate if it was my fault, or gnuplot's. > THanks again, Thanks for your comments. Mario -- Mario Rodriguez Riotorto www.biomates.net From kirr at landau.phys.spbu.ru Sun Jan 21 12:41:40 2007 From: kirr at landau.phys.spbu.ru (Kirill Smelkov) Date: Sun, 21 Jan 2007 21:41:40 +0300 Subject: [Maxima] [newbie] How to optimize maxima code? Message-ID: <20070121184139.GA3579@landau.phys.spbu.ru> Hello All, I'm doing some calculations with spherical functions Ylm, and the problem is that my code is running painfully slow. I'd like to optimize it a bit, but have no clue how -- no previous Lisp or Maxima experience at all. *** So, I'd like to ask 2 questions: 1. Is there something like a Maxima profiler? 2. If someone has any advice on how to perform faster - I would be grateful. My code is located here: http://landau.phys.spbu.ru/~kirr/repos/maxima-study/sph.mac http://landau.phys.spbu.ru/~kirr/repos/maxima-study/test_sph.mac run it with: (%i1) load("test_sph.mac"); Thanks in advance, -- ????? ????????, ??????. http://landau.phys.spbu.ru/~kirr/aiv/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070121/6c267aa9/attachment.pgp From coolens at kahosl.be Sun Jan 21 13:08:47 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Sun, 21 Jan 2007 20:08:47 +0100 (CET) Subject: [Maxima] [newbie] help with simplification In-Reply-To: <20070121184139.GA3579@landau.phys.spbu.ru> References: <20070121184139.GA3579@landau.phys.spbu.ru> Message-ID: Can anyone tell me here how to simplify the following result obtained with maxima? h(s):=(1+r*c*s)/(1+r*c*s+l*c*s^2); s:%i*sqrt(sqrt(l^2+2*c*l*r^2)/l-1)/(r*c); abs(h(s)); (answer 3 times positive to questions) I'd like to see a simplified version of abs(h(s)), can anyone here show how to proceed? regards, hugo From robert.dodier at gmail.com Sun Jan 21 13:40:23 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 21 Jan 2007 12:40:23 -0700 Subject: [Maxima] [newbie] How to optimize maxima code? In-Reply-To: <20070121184139.GA3579@landau.phys.spbu.ru> References: <20070121184139.GA3579@landau.phys.spbu.ru> Message-ID: Kirill, > I'm doing some calculations with spherical functions Ylm, and > the problem is that my code is running painfully slow. Hmm, sounds like an interesting problem. About profiling, take a look at the functions timer and timer_info -- timer records function call execution time and timer_info shows the results. ? timer at the input prompt should find info about these functions. Hope this helps, Robert Dodier From dan.stanger at ieee.org Sun Jan 21 14:08:29 2007 From: dan.stanger at ieee.org (Dan Stanger) Date: Sun, 21 Jan 2007 15:08:29 -0500 Subject: [Maxima] [newbie] help with simplification In-Reply-To: References: <20070121184139.GA3579@landau.phys.spbu.ru> Message-ID: <45B3C83D.7090800@ieee.org> This looks like a RLC bandpass circuit, evaluated at some special point. Usually, with problems like this, there are high and low Q approximations, and you may be able to expand the solution in terms of this. Several examples of this may be found in any circuit analysis text, written before computers were in common use, such as Brenner and Javid. Why don't you describe the problem you are trying to solve, as it may suggest a simplification process. Dan Stanger Hugo Coolens wrote: >Can anyone tell me here how to simplify the following result obtained with >maxima? > >h(s):=(1+r*c*s)/(1+r*c*s+l*c*s^2); >s:%i*sqrt(sqrt(l^2+2*c*l*r^2)/l-1)/(r*c); >abs(h(s)); >(answer 3 times positive to questions) > >I'd like to see a simplified version of abs(h(s)), can anyone here show >how to proceed? > >regards, >hugo > >_______________________________________________ >Maxima mailing list >Maxima at math.utexas.edu >http://www.math.utexas.edu/mailman/listinfo/maxima > > > > From macrakis at alum.mit.edu Sun Jan 21 14:20:36 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 21 Jan 2007 15:20:36 -0500 Subject: [Maxima] [newbie] help with simplification In-Reply-To: References: <20070121184139.GA3579@landau.phys.spbu.ru> Message-ID: <8b356f880701211220v6a2e6c92t2bfd0e63d7e94c67@mail.gmail.com> Try ratsimp(abs(h(s))),algebraic; Beyond that, there are various things you can do to change the form of the result, e.g. factor of the whole expression or some of its subparts. -s On 1/21/07, Hugo Coolens wrote: > Can anyone tell me here how to simplify the following result obtained with > maxima? > > h(s):=(1+r*c*s)/(1+r*c*s+l*c*s^2); > s:%i*sqrt(sqrt(l^2+2*c*l*r^2)/l-1)/(r*c); > abs(h(s)); > (answer 3 times positive to questions) From Daniel.L.Solomon at nasa.gov Sun Jan 21 14:56:49 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sun, 21 Jan 2007 15:56:49 -0500 Subject: [Maxima] the "dynamics" package and numerical solution of DEs Message-ID: <3B83C910-0DDF-4787-B4AC-79E0453C04EA@nasa.gov> I'm trying to run rk on an ODE, and the manual says to load ("dynamics"); but maxima can't find the file in the share folders. Any help where I can get it? I want to solve an ODE in 3-space numerically; that is, I want to integrate step by step from a given initial vector. How can I get an education of the options for such a task? Thanks From amca01 at gmail.com Sun Jan 21 17:42:58 2007 From: amca01 at gmail.com (Alasdair McAndrew) Date: Mon, 22 Jan 2007 10:42:58 +1100 Subject: [Maxima] Running openmath plots in the background Message-ID: <1d67a53c0701211542oba2be89je0a6a4637eb3e762@mail.gmail.com> When I create a standard 2d plot of a function using plot2d (under linux), I have a gnuplot window which remains open while I can continue to work in maxima (using console maxima or imaxima in emacs). However, if I use the [plot_format,openmath] option, then the maxima process is halted while the plot window is open; I can only perform further work in maxima by closing the plot window. How can I run an openmath window in the background, so to speak? That is, remain working with maxima while having a plot window open? Thanks, Alasdair -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070122/5807c4c9/attachment.html From dlakelan at street-artists.org Sun Jan 21 18:01:08 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Sun, 21 Jan 2007 16:01:08 -0800 Subject: [Maxima] the "dynamics" package and numerical solution of DEs In-Reply-To: <3B83C910-0DDF-4787-B4AC-79E0453C04EA@nasa.gov> References: <3B83C910-0DDF-4787-B4AC-79E0453C04EA@nasa.gov> Message-ID: <20070122000108.GW29279@localhost.localdomain> On Sun, Jan 21, 2007 at 03:56:49PM -0500, Dan Solomon wrote: > I'm trying to run rk on an ODE, and the manual says to load > ("dynamics"); but maxima can't find the file in the share folders. > Any help where I can get it? > > I want to solve an ODE in 3-space numerically; that is, I want to > integrate step by step from a given initial vector. How can I get an > education of the options for such a task? I've been doing nothing but this for the last week or so :-) The first thing you should do is get a relatively up to date maxima. 5.10.0 at least. If you're running Debian, that's what's in the "testing" or "unstable" distribution. If you're running windows get the newest 5.11 from the maxima.sf.net website. Other systems I don't know anything about. If you're running Debian, you'll also need the "maxima-share" package which has all the "non-core" maxima stuff. I'm not sure why the Debian packager does this, but I think it's a debian policy to split out "nonessential" portions of packages... This might be a reason why it doesn't find the "dynamics" package, because you will need to "load(dynamics);" before getting rk. "? rk" is supposed to give you info on how to use the runge-kutta ODE integrator. It works for me on windows, but on Debian it doesn't find the docs, so here's a quick rundown in case you have the same problem: rk(derivs, vars, inits, integrationrange); will do what you want if you set it up as follows: integrationrange is a 4 element list: [t,0,1,.01] for example, to integrate with respect to t from t=0 to t=1 in steps of .01 derivs should be a list of expressions for the derivatives of the vector components with respect to your parameter. The only variables allowed in these expressions are your independent variable, and the various dependent variables. vars are a list of symbols naming the dependent variables. inits are the initial conditions. To give a very simple example: rk([x*t,y/t,(x+y)/t],[x,y,z],[1,1,1],[t,0.01,1,.01]); [[0.01, 1, 1, 1], [0.02, 1.0, 2.0, 2.694], [0.03, 1.0, 3.0, 4.1], [0.04, 1.001, 4.0, 5.388], [0.05, 1.001, 5.0, 6.611], [0.06, 1.002, 6.0, 7.794], [0.07, 1.002, 7.0, 8.948], .... -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From robert.dodier at gmail.com Sun Jan 21 23:42:03 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 21 Jan 2007 22:42:03 -0700 Subject: [Maxima] the "dynamics" package and numerical solution of DEs In-Reply-To: <20070122000108.GW29279@localhost.localdomain> References: <3B83C910-0DDF-4787-B4AC-79E0453C04EA@nasa.gov> <20070122000108.GW29279@localhost.localdomain> Message-ID: On 1/21/07, Daniel Lakeland wrote: > If you're running Debian, you'll also need the "maxima-share" package > which has all the "non-core" maxima stuff. I'm not sure why the Debian > packager does this, but I think it's a debian policy to split out > "nonessential" portions of packages... > > This might be a reason why it doesn't find the "dynamics" package, > because you will need to "load(dynamics);" before getting rk. > > "? rk" is supposed to give you info on how to use the runge-kutta ODE > integrator. It works for me on windows, but on Debian it doesn't find > the docs, If there's something odd about the Debian package for Maxima, it would be very helpful if you submit a bug report to the package maintainer, if you have time. Same goes for packages created by any downstream packager. I remember some time ago there was a problem that the packages produced by Debian (or maybe some other project) borked the help system by compressing (gzip) the .info files. I thought that was resolved but I really don't know for sure. Ideally of course Maxima should be able to read compressed info; it is only a "small matter of programming". 8^) All the best, Robert From coolens at kahosl.be Mon Jan 22 00:34:05 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Mon, 22 Jan 2007 07:34:05 +0100 (CET) Subject: [Maxima] [newbie] help with simplification In-Reply-To: <45B3C83D.7090800@ieee.org> References: <20070121184139.GA3579@landau.phys.spbu.ru> <45B3C83D.7090800@ieee.org> Message-ID: Dan Stanger wrote: >This looks like a RLC bandpass circuit, evaluated at some special point. > that's indeed what it is, the evaluation is at the point where the gain is at its maximum (calculated also with maxima) u_i------L----- u_o ^ | | C | | | R | | ___________________| >Usually, with problems like this, there are high and low Q approximations, > It's a low Q version, however the high Q version is also interesting >and you may be able to expand the solution in terms of this. >Several examples of this may be found in any circuit analysis text, >written before computers were in common use, such as Brenner >and Javid. >Why don't you describe the problem you are trying to solve, >as it may suggest a simplification process. > I just want a simple formula for the maximum gain further suggestions are welcome, regards, Hugo >Dan Stanger >Hugo Coolens wrote: > >>Can anyone tell me here how to simplify the following result obtained with >>maxima? >> >>h(s):=(1+r*c*s)/(1+r*c*s+l*c*s^2); >>s:%i*sqrt(sqrt(l^2+2*c*l*r^2)/l-1)/(r*c); >>abs(h(s)); >>(answer 3 times positive to questions) >> >>I'd like to see a simplified version of abs(h(s)), can anyone here show >>how to proceed? >> >>regards, >>hugo >> >>_______________________________________________ >>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 > From robert.dodier at gmail.com Mon Jan 22 01:15:11 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 22 Jan 2007 00:15:11 -0700 Subject: [Maxima] augmented_lagrangian_method on purely computational / numeric functions? In-Reply-To: <20070117053046.GC29279@localhost.localdomain> References: <20070116184329.GY25287@street-artists.org> <20070117053046.GC29279@localhost.localdomain> Message-ID: Daniel, Not sure if this exactly addresses your problem, but I've modified lbfgs and augmented_lagrangian_method to allow the caller to specify the gradient, so that it is not constructed via diff. I didn't attempt to allow for a numerically approximated gradient (a secant or other approximation). Although that probably works more or less, I'm pretty sure in that case methods devised especially for that case might be superior. Anyway the new functions are called as lbfgs ([FOM, [g1, g2, g3, ...]], ...) augmented_lagrangian_method ([FOM, [g1, g2, g3, ...]], ...) where FOM is the figure of merit expression and g1, g2, g3, ... are components of the gradient of FOM, and the other arguments are just as before. FOM and gradient can't be function names or lambda expressions -- probably just laziness on my part -- so if FOM and gradient are computed by some functions F and G1, G2, G3 (e.g.) you would have to write it like this (note the quote mark): augmented_lagrangian_method ( ' [F(x, y, z), [G1(x, y, z), G2(x, y, z), G3(x, y, z)]], ...) You can get the current code from cvs (should appear in a few hours). You'll need src/plot.lisp (new code in COERCE-FLOAT-FUN), share/lbfgs/maxima-lbfgs.lisp, and share/contrib/augmented_lagrangian.mac. Have fun and let me know how it goes -- Robert From villate at fe.up.pt Mon Jan 22 03:43:25 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Mon, 22 Jan 2007 09:43:25 +0000 Subject: [Maxima] Memory use, forcing GC, %oXX vars keeping references In-Reply-To: <20070120183836.GV29279@localhost.localdomain> References: <20070120183836.GV29279@localhost.localdomain> Message-ID: <1169459005.5277.35.camel@localhost.localdomain> On Sat, 2007-01-20 at 10:38 -0800, Daniel Lakeland wrote: > I've been using the "rk" function with very small step sizes, I tend > to get back lists of several thousand or a million entries. I have a modified version of rk that only saves the results of some of the steps (for example, steps 0,100,200,...). I use it when I have to study chaotic systems with very small step sizes. I will soon commit a new version of rk with an extra option to do that. In the mean time, you can also do the following: instead of running rk once with n steps, run it 10 times with n/10 steps, in the second, third, ..., tenth run you use as initial values the last value on the list returned by the previous run. After each run you can select a few points from the whole list using makelist. The English translation of my book, which gives more examples on the use of "dynamics", should become available soon. > After a while, gcl eventually crashes. I'm running on an AMD64 machine > with 2G of memory, but I'm not convinced that gcl is able to use the > entire address space since it tends to stay below about 500MB before > crashing. I do "kill(solns)" (the variable that stores the output) at > each iteration, but I'm thinking perhaps that the %o1,%o2 type > variables keep a handle to these big lists so they aren't gc'ed. Oh really? that would be a bummer. Are you ending each %i command with $ ? Regards, Jaime From villate at fe.up.pt Mon Jan 22 04:49:30 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Mon, 22 Jan 2007 10:49:30 +0000 Subject: [Maxima] Running openmath plots in the background In-Reply-To: <1d67a53c0701211542oba2be89je0a6a4637eb3e762@mail.gmail.com> References: <1d67a53c0701211542oba2be89je0a6a4637eb3e762@mail.gmail.com> Message-ID: <1169462970.5277.68.camel@localhost.localdomain> On Mon, 2007-01-22 at 10:42 +1100, Alasdair McAndrew wrote: > When I create a standard 2d plot of a function using plot2d (under > linux), I have a gnuplot window which remains open while I can > continue to work in maxima (using console maxima or imaxima in emacs). > However, if I use the [plot_format,openmath] option, then the maxima > process is halted while the plot window is open; I can only perform > further work in maxima by closing the plot window. > > How can I run an openmath window in the background, so to speak? Before version 5.10, the default behavior for openmath was to wait for the user to close its window. I guess this came from a time when keeping many open windows could slow down a system. I changed the default behavior in Xmaxima to run the openmath windows in the background. I will now do the same in console Maxima, unless somebody brings an argument against it. Regards, Jaime From dlakelan at street-artists.org Mon Jan 22 09:36:59 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Mon, 22 Jan 2007 07:36:59 -0800 Subject: [Maxima] the "dynamics" package and numerical solution of DEs In-Reply-To: References: <3B83C910-0DDF-4787-B4AC-79E0453C04EA@nasa.gov> <20070122000108.GW29279@localhost.localdomain> Message-ID: <20070122153659.GZ29279@localhost.localdomain> On Sun, Jan 21, 2007 at 10:42:03PM -0700, Robert Dodier wrote: > On 1/21/07, Daniel Lakeland wrote: > If there's something odd about the Debian package for Maxima, > it would be very helpful if you submit a bug report to the package > maintainer, if you have time. Same goes for packages created > by any downstream packager. It turns out that Debian breaks up the maxima system into 3 packages: "maxima", "maxima-share", and "maxima-doc". I only had the first 2. When I installed the doc package it worked as usual. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From villate at fe.up.pt Mon Jan 22 09:45:31 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Mon, 22 Jan 2007 15:45:31 +0000 Subject: [Maxima] the "dynamics" package and numerical solution of DEs In-Reply-To: <20070122000108.GW29279@localhost.localdomain> References: <3B83C910-0DDF-4787-B4AC-79E0453C04EA@nasa.gov> <20070122000108.GW29279@localhost.localdomain> Message-ID: <1169480731.5277.136.camel@localhost.localdomain> On Sun, 2007-01-21 at 16:01 -0800, Daniel Lakeland wrote: > The first thing you should do is get a relatively up to date > maxima. 5.10.0 at least. If you're running Debian, that's what's in > the "testing" or "unstable" distribution. I've just installed maxima 5.10 in Debian testing to see what's going on. I've noticed that the Debian package has a error: it should depend on: libgmp3c2 if you do not have that package installed, maxima will not start. > If you're running Debian, you'll also need the "maxima-share" package > which has all the "non-core" maxima stuff. I'm not sure why the Debian > packager does this, but I think it's a debian policy to split out > "nonessential" portions of packages... That's right. But the definition of what's essential for a package is left to the package maintainer. In this case, Camm Maguire thinks gcl is essential (there are no cmucl, sbcl or clisp versions) but share is not. If I were the maintainer I would pack share into maxima-common and leave the gcl executable into a dependency of the form maxima-gcl | maxima-sbcl | maxima-cmucl | maxima-clisp > This might be a reason why it doesn't find the "dynamics" package, > because you will need to "load(dynamics);" before getting rk. right. > "? rk" is supposed to give you info on how to use the runge-kutta ODE > integrator. It works for me on windows, but on Debian it doesn't find > the docs describe (and the equivalent ? operator) will not work unless you also install maxima-doc, which is not even recommended but just suggested. The info files come in the maxima-doc package. There are other problems with the maxima package in Debian testing (5.10). It depends on gnuplot-nox, but even with that package one will not get any plots unless X is installed and Maxima is run from an X console (which is not among the dependencies). Regards, Jaime From miguel39123 at hotmail.com Mon Jan 22 09:50:53 2007 From: miguel39123 at hotmail.com (miguel) Date: Mon, 22 Jan 2007 15:50:53 +0000 (UTC) Subject: [Maxima] openlogic expert for maxima? Message-ID: Perhaps some experts from the maxima list could be interested in openlogic and its relation with free software. At a first look I don't see the maxima project in the pull-down list, maybe nobody is is this list yet? -M From macrakis at alum.mit.edu Mon Jan 22 11:34:54 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 22 Jan 2007 12:34:54 -0500 Subject: [Maxima] Memory use, forcing GC, %oXX vars keeping references In-Reply-To: <1169459005.5277.35.camel@localhost.localdomain> References: <20070120183836.GV29279@localhost.localdomain> <1169459005.5277.35.camel@localhost.localdomain> Message-ID: <8b356f880701220934r7089fd63s20a6c583d0e2fae3@mail.gmail.com> > > each iteration, but I'm thinking perhaps that the %o1,%o2 type > > variables keep a handle to these big lists so they aren't gc'ed. > Oh really? that would be a bummer. Are you ending each %i command with > $ ? Ending the %i command with a $ keeps the result from being displayed, but still assigns the value to the %o variable. Setting nolabels:true turns off assigning the result to the %o variable, and displays the result if the %i ends with ";". -s From macrakis at alum.mit.edu Mon Jan 22 12:48:14 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 22 Jan 2007 13:48:14 -0500 Subject: [Maxima] [newbie] help with simplification In-Reply-To: References: <20070121184139.GA3579@landau.phys.spbu.ru> <45B3C83D.7090800@ieee.org> Message-ID: <8b356f880701221048w50981ecem1ae8c56dd7a2f8a1@mail.gmail.com> As simplified with ratsimp/algebraic, the result is: sqrt(-(2*l*sqrt(2*c*l*r^2+l^2)-c^2*r^4+2*c*l*r^2+2*l^2)/(c^2*r^4-4*c*l*r^2)) (call that qq) To simplify beyond that, you'll need to decide what form you want, or what assumptions you make about the values of the parameters. For example, if R is relatively small, you might try taylor(qq,r,0,1) => sqrt(c)*sqrt(l)/(c*r)+5*sqrt(c)*sqrt(l)*r/(8*l)+... which you can simplify further ... map(factor,taylor(...)) => sqrt(c)*sqrt(l)/(c*r)+5*sqrt(c)*sqrt(l)*r/(8*l) which it turns out is the same as taylor(qq,[r,l,c],0,3). If on the other hand R is relatively large, map(factor,taylor(qq,r,inf,3)) => l/(c*r^2)-sqrt(2)*l^(3/2)/(c^(3/2)*r^3)+1 If L >> C, then try rr:subst(a*c,l,qq) and then taylor(rr,a,inf,1) => sqrt(a)/r+5*r/(8*sqrt(a)) or if L << C taylor(rr,a,0,1) => 1+a/r^2 and so on. Hope this helps. -s From willisb at unk.edu Mon Jan 22 12:54:44 2007 From: willisb at unk.edu (Barton Willis) Date: Mon, 22 Jan 2007 12:54:44 -0600 Subject: [Maxima] subres --> spmod Message-ID: For the next release, I suggest that we consider making spmod the default gcd algorithm. So that everybody can try this out, this morning I committed this change. The test suite seems to run OK (sbcl 1.0 for windows) Building Maxima under windows is getting more difficult: (1) I think configure requires perl version 5.8, but mingw only has version 5.6 (2) My GCL 2.6.7 builds a Maxima that seems to work, but the test suite reports lots of error breaks (I think this is a problem with line endings) (3) I haven't found a place to download GCL 2.6.8 binaries for windows. I haven't tried to build it for myself. Fortunately, many changes can be tested without re-building. Barton From toy at rtp.ericsson.se Mon Jan 22 13:34:14 2007 From: toy at rtp.ericsson.se (Raymond Toy) Date: Mon, 22 Jan 2007 14:34:14 -0500 Subject: [Maxima] searching for share directories, was: 5.11.0 can not load diff_form In-Reply-To: References: Message-ID: <45B511B6.3040008@rtp.ericsson.se> Robert Dodier wrote: > OK, here is an attempt at some Lisp code to look for share directories. > > (1) File & directory stuff varies from Lisp to Lisp. > I think the code below works for Clisp, GCL, SBCL, and Allegro (all > Linux). Can you explain how find-share-directories is supposed to be used? I tried this with gcl and it just seems to hang. Ray From toy at rtp.ericsson.se Mon Jan 22 13:48:44 2007 From: toy at rtp.ericsson.se (Raymond Toy) Date: Mon, 22 Jan 2007 14:48:44 -0500 Subject: [Maxima] searching for share directories, was: 5.11.0 can not load diff_form In-Reply-To: <45B511B6.3040008@rtp.ericsson.se> References: <45B511B6.3040008@rtp.ericsson.se> Message-ID: <45B5151C.5090109@rtp.ericsson.se> Raymond Toy wrote: > Robert Dodier wrote: >> OK, here is an attempt at some Lisp code to look for share directories. >> >> (1) File & directory stuff varies from Lisp to Lisp. >> I think the code below works for Clisp, GCL, SBCL, and Allegro (all >> Linux). > Can you explain how find-share-directories is supposed to be used? I > tried this with gcl and it just seems to hang. > Never mind. It works with gcl. It just seems to take an exceedingly long time. Something that I probably would not be happy to see, every time I start maxima. Perhaps we could just do something as simple as "find share -type d". That should be fast and we only get directories as a result. We just need to filter out the CVS directories, and binary-* directories. Of course, this probably won't work on Windows with cygwin or equivalent. Ray From robert.dodier at gmail.com Mon Jan 22 14:01:54 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 22 Jan 2007 13:01:54 -0700 Subject: [Maxima] searching for share directories, was: 5.11.0 can not load diff_form In-Reply-To: <45B5151C.5090109@rtp.ericsson.se> References: <45B511B6.3040008@rtp.ericsson.se> <45B5151C.5090109@rtp.ericsson.se> Message-ID: On 1/22/07, Raymond Toy wrote: > Never mind. It works with gcl. It just seems to take an exceedingly > long time. Something that I probably would not be happy to see, every > time I start maxima. Didn't you have a different implementation of the same idea? I've lost track. > Perhaps we could just do something as simple as "find share -type d". > That should be fast and we only get directories as a result. We just > need to filter out the CVS directories, and binary-* directories. > > Of course, this probably won't work on Windows with cygwin or equivalent. Yes, find would be great, if we could make it work on Windows. best Robert From belanger at truman.edu Mon Jan 22 14:32:44 2007 From: belanger at truman.edu (Jay Belanger) Date: Mon, 22 Jan 2007 14:32:44 -0600 Subject: [Maxima] error on first line sent to maxima In-Reply-To: <87sle7ezga.fsf@patagonia.sebmags.homelinux.org> (Seb's message of "Fri\, 19 Jan 2007 10\:47\:01 -0600") References: <871wlzak48.fsf@patagonia.sebmags.homelinux.org> <87ac0mgvhe.fsf@vh213602.truman.edu> <874pqngeow.fsf@patagonia.sebmags.homelinux.org> <87sle7ezga.fsf@patagonia.sebmags.homelinux.org> Message-ID: <87lkju4xar.fsf@vh213602.truman.edu> Seb writes: ... >> Basically, _any_ expression I type in at the >> first maxima prompt (or send to the process from a script file) causes >> the problem. > > I should have mentioned that this occurs only with the first input in a > maxima session; further input is processed without problem. I tried evaluating (require 'ansi-color) (setq ansi-color-for-comint-mode t) and then starting a Maxima process in Emacs, but still I had no problems. Are there any other ansi-color customizations that you have in your .emacs file? Do you get the same problem if you start emacs with emacs -Q loading the ansi-color stuff, loading the maxima stuff, and starting a Maxima process? Jay From raymond.toy at ericsson.com Mon Jan 22 15:13:31 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Mon, 22 Jan 2007 16:13:31 -0500 Subject: [Maxima] searching for share directories, was: 5.11.0 can not load diff_form In-Reply-To: References: <45B511B6.3040008@rtp.ericsson.se> <45B5151C.5090109@rtp.ericsson.se> Message-ID: <45B528FB.3070200@ericsson.com> Robert Dodier wrote: > On 1/22/07, Raymond Toy wrote: > > >> Never mind. It works with gcl. It just seems to take an exceedingly >> long time. Something that I probably would not be happy to see, every >> time I start maxima. >> > > Didn't you have a different implementation of the same idea? > I've lost track. > Yes, I did. Works nicely with cmucl and clisp. Doesn't work at all with gcl because it doesn't understand :wild-inferiors (subdirectories) in directory function. (I looked at the implementation of directory in gcl. It just calls "ls -d *" or "ls -d *.*". No subdirectory support. I have a hack to use find on Unix.) cl-fad (http://www.cliki.net/cl-fad) would seem to work, but, of course, gcl isn't supported. > >> Perhaps we could just do something as simple as "find share -type d". >> That should be fast and we only get directories as a result. We just >> need to filter out the CVS directories, and binary-* directories. >> >> Of course, this probably won't work on Windows with cygwin or equivalent. >> > > Yes, find would be great, if we could make it work on Windows. > > I assume find is not a standard part of Windows, so that would work so nicely. Too bad. Ray From trayracing at yahoo.com Mon Jan 22 16:38:25 2007 From: trayracing at yahoo.com (Ray Tice) Date: Mon, 22 Jan 2007 14:38:25 -0800 (PST) Subject: [Maxima] Integrating function with abs or max Message-ID: <380497.54454.qm@web38403.mail.mud.yahoo.com> How do I reformulate functions that use abs or max so that maxima can integrate them? For example, integrate(abs(x), x, -1, 1) won't evaluate, but both of these will: integrate(abs(x), x, -1, 0) integrate(abs(x), x, 0, 1) Am I missing out on a better way to describe equations to maxima? Maybe I'm missing a flag to subdivide problems? (I am rather a newbie in Maxima) Indefinite integration fares no better even in the simple case. Of course, the above answer is easy to construct, even for high school students, It's less easy for a human to do it flawlessy for even slightly more complidated problems: f(x) := max(1-abs(x), 0) integrate(f(x)*f(x-a), x) Thanks, Ray --------------------------------- Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070122/0e389964/attachment.htm From dlakelan at street-artists.org Mon Jan 22 18:32:37 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Mon, 22 Jan 2007 16:32:37 -0800 Subject: [Maxima] Memory use, forcing GC, %oXX vars keeping references In-Reply-To: <1169459005.5277.35.camel@localhost.localdomain> References: <20070120183836.GV29279@localhost.localdomain> <1169459005.5277.35.camel@localhost.localdomain> Message-ID: <20070123003236.GA29279@localhost.localdomain> On Mon, Jan 22, 2007 at 09:43:25AM +0000, Jaime E. Villate wrote: > On Sat, 2007-01-20 at 10:38 -0800, Daniel Lakeland wrote: > > I've been using the "rk" function with very small step sizes, I tend > > to get back lists of several thousand or a million entries. > I have a modified version of rk that only saves the results of > some of the steps (for example, steps 0,100,200,...). I use it when > I have to study chaotic systems with very small step sizes. I will > soon commit a new version of rk with an extra option to do that. While you're at it, can I suggest that you include in rk the option to let the user supply a predicate function that tells rk when to stop? This would be super useful if for example you are trying to find when a particular solution goes to zero for the first time, or to stop when the solution becomes "un-physical" (ie. one of the vars is negative, or something like that). The predicate function should have access to probably the current values of the independent vars, the previous values of the independent vars, and the current values of the derivative expressions. This lets you check for when a solution crosses a threshold, when one of the derivatives has "blown up", or when the current values are outside acceptable ranges. This can save a lot of time vs just letting rk integrate and finding out after a few minutes that all you wanted to know was in the first 10% of the computation. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From robert.dodier at gmail.com Mon Jan 22 21:22:06 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 22 Jan 2007 20:22:06 -0700 Subject: [Maxima] subres --> spmod In-Reply-To: References: Message-ID: On 1/22/07, Barton Willis wrote: > For the next release, I suggest that we consider making spmod the default > gcd algorithm. OK by me. Robert From tommycli at ucla.edu Tue Jan 23 01:16:23 2007 From: tommycli at ucla.edu (Tommy Li) Date: Mon, 22 Jan 2007 23:16:23 -0800 Subject: [Maxima] How to make Maxima evaluate a curl? Message-ID: I'm trying to get Maxima to actually evaluate a curl. I loaded the "vect" package, and here is the output: (%i2) scalefactors([[x,y,z],x,y,z]); (%o2) DONE (%i3) A:[0,0,a*exp(-%i*beta*x)]; - %I BETA x (%o3) [0, 0, a %E ] (%i4) curl(A); - %I BETA x (%o4) CURL [0, 0, a %E ] So after I take the curl, the output has the curl as an operator. How do I get it to actually evaluate the curl? From willisb at unk.edu Tue Jan 23 04:14:52 2007 From: willisb at unk.edu (Barton Willis) Date: Tue, 23 Jan 2007 04:14:52 -0600 Subject: [Maxima] How to make Maxima evaluate a curl? In-Reply-To: References: Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >So after I take the curl, the output has the curl >as an operator. How do I get it to actually evaluate the curl? Try the function 'express' (%i1) load(vect)$ (%i2) scalefactors([[x,y,z],x,y,z])$ (%i3) A:[0,0,a*exp(-%i*beta*x)]$ (%i4) curl(A)$ (%i5) express(%o4); (%o5) ['diff((a*%e^(-%i*beta*x)),y,1),-'diff((a*%e^(-%i*beta*x)),x,1),0] (%i6) %,diff; (%o6) [0,%i*a*beta*%e^(-%i*beta*x),0] Barton From go.maxima at gmail.com Tue Jan 23 05:12:22 2007 From: go.maxima at gmail.com (=?ISO-2022-JP?B?GyRCOEVDKzlkQDgbKEI=?=) Date: Tue, 23 Jan 2007 20:12:22 +0900 Subject: [Maxima] How to make Maxima evaluate a curl? In-Reply-To: References: Message-ID: hi Tommy you may use diff_form package,share/diff_form/. curl -->hodge star(exterior differemtiayion) such h_st(d()) (%i1) load("diff_form.mac")$ (%i2) fstar_with_clf([x,y,z],[x,y,z],(aa:vtof1([0,0,a*exp(-%i*beta*x)]),h_st(d(aa)))); - %i beta x (%o2) %i a beta Dy %e please read .../share/diff_form/example.txt thanks Gosei Furuya 2007/1/23, Tommy Li : > > I'm trying to get Maxima to actually evaluate a curl. > > I loaded the "vect" package, and here is the output: > > (%i2) scalefactors([[x,y,z],x,y,z]); > > (%o2) DONE > (%i3) A:[0,0,a*exp(-%i*beta*x)]; > > - %I BETA x > (%o3) [0, 0, a %E ] > (%i4) curl(A); > > - %I BETA x > (%o4) CURL [0, 0, a %E ] > > So after I take the curl, the output has the curl as an operator. How do > I get it to actually evaluate the curl? > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070123/cbd4495b/attachment.htm From areiner at tph.tuwien.ac.at Tue Jan 23 10:23:55 2007 From: areiner at tph.tuwien.ac.at (Albert Reiner) Date: 23 Jan 2007 17:23:55 +0100 Subject: [Maxima] Integrating function with abs or max In-Reply-To: <380497.54454.qm@web38403.mail.mud.yahoo.com> References: <380497.54454.qm@web38403.mail.mud.yahoo.com> Message-ID: <864pqh90f8.fsf@willehalm.reiner> [Ray Tice , Mon, 22 Jan 2007 14:38:25 -0800 (PST)]: > How do I reformulate functions that use abs or max so that maxima > can integrate them? For example, integrate(abs(x), x, -1, 1) won't > evaluate, but both of these will: > integrate(abs(x), x, -1, 0) > integrate(abs(x), x, 0, 1) I believe, the correct way to handle these kinds of things is to replace abs(x) by something akin to (if x >= 0 then x else -x). Someone has done some work on unevaluated conditionals that should allow you to do this. Alternatively, I have some code somewhere that should be able to handle this, although the result might well be ugly, and I believe that only linear protaseis are implemented; tell me if you want me to dig it up wherever it sits on my hard drive. Best regards, Albert. From twidlar at yahoo.com Tue Jan 23 10:59:05 2007 From: twidlar at yahoo.com (Thomas Widlar) Date: Tue, 23 Jan 2007 10:59:05 -0600 Subject: [Maxima] How to make Maxima evaluate a curl? In-Reply-To: References: Message-ID: <45B63ED9.9030300@yahoo.com> Gosei, I been meaning to write to you about this, but I haven't been able to phrase the question right. I had a same problems, and that generated a discussion of why grad, div, curl, and laplacian don't follow the same noun/verb rules that diff and integrate do? Does you package replace the vect and various tensor packages? Are they better? I want to enter in the equations of the Einstein/Cartan/Evans (ECE) Relativity Theory in maxima. ECE incorporates Cartan's expression of torsion in GR, yielding a unified field theory. Geometry = Physics. What are the right tools to use? (Your email address causes delivery failures). Tom Widlar ???? wrote: > hi Tommy > > you may use diff_form package,share/diff_form/. > curl -->hodge star(exterior differemtiayion) such h_st(d()) > (%i1) load("diff_form.mac")$ > (%i2) > fstar_with_clf([x,y,z],[x,y,z],(aa:vtof1([0,0,a*exp(-%i*beta*x)]),h_st(d(aa)))); > - %i beta x > (%o2) %i a beta Dy %e > please read .../share/diff_form/example.txt > > thanks > Gosei Furuya > > > 2007/1/23, Tommy Li >: > > I'm trying to get Maxima to actually evaluate a curl. > > I loaded the "vect" package, and here is the output: > > (%i2) scalefactors([[x,y,z],x,y,z]); > > (%o2) DONE > (%i3) A:[0,0,a*exp(-%i*beta*x)]; > > - %I BETA x > (%o3) [0, 0, a %E ] > (%i4) curl(A); > > - %I BETA x > (%o4) CURL [0, 0, a %E ] > > So after I take the curl, the output has the curl as an operator. > How do > I get it to actually evaluate the curl? > _______________________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070123/8cbe383d/attachment.htm From tommycli at ucla.edu Tue Jan 23 11:15:24 2007 From: tommycli at ucla.edu (Tommy Li) Date: Tue, 23 Jan 2007 09:15:24 -0800 Subject: [Maxima] How to make Maxima evaluate a curl? In-Reply-To: References: Message-ID: Barton Willis wrote: > -----maxima-bounces at math.utexas.edu wrote: ----- > >> So after I take the curl, the output has the curl >> as an operator. How do I get it to actually evaluate the curl? > > Try the function 'express' > > (%i1) load(vect)$ > (%i2) scalefactors([[x,y,z],x,y,z])$ > (%i3) A:[0,0,a*exp(-%i*beta*x)]$ > (%i4) curl(A)$ > (%i5) express(%o4); > (%o5) ['diff((a*%e^(-%i*beta*x)),y,1),-'diff((a*%e^(-%i*beta*x)),x,1),0] > (%i6) %,diff; > (%o6) [0,%i*a*beta*%e^(-%i*beta*x),0] > > Barton This seems to work quite well. Thanks a lot! They key seems to be %i6. What is the secret of the comma and diff? Why does that make it evaluate the diffs? I can't seem to find any notes on the comma in the manual. From robert.dodier at gmail.com Tue Jan 23 12:59:18 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 23 Jan 2007 11:59:18 -0700 Subject: [Maxima] How to make Maxima evaluate a curl? In-Reply-To: References: Message-ID: On 1/23/07, Tommy Li wrote: > > (%o5) ['diff((a*%e^(-%i*beta*x)),y,1),-'diff((a*%e^(-%i*beta*x)),x,1),0] > > (%i6) %,diff; > > (%o6) [0,%i*a*beta*%e^(-%i*beta*x),0] > They key seems to be %i6. What is the secret of the comma and diff? Why > does that make it evaluate the diffs? I can't seem to find any notes on > the comma in the manual. 'diff is a so-called noun -- essentially a function which isn't evaluated. ev(foo, diff) causes 'diff nouns to be evaluated if present, ev(foo, nouns) causes all nouns to be evaluated. %, diff is an abbreviation for ev(%, diff). There is an attempt to explain this stuff in the manual under ev -- try ? ev at the input prompt. Hope this helps, & thanks for your interest in Maxima. Robert Dodier From kirr at landau.phys.spbu.ru Tue Jan 23 13:13:06 2007 From: kirr at landau.phys.spbu.ru (Kirill Smelkov) Date: Tue, 23 Jan 2007 22:13:06 +0300 Subject: [Maxima] [newbie] How to optimize maxima code? In-Reply-To: References: <20070121184139.GA3579@landau.phys.spbu.ru> Message-ID: <20070123191306.GA20948@landau.phys.spbu.ru> Robert, On Sun, Jan 21, 2007 at 12:40:23PM -0700, Robert Dodier wrote: > >I'm doing some calculations with spherical functions Ylm, and > >the problem is that my code is running painfully slow. > > Hmm, sounds like an interesting problem. > About profiling, take a look at the functions timer and timer_info -- > timer records function call execution time and timer_info shows > the results. > > ? timer > at the input prompt should find info about these functions. Thanks for the info, timer works. The only inconsistency I've encountered is that it is impossible to profile "partly array function", e.g. Ylm[l,m](theta,phi) := block([], SOME CALC )$ so I need to do a trick: __Ylm(l,m,theta,phi) := block([], SOME CALC); Ylm[l,m](theta,phi) := __Ylm(l,m,theta,phi); But this is a minor problem. > Hope this helps, Yes, thanks. I've rewritten some bits, so it now runs faster, but a lot of time is still spent in function which integrates over sphere: assume(r > 0); sph_integrate(f, theta,phi) := block([Iphi,Itheta,foo], f2 : demoivre(f), /* XXX try to help integrate (see SF #1636106)... (it was asking me whether sin(th) is pos, neg or zero... */ Iphi : integrate(f2, phi, 0,2*%pi), Itheta : integrate(Iphi * sin(theta), theta, 0,%pi), ev(Itheta) /* this is to force evaluation of cos(0), cos(%pi), etc... */ ); What one can do with further optimizing it? f is a mix of trigionometry - maybe I should prepare it for integrate to help, with say trigrat? -- ????? ????????, ??????. http://landau.phys.spbu.ru/~kirr/aiv/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070123/69eefe3e/attachment.pgp From dlakelan at street-artists.org Tue Jan 23 13:22:43 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Tue, 23 Jan 2007 11:22:43 -0800 Subject: [Maxima] [newbie] How to optimize maxima code? In-Reply-To: <20070123191306.GA20948@landau.phys.spbu.ru> References: <20070121184139.GA3579@landau.phys.spbu.ru> <20070123191306.GA20948@landau.phys.spbu.ru> Message-ID: <20070123192243.GF25287@street-artists.org> On Tue, Jan 23, 2007 at 10:13:06PM +0300, Kirill Smelkov wrote: > Iphi : integrate(f2, phi, 0,2*%pi), > Itheta : integrate(Iphi * sin(theta), theta, 0,%pi), Are you looking for numerical results? Perhaps you would be better off with numerical integration using the quadpack functions (quad_qag and friends) -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From kirr at landau.phys.spbu.ru Tue Jan 23 14:18:32 2007 From: kirr at landau.phys.spbu.ru (Kirill Smelkov) Date: Tue, 23 Jan 2007 23:18:32 +0300 Subject: [Maxima] [newbie] How to optimize maxima code? In-Reply-To: <20070123192243.GF25287@street-artists.org> References: <20070121184139.GA3579@landau.phys.spbu.ru> <20070123191306.GA20948@landau.phys.spbu.ru> <20070123192243.GF25287@street-artists.org> Message-ID: <20070123201832.GA22559@landau.phys.spbu.ru> Daniel, On Tue, Jan 23, 2007 at 11:22:43AM -0800, Daniel Lakeland wrote: > On Tue, Jan 23, 2007 at 10:13:06PM +0300, Kirill Smelkov wrote: > > > Iphi : integrate(f2, phi, 0,2*%pi), > > Itheta : integrate(Iphi * sin(theta), theta, 0,%pi), > > Are you looking for numerical results? Perhaps you would be better off > with numerical integration using the quadpack functions (quad_qag and > friends) No. At this point I'm looking for analytical results. There will be a lot of exact zeroes at least, and I use the results to construct formulas and code. However thanks for pointing at quadpack -- I'll need it when verifing the whole results (various R^3 integrals analytically taken in r,theta,phi). -- ????? ????????, ??????. http://landau.phys.spbu.ru/~kirr/aiv/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070123/6747a7a2/attachment.pgp From robert.dodier at gmail.com Tue Jan 23 22:14:41 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 23 Jan 2007 21:14:41 -0700 Subject: [Maxima] A note on graphics In-Reply-To: <1169382954.12070.9.camel@localhost.localdomain> References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: Mario, I looked at the examples of new plotting capabilities which you posted, > http://www.telefonica.net/web2/biomates/maxima/gpdraw I have just some minor quibbles. On the whole it looks terrific to me. (1) I'd prefer to rework plot2d instead of creating a separate function gpdraw2d. It would be a mess to have both old and new plotting functions. It would be OK with me to cut out plot2d, but if so I would rename gpdraw2d to draw2d or something else not specific to Gnuplot. (2) I'd like to see a function which adds more stuff to an existing plot, let's say plot2d_more or something. That way the user need not think of everything before calling plot2d just once. (3) I'd like to see a function which replots the most recent plot. E.g. if you close the plot window and then you want to see the same stuff again. Or you want the same stuff but output to a file instead of shown on the screen. (4) I think I'd like to see plotting functions return a description of the current plot, maybe as a noun expression 'plot2d(x, y, z, ...). At present plot2d returns an empty string; pretty much anything would be more useful. As I was saying, this is great work, and I hope that we can come to agreement on how to merge it into Maxima soon. best Robert From robert.dodier at gmail.com Tue Jan 23 23:31:22 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 23 Jan 2007 22:31:22 -0700 Subject: [Maxima] Integrating function with abs or max In-Reply-To: <864pqh90f8.fsf@willehalm.reiner> References: <380497.54454.qm@web38403.mail.mud.yahoo.com> <864pqh90f8.fsf@willehalm.reiner> Message-ID: On 23 Jan 2007 17:23:55 +0100, Albert Reiner wrote: > [Ray Tice , Mon, 22 Jan 2007 14:38:25 -0800 (PST)]: > > How do I reformulate functions that use abs or max so that maxima > > can integrate them? For example, integrate(abs(x), x, -1, 1) won't > > evaluate, but both of these will: > > integrate(abs(x), x, -1, 0) > > integrate(abs(x), x, 0, 1) > > I believe, the correct way to handle these kinds of things is to > replace abs(x) by something akin to (if x >= 0 then x else -x). > Someone has done some work on unevaluated conditionals that should > allow you to do this. The boolsimp package makes Maxima comfortable with unevaluated conditionals, but there aren't any functions to make conditionals interact with integrate or arithmetic operators. Not for any principled reason, but just because I haven't gotten around to it. This is an interesting problem; I'll try to work on it over the weekend. best, Robert Dodier From willisb at unk.edu Wed Jan 24 04:53:23 2007 From: willisb at unk.edu (Barton Willis) Date: Wed, 24 Jan 2007 04:53:23 -0600 Subject: [Maxima] syntax question about user defined infix Message-ID: Mostly for fun I tried: (%i1) infix("-->",10,10)$ (%i2) "-->"(x,e) := buildq([x,e], lambda([x],e))$ It seems to work: (%i3) x --> 5 - x^7; (%o3) lambda([x],5-x^7) I have a function 'bisection' that takes as its first argument a function. Does my infix --> work now? No: (%i4) bisection(x --> 5 - x^7, 0, 2, 1/10); Incorrect syntax: Missing ) bisection(x --> ^ But bisection("-->"(x, 5 - x^7), 0, 2, 1/10) is OK: (%i8) bisection("-->"(x, 5 - x^7), 0, 2, 1/10); (%o8) interval(5/4,21/16) Does this have something to do with 'bisection'? Apparently, no: (%i4) f( x --> 5 - x^7); Incorrect syntax: Missing ) f( x --> ^ I've tried other binding powers and other names for "-->", but nothing I tried works. My Macsyma (an elderly 2.2) does the same thing. I tried this infix scheme for a lambda form partly because students think the lambda from is weird and verbose. And they love arrows .... Barton From l.couraud at gmail.com Wed Jan 24 06:29:58 2007 From: l.couraud at gmail.com (laurent couraud) Date: Wed, 24 Jan 2007 13:29:58 +0100 Subject: [Maxima] syntax question about user defined infix In-Reply-To: References: Message-ID: <8275d2360701240429y7e66d0f7yf66d282a65c6c7ec@mail.gmail.com> infix("-->",50,50)$ work correctly it seems. but i don't know what is the best value. 2007/1/24, Barton Willis : > > Mostly for fun I tried: > > (%i1) infix("-->",10,10)$ > (%i2) "-->"(x,e) := buildq([x,e], lambda([x],e))$ > > It seems to work: > > (%i3) x --> 5 - x^7; > (%o3) lambda([x],5-x^7) > > I have a function 'bisection' that takes as its first > argument a function. Does my infix --> work now? No: > > (%i4) bisection(x --> 5 - x^7, 0, 2, 1/10); > Incorrect syntax: Missing ) > bisection(x --> > ^ > But bisection("-->"(x, 5 - x^7), 0, 2, 1/10) is OK: > > (%i8) bisection("-->"(x, 5 - x^7), 0, 2, 1/10); > (%o8) interval(5/4,21/16) > > Does this have something to do with 'bisection'? Apparently, no: > > (%i4) f( x --> 5 - x^7); > Incorrect syntax: Missing ) > f( x --> > ^ > > I've tried other binding powers and other names for "-->", > but nothing I tried works. > > My Macsyma (an elderly 2.2) does the same thing. I tried > this infix scheme for a lambda form partly because students think > the lambda from is weird and verbose. And they love arrows .... > > Barton > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From willisb at unk.edu Wed Jan 24 07:10:01 2007 From: willisb at unk.edu (Barton Willis) Date: Wed, 24 Jan 2007 07:10:01 -0600 Subject: [Maxima] syntax question about user defined infix In-Reply-To: <8275d2360701240429y7e66d0f7yf66d282a65c6c7ec@mail.gmail.com> References: , <8275d2360701240429y7e66d0f7yf66d282a65c6c7ec@mail.gmail.com> Message-ID: -----"laurent couraud" wrote: ----- >infix("-->",50,50)$ work correctly it seems. Yes, it does. Thank you. Barton From ficmatin01 at solar.com.br Wed Jan 24 01:18:34 2007 From: ficmatin01 at solar.com.br (Jorge Barros de Abreu) Date: Wed, 24 Jan 2007 05:18:34 -0200 Subject: [Maxima] historical file for pt_BR Message-ID: <200701240518.34233.ficmatin01@solar.com.br> Hi for all. In 4 May pt_BR is 2 years old. The translation is complete. All Maxima manual files is translated. The historical file from translation was being made. If you make contributions for the translation please send to me the date for your contribuition and a text that describe it. This data will be located in the historical file. []?s -- Data Estelar 2454122,818646 http://usr.solar.com.br/~ficmatin Desejo-lhe Paz, Vida Longa e Prosperidade. S?o Bem Vindas Mensagens no Formato Texto Gen?rico com Acentos. From robert.dodier at gmail.com Wed Jan 24 10:04:29 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 24 Jan 2007 09:04:29 -0700 Subject: [Maxima] DSC-2007 Common Lisp talks by Ross Ihaka and Tony Rossini (R-Project) In-Reply-To: <45B69799.4090900@prodigy.net.mx> References: <45B69799.4090900@prodigy.net.mx> Message-ID: Robert, thanks for sending the link. I've taken the liberty of forwarding this to the Maxima mailing list. I wish I could attend the conference! > http://www.stat.auckland.ac.nz/dsc-2007/abstracts/program.html Lately Maxima has been getting additional functions for statistical analysis, so in a sense Maxima is slowly subsuming functions which have existed til now in packages purpose-built for statistics. Perhaps Maxima will make an appearance at DSC soon. best, Robert Dodier From willisb at unk.edu Wed Jan 24 10:25:58 2007 From: willisb at unk.edu (Barton Willis) Date: Wed, 24 Jan 2007 10:25:58 -0600 Subject: [Maxima] derivatives of bessel_j A&S 9.1.27 vs 9.1.30 Message-ID: Would it be OK to change the derivatives of the Bessel functions to use A&S 9.1.27 instead of 9.1.30? See: http://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP?Res=200&Page=361 This change allows taylor to expand bessel_j about zero: (%i1) e : bessel_j(0,x)$ (%i2) taylor(e,x,0,4); `taylor' encountered an unfamiliar singularity in: bessel_j(0,x) The cause is (%i3) diff(e,x,2); (%o3) bessel_j(1,x)/x-bessel_j(0,x) <--- problem at zero With the change to A&S 9.1.27: (%i4) load("c:/maximacvs3/src/bessel.lisp")$ (%i5) taylor(e,x,0,4); (%o5) 1-x^2/4+x^4/64+... (%i6) diff(e,x,2); (%o6) -(bessel_j(0,x)-bessel_j(2,x))/2 With the exception of #10 in rtest14, I think the test suite is OK with this change (rtest14 #10 checks diff(bessel_j(1,x),x) = bessel_j(0,x)-bessel_j(1,x)/x So it's a non bug failure) Barton From robert.dodier at gmail.com Wed Jan 24 10:47:40 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 24 Jan 2007 09:47:40 -0700 Subject: [Maxima] derivatives of bessel_j A&S 9.1.27 vs 9.1.30 In-Reply-To: References: Message-ID: On 1/24/07, Barton Willis wrote: > Would it be OK to change the derivatives of the Bessel functions > to use A&S 9.1.27 instead of 9.1.30? OK by me. best Robert From sen1 at math.msu.edu Wed Jan 24 10:44:12 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Wed, 24 Jan 2007 11:44:12 -0500 (EST) Subject: [Maxima] A note on graphics In-Reply-To: References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: What ever is done to improve plotting, I hope some of the functionality of gnuplot is not removed. For instance, the ability to export to xfig, png, and many other formats. Also, since gnuplot gets better and better, it would be nice to have access to all of the features of gnuplot from maxima. For instance, using gnuplot interactively, one can save the coordinates of mouse-clicked points on the screen (in a 2d plot) to a file. As far as I can tell, one can't do that in maxima at this time. Also, note that, as was mentioned earlier in this list, one can use the output to png (and ImageMagick) to create animated plots. There are many things on a "wish list" for improvements to the plot2d and plot3d and Mario's work is a very good beginning, but perhaps one should not try to remove the utility of gnuplot in maxima. -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Tue, 23 Jan 2007, Robert Dodier wrote: > Mario, > > I looked at the examples of new plotting capabilities which you posted, >> http://www.telefonica.net/web2/biomates/maxima/gpdraw > > I have just some minor quibbles. On the whole it looks terrific to me. > > (1) I'd prefer to rework plot2d instead of creating a separate > function gpdraw2d. > It would be a mess to have both old and new plotting functions. > It would be OK with me to cut out plot2d, but if so I would rename > gpdraw2d to draw2d or something else not specific to Gnuplot. > > (2) I'd like to see a function which adds more stuff to an existing plot, > let's say plot2d_more or something. That way the user need not think > of everything before calling plot2d just once. > > (3) I'd like to see a function which replots the most recent plot. > E.g. if you close the plot window and then you want to see the > same stuff again. Or you want the same stuff but output to a > file instead of shown on the screen. > > (4) I think I'd like to see plotting functions return a description of > the current plot, maybe as a noun expression 'plot2d(x, y, z, ...). > At present plot2d returns an empty string; pretty much anything > would be more useful. > > > As I was saying, this is great work, and I hope that we can come > to agreement on how to merge it into Maxima soon. > > best > Robert > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From Daniel.L.Solomon at nasa.gov Wed Jan 24 11:02:55 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Wed, 24 Jan 2007 12:02:55 -0500 Subject: [Maxima] how do I get rk to do anything? Message-ID: I have prepared a 3 vector, dxdt, a function of x, and an initial vector (called init). Then I issue rk(dxdt,x,init,[t,0,.1,1.]); and maxima responds by typing out rk (the functional definition of dxdt, x, init, [t,0,.1,1.]) how do i get it to give me an answer? From dlakelan at street-artists.org Wed Jan 24 11:13:43 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 24 Jan 2007 09:13:43 -0800 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: Message-ID: <20070124171343.GI25287@street-artists.org> On Wed, Jan 24, 2007 at 12:02:55PM -0500, Dan Solomon wrote: > I have prepared a 3 vector, dxdt, a function of x, and an initial > vector (called init). Then I issue > > rk(dxdt,x,init,[t,0,.1,1.]); > and maxima responds by typing out > > rk (the functional definition of dxdt, x, init, [t,0,.1,1.]) > > how do i get it to give me an answer? you have to "load(dynamics);" before issing the rk command. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From Daniel.L.Solomon at nasa.gov Wed Jan 24 14:26:05 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Wed, 24 Jan 2007 15:26:05 -0500 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <20070124171343.GI25287@street-artists.org> References: <20070124171343.GI25287@street-artists.org> Message-ID: OK, now that I am loading dynamics, first, rk fails: Maxima is unable to evaluate the predicate: errexpl [[0, init]] the double bracket business concerns me. init is a 3 vector. What is [[0, init]] ? On Jan 24, 2007, at 12:13 PM, Daniel Lakeland wrote: > On Wed, Jan 24, 2007 at 12:02:55PM -0500, Dan Solomon wrote: >> I have prepared a 3 vector, dxdt, a function of x, and an initial >> vector (called init). Then I issue >> >> rk(dxdt,x,init,[t,0,.1,1.]); >> and maxima responds by typing out >> >> rk (the functional definition of dxdt, x, init, [t,0,.1,1.]) >> >> how do i get it to give me an answer? > > you have to "load(dynamics);" before issing the rk command. > > > -- > Daniel Lakeland > dlakelan at street-artists.org > http://www.street-artists.org/~dlakelan > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From raymond.toy at ericsson.com Wed Jan 24 14:54:42 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Wed, 24 Jan 2007 15:54:42 -0500 Subject: [Maxima] derivatives of bessel_j A&S 9.1.27 vs 9.1.30 In-Reply-To: (Robert Dodier's message of "Wed, 24 Jan 2007 09:47:40 -0700") References: Message-ID: >>>>> "Robert" == Robert Dodier writes: Robert> On 1/24/07, Barton Willis wrote: >> Would it be OK to change the derivatives of the Bessel functions >> to use A&S 9.1.27 instead of 9.1.30? Robert> OK by me. Is this related to the bug Barton reported about taylor not being able to expand bessel functions? If so, we should also tell limit about bessel functions. (I think that was the issue.) But otherwise, I have no problems with changing the derivatives. Perhaps the derivative in 9.1.30 makes it easier for maxima to deduce that the bessel functions satisfy Bessel's differential equation? Just guessing. Ray From dlakelan at street-artists.org Wed Jan 24 14:57:36 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 24 Jan 2007 12:57:36 -0800 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <20070124171343.GI25287@street-artists.org> Message-ID: <20070124205736.GK25287@street-artists.org> On Wed, Jan 24, 2007 at 03:26:05PM -0500, Dan Solomon wrote: > OK, now that I am loading dynamics, first, rk fails: > > Maxima is unable to evaluate the predicate: > errexpl > [[0, init]] > > the double bracket business concerns me. init is a 3 vector. What > is [[0, init]] ? try typing in "errexp1;" which will tell you what the predicate it was trying to evaluate is... this error message is a (minor) bug in my opinion. (see an earlier post a week ago or so where I had the same problem) the error messages should say something along the lines: "Maxima was unable to evaluate a predicate, you may view the expression in the global variable errexp1 for debugging purposes." or something like that. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From Daniel.L.Solomon at nasa.gov Wed Jan 24 16:09:16 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Wed, 24 Jan 2007 17:09:16 -0500 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <20070124205736.GK25287@street-artists.org> References: <20070124171343.GI25287@street-artists.org> <20070124205736.GK25287@street-artists.org> Message-ID: <6.1.1.1.2.20070124163943.026e8d00@orion.ivv.nasa.gov> An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070124/0918a2c6/attachment.htm From willisb at unk.edu Wed Jan 24 17:04:41 2007 From: willisb at unk.edu (Barton Willis) Date: Wed, 24 Jan 2007 17:04:41 -0600 Subject: [Maxima] derivatives of bessel_j A&S 9.1.27 vs 9.1.30 In-Reply-To: References: , Message-ID: maxima-bounces at math.utexas.edu wrote on 01/24/2007 02:54:42 PM: > >>>>> "Robert" == Robert Dodier writes: > > Robert> On 1/24/07, Barton Willis wrote: > >> Would it be OK to change the derivatives of the Bessel functions > >> to use A&S 9.1.27 instead of 9.1.30? > > Robert> OK by me. > > Is this related to the bug Barton reported about taylor not being able > to expand bessel functions? Yes. > If so, we should also tell limit about bessel functions. (I think that was the issue.) Sure, telling limit about bessel is a good thing, but I don't think that will fix the taylor(bessel_j(0,x),x,0,4) bug. I think taylor evaluates by substitution, not via limit. I tested the change from A&S 9.1.27 to 9.1.30: (%i22) load("bessel.lisp")$ (%i23) taylor(bessel_j(0,x),x,0,5); (%o23) 1-x^2/4+x^4/64+... (%i24) taylor(bessel_j(5,x),x,0,5); (%o24) x^5/3840+... (%i25) taylor(bessel_j(5,x),x,1,5); (%o25) bessel_j(5,1)+((bessel_j(4,1)-bessel_j(6,1))*(x-1))/2 + junk That's OK. But the same change for beseel_y is a problem: (%i28) taylor(bessel_y(5,x),x,0,1); (%o28) bessel_y(5,0)+((bessel_y(4,0)-bessel_y(6,0))*x)/2+... I'm not sure how to handle that... yeechs: (%i32) bessel_y(0,0); (%o32) bessel_y(0,0) <--- could be an error or > But otherwise, I have no problems with changing the derivatives. > Perhaps the derivative in 9.1.30 makes it easier for maxima to deduce > that the bessel functions satisfy Bessel's differential equation? No, I don't think it makes it easier, just different. Barton From dlakelan at street-artists.org Wed Jan 24 17:37:47 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Wed, 24 Jan 2007 15:37:47 -0800 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <6.1.1.1.2.20070124163943.026e8d00@orion.ivv.nasa.gov> References: <20070124171343.GI25287@street-artists.org> <20070124205736.GK25287@street-artists.org> <6.1.1.1.2.20070124163943.026e8d00@orion.ivv.nasa.gov> Message-ID: <20070124233747.GL25287@street-artists.org> On Wed, Jan 24, 2007 at 05:09:16PM -0500, Dan Solomon wrote: ...HTML email Elided... Your email was a bit difficult to read from a non HTML email reader, but I gather that the problem seems to be something about how you're defining your expressions for the components since heavily nested lists are being formed . rk expects as its first argument, a list of expressions. Each expression is the derivative of one of the unknown dependent variables. here's an example: solve the system dx/dt = .1*x + .1*y, dy/dt = -.1*y^2, x0=1,y0=1, for x and y when t in the interval 0,1 with step size .01 rk([.1*x+.1*y,-.1*y^2],[x,y],[1,1],[t,0,1,.01]); Now perhaps you can convert your equations into a similar form given the template? Hope that helps. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From biomates at telefonica.net Wed Jan 24 17:39:03 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 25 Jan 2007 00:39:03 +0100 Subject: [Maxima] A note on graphics In-Reply-To: References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: <1169681944.32204.19.camel@localhost.localdomain> Hello, > I looked at the examples of new plotting capabilities which you posted, > > http://www.telefonica.net/web2/biomates/maxima/gpdraw > > I have just some minor quibbles. On the whole it looks terrific to me. > > (1) I'd prefer to rework plot2d instead of creating a separate > function gpdraw2d. > It would be a mess to have both old and new plotting functions. > It would be OK with me to cut out plot2d, but if so I would rename > gpdraw2d to draw2d or something else not specific to Gnuplot. > The prefix gp is to make clear it's only a gnuplot interface. > (2) I'd like to see a function which adds more stuff to an existing plot, > let's say plot2d_more or something. That way the user need not think > of everything before calling plot2d just once. > > (3) I'd like to see a function which replots the most recent plot. > E.g. if you close the plot window and then you want to see the > same stuff again. Or you want the same stuff but output to a > file instead of shown on the screen. > These two points are related to interactivity. I add them to the todo list, but maybe it's not a bad idea to wait for gnuplot 4.2 to fully develope this part. > (4) I think I'd like to see plotting functions return a description of > the current plot, maybe as a noun expression 'plot2d(x, y, z, ...). > At present plot2d returns an empty string; pretty much anything > would be more useful. > You can make use of objects gr2d and gr3d to store 2d and 3d scenes respectively: (%i3) scn4:gr3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = 15, contour = both, surface_hide = true, terminal = eps_color) $ (%i4) args(scn4); 2 2 - y - x (%o4) [explicit(20 %e - 10, x, 0, 2, y, - 3, 3), contour_levels = 15, contour = both, surface_hide = true, terminal = eps_color] (%i5) gpdraw(scn4); (%o5) false Instead of false, gpdraw could return the input object (scn4 in this case). Is that right? Mario -- Mario Rodriguez Riotorto www.biomates.net From biomates at telefonica.net Wed Jan 24 17:57:40 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 25 Jan 2007 00:57:40 +0100 Subject: [Maxima] A note on graphics In-Reply-To: References: <45B00086.5080804@vkonovalov.ru> <1169382954.12070.9.camel@localhost.localdomain> Message-ID: <1169683060.32204.37.camel@localhost.localdomain> Sheldon, > What ever is done to improve plotting, I hope some of the > functionality of gnuplot is not removed. For instance, the ability to > export to xfig, png, and many other formats. Also, since gnuplot gets > better and better, it would be nice to have access to all of the > features of gnuplot from maxima. gpdraw acts as a filter and some (many) gnuplot features are lost. We could define a new option (let's call it 'user_preamble') where gnuplot-experts could write additional settings to be sent to gnuplot, just before the 'plot' or 'splot' command. > For instance, using gnuplot interactively, one can save the > coordinates of mouse-clicked points on the screen (in a 2d plot) to a file. As far > as I can tell, one can't do that in maxima at this time. Now you can with gpdraw. I've uploaded a new version (I call it version 3): http://www.telefonica.net/web2/biomates/maxima/gpdraw If you write gpdraw2d(xy_file="my_coord_file",explicit(u^2,u,-3,3))$ you can clic on any point with the mouse button, afterwards if you hit the 'x' key, the coordinates will be sent to "my_coord_file", as many times as you clic+hit x. Hope this helps. Mario. -- Mario Rodriguez Riotorto www.biomates.net From Daniel.L.Solomon at nasa.gov Wed Jan 24 21:59:18 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Wed, 24 Jan 2007 22:59:18 -0500 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <20070124233747.GL25287@street-artists.org> References: <20070124171343.GI25287@street-artists.org> <20070124205736.GK25287@street-artists.org> <6.1.1.1.2.20070124163943.026e8d00@orion.ivv.nasa.gov> <20070124233747.GL25287@street-artists.org> Message-ID: I'm attaching the plain text file 'testcopy' which should be readable - it can be opened with most any editor. I must be doing something wrong, but I can't see it. -------------- next part -------------- A non-text attachment was scrubbed... Name: testcopy Type: application/octet-stream Size: 968 bytes Desc: not available Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070124/2be4429d/attachment-0001.obj -------------- next part -------------- On Jan 24, 2007, at 6:37 PM, Daniel Lakeland wrote: > On Wed, Jan 24, 2007 at 05:09:16PM -0500, Dan Solomon wrote: > > ...HTML email Elided... > > Your email was a bit difficult to read from a non HTML email reader, > but I gather that the problem seems to be something about how you're > defining your expressions for the components since heavily nested > lists are being formed . > > rk expects as its first argument, a list of expressions. Each > expression is the derivative of one of the unknown dependent > variables. > > here's an example: > > solve the system dx/dt = .1*x + .1*y, dy/dt = -.1*y^2, x0=1,y0=1, for > x and y when t in the interval 0,1 with step size .01 > > rk([.1*x+.1*y,-.1*y^2],[x,y],[1,1],[t,0,1,.01]); > > Now perhaps you can convert your equations into a similar form given > the template? > > Hope that helps. > > > -- > Daniel Lakeland > dlakelan at street-artists.org > http://www.street-artists.org/~dlakelan > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From villate at fe.up.pt Thu Jan 25 02:55:01 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Thu, 25 Jan 2007 08:55:01 +0000 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: Message-ID: <1169715301.7037.16.camel@localhost.localdomain> On Wed, 2007-01-24 at 12:02 -0500, Dan Solomon wrote: > I have prepared a 3 vector, dxdt, a function of x, and an initial > vector (called init). Then I issue > > rk(dxdt,x,init,[t,0,.1,1.]); x cannot be a function. It should also be a vector, with 3 undefined variables that tells rk which are the 3 independent variables. Please look at http://maxima.sourceforge.net/docs/manual/en/maxima_49.html and let me know if there is something confusing or poorly written in the documentation for rk. Thanks for using rk. Regards, Jaime From sen1 at math.msu.edu Thu Jan 25 03:27:03 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 04:27:03 -0500 (EST) Subject: [Maxima] xmaxima bug with sbcl Message-ID: Hello, I noticed the following errors when starting Xmaxima with sbcl from the command line. This does not happen with the command line maxima. This is v. 5.11.0 in Linux Fedora Core 6 There are many screens full of errors. I am writing the beginning and the end. Help! 11 nested errors. SB-KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded. 0: (BACKTRACE 536870911 #) 1: ((LAMBDA NIL)) 2: ((LAMBDA NIL)) 3: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #) 4: (SB-IMPL::ERROR-ERROR) 5: (SB-IMPL::INFINITE-ERROR-PROTECTOR) 6: (ERROR SB-INT:SIMPLE-STREAM-ERROR) 7: (SB-IMPL::SIMPLE-STREAM-PERROR "couldn't write to ~S" # 32) 8: (SB-IMPL::FLUSH-OUTPUT-BUFFER #) 9: (SB-IMPL::OUTPUT-CHAR-UTF-8-LINE-BUFFERED # #\Newline) 10: (TERPRI #) 11: ((LAMBDA NIL)) 12: ((LAMBDA NIL)) 13: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #) ..... 84: (FORMAT T "~&Maxima encountered a Lisp error:~%~% ~A") 85: (MAXIMA::MAXIMA-LISP-DEBUGGER # #) 86: (MAXIMA::MAXIMA-LISP-DEBUGGER # #) 87: (INVOKE-DEBUGGER #) 88: (ERROR SB-INT:SIMPLE-STREAM-ERROR) 89: (SB-IMPL::SIMPLE-STREAM-PERROR "couldn't write to ~S" # 32) 90: (SB-IMPL::FLUSH-OUTPUT-BUFFER #) 91: (FORCE-OUTPUT #) 92: (SB-INT:FLUSH-STANDARD-OUTPUT-STREAMS) 93: ((LABELS SB-IMPL::RESTART-LISP)) debugger invoked on a SIMPLE-ERROR: Maximum error nesting depth exceeded Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. (no restarts: If you didn't do this on purpose, please report it as a bug.) (SB-IMPL::SIMPLE-STREAM-PERROR "couldn't write to ~S" # 32) 0] fatal error encountered in SBCL pid 1133: %PRIMITIVE HALT called; the party is over. -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From areiner at tph.tuwien.ac.at Wed Jan 24 16:30:57 2007 From: areiner at tph.tuwien.ac.at (Albert Reiner) Date: 24 Jan 2007 23:30:57 +0100 Subject: [Maxima] Lisp-only install (Linux, CMUCL) Message-ID: <863b60awgu.fsf@willehalm.reiner> I just tried the Lisp-only installation method described in INSTALL.lisp in the tar ball for version 5.11.0. In step (9), there seems to be an error: (9) Dump an image, and if the Lisp implementation allows one to specify a start-up function, specify USER::RUN. This should be CL-USER::RUN, at least for CMUCL (as it already is for SBCL): CMUCL: (CMUCL terminates after saving the image) (extensions:save-lisp "binary-cmucl/maxima.core" :init-function 'user::run) ^|^^ should be CL-USER ----------------------------------------------------' Regards, Albert. P.S.: It seems that the question regarding the maxima directory (PREFIX) can be eliminated in step (3) as src/maxima should be able to use the same trick as maxima-local, `(cd \`dirname $0\` > /dev/null 2>&1 ; pwd)`, to get the correct path at run time. It seems that this would allow people to move around the directories at will. P.P.S.: One might want to (DECLARE (IGNORABLE FILE-NAME)) in the definition of COMPILED-FILE-P in lisp-utils/defsystem.lisp in order to get rid of some seemingly strange compiler notes on non-CLisp implementations: ; (DEFUN COMPILED-FILE-P (FILE-NAME) ; "Return T if the FILE-NAME is a filename designator for a valid compiled. ; Signal an error when it is not a filename designator. ; Return NIL when the file does not exist, or is not readable, ; or does not contain valid compiled code." ..) ; Note: Variable FILE-NAME defined but never used. ; From rdieter at math.unl.edu Thu Jan 25 07:28:35 2007 From: rdieter at math.unl.edu (Rex Dieter) Date: Thu, 25 Jan 2007 07:28:35 -0600 Subject: [Maxima] xmaxima bug with sbcl In-Reply-To: References: Message-ID: sen1 at math.msu.edu wrote: > Hello, > I noticed the following errors when starting Xmaxima with sbcl from > the command line. This does not happen with the command line maxima. > > This is v. 5.11.0 in Linux Fedora Core 6 > > There are many screens full of errors. I am writing the beginning and > the end. Can't reproduce, WORKSFORME. -- Rex From rdieter at math.unl.edu Thu Jan 25 07:33:24 2007 From: rdieter at math.unl.edu (Rex Dieter) Date: Thu, 25 Jan 2007 07:33:24 -0600 Subject: [Maxima] xmaxima bug with sbcl In-Reply-To: References: Message-ID: Rex Dieter wrote: > sen1 at math.msu.edu wrote: > >>Hello, >> I noticed the following errors when starting Xmaxima with sbcl from >> the command line. This does not happen with the command line maxima. >> >>This is v. 5.11.0 in Linux Fedora Core 6 >> >>There are many screens full of errors. I am writing the beginning and >>the end. > > > Can't reproduce, WORKSFORME. $ rpm -q maxima-runtime-sbcl sbcl please -- Rex From robert.dodier at gmail.com Thu Jan 25 08:57:35 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 07:57:35 -0700 Subject: [Maxima] xmaxima bug with sbcl In-Reply-To: References: Message-ID: On 1/25/07, sen1 at math.msu.edu wrote: > I noticed the following errors when starting Xmaxima with sbcl from > the command line. This does not happen with the command line maxima. > > This is v. 5.11.0 in Linux Fedora Core 6 > > There are many screens full of errors. I am writing the beginning and > the end. Hmm, xmaxima works OK for me -- Maxima 5.11.0cvs + SBCL 1.0 + FC 2. If we can't figure out what's going on, you might post a message to the sbcl-devel mailing list -- at least they might be able to recognize the cause of the error messages. Sorry i can't be more helpful -- Robert From villate at fe.up.pt Thu Jan 25 09:09:02 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Thu, 25 Jan 2007 15:09:02 +0000 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <1169715301.7037.16.camel@localhost.localdomain> Message-ID: <1169737743.6890.26.camel@localhost.localdomain> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: > I don't understand your comment. Don't I have x as a 3-vector? No, you don't. x[1], x[2], x[3] have no relation to the variable x. x and x[1] are considered different variables in Maxima. For instance, try this; x[1]: 3; x: 5; x[1]; x; You have a similar problem with the initial conditions: you defined init[1], init[2] and init[3]. That's OK. But when you write "init", it will not refer to the three array elements you defined but to an unknown variable init, independent from init[1], init[2] and init[3]. That's the way Maxima works. Therefore, the initial conditions must be given as [init[1], init[2], init[3]]. If you really wanted init to be a list, you could give it an initial value [] (empty list) and append numbers to it. Read the documentation about lists and arrays. The first argument given to rk must be a list of expressions. You first tried with a 3x1 matrix dxdtau. It won't work. You then tried [dxdtau[1],dxdtau[2],dxdtau[3]] this is not a list of expressions either. Please notice that since dxdtau is a matrix, dxdtau[1] is the first row of that matrix; namely, it is a list itself. [dxdtau[1],dxdtau[2],dxdtau[3]] is a list of lists. You should try with: [dxdtau[1][1], dxdtau[2][1], dxdtau[3][1]] which will give you a list with the three elements in the matrix. I hope this helps. Regards, Jaime > Do I need to change x[1], x[2], x[3] to x, y, z, and then do rk > (dxdt, [x,y,z], init, [t,0,1,.1])? > From robert.dodier at gmail.com Thu Jan 25 09:06:08 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 08:06:08 -0700 Subject: [Maxima] Lisp-only install (Linux, CMUCL) In-Reply-To: <863b60awgu.fsf@willehalm.reiner> References: <863b60awgu.fsf@willehalm.reiner> Message-ID: On 24 Jan 2007 23:30:57 +0100, Albert Reiner wrote: > This should be CL-USER::RUN, at least for CMUCL (as it already is for > SBCL): OK by me. > P.S.: It seems that the question regarding the maxima directory > (PREFIX) can be eliminated in step (3) as src/maxima should be > able to use the same trick as maxima-local, `(cd \`dirname $0\` > > /dev/null 2>&1 ; pwd)`, to get the correct path at run time. > It seems that this would allow people to move around the > directories at will. Well, that seems to be a *nix-only modification -- the instructions in INSTALL.lisp apply to Windows as well, and in fact a Lisp-only install is probably more important for Windows because setting up a Windows development environment is so much work. So I recommend against this change. > P.P.S.: One might want to (DECLARE (IGNORABLE FILE-NAME)) in the > definition of COMPILED-FILE-P in lisp-utils/defsystem.lisp in > order to get rid of some seemingly strange compiler notes on > non-CLisp implementations: OK by me. Thanks for these comments -- I hope that someone (maybe even me) can attend to these items shortly. best Robert From robert.dodier at gmail.com Thu Jan 25 09:25:35 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 08:25:35 -0700 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <1169737743.6890.26.camel@localhost.localdomain> References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> Message-ID: Dan, it looks like the basic problem is that Maxima treats lists and matrices in ways that are somewhat less than obvious. I'll try to clarify some points. On 1/25/07, Jaime E. Villate wrote: > On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: > > I don't understand your comment. Don't I have x as a 3-vector? > > No, you don't. x[1], x[2], x[3] have no relation to the variable x. > x and x[1] are considered different variables in Maxima. Well, if the user writes x:[a, b, c] (i.e. assign a list to x) then x[1], x[2], and x[3] are indeed related to x; those are the three elements of x. Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter form, x doesn't refer collectively to a, b, and c. Whether that's a design flaw is a topic for a rainy day .... > The first argument given to rk must be a list of expressions. You first > tried with a 3x1 matrix dxdtau. It won't work. You then tried > [dxdtau[1],dxdtau[2],dxdtau[3]] > > this is not a list of expressions either. Please notice that since > dxdtau is a matrix, dxdtau[1] is the first row of that matrix; namely, > it is a list itself. Lists are not row or column matrices, and the elements of a row or column matrix must be indexed by 2 indices (one of which is always 1). Dan, probably what you want is to make dxdtau a list. Hope this helps -- I'm sorry if the treatment of lists and matrices is confusing. I would be interested to hear your comments on this point. Robert Dodier From robert.dodier at gmail.com Thu Jan 25 09:43:10 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 08:43:10 -0700 Subject: [Maxima] historical file for pt_BR In-Reply-To: <200701240518.34233.ficmatin01@solar.com.br> References: <200701240518.34233.ficmatin01@solar.com.br> Message-ID: On 1/24/07, Jorge Barros de Abreu wrote: > In 4 May pt_BR is 2 years old. The translation is complete. > All Maxima manual files is translated. Terrific, Jorge -- I know that making a translation is a great effort -- many thanks to you and all the Maxima translators. I think the translations of the documentation are a great feature for Maxima. best Robert From sen1 at math.msu.edu Thu Jan 25 09:32:58 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 10:32:58 -0500 (EST) Subject: [Maxima] xmaxima bug with sbcl In-Reply-To: References: Message-ID: I found that when I did the same thing on my Fedora Core 4 box, there were some errors on closing Xmaxima, but the tk window did at least close. In Core 6, it would hang and not close. So, my guess is that there are problems in the new Fedora Core 6 package that cause the issue. I'll wait awhile and see if the newer versions of SBCL fix this problem. In the mean time, I'll send the errors to them. Thanks for the information. -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Thu, 25 Jan 2007, Robert Dodier wrote: > On 1/25/07, sen1 at math.msu.edu wrote: > >> I noticed the following errors when starting Xmaxima with sbcl from >> the command line. This does not happen with the command line maxima. >> >> This is v. 5.11.0 in Linux Fedora Core 6 >> >> There are many screens full of errors. I am writing the beginning and >> the end. > > Hmm, xmaxima works OK for me -- Maxima 5.11.0cvs + SBCL 1.0 + FC 2. > > If we can't figure out what's going on, you might post a message > to the sbcl-devel mailing list -- at least they might be able to > recognize the cause of the error messages. > > Sorry i can't be more helpful -- > > Robert > From miguel39123 at hotmail.com Thu Jan 25 09:49:59 2007 From: miguel39123 at hotmail.com (miguel Lopez) Date: Thu, 25 Jan 2007 15:49:59 +0000 (UTC) Subject: [Maxima] list and matrices = should you be fired? Message-ID: R. Dodiet said: Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter form, x doesn't refer collectively to a, b, and c. Whether that's a design flaw is a topic for a rainy day .... I'm pretty sure that nobody has so much time to waste so to play with list and matrices in this way. I as a boss would say about this topic: 1.- Here there is not a second opportunity. 2.- Please go to make some poems in a rany day. From a teacher point of view: Well, and too please take with you the author of the package for computing vector calculus (express for curl and the like). As a teacher with more than 20 years of experience this type of software should be banned for students (like a donkey in a cage). There is no space in this world for ugly mathematics, here one should say code like this. Are a little hard this words? I think they are not, many people would prefer sincerity. And for maxima language: Don't accept bad friends. - M From robert.dodier at gmail.com Thu Jan 25 09:56:30 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 08:56:30 -0700 Subject: [Maxima] xmaxima bug with sbcl In-Reply-To: References: Message-ID: On 1/25/07, sen1 at math.msu.edu wrote: > I found that when I did the same thing on my Fedora Core 4 box, there > were some errors on closing Xmaxima, but the tk window did at least > close. > > In Core 6, it would hang and not close. Now that you mention it, I see the same error when I try to close the xmaxima window (not when it opens or it is running). Same business about (SB-IMPL::SIMPLE-STREAM-PERROR "couldn't write to ~S" ...) Xmaxima does terminate after printing those messages. For the record, Maxima 5.11.0cvs + SBCL 1.0 + FC 2. HTH Robert From sen1 at math.msu.edu Thu Jan 25 09:46:13 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 10:46:13 -0500 (EST) Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> Message-ID: My guess is that Dan wanted to write his system of DE's using matrix methods to simply express them. So, his original right hand side is a vector function whose components are 1x1 matrices of functions instead of functions. So, all that was necessary to get it to work is to replace [dxdtau[1],dxdtau[2],dxdtau[3]] by [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] Thus, instead of his right side of the DE looking like (using x,y,z instead of x[1],x[2],x[3] for easier writing) [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like [x^2 + y^2, x - y, z*y*z] Hence, the simple fix above. I think Jaime's manual and the examples are fine as written. If one wants to use matrices of functions to define systems of equations, one just has to convert back to the standard thing maxima expects. I don't know if it is worth rewriting the code to take care of this. But, it might be worthwhile to put an example or two in the manual to show how to deal with this. -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Thu, 25 Jan 2007, Robert Dodier wrote: > Dan, it looks like the basic problem is that Maxima treats lists and > matrices in ways that are somewhat less than obvious. > I'll try to clarify some points. > > On 1/25/07, Jaime E. Villate wrote: >> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>> I don't understand your comment. Don't I have x as a 3-vector? >> >> No, you don't. x[1], x[2], x[3] have no relation to the variable x. >> x and x[1] are considered different variables in Maxima. > > Well, if the user writes x:[a, b, c] (i.e. assign a list to x) then > x[1], x[2], and x[3] are indeed related to x; those are the three > elements of x. > > Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter > form, x doesn't refer collectively to a, b, and c. > Whether that's a design flaw is a topic for a rainy day .... > >> The first argument given to rk must be a list of expressions. You first >> tried with a 3x1 matrix dxdtau. It won't work. You then tried >> [dxdtau[1],dxdtau[2],dxdtau[3]] >> >> this is not a list of expressions either. Please notice that since >> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; namely, >> it is a list itself. > > Lists are not row or column matrices, and the elements of a > row or column matrix must be indexed by 2 indices (one of which > is always 1). Dan, probably what you want is to make dxdtau a list. > > Hope this helps -- I'm sorry if the treatment of lists and matrices > is confusing. I would be interested to hear your comments on this > point. > > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From macrakis at alum.mit.edu Thu Jan 25 10:01:30 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 25 Jan 2007 11:01:30 -0500 Subject: [Maxima] list and matrices = should you be fired? In-Reply-To: References: Message-ID: <8b356f880701250801w54c66358gb2f781949e5de009@mail.gmail.com> Miguel, There are many things wrong with Maxima. Some of them are bad design decisions, others are implementation errors, others still are bad documentation. I think we are all painfully aware of this. We are also aware that there are many things good about Maxima, and we're working on it because we believe it can be improved over time. You are welcome to help us with that, including design, implementation, and documentation. The nature of an open-source collaboration like Maxima -- unlike closed systems like Mathematica and Maple -- is precisely the opportunity to improve it ourselves to meet our own needs and wants better. The cost is perhaps a certain level of chaos, and slower progress than if a full-time, paid staff were working on it. Of course, if you'd rather contribute money to hire programmers than design and code, I think we'd take that, too.... -s From robert.dodier at gmail.com Thu Jan 25 10:02:33 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 09:02:33 -0700 Subject: [Maxima] list and matrices = should you be fired? In-Reply-To: References: Message-ID: On 1/25/07, miguel Lopez wrote: > There is no space in this world for ugly mathematics, here one should say > code like this. Miguel, I agree that some aspects of the Maxima language are suboptimal. We are fortunate that after more than 20 years, Maxima again has a sizeable developer group and we can begin to resolve questions that were first discussed many years ago. Towards this end it is more productive to expound specific proposals, rather than general discontent. If you have some specific ideas about how to rework the treatment of lists and matrices, I would be interested to hear about it. best Robert From sen1 at math.msu.edu Thu Jan 25 09:56:05 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 10:56:05 -0500 (EST) Subject: [Maxima] list and matrices = should you be fired? In-Reply-To: References: Message-ID: Well, this seems a bit extreme to me. To be fired, you first need to be employed. Who is employed on this list to do maxima work? AFAIK the people doing the current work on maxima are all volunteers. They should be commended, not scolded. When someone starts a project, e.g. the differential form project, it takes some time to get to a clean, good form. People should be encouraged to do these things. If there are suggestions for improvement, then, by all means, put them in. It is not productive to shout and be critical. I am a beginner at maxima. The project has great potential, and I am starting to use it in my research and teaching. If my skin were so thin as to listen to Miguel, then I would just go back to Mathematica, Maple, etc. and *that* would be a great disservice to my students. Everyone has to begin somewhere, when did you begin Miguel and what was your original code like? BTW, this kind of interchange has no place on this newsgroup. If you want to continue it, I may be happy (I'll decide later) to do it in private email. -sen P.S. If you meant all this as a joke, it is clear that I did not take it that way. --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Thu, 25 Jan 2007, miguel Lopez wrote: > > > R. Dodiet said: Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the > latter form, x doesn't refer collectively to a, b, and c. > Whether that's a design flaw is a topic for a rainy day .... > > I'm pretty sure that nobody has so much time to waste so to play with > list and matrices in this way. I as a boss would say about this topic: > > 1.- Here there is not a second opportunity. > 2.- Please go to make some poems in a rany day. > > From a teacher point of view: > > Well, and too please take with you the author of the package for computing > vector calculus (express for curl and the like). > > As a teacher with more than 20 years of experience this type of software > should be banned for students (like a donkey in a cage). > > There is no space in this world for ugly mathematics, here one should say > code like this. > > Are a little hard this words? > I think they are not, many people would prefer sincerity. > > And for maxima language: Don't accept bad friends. > > > - M > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From rjerrard at math.concordia.ab.ca Thu Jan 25 10:31:14 2007 From: rjerrard at math.concordia.ab.ca (Bob Jerrard) Date: Thu, 25 Jan 2007 09:31:14 -0700 Subject: [Maxima] error with find_root when functions containing more than one built-in constant like %pi Message-ID: <1169742674.18506.8.camel@opteron.lab.math.concordia.ab.ca> Hello, I tried find_root with a function containing %e and %pi and it produced only an error. Replacing the constants with approximate numerical values allows a solution: Maxima 5.10.0 http://maxima.sourceforge.net Using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (aka GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) f(x):=-(log((4+%e)/(2*%pi)))*(((4+%e)/(2*%pi))^x); 4 + %e 4 + %e x (%o1) f(x) := (- log(------)) (------) 2 %pi 2 %pi (%i2) find_root(2*x=f(x),x,-1.0,0.0); Maxima encountered a Lisp error: Error in MACSYMA-TOP-LEVEL [or a callee]: ((MPLUS SIMP) -2.0 ((MTIMES SIMP) 6.2831853071795862 ((MEXPT SIMP) ((MPLUS SIMP) 4 $%E) -1.0) ((%LOG SIMP) ((MTIMES SIMP) 0.15915494309189535 ((MPLUS SIMP) 4 $%E))))) is not of type (OR RATIONAL LISP:FLOAT). Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i3) f(x):=-(log((4+2.71828)/(2*3.14159)))*(((4 +2.71828)/(2*3.14159))^x); 4 + 2.71828 4 + 2.71828 x (%o3) f(x) := (- log(-----------)) (-----------) 2 3.14159 2 3.14159 (%i4) find_root(2*x=f(x),x,-1.0,0.0); (%o4) - 0.033403182605785 (%i5) g(x):=sin(%pi*x); (%o5) g(x) := sin(%pi x) (%i6) find_root(2*x=g(x),x,0.0,1.0); (%o6) 0.0 (%i7) g(x):=cos(%pi*x); (%o7) g(x) := cos(%pi x) (%i8) find_root(2*x=g(x),x,0.0,1.0); (%o8) 0.29730582202842 (%i9)g(x):=cos((%e+%pi)*x); (%o9) g(x) := cos((%e + %pi) x) (%i10) find_root(2*x=g(x),x,0.0,1.0); Maxima encountered a Lisp error: Error in MACSYMA-TOP-LEVEL [or a callee]: ((MPLUS SIMP) 2.0 ((MTIMES SIMP) -1 ((%COS SIMP) ((MTIMES SIMP) 1.0 ((MPLUS SIMP) 3.1415926535897931 $% E))))) is not of type (OR RATIONAL LISP:FLOAT). Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i11) g(x):=cos(%e*x); (%o11) g(x) := cos(%e x) (%i12) find_root(2*x=g(x),x,0.0,1.0); (%o12) 0.32121095788978 (%i13) Any ideas why it does not work for functions with more than one constant? Thanks for any help. -- Dr. Robert J. Jerrard, Professor of Mathematics, Concordia University College of Alberta, 7128 Ada Blvd., Edmonton, Alberta, T5B 4E4, Canada. Phone: (780) 479-9291, Fax: (780) 474-1933. From miguel39123 at hotmail.com Thu Jan 25 11:12:10 2007 From: miguel39123 at hotmail.com (miguel Lopez) Date: Thu, 25 Jan 2007 17:12:10 +0000 (UTC) Subject: [Maxima] suboptimal versus non sense Message-ID: R. Dodiet said: Miguel, I agree that some aspects of the Maxima language are suboptimal. Should I use a political correct language to hide the reality, a beautiful dress to hide the ugliness? Well, i'm sure that any of you can conceptually understand the difference between 1.- Due to scarse staff we can't make same changes in the code. 2.- The concepts are correct. 3.- Bla, Bla. My studentes in four months must learn the following concepts: Vector Calculus: Line integral, double and triple integral, multiple integrals, change of variables, surface integral, Stokes theorem, Divergence Theorem, Green Theorem, Laplace Transform and ED (first order: homogeneous, exact, integral factors, Bernoulli, linear) and Linear (indeterminate coefficients, via Laplace, and operator method (invert a polynomial in the operator D). Should I suggest a computer program that should generate about a googol of questions and erros? I'm nobody boss, not i'm going to fire somebody. But i want to say clearly that there is a need for a clear concept of what is a bug For a student list and matrices are a bug. Vector Calculus package is a bug. Why? Is suboptimal? No, clearly not. Any of you can define curl, or div, or anything like that in four lines. The problem is that there is not quality control A good engineer would say, here students play 80 % or more, let's do a program for students, a good one, one that talk like them not like an expert mathematician. Don't do it for me, i prefer you hate me, do it for the students population: The say: Please eliminate thoses ideas that no one can foresee. By the way, thinks a lot to everybody, education shine here. From miguel39123 at hotmail.com Thu Jan 25 11:14:49 2007 From: miguel39123 at hotmail.com (miguel Lopez) Date: Thu, 25 Jan 2007 17:14:49 +0000 (UTC) Subject: [Maxima] suboptimal versus non sense Message-ID: R. Dodiet said: Miguel, I agree that some aspects of the Maxima language are suboptimal. Should I use a political correct language to hide the reality, a beautiful dress to hide the ugliness? Well, i'm sure that any of you can conceptually understand the difference between 1.- Due to scarse staff we can't make same changes in the code. 2.- The concepts are correct. 3.- Bla, Bla. My studentes in four months must learn the following concepts: Vector Calculus: Line integral, double and triple integral, multiple integrals, change of variables, surface integral, Stokes theorem, Divergence Theorem, Green Theorem, Laplace Transform and ED (first order: homogeneous, exact, integral factors, Bernoulli, linear) and Linear (indeterminate coefficients, via Laplace, and operator method (invert a polynomial in the operator D). Should I suggest a computer program that should generate about a googol of questions and erros? I'm nobody boss, not i'm going to fire somebody. But i want to say clearly that there is a need for a clear concept of what is a bug For a student list and matrices are a bug. Vector Calculus package is a bug. Why? Is suboptimal? No, clearly not. Any of you can define curl, or div, or anything like that in four lines. The problem is that there is not quality control A good engineer would say, here students play 80 % or more, let's do a program for students, a good one, one that talk like them not like an expert mathematician. Don't do it for me, i prefer you hate me, do it for the students population: The say: Please eliminate thoses ideas that no one can foresee. By the way, thinks a lot to everybody, education shine here. By the way, here is a rainy day! From A.G.Grozin at inp.nsk.su Thu Jan 25 11:29:24 2007 From: A.G.Grozin at inp.nsk.su (Andrey G. Grozin) Date: Thu, 25 Jan 2007 23:29:24 +0600 (NOVT) Subject: [Maxima] suboptimal versus non sense In-Reply-To: References: Message-ID: You are welcome to write another computer algebra system. *After* it will be ready, we'll be happy to compare it with maxima. Andrey P.S. Maxima is a result of continuous development from 1969 to 2007, by more than one person (the exact number varied) From belanger at truman.edu Thu Jan 25 11:53:12 2007 From: belanger at truman.edu (Jay Belanger) Date: Thu, 25 Jan 2007 11:53:12 -0600 Subject: [Maxima] suboptimal versus non sense In-Reply-To: (miguel Lopez's message of "Thu\, 25 Jan 2007 17\:12\:10 +0000 \(UTC\)") References: Message-ID: <877ivb0z93.fsf@vh213602.truman.edu> miguel Lopez writes: > R. Dodiet said: > > Miguel, I agree that some aspects of the Maxima language are suboptimal. > > > Should I use a political correct language to hide the reality, > a beautiful dress to hide the ugliness? As long as the language is polite, I don't see anyone insisting on "politically correct", whatever that means. > Well, i'm sure that any of you can conceptually understand the difference > between > > 1.- Due to scarse staff we can't make same changes in the code. > 2.- The concepts are correct. > 3.- Bla, Bla. Sure... > My studentes in four months must learn the following concepts: > > Vector Calculus: Line integral, double and triple integral, multiple integrals, > change of variables, surface integral, Stokes theorem, Divergence Theorem, > Green Theorem, Laplace Transform and ED (first order: homogeneous, exact, > integral factors, Bernoulli, linear) and Linear (indeterminate coefficients, > via Laplace, and operator method (invert a polynomial in the operator D). > > Should I suggest a computer program that should generate about a googol of > questions and erros? Are you saying that Maxima would generate many questions and errors? Looking at this message and the one you started the previous thread with, I'm still not clear on what the problem is. > I'm nobody boss, not i'm going to fire somebody. But i want to say clearly > that there is a need for a clear concept of what is a bug Why? And is there something specific that you think is a bug? Why not say what it is, and not worry about whether it meets somebody's definition of bug. > For a student list and matrices are a bug. > Vector Calculus package is a bug. Why? > The say: Please eliminate thoses ideas that no one can foresee. What ideas are those? Perhaps you have stated them clearly in a previous message, but it might be useful to explicitly state what you are complaining about when you start a thread complaining about something. I've found the Maxima community to be very responsive. Jay From raymond.toy at ericsson.com Thu Jan 25 12:03:08 2007 From: raymond.toy at ericsson.com (Raymond Toy) Date: Thu, 25 Jan 2007 13:03:08 -0500 Subject: [Maxima] Interpreter vs compiler In-Reply-To: <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> References: <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> Message-ID: <45B8F0DC.8080402@ericsson.com> Stavros Macrakis wrote: > > Having written the first version of the translator in the early 70's > (I was either in high school or a freshman), I can tell you that a > basic translator is not that complicated. The current translator > (which contains none of my code as far as I know) is much more > elaborate partly because it is better, but also because it is > over-engineered, and handles many more special cases. > > Having an interpreter and a compatible compiler is standard practice > in the Lisp world, and I see no reason that we can't do a good job in > Maxima without inordinate effort. There are certain constructions > which are very difficult to compile effectively, but that's not fatal, > because the interpreter is always available as backup. And perhaps > some of the messier semantics need to be reevaluated -- for example > dynamic vs. static scope. In fact, all functions which try to be > clever about evaluating their arguments in special contexts (e.g. cf, > ev) are rather a mess. > > It seems important to me that users need learn only one new language > to take advantage of Maxima and anyway, few users nowadays know Lisp > or are willing to invest in it. Not to mention that the Lisp style > used in Maxima internals is rather... um... dated... and um... hard to > read. In fact, I would go in the opposite direction, and try to make > it easier for users writing in the Maxima language to do more, notably > to write simplifiers for mathematical functions. I agree with this idea. Users should only have to deal with Maxima and not Lisp. I have thought about always translating Maxima's input into Lisp and then running the Lisp code, instead of interpreting the internal s-expr representation. If the translation is done correctly, we could have lexical scope by default. And since the code is Lisp, a Lisp compiler could be used to make things go faster. And that would allow things currently in Lisp to be moved to Maxima if desired. This could also clean up some semantics because we would use Lisp semantics for the most part. I don't know if this is feasible, but having more stuff in Maxima and less in Lisp sounds like a good idea to me. Ray From miguel39123 at hotmail.com Thu Jan 25 12:15:46 2007 From: miguel39123 at hotmail.com (miguel Lopez) Date: Thu, 25 Jan 2007 18:15:46 +0000 (UTC) Subject: [Maxima] suboptimal versus non sense References: <877ivb0z93.fsf@vh213602.truman.edu> Message-ID: Jay Belanger truman.edu> writes: > > The say: Please eliminate thoses ideas that no one can foresee. > > What ideas are those? My point is this one: Suppose I'm a student and i am begining with vector calculus, I should expect that divergence was define as: divergence(f):=[diff(f,x),diff(f,y),diff(f,z)]; and grad, curl, etc in similar terms. I think this can be done in 30 minutes or less, but the current package is complicated (in my opinion). Read the recents questions about rk to see the problems with list and matrices. I can't understand why things are not easier. You can say that there is nobody interested, or nobody working on making things easier, but the concept or the philosophy seem to me to be in a wrong direction. We should strive to make the system easy for students, and i don't see this here. I may be wrong, but i can't understand why grad, curl, etc are not defined in the easy way, or why there is not a simple package for beginners. If you say that is because few people are working on maxima I can't believe it! My point is contrary to arbitrary complication. If you tell me that this system is design for expert mathematicians to make calculations and not for students, then all has a sense, but I believe that this is not situation nowadays. Also I think that maxima matrices should change to be similar to any other language. From michel.vandenbergh at uhasselt.be Thu Jan 25 12:31:39 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Thu, 25 Jan 2007 19:31:39 +0100 Subject: [Maxima] Interpreter vs compiler In-Reply-To: <45B8F0DC.8080402@ericsson.com> References: <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> <45B8F0DC.8080402@ericsson.com> Message-ID: <45B8F78B.8070307@uhasselt.be> >I have thought about always translating Maxima's input into Lisp and >then running the Lisp code, instead of interpreting the internal s-expr >representation. If the translation is done correctly, we could have >lexical scope by default. And since the code is Lisp, a Lisp compiler >could be used to make things go faster. And that would allow things >currently in Lisp to be moved to Maxima if desired. > >This could also clean up some semantics because we would use Lisp >semantics for the most part. > >I don't know if this is feasible, but having more stuff in Maxima and >less in Lisp sounds like a good idea to me. > >Ray > > I have thought about this too. Unfortunately currently the translated code sometimes calls the interpreter. E.g for f(x):=ev(x). This would have to be replaced by code that first translates the argument to ev and then executes it. This does not seem entirely unfeasible.... Michel From macrakis at alum.mit.edu Thu Jan 25 12:33:54 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 25 Jan 2007 13:33:54 -0500 Subject: [Maxima] Interpreter vs compiler In-Reply-To: <45B8F0DC.8080402@ericsson.com> References: <8b356f880701201054s290ddf4ek38f56401a901d116@mail.gmail.com> <45B8F0DC.8080402@ericsson.com> Message-ID: <8b356f880701251033q702ee253me41a0b339a348210@mail.gmail.com> > I have thought about always translating Maxima's input into Lisp and > then running the Lisp code, instead of interpreting the internal s-expr > representation. You could of course do this, but if you want to preserve current Maxima semantics, in the absence of additional information (declarations), you'd end up with simple things like f(x) being translated to (let* ((xval (simplifya (if (boundp '$x) $x '$x)))) (simplifya (if (fboundp '$f) -- assuming all functions are Lisp functions ($f xval) (list '($f) xval) ))) (the current translator does not do this, instead calling the interpreter when it has no declarations, thus leaving us back where we started) And of course simplifya is a non-trivial function -- that's where 1+1 becomes 2, for example. If you want to expand x+1 out, then you get code like (if (and (boundp '$x) (numberp $x)) (+ $x 1) (simplifya (list '(mplus) 1 (if (boundp '$x) $x '$x)))) And this assumes that Maxima "+" on Lisp numbers is the same as Lisp "+", which is true currently (except if you foolishly add weird simplification rules to "+"); on the other hand, it is not true for, say sqrt(-1), for which Lisp gives a approximate (floating) complex, and Maxima gives an exact %i. I suppose the advantage would be that you'd have a single code-base for evaluation. On the other hand, do you really want to debug running code that looks like that? -s PS Not to mention things like ev.... From macrakis at alum.mit.edu Thu Jan 25 12:39:18 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 25 Jan 2007 13:39:18 -0500 Subject: [Maxima] suboptimal versus non sense In-Reply-To: References: <877ivb0z93.fsf@vh213602.truman.edu> Message-ID: <8b356f880701251039x70bec64cu30594835fed7b7aa@mail.gmail.com> > I should expect that divergence was define as: > > divergence(f):=[diff(f,x),diff(f,y),diff(f,z)]; > > and grad, curl, etc in similar terms. > > I think this can be done in 30 minutes or less, but the current package > is complicated (in my opinion). You can certainly do this TODAY if you want to operate component-wise and assume 3 cartesian coordinates x/y/z. You or your students can easily do this in 30 minutes or less (as you say) in Maxima without using any add-on packages. So just do it. This sort of approach doesn't help much, though, if you want to manipulate div/curl/grad on symbolic vectors (not components), possibly in other coordinate systems. -s From dlakelan at street-artists.org Thu Jan 25 12:49:12 2007 From: dlakelan at street-artists.org (Daniel Lakeland) Date: Thu, 25 Jan 2007 10:49:12 -0800 Subject: [Maxima] Maxima storage class semantics In-Reply-To: References: <877ivb0z93.fsf@vh213602.truman.edu> Message-ID: <20070125184912.GB5171@street-artists.org> On Thu, Jan 25, 2007 at 06:15:46PM +0000, miguel Lopez wrote: > Jay Belanger truman.edu> writes: > > > > > The say: Please eliminate thoses ideas that no one can foresee. > > > > What ideas are those? > > > My point is this one: > > Suppose I'm a student and i am begining with vector calculus, > I should expect that divergence was define as: > > divergence(f):=[diff(f,x),diff(f,y),diff(f,z)]; > > and grad, curl, etc in similar terms. > > I think this can be done in 30 minutes or less, but the current package > is complicated (in my opinion). > > Read the recents questions about rk to see the problems with list and matrices. I agree to some extent here... Maxima has confusing semantics with regard to lists, matrices, arrays, subscripted variables, and soforth. Perhaps a generalized discussion of what the semantics of the various storage classes SHOULD be is in order, then we could discuss whether or not changing to those semantics is a major problem for existing code... To kick it off, I think maxima should have (at least) the following types of things: 1) lists, which are just like lisp lists, current maxima lists are fine 2) vectors, which have mathematical semantics and O(1) indexing. 3) Arrays, which are like common lisp "vectors" 4) Hash tables, which are like common lisp hash tables but can be accessed in a similar way to an array, except the index need not be an integer. 5) Numerical arrays, which are like common lisp arrays specialized to double floats. 6) Matrices, which should have mathematical semantics. When assigning any of these to a named variable, they should be assigned to the "value" cell of that variable. It seems to me that currently there is some confusion over whether a list is a vector, or how many ways to use an array... etc. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From biomates at telefonica.net Thu Jan 25 13:22:32 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 25 Jan 2007 20:22:32 +0100 Subject: [Maxima] DSC-2007 Common Lisp talks by Ross Ihaka and Tony Rossini (R-Project) In-Reply-To: References: <45B69799.4090900@prodigy.net.mx> Message-ID: <1169752952.8346.65.camel@localhost.localdomain> Hello, > Robert, thanks for sending the link. I've taken the liberty of > forwarding this to the Maxima mailing list. > I wish I could attend the conference! > > > http://www.stat.auckland.ac.nz/dsc-2007/abstracts/program.html A parallel world with R written in lisp? This sounds interesting. Statistical procedures have been always designed from a purely numerical point of view. Now we know that the R team is looking for some symbolic features (there was some posts in this mailing list about switching from yacas to maxima). Symbolic environments should be very powerful tools in some probabilistic contexts. For example, a cas with Lebesgue or Stieltjes integrals could be used to compute probabilities both with discrete and continuous models. If the cas also incorporates a graph package, a possible application could be in 'graphical models', these are random multivariate models where stochastic dependencies are represented by graphs, both directed or undirected, as in bayesian networks, or random fields. Sometimes there are conditional dependencies among discrete and continuous random variables. The likelihood function must be constructed and numeric parameters (even the graph's structure) estimated from the sample. I don't know if someone, somewhere, has started such a project. My 2*10^-2 EU. -- Mario Rodriguez Riotorto www.biomates.net From Daniel.L.Solomon at nasa.gov Thu Jan 25 13:29:16 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Thu, 25 Jan 2007 14:29:16 -0500 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> Message-ID: I really appreciate everyone's help, but I have two questions. 1. How can I learn the differences/relationships between lists, arrays, and matrices? I've read the documentation (a few times), and I never picked up the idea that if I define init[1], init[2], and init [3], maxima wouldn't realize that "init" meant the 3 vector. 2. is there a way to define my vectors, dxdt, x, and init, so that it will work to issue the command rk(dxdt, x, init, [t,0,1,.1]) Thanks again! Dan On Jan 25, 2007, at 10:46 AM, sen1 at math.msu.edu wrote: > My guess is that Dan wanted to write his system of DE's using matrix > methods to simply express them. So, his original right hand side is a > vector function whose components are 1x1 > matrices of functions instead of functions. So, all that was > necessary to get it to work is to replace > > [dxdtau[1],dxdtau[2],dxdtau[3]] > > by > > [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] > > Thus, instead of his right side of the DE looking like (using x,y,z > instead of x[1],x[2],x[3] for easier writing) > > [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like > > [x^2 + y^2, x - y, z*y*z] > > Hence, the simple fix above. I think Jaime's manual and the examples > are fine as written. If one wants to use matrices of functions to > define systems of equations, one just has to convert back to the > standard thing maxima expects. I don't know if it is worth rewriting > the code to take care of this. But, it might be worthwhile to put an > example or two in the manual to show how to deal with this. > > -sen > > > ---------------------------------------------------------------------- > ----- > | Sheldon E. Newhouse | e-mail: > sen1 at math.msu.edu | > | Mathematics Department | | > | Michigan State University | telephone: > 517-355-9684 | > | E. Lansing, MI 48824-1027 USA | FAX: > 517-432-1562 | > > ---------------------------------------------------------------------- > ----- > > On Thu, 25 Jan 2007, Robert Dodier wrote: > >> Dan, it looks like the basic problem is that Maxima treats lists and >> matrices in ways that are somewhat less than obvious. >> I'll try to clarify some points. >> >> On 1/25/07, Jaime E. Villate wrote: >>> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>>> I don't understand your comment. Don't I have x as a 3-vector? >>> >>> No, you don't. x[1], x[2], x[3] have no relation to the variable x. >>> x and x[1] are considered different variables in Maxima. >> >> Well, if the user writes x:[a, b, c] (i.e. assign a list to x) then >> x[1], x[2], and x[3] are indeed related to x; those are the three >> elements of x. >> >> Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter >> form, x doesn't refer collectively to a, b, and c. >> Whether that's a design flaw is a topic for a rainy day .... >> >>> The first argument given to rk must be a list of expressions. You >>> first >>> tried with a 3x1 matrix dxdtau. It won't work. You then tried >>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>> >>> this is not a list of expressions either. Please notice that since >>> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; >>> namely, >>> it is a list itself. >> >> Lists are not row or column matrices, and the elements of a >> row or column matrix must be indexed by 2 indices (one of which >> is always 1). Dan, probably what you want is to make dxdtau a list. >> >> Hope this helps -- I'm sorry if the treatment of lists and matrices >> is confusing. I would be interested to hear your comments on this >> point. >> >> Robert Dodier >> _______________________________________________ >> 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 From belanger at truman.edu Thu Jan 25 13:31:24 2007 From: belanger at truman.edu (Jay Belanger) Date: Thu, 25 Jan 2007 13:31:24 -0600 Subject: [Maxima] Maxima storage class semantics In-Reply-To: <20070125184912.GB5171@street-artists.org> (Daniel Lakeland's message of "Thu\, 25 Jan 2007 10\:49\:12 -0800") References: <877ivb0z93.fsf@vh213602.truman.edu> <20070125184912.GB5171@street-artists.org> Message-ID: <873b5y299v.fsf@vh213602.truman.edu> Daniel Lakeland writes: > On Thu, Jan 25, 2007 at 06:15:46PM +0000, miguel Lopez wrote: >> Jay Belanger truman.edu> writes: ... >> > What ideas are those? >> My point is this one: ... > I agree to some extent here... Maxima has confusing semantics with > regard to lists, matrices, arrays, subscripted variables, and soforth. ... Ah; I see. Well, if nobody has time to work in this (currently, I certainly don't), perhaps they could be put on the bug-list. Jay From sen1 at math.msu.edu Thu Jan 25 14:35:27 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 15:35:27 -0500 (EST) Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> Message-ID: On Thu, 25 Jan 2007, Dan Solomon wrote: > I really appreciate everyone's help, but I have two questions. > 1. How can I learn the differences/relationships between lists, > arrays, and matrices? I've read the documentation (a few times), and > I never picked up the idea that if I define init[1], init[2], and init > [3], maxima wouldn't realize that "init" meant the 3 vector. > > 2. is there a way to define my vectors, dxdt, x, and init, so that > it will work to issue the command > rk(dxdt, x, init, [t,0,1,.1]) How about e.g., x: [x1,x2,x3]; dxdt: [x1*exp(-x2) - x2^(-3), x1 + x2, x1 + x3]; init: [2.0, -1.1, 3.2]; sol: rk(dxdt, x, init, [t,0,1,.1]); > Thanks again! > Dan > On Jan 25, 2007, at 10:46 AM, sen1 at math.msu.edu wrote: > >> My guess is that Dan wanted to write his system of DE's using matrix >> methods to simply express them. So, his original right hand side is a >> vector function whose components are 1x1 >> matrices of functions instead of functions. So, all that was >> necessary to get it to work is to replace >> >> [dxdtau[1],dxdtau[2],dxdtau[3]] >> >> by >> >> [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] >> >> Thus, instead of his right side of the DE looking like (using x,y,z >> instead of x[1],x[2],x[3] for easier writing) >> >> [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like >> >> [x^2 + y^2, x - y, z*y*z] >> >> Hence, the simple fix above. I think Jaime's manual and the examples >> are fine as written. If one wants to use matrices of functions to >> define systems of equations, one just has to convert back to the >> standard thing maxima expects. I don't know if it is worth rewriting >> the code to take care of this. But, it might be worthwhile to put an >> example or two in the manual to show how to deal with this. >> >> -sen >> >> >> ---------------------------------------------------------------------- >> ----- >> | Sheldon E. Newhouse | e-mail: >> sen1 at math.msu.edu | >> | Mathematics Department | | >> | Michigan State University | telephone: >> 517-355-9684 | >> | E. Lansing, MI 48824-1027 USA | FAX: >> 517-432-1562 | >> >> ---------------------------------------------------------------------- >> ----- >> >> On Thu, 25 Jan 2007, Robert Dodier wrote: >> >>> Dan, it looks like the basic problem is that Maxima treats lists and >>> matrices in ways that are somewhat less than obvious. >>> I'll try to clarify some points. >>> >>> On 1/25/07, Jaime E. Villate wrote: >>>> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>>>> I don't understand your comment. Don't I have x as a 3-vector? >>>> >>>> No, you don't. x[1], x[2], x[3] have no relation to the variable x. >>>> x and x[1] are considered different variables in Maxima. >>> >>> Well, if the user writes x:[a, b, c] (i.e. assign a list to x) then >>> x[1], x[2], and x[3] are indeed related to x; those are the three >>> elements of x. >>> >>> Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter >>> form, x doesn't refer collectively to a, b, and c. >>> Whether that's a design flaw is a topic for a rainy day .... >>> >>>> The first argument given to rk must be a list of expressions. You >>>> first >>>> tried with a 3x1 matrix dxdtau. It won't work. You then tried >>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>> >>>> this is not a list of expressions either. Please notice that since >>>> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; >>>> namely, >>>> it is a list itself. >>> >>> Lists are not row or column matrices, and the elements of a >>> row or column matrix must be indexed by 2 indices (one of which >>> is always 1). Dan, probably what you want is to make dxdtau a list. >>> >>> Hope this helps -- I'm sorry if the treatment of lists and matrices >>> is confusing. I would be interested to hear your comments on this >>> point. >>> >>> Robert Dodier >>> _______________________________________________ >>> 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 > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From miguel39123 at hotmail.com Thu Jan 25 14:50:40 2007 From: miguel39123 at hotmail.com (miguel Lopez) Date: Thu, 25 Jan 2007 20:50:40 +0000 (UTC) Subject: [Maxima] suboptimal versus non sense References: <877ivb0z93.fsf@vh213602.truman.edu> <8b356f880701251039x70bec64cu30594835fed7b7aa@mail.gmail.com> Message-ID: Stavros Macrakis alum.mit.edu> writes: > > > > > divergence(f):=[diff(f,x),diff(f,y),diff(f,z)]; > This sort of approach doesn't help much, though, if you want to > manipulate div/curl/grad on symbolic vectors (not components), > possibly in other coordinate systems. Sorry for the error, divergence(f):=diff(f,x)+diff(f,y)+diff(f,z); From miguel39123 at hotmail.com Thu Jan 25 14:56:30 2007 From: miguel39123 at hotmail.com (miguel Lopez) Date: Thu, 25 Jan 2007 20:56:30 +0000 (UTC) Subject: [Maxima] suboptimal versus non sense References: <877ivb0z93.fsf@vh213602.truman.edu> <8b356f880701251039x70bec64cu30594835fed7b7aa@mail.gmail.com> Message-ID: miguel Lopez hotmail.com> writes: Another error, clearly today is not my day! divergence(f):=diff(f[1],x)+diff(f[2],y)+diff(f[3],z); From macrakis at alum.mit.edu Thu Jan 25 15:35:06 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 25 Jan 2007 16:35:06 -0500 Subject: [Maxima] Maxima storage class semantics In-Reply-To: <8b356f880701251108p296b4299la8853bfee0cb48e@mail.gmail.com> References: <877ivb0z93.fsf@vh213602.truman.edu> <20070125184912.GB5171@street-artists.org> <8b356f880701251108p296b4299la8853bfee0cb48e@mail.gmail.com> Message-ID: <8b356f880701251335y79f3b82emdf4b3c6faadf300b@mail.gmail.com> I sent this to Daniel a couple of hours ago, intending to send it to the whole lis.... > I agree to some extent here... Maxima has confusing semantics with > regard to lists, matrices, arrays, subscripted variables, and soforth. Agreed. For the rest, I think this proposal is going in precisely the wrong direction, with multiple special-purpose mechanisms defined by a mixture of semantics and implementation matters. I have previously proposed a simpler system, which separates semantics and implementation cleanly. I will outline more details later. > To kick it off, I think maxima should have (at least) the following > types of things: > > 1) lists, which are just like lisp lists, current maxima lists are fine > 2) vectors, which have mathematical semantics and O(1) indexing. What exactly do you mean by "mathematical semantics"? Why are you requiring that semantics be aligned with performance characteristics? > 3) Arrays, which are like common lisp "vectors" What exactly are the properties you want? > 4) Hash tables, which are like common lisp hash tables but can be > accessed in a similar way to an array, except the index need not be an > integer. Why is this different from a list or an array? > 5) Numerical arrays, which are like common lisp arrays specialized to > double floats. This is an implementation matter. Are the semantics the same as arrays? If we later add quad-precision floats, is that a different type? > 6) Matrices, which should have mathematical semantics. What exactly do you want here? I assume you want to allow general values in each entry, not just numbers. If they entries happen to be double-floats, how does this relate to your "numeric arrays"? > When assigning any of these to a named variable, they should be > assigned to the "value" cell of that variable. That is an implementation detail. I think what you intend is that the objects above be first-class objects, which can be assigned to variables, passed as arguments, etc. From Daniel.L.Solomon at nasa.gov Thu Jan 25 15:37:51 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Thu, 25 Jan 2007 16:37:51 -0500 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> Message-ID: <5246422B-8063-4C6B-BA4D-45392717D58E@nasa.gov> that would make row vectors, instead of column vectors, right? Which should be OK for using rk, but perhaps not for other purposes, is why I was doing matrix([x1], [x2], [x3]) - i understood the documentation to mean matrix () needs its rows inside separate [ ]. I was trying to make a 3 row by 1 column matrix, i.e., a column 3 vector. But anyway, don't you have to say x:matrix([x1,x2,x3]); rather than just x:[x1,x2,x3]; ? On Jan 25, 2007, at 3:35 PM, sen1 at math.msu.edu wrote: > > On Thu, 25 Jan 2007, Dan Solomon wrote: > >> I really appreciate everyone's help, but I have two questions. >> 1. How can I learn the differences/relationships between lists, >> arrays, and matrices? I've read the documentation (a few times), and >> I never picked up the idea that if I define init[1], init[2], and >> init >> [3], maxima wouldn't realize that "init" meant the 3 vector. >> >> 2. is there a way to define my vectors, dxdt, x, and init, so that >> it will work to issue the command >> rk(dxdt, x, init, [t,0,1,.1]) > > > How about e.g., > > x: [x1,x2,x3]; > > dxdt: [x1*exp(-x2) - x2^(-3), x1 + x2, x1 + x3]; > > init: [2.0, -1.1, 3.2]; > > sol: rk(dxdt, x, init, [t,0,1,.1]); > > >> Thanks again! >> Dan >> On Jan 25, 2007, at 10:46 AM, sen1 at math.msu.edu wrote: >> >>> My guess is that Dan wanted to write his system of DE's using matrix >>> methods to simply express them. So, his original right hand side >>> is a >>> vector function whose components are 1x1 >>> matrices of functions instead of functions. So, all that was >>> necessary to get it to work is to replace >>> >>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>> >>> by >>> >>> [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] >>> >>> Thus, instead of his right side of the DE looking like (using x,y,z >>> instead of x[1],x[2],x[3] for easier writing) >>> >>> [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like >>> >>> [x^2 + y^2, x - y, z*y*z] >>> >>> Hence, the simple fix above. I think Jaime's manual and the >>> examples >>> are fine as written. If one wants to use matrices of functions to >>> define systems of equations, one just has to convert back to the >>> standard thing maxima expects. I don't know if it is worth >>> rewriting >>> the code to take care of this. But, it might be worthwhile to >>> put an >>> example or two in the manual to show how to deal with this. >>> >>> -sen >>> >>> >>> -------------------------------------------------------------------- >>> -- >>> ----- >>> | Sheldon E. Newhouse | e-mail: >>> sen1 at math.msu.edu | >>> | Mathematics Department | | >>> | Michigan State University | telephone: >>> 517-355-9684 | >>> | E. Lansing, MI 48824-1027 USA | FAX: >>> 517-432-1562 | >>> >>> -------------------------------------------------------------------- >>> -- >>> ----- >>> >>> On Thu, 25 Jan 2007, Robert Dodier wrote: >>> >>>> Dan, it looks like the basic problem is that Maxima treats lists >>>> and >>>> matrices in ways that are somewhat less than obvious. >>>> I'll try to clarify some points. >>>> >>>> On 1/25/07, Jaime E. Villate wrote: >>>>> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>>>>> I don't understand your comment. Don't I have x as a 3-vector? >>>>> >>>>> No, you don't. x[1], x[2], x[3] have no relation to the >>>>> variable x. >>>>> x and x[1] are considered different variables in Maxima. >>>> >>>> Well, if the user writes x:[a, b, c] (i.e. assign a list to x) then >>>> x[1], x[2], and x[3] are indeed related to x; those are the three >>>> elements of x. >>>> >>>> Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter >>>> form, x doesn't refer collectively to a, b, and c. >>>> Whether that's a design flaw is a topic for a rainy day .... >>>> >>>>> The first argument given to rk must be a list of expressions. You >>>>> first >>>>> tried with a 3x1 matrix dxdtau. It won't work. You then tried >>>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>>> >>>>> this is not a list of expressions either. Please notice that since >>>>> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; >>>>> namely, >>>>> it is a list itself. >>>> >>>> Lists are not row or column matrices, and the elements of a >>>> row or column matrix must be indexed by 2 indices (one of which >>>> is always 1). Dan, probably what you want is to make dxdtau a list. >>>> >>>> Hope this helps -- I'm sorry if the treatment of lists and matrices >>>> is confusing. I would be interested to hear your comments on this >>>> point. >>>> >>>> Robert Dodier >>>> _______________________________________________ >>>> 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 >> _______________________________________________ >> 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 From sen1 at math.msu.edu Thu Jan 25 15:29:09 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 16:29:09 -0500 (EST) Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <5246422B-8063-4C6B-BA4D-45392717D58E@nasa.gov> References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> <5246422B-8063-4C6B-BA4D-45392717D58E@nasa.gov> Message-ID: What's the difference between using rows or columns? (%i5) x: [u,v,w]; (%o5) [u, v, w] (%i6) transpose(x); [ u ] [ ] (%o6) [ v ] [ ] [ w ] -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Thu, 25 Jan 2007, Dan Solomon wrote: > that would make row vectors, instead of column vectors, right? Which > should be OK for using rk, but perhaps not for other purposes, is why > I was doing matrix([x1], [x2], [x3]) - i understood the documentation > to mean matrix () needs its rows inside separate [ ]. I was trying > to make a 3 row by 1 column matrix, i.e., a column 3 vector. > > But anyway, don't you have to say x:matrix([x1,x2,x3]); rather than > just x:[x1,x2,x3]; ? > > > On Jan 25, 2007, at 3:35 PM, sen1 at math.msu.edu wrote: > >> >> On Thu, 25 Jan 2007, Dan Solomon wrote: >> >>> I really appreciate everyone's help, but I have two questions. >>> 1. How can I learn the differences/relationships between lists, >>> arrays, and matrices? I've read the documentation (a few times), and >>> I never picked up the idea that if I define init[1], init[2], and >>> init >>> [3], maxima wouldn't realize that "init" meant the 3 vector. >>> >>> 2. is there a way to define my vectors, dxdt, x, and init, so that >>> it will work to issue the command >>> rk(dxdt, x, init, [t,0,1,.1]) >> >> >> How about e.g., >> >> x: [x1,x2,x3]; >> >> dxdt: [x1*exp(-x2) - x2^(-3), x1 + x2, x1 + x3]; >> >> init: [2.0, -1.1, 3.2]; >> >> sol: rk(dxdt, x, init, [t,0,1,.1]); >> >> >>> Thanks again! >>> Dan >>> On Jan 25, 2007, at 10:46 AM, sen1 at math.msu.edu wrote: >>> >>>> My guess is that Dan wanted to write his system of DE's using matrix >>>> methods to simply express them. So, his original right hand side >>>> is a >>>> vector function whose components are 1x1 >>>> matrices of functions instead of functions. So, all that was >>>> necessary to get it to work is to replace >>>> >>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>> >>>> by >>>> >>>> [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] >>>> >>>> Thus, instead of his right side of the DE looking like (using x,y,z >>>> instead of x[1],x[2],x[3] for easier writing) >>>> >>>> [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like >>>> >>>> [x^2 + y^2, x - y, z*y*z] >>>> >>>> Hence, the simple fix above. I think Jaime's manual and the >>>> examples >>>> are fine as written. If one wants to use matrices of functions to >>>> define systems of equations, one just has to convert back to the >>>> standard thing maxima expects. I don't know if it is worth >>>> rewriting >>>> the code to take care of this. But, it might be worthwhile to >>>> put an >>>> example or two in the manual to show how to deal with this. >>>> >>>> -sen >>>> >>>> >>>> -------------------------------------------------------------------- >>>> -- >>>> ----- >>>> | Sheldon E. Newhouse | e-mail: >>>> sen1 at math.msu.edu | >>>> | Mathematics Department | | >>>> | Michigan State University | telephone: >>>> 517-355-9684 | >>>> | E. Lansing, MI 48824-1027 USA | FAX: >>>> 517-432-1562 | >>>> >>>> -------------------------------------------------------------------- >>>> -- >>>> ----- >>>> >>>> On Thu, 25 Jan 2007, Robert Dodier wrote: >>>> >>>>> Dan, it looks like the basic problem is that Maxima treats lists >>>>> and >>>>> matrices in ways that are somewhat less than obvious. >>>>> I'll try to clarify some points. >>>>> >>>>> On 1/25/07, Jaime E. Villate wrote: >>>>>> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>>>>>> I don't understand your comment. Don't I have x as a 3-vector? >>>>>> >>>>>> No, you don't. x[1], x[2], x[3] have no relation to the >>>>>> variable x. >>>>>> x and x[1] are considered different variables in Maxima. >>>>> >>>>> Well, if the user writes x:[a, b, c] (i.e. assign a list to x) then >>>>> x[1], x[2], and x[3] are indeed related to x; those are the three >>>>> elements of x. >>>>> >>>>> Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the latter >>>>> form, x doesn't refer collectively to a, b, and c. >>>>> Whether that's a design flaw is a topic for a rainy day .... >>>>> >>>>>> The first argument given to rk must be a list of expressions. You >>>>>> first >>>>>> tried with a 3x1 matrix dxdtau. It won't work. You then tried >>>>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>>>> >>>>>> this is not a list of expressions either. Please notice that since >>>>>> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; >>>>>> namely, >>>>>> it is a list itself. >>>>> >>>>> Lists are not row or column matrices, and the elements of a >>>>> row or column matrix must be indexed by 2 indices (one of which >>>>> is always 1). Dan, probably what you want is to make dxdtau a list. >>>>> >>>>> Hope this helps -- I'm sorry if the treatment of lists and matrices >>>>> is confusing. I would be interested to hear your comments on this >>>>> point. >>>>> >>>>> Robert Dodier >>>>> _______________________________________________ >>>>> 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 >>> _______________________________________________ >>> 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 > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From Daniel.L.Solomon at nasa.gov Thu Jan 25 15:50:59 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Thu, 25 Jan 2007 16:50:59 -0500 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> <5246422B-8063-4C6B-BA4D-45392717D58E@nasa.gov> Message-ID: <12FC9F59-6AF7-4A09-B3D0-B98C1F040E5B@nasa.gov> It is often convenient to express a linear vector ODE in matrix form, dxdt = A.x, which works if A is a square matrix and x & dxdt are column vectors. But you know that. Are you pointing out that the tools in Maxima can deal with things either way? That rk(dxdt, x, init, [t,0,1,.1]) will work as long as dxdt, x, and init are all column vectors or all row vectors? On Jan 25, 2007, at 4:29 PM, sen1 at math.msu.edu wrote: > What's the difference between using rows or columns? > > (%i5) x: [u,v,w]; > (%o5) [u, v, w] > (%i6) transpose(x); > [ u ] > [ ] > (%o6) [ v ] > [ ] > [ w ] > > -sen > > > ---------------------------------------------------------------------- > ----- > | Sheldon E. Newhouse | e-mail: > sen1 at math.msu.edu | > | Mathematics Department | | > | Michigan State University | telephone: > 517-355-9684 | > | E. Lansing, MI 48824-1027 USA | FAX: > 517-432-1562 | > > ---------------------------------------------------------------------- > ----- > > On Thu, 25 Jan 2007, Dan Solomon wrote: > >> that would make row vectors, instead of column vectors, right? Which >> should be OK for using rk, but perhaps not for other purposes, is why >> I was doing matrix([x1], [x2], [x3]) - i understood the documentation >> to mean matrix () needs its rows inside separate [ ]. I was trying >> to make a 3 row by 1 column matrix, i.e., a column 3 vector. >> >> But anyway, don't you have to say x:matrix([x1,x2,x3]); rather than >> just x:[x1,x2,x3]; ? >> >> >> On Jan 25, 2007, at 3:35 PM, sen1 at math.msu.edu wrote: >> >>> >>> On Thu, 25 Jan 2007, Dan Solomon wrote: >>> >>>> I really appreciate everyone's help, but I have two questions. >>>> 1. How can I learn the differences/relationships between lists, >>>> arrays, and matrices? I've read the documentation (a few >>>> times), and >>>> I never picked up the idea that if I define init[1], init[2], and >>>> init >>>> [3], maxima wouldn't realize that "init" meant the 3 vector. >>>> >>>> 2. is there a way to define my vectors, dxdt, x, and init, so that >>>> it will work to issue the command >>>> rk(dxdt, x, init, [t,0,1,.1]) >>> >>> >>> How about e.g., >>> >>> x: [x1,x2,x3]; >>> >>> dxdt: [x1*exp(-x2) - x2^(-3), x1 + x2, x1 + x3]; >>> >>> init: [2.0, -1.1, 3.2]; >>> >>> sol: rk(dxdt, x, init, [t,0,1,.1]); >>> >>> >>>> Thanks again! >>>> Dan >>>> On Jan 25, 2007, at 10:46 AM, sen1 at math.msu.edu wrote: >>>> >>>>> My guess is that Dan wanted to write his system of DE's using >>>>> matrix >>>>> methods to simply express them. So, his original right hand side >>>>> is a >>>>> vector function whose components are 1x1 >>>>> matrices of functions instead of functions. So, all that was >>>>> necessary to get it to work is to replace >>>>> >>>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>>> >>>>> by >>>>> >>>>> [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] >>>>> >>>>> Thus, instead of his right side of the DE looking like (using >>>>> x,y,z >>>>> instead of x[1],x[2],x[3] for easier writing) >>>>> >>>>> [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like >>>>> >>>>> [x^2 + y^2, x - y, z*y*z] >>>>> >>>>> Hence, the simple fix above. I think Jaime's manual and the >>>>> examples >>>>> are fine as written. If one wants to use matrices of functions to >>>>> define systems of equations, one just has to convert back to the >>>>> standard thing maxima expects. I don't know if it is worth >>>>> rewriting >>>>> the code to take care of this. But, it might be worthwhile to >>>>> put an >>>>> example or two in the manual to show how to deal with this. >>>>> >>>>> -sen >>>>> >>>>> >>>>> ------------------------------------------------------------------ >>>>> -- >>>>> -- >>>>> ----- >>>>> | Sheldon E. Newhouse | e-mail: >>>>> sen1 at math.msu.edu | >>>>> | Mathematics Department | | >>>>> | Michigan State University | telephone: >>>>> 517-355-9684 | >>>>> | E. Lansing, MI 48824-1027 USA | FAX: >>>>> 517-432-1562 | >>>>> >>>>> ------------------------------------------------------------------ >>>>> -- >>>>> -- >>>>> ----- >>>>> >>>>> On Thu, 25 Jan 2007, Robert Dodier wrote: >>>>> >>>>>> Dan, it looks like the basic problem is that Maxima treats lists >>>>>> and >>>>>> matrices in ways that are somewhat less than obvious. >>>>>> I'll try to clarify some points. >>>>>> >>>>>> On 1/25/07, Jaime E. Villate wrote: >>>>>>> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>>>>>>> I don't understand your comment. Don't I have x as a 3-vector? >>>>>>> >>>>>>> No, you don't. x[1], x[2], x[3] have no relation to the >>>>>>> variable x. >>>>>>> x and x[1] are considered different variables in Maxima. >>>>>> >>>>>> Well, if the user writes x:[a, b, c] (i.e. assign a list to x) >>>>>> then >>>>>> x[1], x[2], and x[3] are indeed related to x; those are the three >>>>>> elements of x. >>>>>> >>>>>> Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the >>>>>> latter >>>>>> form, x doesn't refer collectively to a, b, and c. >>>>>> Whether that's a design flaw is a topic for a rainy day .... >>>>>> >>>>>>> The first argument given to rk must be a list of expressions. >>>>>>> You >>>>>>> first >>>>>>> tried with a 3x1 matrix dxdtau. It won't work. You then tried >>>>>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>>>>> >>>>>>> this is not a list of expressions either. Please notice that >>>>>>> since >>>>>>> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; >>>>>>> namely, >>>>>>> it is a list itself. >>>>>> >>>>>> Lists are not row or column matrices, and the elements of a >>>>>> row or column matrix must be indexed by 2 indices (one of which >>>>>> is always 1). Dan, probably what you want is to make dxdtau a >>>>>> list. >>>>>> >>>>>> Hope this helps -- I'm sorry if the treatment of lists and >>>>>> matrices >>>>>> is confusing. I would be interested to hear your comments on this >>>>>> point. >>>>>> >>>>>> Robert Dodier >>>>>> _______________________________________________ >>>>>> 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 >>>> _______________________________________________ >>>> 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 >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> From robert.dodier at gmail.com Thu Jan 25 15:58:26 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 14:58:26 -0700 Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <12FC9F59-6AF7-4A09-B3D0-B98C1F040E5B@nasa.gov> References: <1169737743.6890.26.camel@localhost.localdomain> <5246422B-8063-4C6B-BA4D-45392717D58E@nasa.gov> <12FC9F59-6AF7-4A09-B3D0-B98C1F040E5B@nasa.gov> Message-ID: On 1/25/07, Dan Solomon wrote: > It is often convenient to express a linear vector ODE in matrix form, > dxdt = A.x, which works if A is a square matrix and x & dxdt are > column vectors. But you know that. Are you pointing out that the > tools in Maxima can deal with things either way? That rk(dxdt, x, > init, [t,0,1,.1]) will work as long as dxdt, x, and init are all > column vectors or all row vectors? In Maxima, lists are quite distinct from matrices. I'm pretty sure rk works OK if arguments are lists and probably not if arguments are matrices. HTH Robert From l.couraud at gmail.com Thu Jan 25 16:05:17 2007 From: l.couraud at gmail.com (laurent couraud) Date: Thu, 25 Jan 2007 23:05:17 +0100 Subject: [Maxima] RE : A note on graphics In-Reply-To: <1169382954.12070.9.camel@localhost.localdomain> Message-ID: <000001c740cc$ea6bfc40$85274252@xiii> Maybe you can add gpdraw4d. (just a dream). > -----Message d'origine----- > De?: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] De la part de > Mario Rodriguez > Envoy??: dimanche 21 janvier 2007 13:36 > ??: maxima at math.utexas.edu > Objet?: [Maxima] A note on graphics > > Hello, > > There was a discussion in this mailing list some months back regarding > new Maxima-Gnuplot and Maxima-Openmath interfaces. I've been working the > last weeks on the Maxima-Gnuplot part. > > The project is in its very very infancy, but I think it's not a bad idea > to make public the directions I took. > > All the relevant information is here: > > http://www.telefonica.net/web2/biomates/maxima/gpdraw > > Comments are welcome, specially those related to syntax and/or new > capabilities. > > Best wishes. > > -- > Mario Rodriguez Riotorto > www.biomates.net > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From sen1 at math.msu.edu Thu Jan 25 16:10:17 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 17:10:17 -0500 (EST) Subject: [Maxima] how do I get rk to do anything? In-Reply-To: <12FC9F59-6AF7-4A09-B3D0-B98C1F040E5B@nasa.gov> References: <1169715301.7037.16.camel@localhost.localdomain> <1169737743.6890.26.camel@localhost.localdomain> <5246422B-8063-4C6B-BA4D-45392717D58E@nasa.gov> <12FC9F59-6AF7-4A09-B3D0-B98C1F040E5B@nasa.gov> Message-ID: On Thu, 25 Jan 2007, Dan Solomon wrote: > It is often convenient to express a linear vector ODE in matrix form, > dxdt = A.x, which works if A is a square matrix and x & dxdt are > column vectors. But you know that. Are you pointing out that the > tools in Maxima can deal with things either way? That rk(dxdt, x, > init, [t,0,1,.1]) will work as long as dxdt, x, and init are all > column vectors or all row vectors? No, rk needs "horizontal" lists as in the examples. If you write something which involves column vectors, you simply use the "transpose" operator to convert them into row vectors to use in rk. Is this clear? Consider the following. (%i37) A: matrix([2,1],[1,1]); [ 2 1 ] (%o37) [ ] [ 1 1 ] (%i38) xb: [x,y]; (%o38) [x, y] (%i39) dxdt: A. transpose(xb); [ y + 2 x ] (%o39) [ ] [ y + x ] (%i40) transpose(dxdt); (%o40) [ y + 2 x y + x ] (%i41) /* note that it is not of the proper form, so try */ transpose(dxdt)[1]; (%o41) [y + 2 x, y + x] (%i42) init: [2.0,1.2]; (%o42) [2.0, 1.2] (%i43) t_range: [t,0,1,.1]; (%o43) [t, 0, 1, 0.1] (%i44) eq: transpose(dxdt)[1]; (%o44) [y + 2 x, y + x] (%i45) sol: rk(eq, [x,y], init, t_range); (%o45) [[0, 2.0, 1.2], [0.1, 2.594321666666667, 1.565906666666667], [0.2, 3.366336759902778, 2.041579232534722], [0.3, 4.369215513802731, 2.659876580550931], [0.4, 5.67203965829093, 3.463491356006614], [0.5, 7.364564089526698, 4.507892837463743], [0.6, 9.563403519158422, 5.865150492917444], [0.7, 12.42007054210332, 7.628901775404184], [0.8, 16.13141917902195, 9.920806583594768], [0.9, 20.95321375670773, 12.89893328730419], [1.0, 27.21775841614106, 16.76865435876751]] (%i46) -sen > On Jan 25, 2007, at 4:29 PM, sen1 at math.msu.edu wrote: > >> What's the difference between using rows or columns? >> >> (%i5) x: [u,v,w]; >> (%o5) [u, v, w] >> (%i6) transpose(x); >> [ u ] >> [ ] >> (%o6) [ v ] >> [ ] >> [ w ] >> >> -sen >> >> >> ---------------------------------------------------------------------- >> ----- >> | Sheldon E. Newhouse | e-mail: >> sen1 at math.msu.edu | >> | Mathematics Department | | >> | Michigan State University | telephone: >> 517-355-9684 | >> | E. Lansing, MI 48824-1027 USA | FAX: >> 517-432-1562 | >> >> ---------------------------------------------------------------------- >> ----- >> >> On Thu, 25 Jan 2007, Dan Solomon wrote: >> >>> that would make row vectors, instead of column vectors, right? Which >>> should be OK for using rk, but perhaps not for other purposes, is why >>> I was doing matrix([x1], [x2], [x3]) - i understood the documentation >>> to mean matrix () needs its rows inside separate [ ]. I was trying >>> to make a 3 row by 1 column matrix, i.e., a column 3 vector. >>> >>> But anyway, don't you have to say x:matrix([x1,x2,x3]); rather than >>> just x:[x1,x2,x3]; ? >>> >>> >>> On Jan 25, 2007, at 3:35 PM, sen1 at math.msu.edu wrote: >>> >>>> >>>> On Thu, 25 Jan 2007, Dan Solomon wrote: >>>> >>>>> I really appreciate everyone's help, but I have two questions. >>>>> 1. How can I learn the differences/relationships between lists, >>>>> arrays, and matrices? I've read the documentation (a few >>>>> times), and >>>>> I never picked up the idea that if I define init[1], init[2], and >>>>> init >>>>> [3], maxima wouldn't realize that "init" meant the 3 vector. >>>>> >>>>> 2. is there a way to define my vectors, dxdt, x, and init, so that >>>>> it will work to issue the command >>>>> rk(dxdt, x, init, [t,0,1,.1]) >>>> >>>> >>>> How about e.g., >>>> >>>> x: [x1,x2,x3]; >>>> >>>> dxdt: [x1*exp(-x2) - x2^(-3), x1 + x2, x1 + x3]; >>>> >>>> init: [2.0, -1.1, 3.2]; >>>> >>>> sol: rk(dxdt, x, init, [t,0,1,.1]); >>>> >>>> >>>>> Thanks again! >>>>> Dan >>>>> On Jan 25, 2007, at 10:46 AM, sen1 at math.msu.edu wrote: >>>>> >>>>>> My guess is that Dan wanted to write his system of DE's using >>>>>> matrix >>>>>> methods to simply express them. So, his original right hand side >>>>>> is a >>>>>> vector function whose components are 1x1 >>>>>> matrices of functions instead of functions. So, all that was >>>>>> necessary to get it to work is to replace >>>>>> >>>>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>>>> >>>>>> by >>>>>> >>>>>> [dxdtau[1][1],dxdtau[2][1],dxdtau[3][1]] >>>>>> >>>>>> Thus, instead of his right side of the DE looking like (using >>>>>> x,y,z >>>>>> instead of x[1],x[2],x[3] for easier writing) >>>>>> >>>>>> [[x^2 + y^2], [x - y], [z*y*z]], it should have looked like >>>>>> >>>>>> [x^2 + y^2, x - y, z*y*z] >>>>>> >>>>>> Hence, the simple fix above. I think Jaime's manual and the >>>>>> examples >>>>>> are fine as written. If one wants to use matrices of functions to >>>>>> define systems of equations, one just has to convert back to the >>>>>> standard thing maxima expects. I don't know if it is worth >>>>>> rewriting >>>>>> the code to take care of this. But, it might be worthwhile to >>>>>> put an >>>>>> example or two in the manual to show how to deal with this. >>>>>> >>>>>> -sen >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------ >>>>>> -- >>>>>> -- >>>>>> ----- >>>>>> | Sheldon E. Newhouse | e-mail: >>>>>> sen1 at math.msu.edu | >>>>>> | Mathematics Department | | >>>>>> | Michigan State University | telephone: >>>>>> 517-355-9684 | >>>>>> | E. Lansing, MI 48824-1027 USA | FAX: >>>>>> 517-432-1562 | >>>>>> >>>>>> ------------------------------------------------------------------ >>>>>> -- >>>>>> -- >>>>>> ----- >>>>>> >>>>>> On Thu, 25 Jan 2007, Robert Dodier wrote: >>>>>> >>>>>>> Dan, it looks like the basic problem is that Maxima treats lists >>>>>>> and >>>>>>> matrices in ways that are somewhat less than obvious. >>>>>>> I'll try to clarify some points. >>>>>>> >>>>>>> On 1/25/07, Jaime E. Villate wrote: >>>>>>>> On Thu, 2007-01-25 at 06:12 -0500, Dan Solomon wrote: >>>>>>>>> I don't understand your comment. Don't I have x as a 3-vector? >>>>>>>> >>>>>>>> No, you don't. x[1], x[2], x[3] have no relation to the >>>>>>>> variable x. >>>>>>>> x and x[1] are considered different variables in Maxima. >>>>>>> >>>>>>> Well, if the user writes x:[a, b, c] (i.e. assign a list to x) >>>>>>> then >>>>>>> x[1], x[2], and x[3] are indeed related to x; those are the three >>>>>>> elements of x. >>>>>>> >>>>>>> Dan, I think you want x:[a, b, c], not x[1]:a, etc -- in the >>>>>>> latter >>>>>>> form, x doesn't refer collectively to a, b, and c. >>>>>>> Whether that's a design flaw is a topic for a rainy day .... >>>>>>> >>>>>>>> The first argument given to rk must be a list of expressions. >>>>>>>> You >>>>>>>> first >>>>>>>> tried with a 3x1 matrix dxdtau. It won't work. You then tried >>>>>>>> [dxdtau[1],dxdtau[2],dxdtau[3]] >>>>>>>> >>>>>>>> this is not a list of expressions either. Please notice that >>>>>>>> since >>>>>>>> dxdtau is a matrix, dxdtau[1] is the first row of that matrix; >>>>>>>> namely, >>>>>>>> it is a list itself. >>>>>>> >>>>>>> Lists are not row or column matrices, and the elements of a >>>>>>> row or column matrix must be indexed by 2 indices (one of which >>>>>>> is always 1). Dan, probably what you want is to make dxdtau a >>>>>>> list. >>>>>>> >>>>>>> Hope this helps -- I'm sorry if the treatment of lists and >>>>>>> matrices >>>>>>> is confusing. I would be interested to hear your comments on this >>>>>>> point. >>>>>>> >>>>>>> Robert Dodier >>>>>>> _______________________________________________ >>>>>>> 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 >>>>> _______________________________________________ >>>>> 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 >>> _______________________________________________ >>> 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 > From biomates at telefonica.net Thu Jan 25 16:47:17 2007 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 25 Jan 2007 23:47:17 +0100 Subject: [Maxima] RE : A note on graphics In-Reply-To: <000001c740cc$ea6bfc40$85274252@xiii> References: <000001c740cc$ea6bfc40$85274252@xiii> Message-ID: <1169765237.11492.3.camel@localhost.localdomain> Hello, > Maybe you can add gpdraw4d. (just a dream). > It's done!! At least if you mean 4d = 3d spatial + 1d temporal :-) -- Mario Rodriguez Riotorto www.biomates.net From dlakelan at street-artists.org Thu Jan 25 15:31:15 2007 From: dlakelan at street-artists.org (dlakelan at street-artists.org) Date: Thu, 25 Jan 2007 13:31:15 -0800 Subject: [Maxima] Maxima storage class semantics In-Reply-To: <8b356f880701251108p296b4299la8853bfee0cb48e@mail.gmail.com> References: <877ivb0z93.fsf@vh213602.truman.edu> <20070125184912.GB5171@street-artists.org> <8b356f880701251108p296b4299la8853bfee0cb48e@mail.gmail.com> Message-ID: <20070125213115.GC5171@street-artists.org> On Thu, Jan 25, 2007 at 02:08:20PM -0500, Stavros Macrakis wrote: > >I agree to some extent here... Maxima has confusing semantics with > >regard to lists, matrices, arrays, subscripted variables, and soforth. > > Agreed. For the rest, I think this proposal is going in precisely the > wrong direction, with multiple special-purpose mechanisms defined by a > mixture of semantics and implementation matters. I have previously > proposed a simpler system, which separates semantics and > implementation cleanly. I will outline more details later. Are we off list on purpose? I see this message in my private mail, but not on the list. In any case, I was trying to get the ball rolling on the discussion. So I'll try to clarify your questions. > >To kick it off, I think maxima should have (at least) the following > >types of things: > > > >1) lists, which are just like lisp lists, current maxima lists are fine > > >2) vectors, which have mathematical semantics and O(1) indexing. > > What exactly do you mean by "mathematical semantics"? > Why are you requiring that semantics be aligned with performance > characteristics? Maxima is both a programming language, and a language for expressing mathematics. It is computationally interesting to do things with "arrays" which are conceptually different from mathematical "vectors". That is, I might want to put various things into an ordered structure with O(1) access time. However, I don't want to necessarily have the notion of a transpose, or commutative addition, or whatever. I don't have a hard and fast definition of "mathematical semantics" but it should include some notions such as: vector addition, vector inner product, multiplication by scalars, transpose. A vector should probably conceptually be no different from a 1 column or 1 row matrix. When it comes to mathematical vectors, the common and expected case is to access them by indexing, and therefore it would be unacceptable to have a vector which could not be indexed efficiently, even if we provide an iterator type of access mechanism. > >3) Arrays, which are like common lisp "vectors" > > What exactly are the properties you want? an ordered structure that can contain any maxima data type with O(1) access time which is suitable for writing computational code which needs direct access to elements. > >4) Hash tables, which are like common lisp hash tables but can be > >accessed in a similar way to an array, except the index need not be an > >integer. > > Why is this different from a list or an array? Arrays are conceptually "ordered" that is indexed by integers, and also indexable by an iterator scheme (ie a notion of a "next" element or a "previous" element). A hash table is a representation of a mapping from a key to a value. One could completely eliminate arrays and only have hash tables, but I think there is an efficiency price to pay that would be unacceptable when only integers are needed. > >5) Numerical arrays, which are like common lisp arrays specialized to > >double floats. > > This is an implementation matter. Are the semantics the same as > arrays? If we later add quad-precision floats, is that a different > type? The goal here is to have specialization suitable for fast numerical mathematical computation. I don't claim to have a comprehensive suggestion as to how to get that, but I think it's essential. There need not be a conceptually different type, but there should be a way to get high performance by specialization. > >6) Matrices, which should have mathematical semantics. > > What exactly do you want here? I assume you want to allow general > values in each entry, not just numbers. If they entries happen to be > double-floats, how does this relate to your "numeric arrays"? Good questions. I don't have answers as yet. > That is an implementation detail. I think what you intend is that the > objects above be first-class objects, which can be assigned to > variables, passed as arguments, etc. Yes, this is what I intend. All storage types should be first-class objects. I'm glad to see the ball rolling on this issue. -- Daniel Lakeland dlakelan at street-artists.org http://www.street-artists.org/~dlakelan From l.couraud at gmail.com Thu Jan 25 17:33:26 2007 From: l.couraud at gmail.com (laurent couraud) Date: Fri, 26 Jan 2007 00:33:26 +0100 Subject: [Maxima] RE : RE : A note on graphics In-Reply-To: <1169765237.11492.3.camel@localhost.localdomain> Message-ID: <000001c740d9$37045460$85274252@xiii> I thought rather of a tool for topologist. But I am unaware of to tell the truth if that can be of any interest. > -----Message d'origine----- > De?: Mario Rodriguez [mailto:biomates at telefonica.net] > Envoy??: jeudi 25 janvier 2007 23:47 > ??: laurent couraud > Cc?: maxima at math.utexas.edu > Objet?: Re: [Maxima] RE : A note on graphics > > Hello, > > > Maybe you can add gpdraw4d. (just a dream). > > > > It's done!! > > At least if you mean 4d = 3d spatial + 1d temporal :-) > > -- > Mario Rodriguez Riotorto > www.biomates.net From trayracing at yahoo.com Thu Jan 25 19:37:50 2007 From: trayracing at yahoo.com (Ray Tice) Date: Thu, 25 Jan 2007 17:37:50 -0800 (PST) Subject: [Maxima] Integrating function with abs or max In-Reply-To: Message-ID: <278183.48714.qm@web38415.mail.mud.yahoo.com> Robert Dodier wrote: On 23 Jan 2007 17:23:55 +0100, Albert Reiner wrote: > [Ray Tice , Mon, 22 Jan 2007 14:38:25 -0800 (PST)]: > > How do I reformulate functions that use abs or max so that maxima > > can integrate them? For example, integrate(abs(x), x, -1, 1) won't > > evaluate, but both of these will: > > integrate(abs(x), x, -1, 0) > > integrate(abs(x), x, 0, 1) > > I believe, the correct way to handle these kinds of things is to > replace abs(x) by something akin to (if x >= 0 then x else -x). > Someone has done some work on unevaluated conditionals that should > allow you to do this. The boolsimp package makes Maxima comfortable with unevaluated conditionals, but there aren't any functions to make conditionals interact with integrate or arithmetic operators. Not for any principled reason, but just because I haven't gotten around to it. This is an interesting problem; I'll try to work on it over the weekend. best, Robert Dodier Thanks for the suggestion Albert. It didn't quite work out on Maxima 5.11.0: "Maxima was unable to evaluate the predicate:x>=0" Robert, glad I got you enthused. Thanks both! --------------------------------- Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070125/71d01223/attachment.htm From go.maxima at gmail.com Thu Jan 25 19:49:50 2007 From: go.maxima at gmail.com (Gosei Furuya) Date: Fri, 26 Jan 2007 10:49:50 +0900 Subject: [Maxima] suboptimal versus non sense In-Reply-To: References: <877ivb0z93.fsf@vh213602.truman.edu> <8b356f880701251039x70bec64cu30594835fed7b7aa@mail.gmail.com> Message-ID: hi miguel You shoud read share/diff_form/example.txt you can calc with all coordinate system. for example (%i33) fstar_with_clf([r,th,phi],[r*sin(phi)*cos(th),r*sin(phi)*sin(th),r*cos(phi)], (depends([a,b,c],[r,th,phi]),aa:vtof1([a,b,c]),nest2([h_st,d,h_st],aa))); db dc --- ---- c cos(phi) dth dphi 2 a da (%o33) ---------- + ---------- + ---- + --- + -- sin(phi) r sin(phi) r r r dr h_st is hodge star,d is exterior derivative,nest2([h_st,d,h_st],aa) is h_st(d(h_st(aa))) I recommend my diff_form package to you and your students. Thanks Gosei Furuya 2007/1/26, miguel Lopez : > > Stavros Macrakis alum.mit.edu> writes: > > > > > > > > > divergence(f):=[diff(f,x),diff(f,y),diff(f,z)]; > > > This sort of approach doesn't help much, though, if you want to > > manipulate div/curl/grad on symbolic vectors (not components), > > possibly in other coordinate systems. > > > Sorry for the error, > > divergence(f):=diff(f,x)+diff(f,y)+diff(f,z); > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070126/cc5a533f/attachment.htm From sen1 at math.msu.edu Thu Jan 25 21:34:24 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 22:34:24 -0500 (EST) Subject: [Maxima] rk and gpdraw Message-ID: Hello, Since the recent "rk" thread went on a bit, I played with some of the tools available, and I thought I'd send a very simple example of how to plot the solutions of the Lorenz system of differential equations using "rk" and "gpdraw". Of course, this owes much thanks to Jaime and Mario. The enclosed file shows in a very meager sense the potential that already exists for the study of nonlinear 3-d differential equations. Just load the file "Lorenz.mac" and wait several seconds. On my dual core linux system it takes around 5 seconds to produce the picture. Once the picture is there, drag the left mouse button around, and then move the middle mouse button left-right or up-down. My students will like this! Now, for some "wish list" items. 1. The keyboard is available. So, how about doing the rotations, and zooms with combinations: "r" key + left mouse "z" key + middle mouse or some such combination. That leaves the left mouse key alone to allow selecting an initial point in 3-space as a new initial condition to do real time plots of different orbits. This is like what works in the "plotdf" 2d routine. One could also implement some sort of menu (or dialog box) like Jaime's in graph2d and plotdf. A special key could open a window with commands, help, etc. I don't know what is preferable. One does not want to make the program bloated. The list could go on and on. 2. What about the name "draw" instead of "gpdraw"? Of course, with aliases, this is not necessary. -sen P.S. The file "Lorenz.mac" is, of course, sort of trivial, and one could do similar examples for most of the things in Maxima. So, if people would prefer that such things not be sent to this development list, is there a more appropriate place? --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From sen1 at math.msu.edu Thu Jan 25 21:36:37 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Thu, 25 Jan 2007 22:36:37 -0500 (EST) Subject: [Maxima] rk and gpdraw In-Reply-To: References: Message-ID: Whoops, forgot the attachment in the last message. Here is is. --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Thu, 25 Jan 2007, sen1 at math.msu.edu wrote: > Hello, > > Since the recent "rk" thread went on a bit, I played with some of the tools > available, and I thought I'd send a very simple example of how to plot > the solutions of the Lorenz system of differential equations > using "rk" and "gpdraw". > > Of course, this owes much thanks to Jaime and Mario. > > The enclosed file shows in a very meager sense the potential that > already exists for the study of nonlinear 3-d differential equations. > > Just load the file "Lorenz.mac" and wait several seconds. On my dual > core linux system it takes around 5 seconds to produce the picture. > Once the picture is there, drag the left mouse button around, and then > move the middle mouse button left-right or up-down. > My students will like this! > > Now, for some "wish list" items. > > 1. The keyboard is available. So, how about doing the rotations, and > zooms with combinations: > > "r" key + left mouse > "z" key + middle mouse > or some such combination. > > > That leaves the left mouse key alone to allow selecting an initial > point in 3-space as a new initial condition to do real time plots of different > orbits. This is like what works in the "plotdf" 2d routine. > > One could also implement some sort of menu (or dialog box) like > Jaime's in graph2d and plotdf. A special key could open a window > with commands, help, etc. I don't know what is preferable. One does > not want to make the program bloated. > > The list could go on and on. > > 2. What about the name "draw" instead of "gpdraw"? Of course, with > aliases, this is not necessary. > > -sen > > P.S. The file "Lorenz.mac" is, of course, sort of trivial, and one > could do similar examples for most of the things in Maxima. So, if people > would prefer that such things not be sent to this development list, is there a more > appropriate place? > > --------------------------------------------------------------------------- > | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | > | Mathematics Department | | > | Michigan State University | telephone: 517-355-9684 | > | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | > --------------------------------------------------------------------------- > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- /* This is the Lorenz system */ load("dynamics"); load("rk"); load("gpdraw"); print(" Consider the Lorenz system eq: [s*(y-x), x*(r-z) -y, x*y - b*z]; s: 10.0; r: 28.0; b: 2.6667; t_range: [t,0,100,.03]; init: [1.0,0,0]; We use the rk routine to compute the solution 'sol' The actual points in 3-space are 'sol_pts' To plot the solution curve we use gpdraw3d( points(sol_pts))$. Here is the first plot. Be patient! "); eq: [s*(y-x), x*(r-z) -y, x*y - b*z]; s: 10.0; r: 28.0; b: 2.6667; t_range: [t,0,100,.03]; init: [1.0,0,0]; sol: rk(eq, [x,y,z],init,t_range)$ sol_pts: makelist( rest(sol[i]),i,1,length(sol))$ gpdraw3d( point_size=0,points_joined=true, points(sol_pts))$ From robert.dodier at gmail.com Fri Jan 26 00:42:50 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 25 Jan 2007 23:42:50 -0700 Subject: [Maxima] DSC-2007 Common Lisp talks by Ross Ihaka and Tony Rossini (R-Project) In-Reply-To: <1169752952.8346.65.camel@localhost.localdomain> References: <45B69799.4090900@prodigy.net.mx> <1169752952.8346.65.camel@localhost.localdomain> Message-ID: On 1/25/07, Mario Rodriguez wrote: > Symbolic environments should be very powerful tools in some > probabilistic contexts. For example, a cas with Lebesgue or Stieltjes > integrals could be used to compute probabilities both with discrete and > continuous models. Agreed, that would be a good application. > If the cas also incorporates a graph package, a possible application > could be in 'graphical models', these are random multivariate models > where stochastic dependencies are represented by graphs, both directed > or undirected, as in bayesian networks, or random fields. Sometimes > there are conditional dependencies among discrete and continuous random > variables. The likelihood function must be constructed and numeric > parameters (even the graph's structure) estimated from the sample. Yep. > I don't know if someone, somewhere, has started such a project. I wrote some preliminary code to compute posterior distributions in simply-connected Bayesian networks (i.e. the easy case) and submitted a paper about it to a conference (it was rejected). If anyone is interested to see the paper I'll be happy to send it. I didn't really get very far with the code -- just enough to solve some toy problems. I should probably get back on it. All the best, Robert From villate at fe.up.pt Fri Jan 26 02:28:55 2007 From: villate at fe.up.pt (Jaime E. Villate) Date: Fri, 26 Jan 2007 08:28:55 +0000 Subject: [Maxima] suboptimal versus non sense In-Reply-To: References: <877ivb0z93.fsf@vh213602.truman.edu> Message-ID: <1169800136.16026.14.camel@localhost.localdomain> On Thu, 2007-01-25 at 18:15 +0000, miguel Lopez wrote: > Suppose I'm a student and i am begining with vector calculus, > I should expect that divergence was define as: > > divergence(f):=[diff(f,x),diff(f,y),diff(f,z)]; ... > We should strive to make the system easy for students, and i don't > see this > here. I've done a lot of work to make Maxima more useful for my students. And there are several other people in this list who are also doing the same for their students. We cannot guess what your student's needs are, and even if you tell us, we might not have time to help you (we're helping our students) and we cannot interact with your students to see where they run into trouble. If the vector operators introduced in Maxima seem complicated to you, it is because they were introduced by someone with a different perspective than yours. Vector/tensor calculus can be taught at several different levels. If you just complain about their work and do not give them specific suggestions they will not be able to suit your needs. Regards, Jaime From aeder at arcor.de Fri Jan 26 05:17:19 2007 From: aeder at arcor.de (Andreas Eder) Date: Fri, 26 Jan 2007 12:17:19 +0100 Subject: [Maxima] test failure in rtest_taylor Message-ID: <51209.1169810239@staffa.eder.local> After my last cvs update I get the following errors in make check: Running tests in rtest_taylor: ********************** Problem 85 *************** Input: taylor(bessel_j(0, x), x, 0, 5) Result: `taylor' encountered an unfamiliar singularity in: bessel_j(0, x) -- an error. To debug this try debugmode(true); 0 + . . . This differed from the expected result: 4 2 x x -- - -- + 1 64 4 ********************** Problem 86 *************** Input: taylor(bessel_j(1, x), x, 0, 5) Result: `taylor' encountered an unfamiliar singularity in: bessel_j(1, x) -- an error. To debug this try debugmode(true); 0 + . . . This differed from the expected result: 5 3 x x x --- - -- + - 384 16 2 124/126 tests passed. The following 2 problems failed: (85 86) Error summary: Errors found in /usr/home/are/maxima/maxima/tests/rtest_taylor.mac, problems: (85 86) There was some discussion about changes for bessel_j on the list. Is the failure connected to that? Any ideas before I go hunting after the culprit? 'Andreas -- Wherever I lay my .emacs, there's my $HOME. From nicolas.pettiaux at ael.be Fri Jan 26 07:43:55 2007 From: nicolas.pettiaux at ael.be (Nicolas Pettiaux) Date: Fri, 26 Jan 2007 14:43:55 +0100 Subject: [Maxima] RE : RE : A note on graphics In-Reply-To: <000001c740d9$37045460$85274252@xiii> References: <1169765237.11492.3.camel@localhost.localdomain> <000001c740d9$37045460$85274252@xiii> Message-ID: 2007/1/26, laurent couraud : > I thought rather of a tool for topologist. But I am unaware of to tell > the truth if that can be of any interest. > > At least if you mean 4d = 3d spatial + 1d temporal :-) it is of much interest at least for many people doing spatial rendering over time. For examples, the people in medicine use this a lot to see the heart beating. Now, we could for example model the propagation of the nervous influx in 3D (eg in the heart) as a function of the time and plot it. The next thing is to make a movie out of the computation (that is generally intensive !) Thank you very much, Nicolas -- Nicolas Pettiaux - email: nicolas.pettiaux at ael.be From willisb at unk.edu Fri Jan 26 06:35:01 2007 From: willisb at unk.edu (Barton Willis) Date: Fri, 26 Jan 2007 06:35:01 -0600 Subject: [Maxima] suboptimal versus non sense In-Reply-To: <1169800136.16026.14.camel@localhost.localdomain> References: <877ivb0z93.fsf@vh213602.truman.edu> , <1169800136.16026.14.camel@localhost.localdomain> Message-ID: Maple has a 'student package' that aims to make some commonly done undergraduate mathematics computations easier. Maybe somebody would like this package as a model for a student package in Maxima. Or maybe you would like to use Maple. Barton From willisb at unk.edu Fri Jan 26 06:26:16 2007 From: willisb at unk.edu (Barton Willis) Date: Fri, 26 Jan 2007 06:26:16 -0600 Subject: [Maxima] test failure in rtest_taylor In-Reply-To: <51209.1169810239@staffa.eder.local> References: <51209.1169810239@staffa.eder.local> Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >After my last cvs update I get the following >errors in make check: >There was some discussion about changes for >bessel_j on the list. Is the failure connected to that? Yes, I have putative fixes for these bugs in my CVS, but I'm still trying to think a few things through. By the way, taylor(bessel_j(0,x),x,0,5) bug isn't new. Thanks for reporting this--I've made a few changes to Maxima this past week and added two new regression tests (rtest_abs and rtest_taylor). I'm relieved that *only* two tests failed (and tests that I knew about). Barton From michel.vandenbergh at uhasselt.be Fri Jan 26 09:22:35 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 26 Jan 2007 16:22:35 +0100 Subject: [Maxima] value cell issue Message-ID: <45BA1CBB.4050402@uhasselt.be> wrote: >When assigning any of these to a named variable, they should be >> assigned to the "value" cell of that variable. > > > >That is an implementation detail. > > Yes that's true. But the current difference in semantics between lists and arrays is partially caused by this "implementation detail". The underlying CL system treats the value cell of a symbol very differently from its other attributes (the property list and the function cell). For example in a function call only the value cell is rebound which creates all kinds of weird behaviour in maxima. So I think life will be ***a lot*** easier if we decide to store everything in the value cell (including perhaps functions). Then we do no longer have to deal with messy "local" declarations which are not supported by the translator anyway. Finally if we decide to make the maxima language more object oriented (i.e. if the user has the ability to create other types of objects than the built in ones) we definititely need a uniform semantics for storing objects. Michel BTW I have not been following this thread but besides lists, vectors, arrays, matrices, hashes and what not is seems we also need clear semantics for indexed variables (for symbolic manipulation). From ryanlists at gmail.com Fri Jan 26 11:18:21 2007 From: ryanlists at gmail.com (Ryan Krauss) Date: Fri, 26 Jan 2007 11:18:21 -0600 Subject: [Maxima] z transform? Message-ID: Is anyone aware of Maxima functions to find the z transform of a function of time? I need to convert some transfer functions from the Laplace domain to the z domain and include the effect of sample-and-hold circuitry. One way to do this is to inverse Laplace the transfer function divided by s and then z transform, and then multiply by (1-z^-1). I know that Maxima has inverse Laplace, I would just need to be able to do a z transform to make it all work. The z transform is an infinite sum, so perhaps this is not a big deal for maxima: X(z)=sum x(kT)*z^-k where k goes from 0 to infinity and T is the sample time to move from continuous time t to discrete time kT. Thanks, Ryan From michel.vandenbergh at uhasselt.be Fri Jan 26 11:31:45 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Fri, 26 Jan 2007 18:31:45 +0100 Subject: [Maxima] value cell issue In-Reply-To: <8b356f880701260857k7a940adel5dfd93bee3de6b7b@mail.gmail.com> References: <45BA057C.3050507@uhasselt.be> <8b356f880701260857k7a940adel5dfd93bee3de6b7b@mail.gmail.com> Message-ID: <45BA3B01.90801@uhasselt.be> Stavros Macrakis wrote: >> >When assigning any of these to a named variable, they should be >> >> assigned to the "value" cell of that variable. >> >That is an implementation detail. >> Yes that's true. But the current difference in semantics between lists >> and arrays is partially caused by this "implementation detail". >> The underlying CL system treats the value cell >> of a symbol very differently from its other attributes... >> So I think life will be ***a lot*** easier if we decide to store >> everything in the value cell (including perhaps functions). > > > I think we agree on the goal of cleaner semantics. At the risk of > sounding pedantic, though, I will insist that specifying behavior in > terms of implementation is unwise. After all, one perfectly > respectable way to implement lexical scope is to use an alist in the > interpreter and store values in the stack frame in compiled code -- so > there are no value cells at all. Talking in terms of symbols' value > cells also doesn't clarify the semantics of assigning to *part* of an > object: where is the symbol and where is the "value cell" of a[3] in > an expression like a[3] : 5? > Ok. But people have been using lisp semantics to explain the current behaviour of maxima. So I was just following that tradition. Would you agree that a symbol (perhaps I should say variable) should stand for only one thing at a time? Michel From macrakis at alum.mit.edu Fri Jan 26 11:33:31 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 26 Jan 2007 12:33:31 -0500 Subject: [Maxima] value cell issue In-Reply-To: <8b356f880701260857k7a940adel5dfd93bee3de6b7b@mail.gmail.com> References: <45BA057C.3050507@uhasselt.be> <8b356f880701260857k7a940adel5dfd93bee3de6b7b@mail.gmail.com> Message-ID: <8b356f880701260933l8baa5dq8e21a43c5efb39a1@mail.gmail.com> On 1/26/07, Stavros Macrakis wrote: > > >When assigning any of these to a named variable, they should be > > >> assigned to the "value" cell of that variable. > > >That is an implementation detail. > > Yes that's true. But the current difference in semantics between lists > > and arrays is partially caused by this "implementation detail". > > The underlying CL system treats the value cell > > of a symbol very differently from its other attributes... > > So I think life will be ***a lot*** easier if we decide to store > > everything in the value cell (including perhaps functions). > > I think we agree on the goal of cleaner semantics. At the risk of > sounding pedantic, though, I will insist that specifying behavior in > terms of implementation is unwise. After all, one perfectly > respectable way to implement lexical scope is to use an alist in the > interpreter and store values in the stack frame in compiled code -- so > there are no value cells at all. Talking in terms of symbols' value > cells also doesn't clarify the semantics of assigning to *part* of an > object: where is the symbol and where is the "value cell" of a[3] in > an expression like a[3] : 5? > > As I say, I think we agree on the goal, but I believe we should > specify it independently of the implementation. > > -s > From amca01 at gmail.com Fri Jan 26 15:23:43 2007 From: amca01 at gmail.com (Alasdair McAndrew) Date: Sat, 27 Jan 2007 08:23:43 +1100 Subject: [Maxima] z transform? In-Reply-To: References: Message-ID: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> I think a symbolic z-transform would be a very welcome addition to Maxima. I don't know if commercial Macsyma ever included z-transform routines, but if so it should be possible to port them to Maxima (assuming that you can obtain the source code). On 1/27/07, Ryan Krauss wrote: > > Is anyone aware of Maxima functions to find the z transform of a > function of time? I need to convert some transfer functions from the > Laplace domain to the z domain and include the effect of > sample-and-hold circuitry. One way to do this is to inverse Laplace > the transfer function divided by s and then z transform, and then > multiply by (1-z^-1). I know that Maxima has inverse Laplace, I would > just need to be able to do a z transform to make it all work. > > The z transform is an infinite sum, so perhaps this is not a big deal > for maxima: > X(z)=sum x(kT)*z^-k where k goes from 0 to infinity and T is the > sample time to move from continuous time t to discrete time kT. > > Thanks, > > Ryan > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070127/7fc1ec0f/attachment.html From macrakis at alum.mit.edu Fri Jan 26 15:49:58 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 26 Jan 2007 16:49:58 -0500 Subject: [Maxima] z transform? In-Reply-To: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> References: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> Message-ID: <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> On 1/26/07, Alasdair McAndrew wrote: > I think a symbolic z-transform would be a very welcome addition to Maxima. > I don't know if commercial Macsyma ever included z-transform routines, but > if so it should be possible to port them to Maxima (assuming that you can > obtain the source code). Well, if we could (legally) obtain the source code (whether in Lisp or in the Macsyma language) to commercial Macsyma, there are *many* things we could improve. But as far as I know, the copyright holder has no interest in releasing it under an free or open license. If, on the other hand, there is code developed for commercial Macsyma by *outside* developers, there is a chance they can be persuaded to contribute their code to the Maxima project. -s From coolens at kahosl.be Fri Jan 26 16:19:04 2007 From: coolens at kahosl.be (Hugo Coolens) Date: Fri, 26 Jan 2007 23:19:04 +0100 (CET) Subject: [Maxima] [newbie] help with simplification In-Reply-To: <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> References: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> Message-ID: Could anyone explain here which steps are needed to simplify the results of the following function tpald(m):=product(1+4*s*(cos((k*%pi)/(2*m+1)))^2,k,1,m)-s^m; I know e.g. that the result for m=2 should be 1+3s, for m=3 it should be 1+5*s+6*s^2 ... but I can't find the correct steps to make maxima give me those results any help welcome hugo From andrej.vodopivec at gmail.com Fri Jan 26 16:45:09 2007 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Fri, 26 Jan 2007 23:45:09 +0100 Subject: [Maxima] [newbie] help with simplification In-Reply-To: References: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> Message-ID: <7775b21a0701261445p10800457y4babeecede87839f@mail.gmail.com> On 1/26/07, Hugo Coolens wrote: > Could anyone explain here which steps are needed to simplify the results > of the following function > > tpald(m):=product(1+4*s*(cos((k*%pi)/(2*m+1)))^2,k,1,m)-s^m; > > I know e.g. that the result for m=2 should be 1+3s, for m=3 it should be > 1+5*s+6*s^2 ... > but I can't find the correct steps to make maxima give me those results > > any help welcome > > hugo > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > Hello Hugo, use trigrat: (%i1) tpald(m):=product(1+4*s*(cos((k*%pi)/(2*m+1)))^2,k,1,m)-s^m$ (%i2) trigrat(tpald(2)); (%o2) 3*s+1 (%i3) trigrat(tpald(3)); (%o3) 6*s^2+5*s+1 Andrej From michel.vandenbergh at uhasselt.be Fri Jan 26 17:33:09 2007 From: michel.vandenbergh at uhasselt.be (Michel Van den Bergh) Date: Sat, 27 Jan 2007 00:33:09 +0100 Subject: [Maxima] value cell issue In-Reply-To: <8b356f880701260857k7a940adel5dfd93bee3de6b7b@mail.gmail.com> References: <45BA057C.3050507@uhasselt.be> <8b356f880701260857k7a940adel5dfd93bee3de6b7b@mail.gmail.com> Message-ID: <45BA8FB5.6060402@uhasselt.be> > After all, one perfectly > respectable way to implement lexical scope is to use an alist in the > interpreter and store values in the stack frame in compiled code -- so > there are no value cells at all. The current maxima code base makes a lot of use of properties of symbols and if I understand correctly if someone sets a propery of a symbol it is global even if the symbol is used somewhere as a local variable. So it seem to me that properties should also be rebound to get clean recursive functions etc... It is rather unclear to me how this can be achieved efficiently without getting rid of properties altogether and using some other data structure to hold "meta information" (we are then basically in an object oriented frame work). If the symbols in the maxima language were to be thought of as ordinary variables that could hold one object (with attributes) and ***nothing more*** then it would be a lot easier to think about them, and also probably a lot easier to write an interpreter and compiler (after all interpreters and compilers for algol like languages are very well understood and are part of the CS undergraduate curriculum). Do you think this is correct? My mind is somewhat unclear on this as "symbols" in lisp are a somewhat strange concept that does not seem to exist in any other language I know (I don't know any other functional languages though). Michel From amca01 at gmail.com Fri Jan 26 23:13:02 2007 From: amca01 at gmail.com (Alasdair McAndrew) Date: Sat, 27 Jan 2007 16:13:02 +1100 Subject: [Maxima] z transform? In-Reply-To: <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> References: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> Message-ID: <1d67a53c0701262113p74b962b8r3a85fc9b5b765602@mail.gmail.com> I've done some web searching, and also some database searches, and can't find anything about public Macsyma z-transform code. However, back in 1995, some code was written for REDUCE: http://www.zib.de/Symbolik/reduce/moredocs/ztrans.pdf I have no idea of the differences between Macsyma and REDUCE, and how non-trivial it would be to port REDUCE code to Maxima, but maybe it would be worth a look... the first author is now at Universit?t Kassel: http://www.mathematik.uni-kassel.de/~koepf/indexenglish.html -Alasdair On 1/27/07, Stavros Macrakis wrote: > > On 1/26/07, Alasdair McAndrew wrote: > > I think a symbolic z-transform would be a very welcome addition to > Maxima. > > I don't know if commercial Macsyma ever included z-transform routines, > but > > if so it should be possible to port them to Maxima (assuming that you > can > > obtain the source code). > > Well, if we could (legally) obtain the source code (whether in Lisp or > in the Macsyma language) to commercial Macsyma, there are *many* > things we could improve. But as far as I know, the copyright holder > has no interest in releasing it under an free or open license. > > If, on the other hand, there is code developed for commercial Macsyma > by *outside* developers, there is a chance they can be persuaded to > contribute their code to the Maxima project. > > -s > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070127/b6c8fac9/attachment.htm From sen1 at math.msu.edu Sat Jan 27 07:34:38 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Sat, 27 Jan 2007 08:34:38 -0500 (EST) Subject: [Maxima] "read" question Message-ID: Hello, I have the file "Interactive.mac" containing the single block statement. block( while (foo # "q") do (foo: read("Enter a number to continue, \"q\" to quit. "), print(" you entered ",foo) ), print(" Bye!"), reset() )$ When I load it into maxima (either command line or xmaxima), it executes as expected. But, in order to load and execute it again, I have to completely restart maxima. Is there a simple way to keep the same session going and simply re-run the Interactive.mac file? Here is what happens. (%i1) load("Interactive"); Enter a number to continue, "q" to quit. 33; you entered 33 Enter a number to continue, "q" to quit. 27; you entered 27 Enter a number to continue, "q" to quit. 32; you entered 32 Enter a number to continue, "q" to quit. "q"; you entered q Bye! (%o1) ./Interactive.mac (%i2) load("Interactive"); Bye! (%o1) ./Interactive.mac (%i2) load("Interactive"); Bye! (%o1) ./Interactive.mac Any suggestions? TIA, -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- From willisb at unk.edu Sat Jan 27 07:59:16 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 27 Jan 2007 07:59:16 -0600 Subject: [Maxima] "read" question In-Reply-To: References: Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >When I load it into maxima (either command line >or xmaxima), it executes as expected. But, in order to load and >execute it again, I have to completely restart maxima. Is there a >simple way to keep the same session going and simply re-run the >Interactive.mac file? Sure, try wrapping the block inside a function; something like read_and_print_stuff_until_q() := block( while (foo # "q") do ...) Barton From sen1 at math.msu.edu Sat Jan 27 08:27:58 2007 From: sen1 at math.msu.edu (sen1 at math.msu.edu) Date: Sat, 27 Jan 2007 09:27:58 -0500 (EST) Subject: [Maxima] "read" question In-Reply-To: References: Message-ID: Hi Barton, It didn't change things for me. I also tried various combinations of load-reset-etc. What should the usage be? Here is how I used it. The new Interactive.mac: Restart():= block( while (foo # "q") do (foo: read("Enter a number to continue, \"q\" to quit. "), print(" you entered ",foo) ), print(" Bye!") )$ (%i1) load("Interactive"); (%o1) ./Interactive.mac (%i2) Restart(); Enter a number to continue, "q" to quit. 34; you entered 34 Enter a number to continue, "q" to quit. 25; you entered 25 Enter a number to continue, "q" to quit. "q"; you entered q Bye! (%o2) Bye! (%i3) Restart(); Bye! (%o3) Bye! (%i4) Restart(); Bye! (%o4) Bye! TIA, -sen --------------------------------------------------------------------------- | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu | | Mathematics Department | | | Michigan State University | telephone: 517-355-9684 | | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 | --------------------------------------------------------------------------- On Sat, 27 Jan 2007, Barton Willis wrote: > -----maxima-bounces at math.utexas.edu wrote: ----- > >> When I load it into maxima (either command line >> or xmaxima), it executes as expected. But, in order to load and >> execute it again, I have to completely restart maxima. Is there a >> simple way to keep the same session going and simply re-run the >> Interactive.mac file? > > Sure, try wrapping the block inside a function; something like > > read_and_print_stuff_until_q() := block( while (foo # "q") do ...) > > Barton > From linux_milano at yahoo.it Sat Jan 27 08:48:04 2007 From: linux_milano at yahoo.it (Pol) Date: Sat, 27 Jan 2007 15:48:04 +0100 Subject: [Maxima] trigonometric expressions Message-ID: <20070127144804.GA25537@finn> I would like to transform trigonometric expressions according to my preferred routes. E.g.: a: 2*sin(x)^2-3*cos(x); to be tranformed by applying the rule cos(x)^2 = 1 - sin(x)^2 I have unsuccessfully tried trigrat, trigexpand, trigsimp Any hints? I would also like to solve that equation, by applying given rules. Thank you -- Pol From willisb at unk.edu Sat Jan 27 09:38:11 2007 From: willisb at unk.edu (Barton Willis) Date: Sat, 27 Jan 2007 09:38:11 -0600 Subject: [Maxima] "read" question In-Reply-To: References: , Message-ID: ----maxima-bounces at math.utexas.edu wrote: ----- >It didn't change things for me. I also tried >various combinations of >load-reset-etc. > >What should the usage be? > >Here is how I used it. > >The new Interactive.mac: > >Restart():= block( while (foo # "q") do > (foo: read("Enter a number to >continue, \"q\" to quit. "), > print(" you entered ",foo) > ), > print(" Bye!") > )$ Make 'foo' local to the block. Otherwise, the second time you run Restart, foo still has the value "q". So the while immediately terminates. Restart():= block([foo], while (foo # "q") do (foo: read("Enter a number to continue, \"q\" to quit. "), print(" you entered ",foo) ), print(" Bye!") )$ This time, I tested the code; it seems to work: (%i1) load("q.mac")$ (%i2) Restart(); Enter a number to continue, "q" to quit. 0; you entered 0 Enter a number to continue, "q" to quit. "q"; you entered q Bye! (%o2) Bye! (%i3) Restart(); Enter a number to continue, "q" to quit. sqrt(2); you entered sqrt(2) Enter a number to continue, "q" to quit. 42; you entered 42 Enter a number to continue, "q" to quit. "q"; you entered q Bye! (%o3) Bye! Barton From ko at research.att.com Sat Jan 27 10:24:30 2007 From: ko at research.att.com (Kostas Oikonomou) Date: Sat, 27 Jan 2007 16:24:30 +0000 (UTC) Subject: [Maxima] Problem in plot3d? Message-ID: Hi, I am using 5.11.0 with gnuplot 4.24c4. I encountered the following problem: (%i5) f(x,y) := 10*sin(sqrt(x^2+y^2))/sqrt(x^2+y^2)$ (%i6) plot3d(f(x,y), [x,-20,20],[y,-20,20], [grid,80,80]); Maxima encountered a Lisp error: Error during processing of --eval option "(cl-user::run)": The value T is not of type DOUBLE-FLOAT. Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i7) This doesn't happen if I use [grid,50,50]. Kostas From Daniel.L.Solomon at nasa.gov Sat Jan 27 10:52:51 2007 From: Daniel.L.Solomon at nasa.gov (Dan Solomon) Date: Sat, 27 Jan 2007 11:52:51 -0500 Subject: [Maxima] lists, matrices, etc Message-ID: How can I learn the differences/relationships between lists, arrays, and matrices? I've read the documentation in pieces, and I never picked up the idea that if I define init[1], init[2], and init[3], maxima wouldn't realize that "init" meant the 3 vector. From A.G.Grozin at inp.nsk.su Sat Jan 27 11:44:11 2007 From: A.G.Grozin at inp.nsk.su (Andrey G. Grozin) Date: Sat, 27 Jan 2007 23:44:11 +0600 (NOVT) Subject: [Maxima] lists, matrices, etc In-Reply-To: References: Message-ID: On Sat, 27 Jan 2007, Dan Solomon wrote: > How can I learn the differences/relationships between lists, arrays, > and matrices? I've read the documentation in pieces, and I never > picked up the idea that if I define init[1], init[2], and init[3], > maxima wouldn't realize that "init" meant the 3 vector. Why have you decided that "init" means a list of 3 elements in this case to begin with? You never assigned any list to it. Usual mathematical notations are very ambiguous. Sometimes a mathematician uses $x$, $x_1$, $x_2$, $x_3$, $x'$, $x^{\prime\prime}$ and several other things as independent variables which have no relation to each other. Sometimes $x_1$, $x_2$, $x_3$ are supposed to be components of a vector $x$. Maxima basically follows the first point of vies. If x is a symbol (nothing is assigned to it), then x can be used as a variable; x[1], x[2] etc. are another variables. If you want x to denote a list, the only way is to assign a list to it x:[a,b,c] After that, x will mean a list with 3 elements a, b, and c. Now x[1] means a. It is rather unfortunate that maxima uses the same notation x[n] for 2 different purposes: when x is a list, x[n] selects its n-th component; when a is just a symbol, x[n] creates a subscripted variable. These 2 uses of [] have nothing in common with each other. Hope this helps. Andrey From ryanlists at gmail.com Sat Jan 27 11:50:45 2007 From: ryanlists at gmail.com (Ryan Krauss) Date: Sat, 27 Jan 2007 11:50:45 -0600 Subject: [Maxima] Fwd: z transform? In-Reply-To: <1d67a53c0701262113p74b962b8r3a85fc9b5b765602@mail.gmail.com> References: <1d67a53c0701261323s5d29094apd8b4bbd7b519f343@mail.gmail.com> <8b356f880701261349y4328236h19567c97a377157e@mail.gmail.com> <1d67a53c0701262113p74b962b8r3a85fc9b5b765602@mail.gmail.com> Message-ID: Alasdair , I can't actually access that pdf, if you have it, can you email it to me please. I am actually a Georgia Tech alumni, so if any of the authors of that other paper are still there as faculty, I may be able to get some help from them (I was actually an ME, so I don't know many EE faculty). If the approaches mentioned in these papers are only for simple functions, it may be easier to use the built in Maxima Laplace and then go from s to z using an approach based on evaluating residues. This is discussed in Ogata's discrete controls and another book by Astrom called Computer Controlled Systems. It works for proper transfer functions with a few restrictions. Alasdair and the rest of the list: It seems to me like there are two approaches to symbolic z transform: 1. Find a way to get Maxima to do simplification of infinite series like what is typically done when teaching the z transform in a digital controls class (usually there is some explanation in an appendix like in Ogata's book). 2. Create a fancy look up table. This is what is done with either the z or Laplace transform after the theory is understood. I don't know how far you could get with this approach, but it basically involves programming some basic transforms and then some properties of the transform to try to make an expression fit something in the table (things like an addition property, a shifting property, ...) Do you have any idea what the existing Laplace transform and ilt functions do? Is it similar to either of the approaches I am describing? Is it a look up table and rules or the actual Laplace integral? This may be the thing that pushes me over the edge, but I must confess that I am not (yet) a Maxima programmer. I have done some lisp programming to make fancy things with the Gimp, but I am far from comfortable and haven't done it in a while. I program mainly in Python. Ryan On 1/26/07, Alasdair McAndrew wrote: > I've done some web searching, and also some database searches, and can't > find anything about public Macsyma z-transform code. However, back in 1995, > some code was written for REDUCE: > > http://www.zib.de/Symbolik/reduce/moredocs/ztrans.pdf > > I have no idea of the differences between Macsyma and REDUCE, and how > non-trivial it would be to port REDUCE code to Maxima, but maybe it would be > worth a look... the first author is now at Universit?t Kassel: > > http://www.mathematik.uni-kassel.de/~koepf/indexenglish.html > > -Alasdair > > > On 1/27/07, Stavros Macrakis wrote: > > On 1/26/07, Alasdair McAndrew wrote: > > > I think a symbolic z-transform would be a very welcome addition to > Maxima. > > > I don't know if commercial Macsyma ever included z-transform routines, > but > > > if so it should be possible to port them to Maxima (assuming that you > can > > > obtain the source code). > > > > Well, if we could (legally) obtain the source code (whether in Lisp or > > in the Macsyma language) to commercial Macsyma, there are *many* > > things we could improve. But as far as I know, the copyright holder > > has no interest in releasing it under an free or open license. > > > > If, on the other hand, there is code developed for commercial Macsyma > > by *outside* developers, there is a chance they can be persuaded to > > contribute their code to the Maxima project. > > > > -s > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > > From robert.dodier at gmail.com Sat Jan 27 11:52:32 2007 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 27 Jan 2007 10:52:32 -0700 Subject: [Maxima] "read" question In-Reply-To: References: Message-ID: On 1/27/07, sen1 at math.msu.edu wrote: > block( while (foo # "q") do > (foo: read("Enter a number to continue, \"q\" to quit. "), > print(" you entered ",foo) > ), > print(" Bye!"), > reset() > )$ reset is a slightly strange function ... Here's what I was able to puzzle out about it: -- Function: reset () Resets many global variables and options, and some other variables, to their default values. `reset' processes the variables on the Lisp list `*variable-initial-values*'. The Lisp macro `defmvar' puts variables on this list (among other actions). Many, but not all, global variables and options are defined by `defmvar', and some variables defined by `defmvar' are not global variables or options. Not sure what you effect you expect from reset -- maybe kill(all) is what you want. HTH Robert From macrakis at alum.mit.edu Sat Jan 27 11:56:40 2007 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sat, 27 Jan 2007 12:56:40 -0500 Subject: [Maxima] lists, matrices, etc In-Reply-To: References: Message-ID: <8b356f880701270956m64dcb9clf6672ce6788eb19e@mail.gmail.com> > How can I learn the differences/relationships between lists, arrays, > and matrices? Sigh. Our documentation is a problem, isn't it? Well, first of all, I would avoid arrays, both the named arrays generated by array(...) and the anonymous arrays generated by make_array(...). Those are I suppose useful for efficiency in handly large numeric calculations, but for most applications, I'd stick to lists, matrices, and associative arrays (hash-arrays). It is true that they have O(n), not O(1), access time, but if you are doing symbolic calculations, that will probably not matter, since symbolic calculation in general is rather expensive. If you are doing large numeric calculations with compiled Maxima code, it may well matter, though. Lists and matrices are first-class objects: they can be assigned to variables, passed as arguments, returned as values, form part of a larger object, etc. I would use them as much as possible. Associative arrays in Maxima, alas, are not first-class objects. They are attached to a particular symbol. I would like to change this, but for now, that's the state of affairs. Associative arrays are useful when