From rswarbrick at gmail.com Sun Jan 1 06:00:18 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Sun, 01 Jan 2012 12:00:18 +0000 Subject: [Maxima] Bug in limit or integrate References: <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: "Richard Hennessy" writes: > The indefinite integral of a continuous function which is finite > valued on a region (a,b) is also continuous on the region (a,b). > Check it out. The answer for this indefinite integral is wrong since > it is discontinuous at zero. If I can figure out the right answer I > will post it. > > Rich Yes, but how does that relate to what Barton said? In general, integration makes functions better behaved (more smooth). But the problem here is that the integrand is nasty. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From willisb at unk.edu Sun Jan 1 08:11:03 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 1 Jan 2012 08:11:03 -0600 Subject: [Maxima] Bug in limit or integrate In-Reply-To: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop> References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw From rich.hennessy at verizon.net Sun Jan 1 12:24:12 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 01 Jan 2012 13:24:12 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: <10B9A12B13044ECC8047B2C37D9274A5@RichsLaptop> "Yes, but how does that relate to what Barton said? In general, integration makes functions better behaved (more smooth). But the problem here is that the integrand is nasty." The integrand is not nasty. It is a simple smooth function. exp(-x^4) is not nasty any more than exp(-x^2). I am not sure what you are talking about. This is a simple integrand. So is exp(-x^6), exp(-x^8) etc... There is no reason why the integral should be discontinuous. Rich -----Original Message----- From: Rupert Swarbrick Sent: Sunday, January 01, 2012 7:00 AM To: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Sun Jan 1 12:38:39 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 01 Jan 2012 13:38:39 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: "you are out of luck". Yes, if you choose not to consider this a bug then you are choosing to make up new math laws with no basis for it and I am out of luck. Anyway, I suppose I don?t care that much if pwint gets this one wrong. The help for pw just needs to be modified to say that pwint() works by taking the antidiff() of the integrand and evaluating it at the limits of integration, (or computing the limit in the case of minf, inf.) I cannot try to anticipate random mathematical decisions. Rich -----Original Message----- From: Barton Willis Sent: Sunday, January 01, 2012 9:11 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw From filonenko.mikhail at gmail.com Sun Jan 1 13:54:41 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Sun, 1 Jan 2012 21:54:41 +0200 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <8isrs8xle3.ln2@hake.rswarbrick.dnsalias.com> <1qpobuqkthr.fsf@iceland.freeshell.org> <1b11t8xcu2.ln2@hake.rswarbrick.dnsalias.com> Message-ID: I saved all maxima history, and now you can fetch quicklisp branch into your local repository. git remote add fm_github https://filonenko-mikhail at github.com/filonenko-mikhail/maxima.git git fetch --depth 1 origin quicklisp:refs/remotes/quicklisp git checkout -b quicklisp --track origin/quicklisp All changes available here: https://github.com/filonenko-mikhail/maxima/commits/quicklisp 2011/12/31 Michael Filonenko : > Happy New Year! > > I understand risks of patches. > > I made mirror of original maxima repository on github and branch that > has name 'quicklisp': > > https://github.com/filonenko-mikhail/orig-maxima/commit/f0a68af97aa318d7a554c30f32369754244edfd7 > > 1. I removed archive directory. Quicklisp repository does not need > history of project. > 2. I moved maxima.asd to root maxima directory. It is simplier to > setup paths, when project file is in the project root. > 3. I replaced *.in files, which require configure step, with > asdf*.lisp files, which contain path searching mechanism using asdf > api. > 4. I removed setup of output binary files, because asdf2 does not > require this feature. > > This version passed all "non-share" tests. Loading some share maxima > libraries is not working now, because it uses mk-defsystem. > > Additionally to previous changes in quicklisp branch I ask following changes: > > refactor (string= autoconf:win32 "true) to #+-win32; > replace all mk-defsystems with asdf systems. asdf is almost fully > compatible with defsystem. > ?remove setup of output binary files; > ?move setup paths from several functions into one; > ?refactor functions, which work with filenames, to use pathnames > instead of strings; > ?remove embedded f2cl and use it from quicklisp; > ?remove sloop; > > But may be there are no critical mass of people, who want to use quicklisp? > > 2011/12/30 Rupert Swarbrick : >> Leo Butler writes: >>> Rupert Swarbrick writes: >>>> Michael Filonenko writes: >>>>> Goal of fork to provide maxima from quicklisp. Maxima big project and I >>>>> need community opinion about fork. I am ready to merge my changes with >>>>> main repo. Only non-mathematical parts were changed by me. >>>> >>>> Hmm. Well, a public github fork is a pretty awful way to develop >>>> features on changing code unless that code is also in github. How are >>>> you going to incorporate changes to core maxima into your fork without >>>> rewriting history? >>> >>> @Rupert: I am not really certain of your meaning here. Git can >>> accomodate multiple upstream repositories. So long as he has forked >>> things correctly, he can pull in updates from sourceforge, and merge >>> these onto his development branch which is on github. This work can be >>> merged into the sourceforge repository without re-writing anyone's >>> history -- that is the nice thing about rebasing. >> >> Yes, but github forks are public repositories, so if you rebase you >> screw up the repository of anyone trying to follow you... >> >> Rupert >> >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> > > > > -- > With best regards, Michael Filonenko -- With best regards, Michael Filonenko From filonenko.mikhail at gmail.com Sun Jan 1 14:06:49 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Sun, 1 Jan 2012 22:06:49 +0200 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <8isrs8xle3.ln2@hake.rswarbrick.dnsalias.com> <1qpobuqkthr.fsf@iceland.freeshell.org> <1b11t8xcu2.ln2@hake.rswarbrick.dnsalias.com> Message-ID: Sorry. Here it is valid commands for fetching quicklisp branch. git remote add fm_github https://filonenko-mikhail at github.com/filonenko-mikhail/maxima.git git fetch --depth 1 fm_github quicklisp:refs/remotes/quicklisp git checkout -b quicklisp --track origin/quicklisp 2012/1/1 Michael Filonenko : > I saved all maxima history, and now you can fetch quicklisp branch > into your local repository. > > ?git remote add fm_github > https://filonenko-mikhail at github.com/filonenko-mikhail/maxima.git > ?git fetch --depth 1 origin quicklisp:refs/remotes/quicklisp > ?git checkout -b quicklisp --track origin/quicklisp > > All changes available here: > > ?https://github.com/filonenko-mikhail/maxima/commits/quicklisp > > > 2011/12/31 Michael Filonenko : >> Happy New Year! >> >> I understand risks of patches. >> >> I made mirror of original maxima repository on github and branch that >> has name 'quicklisp': >> >> https://github.com/filonenko-mikhail/orig-maxima/commit/f0a68af97aa318d7a554c30f32369754244edfd7 >> >> 1. I removed archive directory. Quicklisp repository does not need >> history of project. >> 2. I moved maxima.asd to root maxima directory. It is simplier to >> setup paths, when project file is in the project root. >> 3. I replaced *.in files, which require configure step, with >> asdf*.lisp files, which contain path searching mechanism using asdf >> api. >> 4. I removed setup of output binary files, because asdf2 does not >> require this feature. >> >> This version passed all "non-share" tests. Loading some share maxima >> libraries is not working now, because it uses mk-defsystem. >> >> Additionally to previous changes in quicklisp branch I ask following changes: >> >> refactor (string= autoconf:win32 "true) to #+-win32; >> replace all mk-defsystems with asdf systems. asdf is almost fully >> compatible with defsystem. >> ?remove setup of output binary files; >> ?move setup paths from several functions into one; >> ?refactor functions, which work with filenames, to use pathnames >> instead of strings; >> ?remove embedded f2cl and use it from quicklisp; >> ?remove sloop; >> >> But may be there are no critical mass of people, who want to use quicklisp? >> >> 2011/12/30 Rupert Swarbrick : >>> Leo Butler writes: >>>> Rupert Swarbrick writes: >>>>> Michael Filonenko writes: >>>>>> Goal of fork to provide maxima from quicklisp. Maxima big project and I >>>>>> need community opinion about fork. I am ready to merge my changes with >>>>>> main repo. Only non-mathematical parts were changed by me. >>>>> >>>>> Hmm. Well, a public github fork is a pretty awful way to develop >>>>> features on changing code unless that code is also in github. How are >>>>> you going to incorporate changes to core maxima into your fork without >>>>> rewriting history? >>>> >>>> @Rupert: I am not really certain of your meaning here. Git can >>>> accomodate multiple upstream repositories. So long as he has forked >>>> things correctly, he can pull in updates from sourceforge, and merge >>>> these onto his development branch which is on github. This work can be >>>> merged into the sourceforge repository without re-writing anyone's >>>> history -- that is the nice thing about rebasing. >>> >>> Yes, but github forks are public repositories, so if you rebase you >>> screw up the repository of anyone trying to follow you... >>> >>> Rupert >>> >>> _______________________________________________ >>> Maxima mailing list >>> Maxima at math.utexas.edu >>> http://www.math.utexas.edu/mailman/listinfo/maxima >>> >> >> >> >> -- >> With best regards, Michael Filonenko > > > > -- > With best regards, Michael Filonenko -- With best regards, Michael Filonenko From rich.hennessy at verizon.net Sun Jan 1 16:25:08 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 01 Jan 2012 17:25:08 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: <150A6F92D642498A849444C6BED74C0C@RichsLaptop> "Some definite integrals of exp(-x^4) are broken:" So are some limits. I was trying to use maxima to prove continuity of the function at zero and it blows up limit() with a bind stack overflow. (%i2) kill(all); (%o0) done (%i1) limit((-(gamma_incomplete(1/4,x^4)-gamma(1/4))/-4),x,0,minus); Maxima encountered a Lisp error: Error in $LIMIT [or a callee]: Bind stack overflow. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. (%i2) Rich -----Original Message----- From: Barton Willis Sent: Sunday, January 01, 2012 9:11 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw From leon.magiera at wp.pl Mon Jan 2 02:14:08 2012 From: leon.magiera at wp.pl (leon.magiera at wp.pl) Date: Mon, 02 Jan 2012 09:14:08 +0100 Subject: [Maxima] problems Message-ID: <4f016750a81f33.02531046@wp.pl> Hi Problem 1 How, using Maxima, to solve in elegant way the equation eq:sqrt(x+3-4*sqrt(x-1))+sqrt(x+8-6*sqrt(x-1))=1; The solution is 5<=x<=10 Problem 2 ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); integrate(ex,x); Is the above integral too hard ? Best L.M. From rswarbrick at gmail.com Mon Jan 2 07:28:57 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Mon, 02 Jan 2012 13:28:57 +0000 Subject: [Maxima] problems References: <4f016750a81f33.02531046@wp.pl> Message-ID: leon.magiera at wp.pl writes: > Problem 2 > > ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); > > integrate(ex,x); > > Is the above integral too hard ? For this, have a look at what your expression is. Firstly, the x-b looks unpleasant so lets ignore that. Note that integrate (f(x - b), x, u, v) = integrate (f(x), x, u-b, v-b) and indeed you're asking for the indefinite integral, so this comes out as something like (integrate (f(x - b), x) at x=v) = (integrate (f(x), x) at x=v-b) Anyway, that lets us get rid of the "-b" for a bit: (%i1) ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1))$ (%i2) no_b: subst(x, x-b, ex); 1 (%o2) -------------------------- 2 2 2 x sqrt(x + a ) sqrt(-- + 1) 2 a Hmm. Now it looks like there should be some cancelling going on here. I admit I did this on paper, but Maxima can do it too: (%i3) %, ratsimp; abs(a) (%o3) ------- 2 2 x + a And that's easy enough to integrate (unless, like me, you've forgotten the tables of integrals you learnt at A-level. Fortunately Maxima hasn't): (%i4) E_no_b: integrate (%, x); x abs(a) atan(-) a (%o4) -------------- a Ahah! Now remember what I originally said about how b gets involved and do the substitution by hand: (%i5) E: subst(x-b, x, %); x - b abs(a) atan(-----) a (%o5) ------------------ a Of course, abs(a)/a is ?1. If you know the sign of a, you can get even further: (%i6) assume (a>0); (%o6) [a > 0] (%i7) E, ev; x - b (%o7) atan(-----) a Tada! Now suppose you hadn't spotted the x-b thing. Fortunately, Maxima can still cope: you just have to tell it to get rid of the square roots by simplifying the product: (%i8) forget (a>0); (%o8) [a > 0] (%i9) ratsimp(ex); abs(a) (%o9) -------------------- 2 2 2 x - 2 b x + b + a (%i10) integrate(%,x); 2 x - 2 b abs(a) atan(---------) 2 a (%o10) ---------------------- a And you can get rid of the unfortunate factor of 2 with another call to ratsimp if you fancy: (%i11) ratsimp(%); x - b abs(a) atan(-----) a (%o11) ------------------ a Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From leon.magiera at wp.pl Mon Jan 2 09:30:15 2012 From: leon.magiera at wp.pl (leon.magiera at wp.pl) Date: Mon, 02 Jan 2012 16:30:15 +0100 Subject: [Maxima] problems In-Reply-To: <4f016750a81f33.02531046@wp.pl> References: <4f016750a81f33.02531046@wp.pl> Message-ID: <4f01cd8726af76.23504702@wp.pl> Dnia 2-01-2012 o godz. 14:28 Rupert Swarbrick napisa?(a): > leon.magiera at wp.pl writes: > > Problem 2 > > > > ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); > > > > integrate(ex,x); > > > > Is the above integral too hard ? CAS DERIVE returns ATAN((x - b)/ABS(a)) L.M. > > For this, have a look at what your expression is. Firstly, the > x-b looks unpleasant so lets ignore that. Note that > > integrate (f(x - b), x, u, v) = integrate (f(x), x, u-b, v-b) > > and indeed you're asking for the indefinite integral, so this comes out > as something like > > (integrate (f(x - b), x) at x=v) = (integrate (f(x), x) at x=v-b) > > Anyway, that lets us get rid of the "-b" for a bit: > > (%i1) ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1))$ > > (%i2) no_b: subst(x, x-b, ex); > 1 > (%o2) -------------------------- > 2 > 2 2 x > sqrt(x + a ) sqrt(-- + 1) > 2 > a > > Hmm. Now it looks like there should be some cancelling going on here. I > admit I did this on paper, but Maxima can do it too: > > (%i3) %, ratsimp; > abs(a) > (%o3) ------- > 2 2 > x + a > > And that's easy enough to integrate (unless, like me, you've forgotten > the tables of integrals you learnt at A-level. Fortunately Maxima > hasn't): > > (%i4) E_no_b: integrate (%, x); > x > abs(a) atan(-) > a > (%o4) -------------- > a > > Ahah! Now remember what I originally said about how b gets involved and > do the substitution by hand: > > > (%i5) E: subst(x-b, x, %); > x - b > abs(a) atan(-----) > a > (%o5) ------------------ > a > > Of course, abs(a)/a is ??1. If you know the sign of a, you can get even > further: > > (%i6) assume (a>0); > (%o6) [a > 0] > (%i7) E, ev; > x - b > (%o7) atan(-----) > a > > Tada! Now suppose you hadn't spotted the x-b thing. Fortunately, Maxima > can still cope: you just have to tell it to get rid of the square roots > by simplifying the product: > > (%i8) forget (a>0); > (%o8) [a > 0] > (%i9) ratsimp(ex); > abs(a) > (%o9) -------------------- > 2 2 2 > x - 2 b x + b + a > (%i10) integrate(%,x); > 2 x - 2 b > abs(a) atan(---------) > 2 a > (%o10) ---------------------- > a > > And you can get rid of the unfortunate factor of 2 with another call to > ratsimp if you fancy: > > (%i11) ratsimp(%); > x - b > abs(a) atan(-----) > a > (%o11) ------------------ > a > > > Rupert From rswarbrick at gmail.com Mon Jan 2 10:06:35 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Mon, 02 Jan 2012 16:06:35 +0000 Subject: [Maxima] problems In-Reply-To: <4f01cd8726af76.23504702@wp.pl> (leon magiera's message of "Mon, 02 Jan 2012 16:30:15 +0100") References: <4f016750a81f33.02531046@wp.pl> <4f01cd8726af76.23504702@wp.pl> Message-ID: <87fwfyum0k.fsf@hake.rswarbrick.dnsalias.com> leon.magiera at wp.pl writes: > Dnia 2-01-2012 o godz. 14:28 Rupert Swarbrick napisa?(a): >> leon.magiera at wp.pl writes: >> > Problem 2 >> > >> > ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); >> > >> > integrate(ex,x); >> > >> > Is the above integral too hard ? > > CAS DERIVE returns > ATAN((x - b)/ABS(a)) Well, I'm pretty certain that you've either copied something incorrectly or made another mistake. Look at the bottom of the integrand. It's a product of two terms. One scales as a and the other as 1/a. Therefore the product doesn't have any first-order dependence on a and the derive answer you give above can't possibly be right. Maybe I've misunderstood your original question? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From aleksasd873 at gmail.com Sun Jan 1 04:27:37 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sun, 1 Jan 2012 12:27:37 +0200 Subject: [Maxima] wrong integration Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2011/027256.html On Dec. 31, 2011, t t wrote: ---------------------------------------- >*I tried to integrate the following integral and got the negative answer. *>*Surely the answer is wrong.*>*Here:*>*integrate(x*x^0.5/(1+x)^0.5,x,0,1)*>* -2^(3/2)*-------------------------------- As mentioned by Toth and Fateman, using 1/2 instead of 0.5 leads to the correct answer (at least numerically). A convenient way to prepare the integrand is to use radcan (or ratsimp): --------------------------------------------------- (%i1) exf : x*x^(0.5)/(1+x)^(0.5); (%o1) x^1.5/(x+1)^0.5 (%i2) integrate(%,x,0,1); (%o2) -2^(3/2) (%i3) float(%); (%o3) -2.828427124746191 (%i4) exr : radcan(exf); (%o4) x^(3/2)/sqrt(x+1) (%i5) integrate(%,x,0,1); (%o5) (3*log(sqrt(2)+1)-3*log(1-sqrt(2))-2^(3/2))/8+3*log(-1)/8 (%i6) expand(float(%)); (%o6) 0.30747679967138 (%i7) ratsimp(exf); (%o7) x^(3/2)/sqrt(x+1) ----------------------------------- Ted Woollett **************************************************************** (%i1) S:'integrate(x^(3/2)/sqrt(x+1),x,0,1)$ (%i2) changevar(S, y=sqrt(x), y, x); "Is "y" positive, negative, or zero?"p; (%o2) 2*integrate(y^4/sqrt(y^2+1),y,0,1) (%i3) ev(%, nouns); (%o3) (3*asinh(1)-sqrt(2))/4 (%i4) float(%); (%o4) 0.307476799671383 Aleksas D ------------------------------ -------------- next part -------------- An HTML attachment was scrubbed... URL: From luigi_marino2 at alice.it Sun Jan 1 08:14:28 2012 From: luigi_marino2 at alice.it (Luigi Marino) Date: Sun, 1 Jan 2012 15:14:28 +0100 Subject: [Maxima] wrong graph Message-ID: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> Maxima for a function with rational exponent plots not real parts. Example in the function: x*sqrt(x)/sqrt(1+x) or x^(3/2)/sqrt(1+x) the left part of the plot is not real ( x>0 for sqrt). Best wishes and Happy New Year Luigi Marino -------------- next part -------------- An HTML attachment was scrubbed... URL: From ted.a.smith at frontier.com Sun Jan 1 13:50:14 2012 From: ted.a.smith at frontier.com (Ted Smith) Date: Sun, 1 Jan 2012 11:50:14 -0800 Subject: [Maxima] A Signum bug in Maxima 5.25.1 Message-ID: <000c01ccc8be$95100be0$bf3023a0$@a.smith@frontier.com> I just installed 5.25.1 and was surprised when some of my code didn?t work anymore.? I narrowed it down to: (%i1) numer:true; (%o1) true (%i2) maybe(signum(1) = signum(7)); (%o2) false (%i3) map(signum, [1, -1, 7, -7]); (%o3) [1,-1,1.0,-1.0] In particular note that signum of integer 1 is integer 1, but signum? of some other positive integers is 1.0 which isn?t = 1 This behavior is different than, say, release 5.22 of Maxima. From aleksasd873 at gmail.com Mon Jan 2 05:04:19 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Mon, 2 Jan 2012 13:04:19 +0200 Subject: [Maxima] problems Message-ID: *leon.magiera at wp.pl* leon.magiera at wp.pl *Mon Jan 2 02:14:08 CST 2012 *write: Hi Problem 1 How, using Maxima, to solve in elegant way the equation eq:sqrt(x+3-4*sqrt(x-1))+sqrt(x+8-6*sqrt(x-1))=1; The solution is 5<=x<=10 Problem 2 ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); integrate(ex,x); Is the above integral too hard ? Best L.M. ******************************************************** Problem 1 (%i1) eq:sqrt(x+3-4*sqrt(x-1))+sqrt(x+8-6*sqrt(x-1))=1; (%o1) sqrt(x-4*sqrt(x-1)+3)+sqrt(x-6*sqrt(x-1)+8)=1 The solution we can see from (%i2) wxplot2d([lhs(eq)], [x,1,15])$ (%t2) << Graphics >> (%i3) assume(t>0); (%o3) [t>0] (%i4) eq1:subst(x=1+t^2,eq); (%o4) sqrt(t^2-4*t+4)+sqrt(t^2-6*t+9)=1 (%i5) eq2:subst([t^2-4*t+4=factor(t^2-4*t+4),t^2-6*t+9=factor(t^2-6*t+9)],eq1); (%o5) abs(t-2)+abs(t-3)=1 Next we analyse equation eq2 in cases: a) t<2 (%i6) forget(t>0);assume(t<2); (%o6) [t>0] (%o7) [t<2] (%i8) ratsimp(eq2); (%o8) 5-2*t=1 (%i9) solve(%); (%o9) [t=2] Set of solutions is empty b) 2<=t<=3 (%i10) forget(t<2)$ assume(t>=2,t<=3); (%o11) [t>=2,t<=3] (%i12) ratsimp(eq2); (%o12) 1=1 Set of solutions is 2<=t<=3 or 5<=x<=10 ( because x=1+t^2) c) t>3 (%i13) forget(t>=2,t<=3); assume(t>3); (%o13) [t>=2,t<=3] (%o14) [t>3] (%i15) ratsimp(eq2); (%o15) 2*t-5=1 (%i16) solve(%,t); (%o16) [t=3] Set of solutions is empty problem 2 (%i17) ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); (%o17) 1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)) (%i18) radcan(%); (%o18) abs(a)/(x^2-2*b*x+b^2+a^2) (%i19) integrate(%,x); (%o19) (abs(a)*atan((2*x-2*b)/(2*a)))/a Best, Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Mon Jan 2 13:59:58 2012 From: woollett at charter.net (Edwin Woollett) Date: Mon, 2 Jan 2012 11:59:58 -0800 Subject: [Maxima] Bug in limit or integrate Message-ID: <7892F82731FC468294968DF7A6013D05@edwinc367e16bd> On Jan. 1, 2012, Barton Willis wrote: --------------------------- >Some definite integrals of exp(-x^4) are broken: > > (%i6) integrate(exp(-t^4),t,0,1); > (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 ----------------------------------- the definite integral of the real function exp(-x^n) over the real interval (0,1) is broken (spurious imaginary parts, wrong real parts) for n = 3 through 15, and probably forever. ----------------------------------------------------------------- (%i1) exp_test(n) := ( print (n," qags = ", first( quad_qags (exp(-x^n),x,0,1)), " integrate = ", expand(float(rectform(integrate(exp(-x^n),x,0,1))))))$ (%i2) for m thru 15 do exp_test(m)$ 1 qags = 0.63212055882856 integrate = 0.63212055882856 2 qags = 0.74682413281243 integrate = 0.74682413281243 3 qags = 0.80751118213967 integrate = 0.69932519757296*%i-0.40375559106984 4 qags = 0.8448385947571 integrate = 0.8448385947571*%i 5 qags = 0.87007466768589 integrate = 0.82749018236601*%i+0.26886785869008 6 qags = 0.88826369875194 integrate = 0.76925892837871*%i+0.44413184937597 7 qags = 0.90199160301324 integrate = 0.70520543215755*%i+0.56238256584096 8 qags = 0.91271857185875 integrate = 0.64538949147622*%i+0.64538949147622 9 qags = 0.9213308364909 integrate = 0.59222004611848*%i+0.70578036756801 10 qags = 0.92839720283799 integrate = 0.54569818409775*%i+0.7510891146261 11 qags = 0.93429939205577 integrate = 0.5051203870693*%i+0.78598266428894 12 qags = 0.93930307080183 integrate = 0.46965153540091*%i+0.81346032116712 13 qags = 0.94359882032526 integrate = 0.43851223691831*%i+0.83551526125626 14 qags = 0.94732690220079 integrate = 0.41102973849353*%i+0.85351204660935 15 qags = 0.95059283193 integrate = 0.38664093739113*%i+0.86840976367727 ------------------------------------------------ Ted From biomates at telefonica.net Mon Jan 2 14:09:54 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Mon, 02 Jan 2012 21:09:54 +0100 Subject: [Maxima] wrong graph In-Reply-To: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> References: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> Message-ID: <1325534994.2795.6.camel@pc> El dom, 01-01-2012 a las 15:14 +0100, Luigi Marino escribi?: > Maxima for a function with rational exponent > plots not real parts. > > Example in the function: > > x*sqrt(x)/sqrt(1+x) > or x^(3/2)/sqrt(1+x) > > the left part of the plot > is not real ( x>0 for sqrt). Hello, plot2d plots the function as expected: nothing in interval [-1, 0]. draw2d plots the real part; make use of option draw_realpart=false to avoid plotting in this interval. This option has been added recently and is true by default; I've chosen this default for back compatibility, but probably it'd be better to have the same behavior as in plot2d. -- Mario From renekaelin at gmx.ch Mon Jan 2 14:53:28 2012 From: renekaelin at gmx.ch (rene kaelin) Date: Mon, 2 Jan 2012 21:53:28 +0100 Subject: [Maxima] transform x^(5/2) to sqrt(x^5) Message-ID: <6A6DE2C9-C1BC-4E2C-98AA-E1EC822F20FC@gmx.ch> Dear maxima users I found the following example display2d:false$ logconcoeffp: 'logconfun$ logconfun(m) := featurep(m,integer) or ratnump(m)$ logcontract(1/2*log(x)); which leads to log(sqrt(x)) Is there something similar to transform x^(5/2) to sqrt(x^5)? Reason: To continue processing maxima's output the sqrt-form would be nicer. Thank you. From rich.hennessy at verizon.net Mon Jan 2 16:01:11 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Mon, 02 Jan 2012 17:01:11 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: "OK, this antiderivative is valid on the reals." Here is a general antidiff of the real valued function exp(-x^n) that is valid for all real x, n, (n > about .05 ) (by comparison with quad_qags). I don't know why it fails for 0 < n <=(about .05 ). -(gamma_incomplete(1/n,x^n)/n-gamma(1/n)/n)*signum(x); gammai_test(n, a, b) := ( _z : _z:-(gamma_incomplete(1/n,x^n)/n-gamma(1/n)/n)*signum(x), print(" qags = ", first(quad_qags(exp(-x^n),x,a,b)), " formula = ", float(at(_z,[x=b])-at(_z,[x=a]))))$ display2d:false$ for i : 1 thru 10 do gammai_test(random(10.0)+.5, _h:random(1.0), random(2.0)+_h); qags = 0.70997985233956 formula = 0.70997985233956 qags = 0.64248793774255 formula = 0.64248793774255 qags = 0.39405032292301 formula = 0.39405032292301 qags = 0.12849352798637 formula = 0.12849352798637 qags = 0.2383328942369 formula = 0.2383328942369 qags = 0.14758128797191 formula = 0.14758128797191 qags = 0.14207995833076 formula = 0.14207995833076 qags = 0.54953884342554 formula = 0.54953884342554 qags = 0.14493067138495 formula = 0.14493067138495 qags = 0.25412300011431 formula = 0.25412300011431 done -----Original Message----- From: Barton Willis Sent: Sunday, January 01, 2012 9:11 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw From rswarbrick at gmail.com Mon Jan 2 16:24:25 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Mon, 02 Jan 2012 22:24:25 +0000 Subject: [Maxima] problems In-Reply-To: <4f021e2ab78f37.25110600@wp.pl> (leon magiera's message of "Mon, 02 Jan 2012 22:14:18 +0100") References: <4f016750a81f33.02531046@wp.pl> <4f01cd8726af76.23504702@wp.pl> <87fwfyum0k.fsf@hake.rswarbrick.dnsalias.com> <4f021e2ab78f37.25110600@wp.pl> Message-ID: <874nwdvj3a.fsf@hake.rswarbrick.dnsalias.com> leon.magiera at wp.pl writes: > Dnia 2-01-2012 o godz. 17:06 Rupert Swarbrick napisa??(a): >> leon.magiera at wp.pl writes: >> > Dnia 2-01-2012 o godz. 14:28 Rupert Swarbrick napisa??(a): >> >> leon.magiera at wp.pl writes: >> >> > Problem 2 >> >> > >> >> > ex:1/(sqrt((x-b)^2+a^2)*sqrt((x-b)^2/a^2+1)); >> >> > >> >> > integrate(ex,x); >> >> > >> >> > Is the above integral too hard ? >> > >> > CAS DERIVE returns >> > ATAN((x - b)/ABS(a)) > > Details > ex:=1/(??((x - b)^2 + a^2)????((x - b)^2/a^2 + 1)) > int(ex,x) > ATAN((x - b)/ABS(a)) > We check the obtained result > DIF(ATAN((x - b)/ABS(a)),x)-ex > 0 > >> Well, I'm pretty certain that you've either copied something incorrectly >> or made another mistake. Look at the bottom of the integrand. It's a >> product of two terms. One scales as a and the other as 1/a. Therefore >> the product doesn't have any first-order dependence on a and the derive >> answer you give above can't possibly be right. >> >> Maybe I've misunderstood your original question? >> >> Rupert Erk. It seems I can't read parentheses properly. What you have written agrees with what I said in the first place: I didn't realise that the abs(a) was inside the arc tangent. Rupert PS. Please try to CC the mailing list on conversations like this. If I'm to be humiliated, it may as well be public. PPS. Sentences are also nice. Or any indication that you have read the email to which you are replying. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From rich.hennessy at verizon.net Mon Jan 2 17:02:18 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Mon, 02 Jan 2012 18:02:18 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: <926A618F785242ED8E5AC508E6E76664@RichsLaptop> Quoting myself, "Here is a general antidiff of the real valued function exp(-x^n) that is valid for all real x, n". The limits of integration have to nonnegative, I forgot about that. I should say that it is valid for all positive x, n > .05. For even integer n >= 4 then is works for all x. Rich -----Original Message----- From: Richard Hennessy Sent: Monday, January 02, 2012 5:01 PM To: Barton Willis Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate "OK, this antiderivative is valid on the reals." Here is a general antidiff of the real valued function exp(-x^n) that is valid for all real x, n, (n > about .05 ) (by comparison with quad_qags). I don't know why it fails for 0 < n <=(about .05 ). -(gamma_incomplete(1/n,x^n)/n-gamma(1/n)/n)*signum(x); gammai_test(n, a, b) := ( _z : _z:-(gamma_incomplete(1/n,x^n)/n-gamma(1/n)/n)*signum(x), print(" qags = ", first(quad_qags(exp(-x^n),x,a,b)), " formula = ", float(at(_z,[x=b])-at(_z,[x=a]))))$ display2d:false$ for i : 1 thru 10 do gammai_test(random(10.0)+.5, _h:random(1.0), random(2.0)+_h); qags = 0.70997985233956 formula = 0.70997985233956 qags = 0.64248793774255 formula = 0.64248793774255 qags = 0.39405032292301 formula = 0.39405032292301 qags = 0.12849352798637 formula = 0.12849352798637 qags = 0.2383328942369 formula = 0.2383328942369 qags = 0.14758128797191 formula = 0.14758128797191 qags = 0.14207995833076 formula = 0.14207995833076 qags = 0.54953884342554 formula = 0.54953884342554 qags = 0.14493067138495 formula = 0.14493067138495 qags = 0.25412300011431 formula = 0.25412300011431 done -----Original Message----- From: Barton Willis Sent: Sunday, January 01, 2012 9:11 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From macrakis at alum.mit.edu Mon Jan 2 17:27:49 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 2 Jan 2012 18:27:49 -0500 Subject: [Maxima] wrong graph In-Reply-To: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> References: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> Message-ID: For x>0 and x< -1, the result is real: makelist(x*sqrt(x)/sqrt(1+x),x,[-1.5,-.5,.5,1.5]); (%o69) [- 2.598076211353316, - 0.5 %i, 0.28867513459481, 1.161895003862225] For x>-1 and x< 0, the result is imaginary, and is not plotted, so there is a gap in the plot. Is that what you are referring to? -s PS For reports like this, please include the version number of Maxima, the exact command you used to generate the result you think is incorrect, and why you think it is incorrect. On Sun, Jan 1, 2012 at 09:14, Luigi Marino wrote: > ** > Maxima for a function with rational exponent > plots not real parts. > > Example in the function: > > x*sqrt(x)/sqrt(1+x) > or x^(3/2)/sqrt(1+x) > > the left part of the plot > is not real ( x>0 for sqrt). > > Best wishes and Happy New Year > Luigi Marino > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.hennessy at verizon.net Mon Jan 2 20:19:04 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Mon, 02 Jan 2012 21:19:04 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: <9A46DB131695426C972768678216100C@RichsLaptop> I can fix this. I came across this bug coincidentally to the other emails on gamma_incomplete(). The bug was that pwint() returns 0 for pwint(exp(-x^4),x, minf, inf). So I made a change to pw.mac so that pwint() just passes this problem unchanged to integrate. That fixes pw.mac. Rich -----Original Message----- From: Barton Willis Sent: Sunday, January 01, 2012 9:11 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw From rost14 at gmx.de Tue Jan 3 04:45:08 2012 From: rost14 at gmx.de (Roland Stewen) Date: Tue, 03 Jan 2012 11:45:08 +0100 Subject: [Maxima] Maxima tutorial Message-ID: <4F02DC34.1000603@gmx.de> Hi, I am writing a German tutorial for Maxima together with Eike Sch?tze for German pupils at secondary school (gymnasium). html-Version: http://www.rvk-hagen.de/~stewen/maxima_in_beispielen/maxima_in_beispielen.html pdf-Version: http://www.rvk-hagen.de/~stewen/maxima_in_beispielen.pdf The tutorial should be a "cookbook" with short recipes for traditional mathproblems in school for solving them with maxima. The tutorial will be changed from time to time because of feedback from users and their needs. Comments are more than welcome. Roland Stewen From aishen at free.fr Tue Jan 3 08:10:08 2012 From: aishen at free.fr (aishen) Date: Tue, 03 Jan 2012 15:10:08 +0100 Subject: [Maxima] Maxima tutorial In-Reply-To: <4F02DC34.1000603@gmx.de> References: <4F02DC34.1000603@gmx.de> Message-ID: <4F030C40.2070600@free.fr> Le 03/01/2012 11:45, Roland Stewen a ?crit : > Hi, > > I am writing a German tutorial for Maxima > together with Eike Sch?tze for German pupils at > secondary school (gymnasium). > > html-Version: > http://www.rvk-hagen.de/~stewen/maxima_in_beispielen/maxima_in_beispielen.html > > > pdf-Version: > http://www.rvk-hagen.de/~stewen/maxima_in_beispielen.pdf > > The tutorial should be a "cookbook" with > short recipes for traditional mathproblems in school > for solving them with maxima. > > The tutorial will be changed from time to time > because of feedback from users and their needs. > > Comments are more than welcome. > > Roland Stewen > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > Good ideas... I am thinking about making a collection of wxmaxima "google found" because they are so many "golden mines" in multi languages... So I am reading your tutorial even if my german language is not so good nowadays... But examples should be self explaining most of time... regards Happy new year From fateman at eecs.berkeley.edu Tue Jan 3 09:45:01 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Tue, 03 Jan 2012 07:45:01 -0800 Subject: [Maxima] taylor series, bfloat, zerop enhancements, something to think about, vs. Macsyma Message-ID: <4F03227D.3040905@eecs.berkeley.edu> taylor(((n - 1/2)*(%e^(1/n) - 1))^n, n, inf, 3); says "an error ..." though in Macsyma, the answer comes out as 1 - (1/(12 * n)) - (11/(288 * n^2)) - (653/(51840 * n^3)) + . . . also, bfloat(1/3,100) gives 100 digits of 1/3. Maxima's bfloat ignores 2nd. argument. Maxima has no zerop() function. I think it could be defined as.. zerop(x):=if bfloatp(x) then ?zerop(?cadr (x)) else if ?numberp(x) then ?zerop(x) else if ratp(x) then ?equal(0, ?cadr (x)) else false RJF From christian.stengg at gmx.at Tue Jan 3 12:21:35 2012 From: christian.stengg at gmx.at (Christian Stengg) Date: Tue, 03 Jan 2012 19:21:35 +0100 Subject: [Maxima] problems In-Reply-To: <4f016750a81f33.02531046@wp.pl> References: <4f016750a81f33.02531046@wp.pl> Message-ID: <4F03472F.60505@gmx.at> Try integrate(radcan(ex),x). Christian From macrakis at alum.mit.edu Tue Jan 3 12:35:41 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 3 Jan 2012 13:35:41 -0500 Subject: [Maxima] wrong graph In-Reply-To: References: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> Message-ID: Luigi, I tried your code, and got the following graph, which looks correct to me -- is that the graph you get? Though of course sqrt(-2) is not real, sqrt(-2)/sqrt(-1) is real. There is no good way to tell Maxima to do strictly real arithmetic, such that (e.g.) sqrt(-1)/sqrt(-1) gives Undefined instead of 1. Is that what you want? -s PS Please keep the Maxima mailing list CC'ed on discussions. [image: image.png] On Tue, Jan 3, 2012 at 02:09, Luigi Marino wrote: > ** > Hi Stravos > Maxima works in complex mode. > Look at my file. > I use the last Maxima release 5.21 > Best. > Luigi > > ----- Original Message ----- > *From:* Stavros Macrakis > *To:* Luigi Marino > *Cc:* maxima at math.utexas.edu > *Sent:* Tuesday, January 03, 2012 12:27 AM > *Subject:* Re: [Maxima] wrong graph > > For x>0 and x< -1, the result is real: > > makelist(x*sqrt(x)/sqrt(1+x),x,[-1.5,-.5,.5,1.5]); > (%o69) [- 2.598076211353316, - 0.5 %i, 0.28867513459481, > 1.161895003862225] > > For x>-1 and x< 0, the result is imaginary, and is not plotted, so there > is a gap in the plot. > > Is that what you are referring to? > > -s > > PS For reports like this, please include the version number of Maxima, the > exact command you used to generate the result you think is incorrect, and > why you think it is incorrect. > > > On Sun, Jan 1, 2012 at 09:14, Luigi Marino wrote: > >> ** >> Maxima for a function with rational exponent >> plots not real parts. >> >> Example in the function: >> >> x*sqrt(x)/sqrt(1+x) >> or x^(3/2)/sqrt(1+x) >> >> the left part of the plot >> is not real ( x>0 for sqrt). >> >> Best wishes and Happy New Year >> Luigi Marino >> >> >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 10006 bytes Desc: not available URL: From macrakis at alum.mit.edu Tue Jan 3 12:43:22 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 3 Jan 2012 13:43:22 -0500 Subject: [Maxima] wrong graph In-Reply-To: References: <1D5BDDBE0E6D4C3C8909F3FCA1372C28@luigi3b0e34c8e> Message-ID: To elaborate a bit on "There is no good way to tell Maxima to do strictly real arithmetic", you could of course define mysqrt(x):=if x<0 then error() else sqrt(x)$ which would work fine as a *computational* function, but it will not*simplify * correctly in this case: mysqrt(x)/mysqrt(x) => 1 Also, mysqrt of a variable will expand out to a conditional, and your expressions will tend to blow up, e.g. mysqrt(1+mysqrt(x)); => if (if x < 0 then error() else sqrt(x)) + 1 < 0 then error() else sqrt((if x < 0 then error() else sqrt(x)) + 1) Maybe that is OK in your application.... If on the other hand you keep mysqrt as an unevaluated function, you'd have to re-implement all the standard simplifications. -s On Tue, Jan 3, 2012 at 13:35, Stavros Macrakis wrote: > Luigi, > > I tried your code, and got the following graph, which looks correct to me > -- is that the graph you get? > > Though of course sqrt(-2) is not real, sqrt(-2)/sqrt(-1) is real. There > is no good way to tell Maxima to do strictly real arithmetic, such that > (e.g.) sqrt(-1)/sqrt(-1) gives Undefined instead of 1. Is that what you > want? > > -s > > PS Please keep the Maxima mailing list CC'ed on discussions. > [image: image.png] > > On Tue, Jan 3, 2012 at 02:09, Luigi Marino wrote: > >> ** >> Hi Stravos >> Maxima works in complex mode. >> Look at my file. >> I use the last Maxima release 5.21 >> Best. >> Luigi >> >> ----- Original Message ----- >> *From:* Stavros Macrakis >> *To:* Luigi Marino >> *Cc:* maxima at math.utexas.edu >> *Sent:* Tuesday, January 03, 2012 12:27 AM >> *Subject:* Re: [Maxima] wrong graph >> >> For x>0 and x< -1, the result is real: >> >> makelist(x*sqrt(x)/sqrt(1+x),x,[-1.5,-.5,.5,1.5]); >> (%o69) [- 2.598076211353316, - 0.5 %i, 0.28867513459481, >> 1.161895003862225] >> >> For x>-1 and x< 0, the result is imaginary, and is not plotted, so there >> is a gap in the plot. >> >> Is that what you are referring to? >> >> -s >> >> PS For reports like this, please include the version number of Maxima, >> the exact command you used to generate the result you think is incorrect, >> and why you think it is incorrect. >> >> >> On Sun, Jan 1, 2012 at 09:14, Luigi Marino wrote: >> >>> ** >>> Maxima for a function with rational exponent >>> plots not real parts. >>> >>> Example in the function: >>> >>> x*sqrt(x)/sqrt(1+x) >>> or x^(3/2)/sqrt(1+x) >>> >>> the left part of the plot >>> is not real ( x>0 for sqrt). >>> >>> Best wishes and Happy New Year >>> Luigi Marino >>> >>> >>> _______________________________________________ >>> Maxima mailing list >>> Maxima at math.utexas.edu >>> http://www.math.utexas.edu/mailman/listinfo/maxima >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 10006 bytes Desc: not available URL: From amzoti at gmail.com Tue Jan 3 13:12:13 2012 From: amzoti at gmail.com (W F) Date: Tue, 3 Jan 2012 11:12:13 -0800 Subject: [Maxima] Maxima tutorial In-Reply-To: <4F030C40.2070600@free.fr> References: <4F02DC34.1000603@gmx.de> <4F030C40.2070600@free.fr> Message-ID: On 1/3/12, aishen wrote: > Le 03/01/2012 11:45, Roland Stewen a ?crit : >> Hi, >> >> I am writing a German tutorial for Maxima >> together with Eike Sch?tze for German pupils at >> secondary school (gymnasium). >> >> html-Version: >> http://www.rvk-hagen.de/~stewen/maxima_in_beispielen/maxima_in_beispielen.html >> >> >> >> pdf-Version: >> http://www.rvk-hagen.de/~stewen/maxima_in_beispielen.pdf >> >> The tutorial should be a "cookbook" with >> short recipes for traditional mathproblems in school >> for solving them with maxima. >> >> The tutorial will be changed from time to time >> because of feedback from users and their needs. >> >> Comments are more than welcome. >> >> Roland Stewen >> >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> >> > Good ideas... I am thinking about making a collection of wxmaxima > "google found" because they are so many "golden mines" in multi > languages... So I am reading your tutorial even if my german language is > not so good nowadays... But examples should be self explaining most of > time... > regards > Happy new year > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > Excellent contributions. I have always wondered if a cohesive manual and examples could somehow be maintained and worked as a cumulative effort to get the greatest coverage and examples. For example, the work by http://www.csulb.edu/~woollett/ This would be akin to the example repository that Wolfram-Mathematica uses. Just a thought to chew on. Thanks! From toy.raymond at gmail.com Tue Jan 3 13:59:22 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 3 Jan 2012 11:59:22 -0800 Subject: [Maxima] A Signum bug in Maxima 5.25.1 In-Reply-To: <4f01f370.c6adec0a.49d2.fffffbf0SMTPIN_ADDED@mx.google.com> References: <4f01f370.c6adec0a.49d2.fffffbf0SMTPIN_ADDED@mx.google.com> Message-ID: On Sun, Jan 1, 2012 at 11:50 AM, Ted Smith wrote: > I just installed 5.25.1 and was surprised when some of my code didn?t work > anymore. I narrowed it down to: > The latest release is 5.26.0. > > (%i1) numer:true; > (%o1) true > (%i2) maybe(signum(1) = signum(7)); > (%o2) false > (%i3) map(signum, [1, -1, 7, -7]); > (%o3) [1,-1,1.0,-1.0] > > In particular note that signum of integer 1 is integer 1, but signum of > some other positive integers is 1.0 which isn?t = 1? > > These seem to be fixed in 5.26.0. maybe(signum(1) = signum(7)) returns true, and map(signum,[1,-1,7,-7]) returns either 1 or -1, but not 1.0. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Tue Jan 3 14:24:08 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 3 Jan 2012 12:24:08 -0800 Subject: [Maxima] problems In-Reply-To: <4f016750a81f33.02531046@wp.pl> References: <4f016750a81f33.02531046@wp.pl> Message-ID: On Mon, Jan 2, 2012 at 12:14 AM, wrote: > Hi > > Problem 1 > How, using Maxima, to solve in elegant way the equation > > eq:sqrt(x+3-4*sqrt(x-1))+sqrt(x+8-6*sqrt(x-1))=1; > > The solution is > > 5<=x<=10 > It looks like to_poly_solver can solve this: (%i54) load(to_poly_solver); (%o54) "/Users/rtoy/src/sourceforge/maxima/share/contrib/to_poly_solver.mac" (%i55) to_poly_solve(eq,x); (%o55) %union(%if(?%and(-%pi/2 < parg(3-%c41),-%pi/2 < parg(%c41-2), -%pi/2 < parg(%c41),parg(3-%c41) <= %pi/2, parg(%c41-2) <= %pi/2,parg(%c41) <= %pi/2), [x = %c41^2+1],%union())) This is kind of hard to read, but basically if the complex number %c41 satisfies the conditions in the %if, then %c41^2+1 is a solution. If we're interested in just real solutions, I think the %if simplifies to 2<= %c41 <= 3, which means 5 <= x <= 10. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From biomates at telefonica.net Tue Jan 3 15:13:40 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Tue, 03 Jan 2012 22:13:40 +0100 Subject: [Maxima] Maxima tutorial In-Reply-To: <4F02DC34.1000603@gmx.de> References: <4F02DC34.1000603@gmx.de> Message-ID: <1325625220.2729.1.camel@pc> El mar, 03-01-2012 a las 11:45 +0100, Roland Stewen escribi?: > Hi, > > I am writing a German tutorial for Maxima > together with Eike Sch?tze for German pupils at > secondary school (gymnasium). > > html-Version: > http://www.rvk-hagen.de/~stewen/maxima_in_beispielen/maxima_in_beispielen.html > > pdf-Version: > http://www.rvk-hagen.de/~stewen/maxima_in_beispielen.pdf > > The tutorial should be a "cookbook" with > short recipes for traditional mathproblems in school > for solving them with maxima. > > The tutorial will be changed from time to time > because of feedback from users and their needs. > > Comments are more than welcome. > > Roland Stewen This document is now linked from the Maxima web site. Danke! -- Mario From dlakelan at street-artists.org Tue Jan 3 15:25:22 2012 From: dlakelan at street-artists.org (dlakelan) Date: Tue, 03 Jan 2012 13:25:22 -0800 Subject: [Maxima] expintegral_e: series failed In-Reply-To: References: Message-ID: <4F037242.1070403@street-artists.org> On 12/30/2011 12:13 AM, Raymond Toy wrote: > On Thu, Dec 29, 2011 at 2:16 PM, Edwin Woollett wrote: > >> attempted evaluation of bfloat of an expression >> involving gamma_incomplete's leads to an error message: ... > Could you file a bug report on this? I know about some of these issues and > am working on them (slowly). The basic parts work, but the corner cases > need more work (especically since my approach fails in some cases where the > original gave correct answers). I'm sure you've seen this since the simplest google search would bring it up, but it seemed interesting so if you haven't seen it you might want to take a look: http://iopscience.iop.org/0295-5075/71/1/001/pdf/epl_71_1_001.pdf From toy.raymond at gmail.com Tue Jan 3 16:48:01 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 3 Jan 2012 14:48:01 -0800 Subject: [Maxima] expintegral_e: series failed In-Reply-To: <4F037242.1070403@street-artists.org> References: <4F037242.1070403@street-artists.org> Message-ID: On Tue, Jan 3, 2012 at 1:25 PM, dlakelan wrote: > On 12/30/2011 12:13 AM, Raymond Toy wrote: > > On Thu, Dec 29, 2011 at 2:16 PM, Edwin Woollett >wrote: > > > >> attempted evaluation of bfloat of an expression > >> involving gamma_incomplete's leads to an error message: > ... > > > Could you file a bug report on this? I know about some of these issues > and > > am working on them (slowly). The basic parts work, but the corner cases > > need more work (especically since my approach fails in some cases where > the > > original gave correct answers). > > I'm sure you've seen this since the simplest google search would bring > it up, but it seemed interesting so if you haven't seen it you might > want to take a look: > > http://iopscience.iop.org/0295-5075/71/1/001/pdf/epl_71_1_001.pdf > > Thanks for the tip. I had not seen this; I was working from the continued fraction and series representations of the incomplete gamma function. This seems interesting, but it's not immediately clear if "all a and x" means all real a and x or all complex a and x. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From dlakelan at street-artists.org Tue Jan 3 17:20:30 2012 From: dlakelan at street-artists.org (dlakelan) Date: Tue, 03 Jan 2012 15:20:30 -0800 Subject: [Maxima] expintegral_e: series failed In-Reply-To: References: <4F037242.1070403@street-artists.org> Message-ID: <4F038D3E.8010309@street-artists.org> On 01/03/2012 02:48 PM, Raymond Toy wrote: > On Tue, Jan 3, 2012 at 1:25 PM, dlakelan wrote: > >> On 12/30/2011 12:13 AM, Raymond Toy wrote: >>> Could you file a bug report on this? I know about some of these issues >> and >>> am working on them (slowly). The basic parts work, but the corner cases >>> need more work (especically since my approach fails in some cases where >> the >>> original gave correct answers). >> >> I'm sure you've seen this since the simplest google search would bring >> it up, but it seemed interesting so if you haven't seen it you might >> want to take a look: >> >> http://iopscience.iop.org/0295-5075/71/1/001/pdf/epl_71_1_001.pdf >> >> > Thanks for the tip. I had not seen this; I was working from the continued > fraction and series representations of the incomplete gamma function. > > This seems interesting, but it's not immediately clear if "all a and x" > means all real a and x or all complex a and x. Agreed, and the article seems to treat all the parameters as real, though perhaps the author has worked out whether the method makes sense for complex parameters or requires some modification? In any case, perhaps the real case is the most common, and it could be useful to use this result for evaluation when the parameters are real. From dbmaxima at gmail.com Tue Jan 3 18:57:11 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Wed, 04 Jan 2012 11:57:11 +1100 Subject: [Maxima] expintegral_e: series failed In-Reply-To: <4F037242.1070403@street-artists.org> References: <4F037242.1070403@street-artists.org> Message-ID: <4F03A3E7.7040101@gmail.com> On 4/01/2012 8:25 AM, dlakelan wrote: > > I'm sure you've seen this since the simplest google search would bring > it up, but it seemed interesting so if you haven't seen it you might > want to take a look: > > http://iopscience.iop.org/0295-5075/71/1/001/pdf/epl_71_1_001.pdf This reference is also freely available as http://arxiv.org/abs/math-ph/0501019 Asymptotic and exact series representations for the incomplete Gamma function Authors: Paolo Amore Abstract: Using a variational approach, two new series representations for the incomplete Gamma function are derived: the first is an asymptotic series, which contains and improves over the standard asymptotic expansion; the second is a uniformly convergent series, completely analytical, which can be used to obtain arbitrarily accurate estimates of $\Gamma(a,x)$ for any value of $a$ or $x$. Applications of these formulas are discussed. Journal reference: Europhysics Letters 71, 1-7 (2005) From rich.hennessy at verizon.net Tue Jan 3 19:15:44 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Tue, 03 Jan 2012 20:15:44 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <009CCEB07A82462383B5FAF431448497@RichsLaptop> Message-ID: <9483E60A879B4BE293A00D296BF48A6A@RichsLaptop> "Sometime ago, I wrote a bit of code that attempts to determine when an expression is continuous." I came up with this bit of code. It works pretty well. continuousp(__e, __x, __p):=block ( [inflag : true, ratprint:false, _p, _l], _p : errcatch ( if is(equal(_l : limit(__e, __x, __p, 'plus), limit(__e, __x, __p, 'minus))) then if is(equal(_l, at(__e, [__x=__p]))) = true then true else false else false ), if emptyp(_p) then if is(equal(error, ["expt: undefined: 0 to a negative exponent."]))=true then false else [] else first(_p) ); -----Original Message----- From: Barton Willis Sent: Saturday, December 31, 2011 8:57 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate The function x |-> -gamma_incomplete(1/4,x^4)*x/(4*abs(x)) is not continuous at zero. To do the calculation correctly, you need to consider the intervals (-inf,0) and (0, inf) separately. Doing that, the definite integral is correct, I think. Sometime ago, I wrote a bit of code that attempts to determine when an expression is continuous. I know that in general this is algorithmically impossible--I was aiming for a satisficing (good enough) method. --Barton -----maxima-bounces at math.utexas.edu wrote: ----- I get this incorrect result for the following calculations: (%i4) kill(all); (%o0) done (%i1) exp(-x^4); (%o1) %e^-x^4 (%i2) integrate(%o1,x,minf,inf); (%o2) gamma(1/4)/2 (%i3) integrate(%o1,x); (%o3) -gamma_incomplete(1/4,x^4)*x/(4*abs(x)) (%i4) limit(%o3,x,inf)-limit(%o3,x,minf); (%o4) 0 The limit should give the same answer as the more direct definite integral. I can’t take the analysis much further because I know very little about the gamma_incomplete function. It looks like a bug. Rich _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Tue Jan 3 19:31:57 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Tue, 03 Jan 2012 20:31:57 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: <9483E60A879B4BE293A00D296BF48A6A@RichsLaptop> References: <009CCEB07A82462383B5FAF431448497@RichsLaptop> <9483E60A879B4BE293A00D296BF48A6A@RichsLaptop> Message-ID: <77F2B44468E242738F00F487FA309E9F@RichsLaptop> (%i10) continuousp(abs(x),x,0); (%o10) true (%i11) continuousp(abs(x)^2,x,0); (%o11) true (%i12) continuousp(1/abs(x-a),x,a); expt: undefined: 0 to a negative exponent. (%o12) false (%i13) continuousp(1/(x-a),x,a); (%o13) false (%i14) continuousp(1/(x-a)^3,x,a); (%o14) false (%i15) continuousp(1/(sqrt(x-a))^3,x,a); Rich -----Original Message----- From: Richard Hennessy Sent: Tuesday, January 03, 2012 8:15 PM To: Barton Willis Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate "Sometime ago, I wrote a bit of code that attempts to determine when an expression is continuous." I came up with this bit of code. It works pretty well. continuousp(__e, __x, __p):=block ( [inflag : true, ratprint:false, _p, _l], _p : errcatch ( if is(equal(_l : limit(__e, __x, __p, 'plus), limit(__e, __x, __p, 'minus))) then if is(equal(_l, at(__e, [__x=__p]))) = true then true else false else false ), if emptyp(_p) then if is(equal(error, ["expt: undefined: 0 to a negative exponent."]))=true then false else [] else first(_p) ); -----Original Message----- From: Barton Willis Sent: Saturday, December 31, 2011 8:57 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate The function x |-> -gamma_incomplete(1/4,x^4)*x/(4*abs(x)) is not continuous at zero. To do the calculation correctly, you need to consider the intervals (-inf,0) and (0, inf) separately. Doing that, the definite integral is correct, I think. Sometime ago, I wrote a bit of code that attempts to determine when an expression is continuous. I know that in general this is algorithmically impossible--I was aiming for a satisficing (good enough) method. --Barton -----maxima-bounces at math.utexas.edu wrote: ----- I get this incorrect result for the following calculations: (%i4) kill(all); (%o0) done (%i1) exp(-x^4); (%o1) %e^-x^4 (%i2) integrate(%o1,x,minf,inf); (%o2) gamma(1/4)/2 (%i3) integrate(%o1,x); (%o3) -gamma_incomplete(1/4,x^4)*x/(4*abs(x)) (%i4) limit(%o3,x,inf)-limit(%o3,x,minf); (%o4) 0 The limit should give the same answer as the more direct definite integral. I can’t take the analysis much further because I know very little about the gamma_incomplete function. It looks like a bug. Rich _______________________________________________ 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 leon.magiera at wp.pl Wed Jan 4 03:55:53 2012 From: leon.magiera at wp.pl (leon.magiera at wp.pl) Date: Wed, 04 Jan 2012 10:55:53 +0100 Subject: [Maxima] limit Message-ID: <4f042229041738.17309342@wp.pl> Hi, limit(atan(a*x)-atan(-a*x),x,inf); Maxima's result %pi is correct only for a>0 Best Leon P.S. DERIVE returns: SIGN(a)*PI Mathematica: Sqrt[a^2]/a*Pi From volkervannek at googlemail.com Wed Jan 4 05:26:07 2012 From: volkervannek at googlemail.com (Volker van Nek) Date: Wed, 4 Jan 2012 12:26:07 +0100 Subject: [Maxima] Maxima tutorial In-Reply-To: <1325625220.2729.1.camel@pc> References: <4F02DC34.1000603@gmx.de> <1325625220.2729.1.camel@pc> Message-ID: Hi Mario, thanks for linking this document. And thanks to Roland and Eike for posting it. I attached remarks to some chapters. I believe three points are worth to mention: - Blocks in user functions terminated by a return statement. I have also seen this Java/C++ habit in e.g. the Galois fields package share/contrib/gf/gf.mac. Leaving out unnecessary returns and replacing 'block([ ],' expressions with no local variables by a simple '(' functions can be written a little bit easier. - Lambda expressions are widely used in this document (addressed to school kids!) where in most cases they can be replaced by a call to an existing function. - For working with vectors in schools the vector_rebuild package might be an alternative approach. It is documented in share/vector/vector_rebuild.usg. Greetings Volker 2012/1/3 Mario Rodriguez > El mar, 03-01-2012 a las 11:45 +0100, Roland Stewen escribi?: > > Hi, > > > > I am writing a German tutorial for Maxima > > together with Eike Sch?tze for German pupils at > > secondary school (gymnasium). > > > > html-Version: > > > http://www.rvk-hagen.de/~stewen/maxima_in_beispielen/maxima_in_beispielen.html > > > > pdf-Version: > > http://www.rvk-hagen.de/~stewen/maxima_in_beispielen.pdf > > > > The tutorial should be a "cookbook" with > > short recipes for traditional mathproblems in school > > for solving them with maxima. > > > > The tutorial will be changed from time to time > > because of feedback from users and their needs. > > > > Comments are more than welcome. > > > > Roland Stewen > > > This document is now linked from the Maxima web site. > > Danke! > > -- > Mario > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- S. 18: (%i1) f(x) := x^2; 2 (%o1) f(x) := x (%i2) df(x) := diff(f(x), x); (%o2) df(x) := diff(f(x), x) (%i3) df(x); (%o3) 2 x (%i4) df(2); diff: second argument must be a variable; found 2 #0: df(x=2) -- an error. To debug this try: debugmode(true); (%i5) df(x) := ''( diff(f(x), x) ); (%o5) df(x) := 2 x (%i6) df(2); (%o6) 4 (%i7) define(df(x), diff(f(x), x)); (%o7) df(x) := 2 x (%i8) df(2); (%o8) 4 S. 69: (%i1) load (eigen)$ (%i2) a : covect([1,2,3])$ (%i3) b : covect([2,1,2])$ (%i4) basis : orthogonal_complement(a, b); [ 1 ] [ ] (%o4) span([ 4 ]) [ ] [ - 3 ] (%i5) first(basis); [ 1 ] [ ] (%o5) [ 4 ] [ ] [ - 3 ] S. 70: (%i1) load (eigen)$ (%i2) a : covect([1,2,3])$ (%i3) b : covect([1,2,3])$ (%i4) basis : orthogonal_complement(a, b); [ - 2 ] [ 0 ] [ ] [ ] (%o4) span([ 1 ], [ 3 ]) [ ] [ ] [ 0 ] [ - 2 ] (%i5) n1 : first(basis); [ - 2 ] [ ] (%o5) [ 1 ] [ ] [ 0 ] (%i6) n2 : second(basis); [ 0 ] [ ] (%o6) [ 3 ] [ ] [ - 2 ] S. 72: (%i1) load(vector_rebuild)$ (%i2) a : covect([1,2,3])$ (%i3) b : covect([2,1,2])$ (%i4) a~b; [ 1 ] [ ] (%o4) [ 4 ] [ ] [ - 3 ] S. 73: (%i1) load(vector_rebuild)$ (%i2) v([args]):= covect(args)$ (%i3) x : v(1,2,3) + r*v(2,5,1) + s*v(3,-2,1); [ 3 ] [ 2 ] [ 1 ] [ ] [ ] [ ] (%o3) s [ - 2 ] + r [ 5 ] + [ 2 ] [ ] [ ] [ ] [ 1 ] [ 1 ] [ 3 ] (%i4) x, r = 0, s = 0, vector_simp; [ 1 ] [ ] (%o4) [ 2 ] [ ] [ 3 ] (%i5) x, r = 0, s = 2, vector_simp; [ 7 ] [ ] (%o5) [ - 2 ] [ ] [ 5 ] S. 75: (%i1) load(vector_rebuild)$ (%i2) v([args]):= covect(args)$ (%i3) b : v(-25,2,0)$ (%i4) c : v(0, 2,-5)$ (%i5) n : b~c; [ - 10 ] [ ] (%o5) [ - 125 ] [ ] [ - 50 ] (%i6) n : vector_factor(n), vector_factor_minus:true; [ 2 ] [ ] (%o6) - 5 [ 25 ] [ ] [ 10 ] (%i7) en : 1/|n| * n; [ 2 ] 1 [ ] (%o7) (- --) [ 25 ] 27 [ ] [ 10 ] (%i8) |en|; (%o8) 1 S. 76: (%i1) load(vector_rebuild)$ (%i2) v([args]):= covect(args)$ (%i3) a : v(1,2,3)$ (%i4) n : v(2,25,10)$ (%i5) oc : orthogonal_complement(n)$ 0 errors, 0 warnings (%i6) [b, c] : [first(oc), second(oc)]$ (%i7) a + r * b + s * c; [ 0 ] [ - 25 ] [ 1 ] [ ] [ ] [ ] (%o7) s [ 10 ] + r [ 2 ] + [ 2 ] [ ] [ ] [ ] [ - 25 ] [ 0 ] [ 3 ] (%i8) nf : x.n = a.n; [ 2 ] [ 1 ] [ 2 ] [ ] [ ] [ ] (%o8) x . [ 25 ] = [ 2 ] . [ 25 ] [ ] [ ] [ ] [ 10 ] [ 3 ] [ 10 ] (%i9) nf, x=v(x1,x2,x3), vector_simp; (%o9) 10 x3 + 25 x2 + 2 x1 = 82 (%i10) % / |n|; 10 x3 + 25 x2 + 2 x1 82 (%o10) -------------------- = -- 27 27 S. 100: (%i1) len(vec) := block([sum:0], for n in flatten(args(vec)) do sum : sum + n^2, sqrt(sum) )$ (%i2) load (eigen)$ (%i3) a : covect ([3, 4]); [ 3 ] (%o3) [ ] [ 4 ] (%i4) len(a); (%o4) 5 (%i5) len([3, 4]); (%o5) 5 1. Wert eines Blocks ist stets der Wert des letzten Ausdrucks. 2. vec kann hier Spalten- oder Zeilenvektor sein. S. 101: (%i1) mysolve(a, b) := block([lsg, varListe, len], lsg : solve (a, b), varListe : [r, s, t], len : length(%rnum_list), for i thru len do lsg : subst (varListe[i], %rnum_list[i], lsg), lsg )$ (%i2) gl1 : 2*x = y; (%o2) 2 x = y (%i3) gl2 : 2*gl1; (%o3) 4 x = 2 y (%i4) gleichungen : [gl1, gl2]; (%o4) [2 x = y, 4 x = 2 y] (%i5) variablen : [x, y]; (%o5) [x, y] (%i6) mysolve (gleichungen, variablen); solve: dependent equations eliminated: (2) r (%o6) [[x = -, y = r]] 2 (%i7) mysolve(a, b) := block([lsg, varListe, maperror:false], lsg : solve (a, b), varListe : [r, s, t], lsg : subst (map("=", %rnum_list, varListe), lsg), lsg )$ (%i8) mysolve (gleichungen, variablen)$ solve: dependent equations eliminated: (2) map: truncating one or more arguments. (%i9) %; r (%o9) [[x = -, y = r]] 2 1. Wert eines Blocks ist stets der Wert des letzten Ausdrucks. 2. i ist durch 'for i : 1 thru' lokal im Block der for-Schleife. Kein 'block[i], for i : 1 thru' noetig. 3. 'block([],' ist gleichwertig mit '('. 4. 'subst([a=b], expr)' entspricht 'subst(b, a, expr)'. 5. 'maperror:false' verhindert Abbruch(, erzeugt jedoch Meldung ohne Zeilenumbruch). S. 148: (%i1) a : 1$ (%i2) for i thru 10 do print(a : next_prime(a))$ 2 3 5 7 11 13 17 19 23 29 (%i3) prim : primes(0, 50); (%o3) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] (%i4) rest(prim, 10 - length(prim)); (%o4) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] 1. 1 ist nicht prim. 2. 'block([],' ist gleichwertig mit '('. 3. 'for i : 1 while i < 10 do' --> 9 Durchlaeufe S. 149: (%i1) r : ifactors (12); (%o1) [[2, 2], [3, 1]] (%i2) r : ifactors (12), factors_only : true; (%o2) [2, 3] S. 150: (%i1) genauigkeit : 40$ (%i2) fpprec : genauigkeit + 3$ (%i3) z : bfloat (sqrt(2)); (%o3) 1.414213562373095048801688724209698078569672b0 (%i4) l : map(parse_string, charlist(substring(string(z), 3, fpprec))); (%o4) [4, 1, 4, 2, 1, 3, 5, 6, 2, 3, 7, 3, 0, 9, 5, 0, 4, 8, 8, 0, 1, 6, 8, 8, 7, 2, 4, 2, 0, 9, 6, 9, 8, 0, 7, 8, 5, 6, 9, 6] S. 155: (%i1) l : [1, 2, 3, 4]; (%o1) [1, 2, 3, 4] (%i3) (sum:0, for n in l do sum : sum + n, sum); (%o3) 10 1. 'block([],' ist gleichwertig mit '('. 2. Wert eines Blocks ist stets der Wert des letzten Ausdrucks. S. 156: (%i1) l : [1, 2, 3, 4]; (%o1) [1, 2, 3, 4] (%i3) (prod:1, for n in l do prod : prod * n, prod); (%o3) 24 (%i1) l : [Max, Willi, Peter]; (%o1) [Max, Willi, Peter] (%i3) jungen : endcons(Paul, l); (%o3) [Max, Willi, Peter, Paul] (%i4) jungen : cons(Paul, l); (%o4) [Paul, Max, Willi, Peter] S. 158: (%i2) liste2 : [ [3, 5], [1,8], [4, 2] ]; (%o2) [[3, 5], [1, 8], [4, 2]] (%i4) xWerte : map(first, liste2); (%o4) [3, 1, 4] (%i1) l : [1, 2, 3, 4]; (%o1) [1, 2, 3, 4] (%i2) f(x) := 2*x+1; (%o2) f(x) := 2 x + 1 (%i3) map(f, l); (%o3) [3, 5, 7, 9] S. 159: (%i1) liste : [ [1,2], [3,4], [5,6] ]$ (%i2) M : apply(matrix, liste); [ 1 2 ] [ ] (%o2) [ 3 4 ] [ ] [ 5 6 ] S. 160: (%i1) load (eigen)$ (%i2) a : covect ([1, 2, 3])$ (%i3) [x, y, z] : args(map(first, a)); (%o3) [1, 2, 3] (%i1) a : [1, 2, 3]; (%o1) [1, 2, 3] (%i2) b : 2*a; (%o2) [2, 4, 6] (%i3) a + b, listarith : false; (%o3) [2, 4, 6] + [1, 2, 3] (%i4) map("+", a,b); (%o4) [3, 6, 9] Die Auswertung des Ausdrucks Liste + Liste ist abhaengig von listarith (default=true). S. 161: (%i1) a : [1, 2, 3]; (%o1) [1, 2, 3] (%i2) b : 2*a; (%o2) [2, 4, 6] (%i3) map("[", a,b); (%o3) [[1, 2], [2, 4], [3, 6]] From aleksasd873 at gmail.com Tue Jan 3 09:06:13 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Tue, 3 Jan 2012 17:06:13 +0200 Subject: [Maxima] Bug in limit or integrate Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2012/027277.html On Jan. 1, 2012, Barton Willis wrote: --------------------------- >*Some definite integrals of exp(-x^4) are broken:*>**>* (%i6) integrate(exp(-t^4),t,0,1);*>* (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4*----------------------------------- the definite integral of the real function exp(-x^n) over the real interval (0,1) is broken (spurious imaginary parts, wrong real parts) for n = 3 through 15, and probably forever. ----------------------------------------------------------------- (%i1) exp_test(n) := ( print (n," qags = ", first( quad_qags (exp(-x^n),x,0,1)), " integrate = ", expand(float(rectform(integrate(exp(-x^n),x,0,1))))))$ (%i2) for m thru 15 do exp_test(m)$ 1 qags = 0.63212055882856 integrate = 0.63212055882856 2 qags = 0.74682413281243 integrate = 0.74682413281243 3 qags = 0.80751118213967 integrate = 0.69932519757296*%i-0.40375559106984 4 qags = 0.8448385947571 integrate = 0.8448385947571*%i 5 qags = 0.87007466768589 integrate = 0.82749018236601*%i+0.26886785869008 6 qags = 0.88826369875194 integrate = 0.76925892837871*%i+0.44413184937597 7 qags = 0.90199160301324 integrate = 0.70520543215755*%i+0.56238256584096 8 qags = 0.91271857185875 integrate = 0.64538949147622*%i+0.64538949147622 9 qags = 0.9213308364909 integrate = 0.59222004611848*%i+0.70578036756801 10 qags = 0.92839720283799 integrate = 0.54569818409775*%i+0.7510891146261 11 qags = 0.93429939205577 integrate = 0.5051203870693*%i+0.78598266428894 12 qags = 0.93930307080183 integrate = 0.46965153540091*%i+0.81346032116712 13 qags = 0.94359882032526 integrate = 0.43851223691831*%i+0.83551526125626 14 qags = 0.94732690220079 integrate = 0.41102973849353*%i+0.85351204660935 15 qags = 0.95059283193 integrate = 0.38664093739113*%i+0.86840976367727 ------------------------------------------------ Ted ************************************************************************************************************* Correct results are: (%i1) S(k):='integrate(exp(-x^k),x,0,1)$ (%i2) for k:1 thru 15 do (changevar(S(k),y=-x,y,x),ev(%%,nouns), print((S(k)=%%)=float(%%))); integrate(%e^(-x),x,0,1) =1-%e^(-1) =0.632120558828558 integrate(%e^(-x^2),x,0,1) =(sqrt(%pi)*erf(1))/2 =0.746824132812427 integrate(%e^(-x^3),x,0,1) =(gamma(1/3)-gamma_incomplete(1/3,1))/3 =0.807511182139671 integrate(%e^(-x^4),x,0,1) =(gamma(1/4)-gamma_incomplete(1/4,1))/4 =0.844838594757102 integrate(%e^(-x^5),x,0,1) =(gamma(1/5)-gamma_incomplete(1/5,1))/5 =0.870074667685893 integrate(%e^(-x^6),x,0,1) =(gamma(1/6)-gamma_incomplete(1/6,1))/6 =0.888263698751937 integrate(%e^(-x^7),x,0,1) =(gamma(1/7)-gamma_incomplete(1/7,1))/7 =0.901991603013235 integrate(%e^(-x^8),x,0,1) =(gamma(1/8)-gamma_incomplete(1/8,1))/8 =0.91271857185875 integrate(%e^(-x^9),x,0,1) =(gamma(1/9)-gamma_incomplete(1/9,1))/9 =0.921330836490897 integrate(%e^(-x^10),x,0,1)=(gamma(1/10)-gamma_incomplete(1/10,1))/10=0.928397202837989 integrate(%e^(-x^11),x,0,1)=(gamma(1/11)-gamma_incomplete(1/11,1))/11 =0.934299392055766 integrate(%e^(-x^12),x,0,1)=(gamma(1/12)-gamma_incomplete(1/12,1))/12=0.939303070801829 integrate(%e^(-x^13),x,0,1)=(gamma(1/13)-gamma_incomplete(1/13,1))/13=0.94359882032526 integrate(%e^(-x^14),x,0,1)=(gamma(1/14)-gamma_incomplete(1/14,1))/14=0.947326902200789 integrate(%e^(-x^15),x,0,1)=(gamma(1/15)-gamma_incomplete(1/15,1))/15=0.950592831930002 (%o2) done Questions: 1. How exact compute sum(1/((3*i+1)*i!),i=0..infinity) ? 2. WolframAlpha(http://www.wolframalpha.com/) return sum_(i=0)^infinity1/((3 i+1) i!) = -1/3 (-1)^(2/3) (3 Gamma(4/3)-Gamma(1/3, -1))~~1.3419 How compute this with maxima ? 3. How compute (-1)^(2/3) ? (%i1) (-1)^(2/3); (%o1) 1 or (%i2) polarform(-1)^(2/3); (%o2) (sqrt(3)*%i)/2-1/2 4. Prove, that sum(1/((3*i+1)*i!),i=0..infinity) =integrate(exp(x^3),x,0,1) Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From deburgess at asbury.edu Tue Jan 3 12:07:02 2012 From: deburgess at asbury.edu (Burgess, Don) Date: Tue, 3 Jan 2012 13:07:02 -0500 Subject: [Maxima] simplified vector display output Message-ID: Can Maxima recognize a known vector in a vector expression and give a simplified display output in terms of the Name of the known vector? So, for example, in the Maxima Session represented in the attached image, I would like Maxima to recognize "F.v1" as a scalar multiplied by a known vector " v1" and to display the result as "(2*alpha +1)*v1"" Thank you very much for your help, don burgess -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: EigenVector.png Type: image/x-png Size: 25595 bytes Desc: EigenVector.png URL: From woollett at charter.net Tue Jan 3 16:44:31 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 3 Jan 2012 14:44:31 -0800 Subject: [Maxima] expintegral_e: series failed Message-ID: On Jan. 3, 2012, dlakelan wrote: ---------------------------- >I'm sure you've seen this since the simplest google search would bring >it up, but it seemed interesting so if you haven't seen it you might >want to take a look: > >http://iopscience.iop.org/0295-5075/71/1/001/pdf/epl_71_1_001.pdf --------------------------------------- EPL wants $33 for this short article. A Cornell archive search: http://arxiv.org/find/grp_physics/1/au:+amore/0/1/0/all/0/1?per_page=100 finds this paper as item no. 48: 48. arXiv:math-ph/0501019 [pdf, ps, other] Asymptotic and exact series representations for the incomplete Gamma function Paolo Amore Comments: 8 pages, 4 figures Journal-ref: Europhysics Letters 71, 1-7 (2005) Subjects: Mathematical Physics (math-ph) ------------------------- with free access to pdf or ps file. Paolo Amore is a physicist whose home page is http://fejer.ucol.mx/paolo/ I am attaching the pdf file to this message. Ted Woollett -------------- next part -------------- A non-text attachment was scrubbed... Name: p_amore_gamma_incomplete.pdf Type: application/pdf Size: 140264 bytes Desc: not available URL: From aishen at free.fr Wed Jan 4 09:10:49 2012 From: aishen at free.fr (aishen) Date: Wed, 04 Jan 2012 16:10:49 +0100 Subject: [Maxima] Help In-Reply-To: References: Message-ID: <4F046BF9.302@free.fr> Hi, I would like to integrate yin or yang... As I am not an expert, I can't solve the 1/2 circle on the right side ? Is there a way of doing it ? thank you and best wishes for 2012, regards --------------------that's what I have done yet------------------------------ f(x):= sqrt(4-x^2)$g(x):=sqrt(4-x^2)$p(x):=sqrt(1-x^2)$ o(x):= -sqrt(1-x^2)$n(x):= -sqrt(4-x^2)$m(x):=-sqrt(4-x^2)$ wxdraw2d(user_preamble = ["set size ratio 1","set zeroaxis"],xaxis = true, yaxis = true, /*filling*/ fill_color = grey, filled_func =(f(x),x,0,2), filled_func =(g(x),x,-2,0), filled_func =(o(x-1),x,-2,0), color = red,explicit(p(x+1),x,-2,0), color = red,explicit(n(x),x,-2,0), color = red,explicit(m(x),x,0,2), filled_func = false, /*unfilling*/ filled_func = false, /*NE*/ color = black,explicit(f(x),x,0,2), /*NO*/ color = red,explicit(n(x),x,-2,0), /*1/2SE*/color = black,explicit(o(x-1),x,0,2), /*SW */ color = black,explicit(g(x),x,-2,0), /*1/2NO*/color = red,explicit(p(x+1),x,-2,0), /*SE*/ color = red,explicit(m(x),x,0,2))$ From lapeyre.math122a at gmail.com Wed Jan 4 10:42:09 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Wed, 04 Jan 2012 17:42:09 +0100 Subject: [Maxima] taylor series, bfloat, zerop enhancements, something to think about, vs. Macsyma In-Reply-To: <4F03227D.3040905@eecs.berkeley.edu> References: <4F03227D.3040905@eecs.berkeley.edu> Message-ID: <4F048161.5050006@gmail.com> > also, bfloat(1/3,100) gives 100 digits of 1/3. Maxima's bfloat > ignores 2nd. argument. There is something like that in mixima; maybe it could be adapted. It even goes a bit further, but also obscures what's happening. (%i1) [ Head( N(Pi)) , Head( N(Pi,16) ), Head( N(Pi,17) ) ]; (%o1) [Real, Real, Real] (%i2) MiximaHeadStrict : false$ (%i3) [ Head( N(Pi)) , Head( N(Pi,16) ), Head( N(Pi,17) ) ]; (%o3) [Real, Real, BFloat] It might also be nice to display a single number with higher precision without changing the fpprintprec. btw. I don't know if maxima has something like Head() or lisp's type-of. It's useful to have a what_is_this() function. -- John Lapeyre From fateman at eecs.berkeley.edu Wed Jan 4 10:57:30 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 04 Jan 2012 08:57:30 -0800 Subject: [Maxima] taylor series, bfloat, zerop enhancements, something to think about, vs. Macsyma In-Reply-To: <4F048161.5050006@gmail.com> References: <4F03227D.3040905@eecs.berkeley.edu> <4F048161.5050006@gmail.com> Message-ID: <4F0484FA.3010104@eecs.berkeley.edu> On 1/4/2012 8:42 AM, John Lapeyre wrote: >> also, bfloat(1/3,100) gives 100 digits of 1/3. Maxima's bfloat >> ignores 2nd. argument. > There is something like that in mixima; maybe it could be adapted. > It even goes a bit further, but also obscures what's happening. > > (%i1) [ Head( N(Pi)) , Head( N(Pi,16) ), Head( N(Pi,17) ) ]; > (%o1) [Real, Real, Real] > (%i2) MiximaHeadStrict : false$ > > (%i3) [ Head( N(Pi)) , Head( N(Pi,16) ), Head( N(Pi,17) ) ]; > (%o3) [Real, Real, BFloat] > > It might also be nice to display a single number > with higher precision without changing the fpprintprec. maybe this?? print_one_number_prec(x,p):=block([fpprintprec:p], print(x))$ > btw. I don't know if maxima has something like Head() or lisp's > type-of. It's useful to have a what_is_this() function. what_is_this(x):=if ?atom(x) then ?type\-of(x) else ?caar(x) not built in, but could be... > > -- John Lapeyre > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From macrakis at alum.mit.edu Wed Jan 4 11:38:41 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 4 Jan 2012 12:38:41 -0500 Subject: [Maxima] simplified vector display output In-Reply-To: References: Message-ID: How about something like this: (%i1) ex; (%o1) [x^2-1,x^2-x,x^2-2*x+1,x^4-x^3-x+1] (%i2) vfactor(v):=block([g:lreduce('gcd,v),listarith:false],g*map(lambda([q],factor(q/g)),v))$ (%i3) vfactor(ex); (%o3) (x-1)*[x+1,x,x-1,(x-1)*(x^2+x+1)] Note the listarith trick -- the expression a*[b,c] is simplified with listarith:false, so does not expand to [a*b,a*c] even when it is returned from vfactor. But if that expression is resimplified later, it will expand out. To avoid that, you could use "box" if necessary. -s On Tue, Jan 3, 2012 at 13:07, Burgess, Don wrote: > Can Maxima recognize a known vector in a vector expression and give a > simplified display output in terms of the Name of the known vector? > > So, for example, in the Maxima Session represented in the attached image, > I would like Maxima to recognize "F.v1" as a scalar multiplied by a known > vector " v1" and to display the result as "(2*alpha +1)*v1"" > > Thank you very much for your help, > don burgess > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Wed Jan 4 12:48:23 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Wed, 4 Jan 2012 20:48:23 +0200 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Message-ID: About computing integral integrate(exp(-x^k),x,0,1) (%i1) S(k):='integrate(exp(-x^k),x,0,1)$ Note: output from workshet is removed. Plese copy to wxMaxima and execute. (%i2) assume(x>0); Correct results can be obtained in the following ways: a) using formula integrate(f,x,0,1)=integrate(f,x,0,inf)-integrate(f,x,1,inf): (%i3) for k thru 10 do (integrate(exp(-x^k),x,0,inf)-integrate(exp(-x^k),x,1,inf), print(S(k)=%%,"~~",float(%%))); b) using Newton-Leibniz formula integrate(f,x,a,b) = F( b)-F(a) : (%i4) for k thru 10 do (integrate(exp(-x^k),x), subst(x=1,%%)-subst(x=0,%%), float(%%), print(%%)); c) using change of variable y=-x : (%i5) for k thru 10 do (changevar(S(k),y=-x,y,x),ev(%%,nouns), print(S(k)=%%,"~~",float(%%))); d) using change of variable y=1/x : (%i6) for k thru 10 do (changevar(S(k),y=1/x,y,x),ev(%%,nouns), print(S(k)=expand(%%),"~~",float(%%))); e) using change of variable x=y^(2/k) : (%i7) for k thru 10 do (changevar(S(k),x=y^(2/k),y,x),ev(%%,nouns), print(S(k)=expand(%%))); f) using change of variable x=sin(y): (%i8) for k thru 10 do (changevar(S(k),x=sin(y),y,x),ev(%%,nouns), print(S(k)=expand(%%))); g) using change of variable x=cos(y): (%i9) for k thru 10 do (changevar(S(k),x=cos(y),y,x),ev(%%,nouns), print(S(k)=expand(%%))); But, Maxima compute wrong: (%i10) for k thru 10 do (integrate(exp(-x^k),x,0,1), print(S(k)=%%)); I think , that Maxima wrong compute like this: (%i11) for k thru 10 do (a:changevar(S(k),exp(-x^k)=y,y,x), changevar(%%,-log(y)=z,z,y), b:factor(%%), ev(%%,nouns), print(((S(k)=a)=b)=%%)); Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.hennessy at verizon.net Wed Jan 4 15:30:27 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Wed, 04 Jan 2012 16:30:27 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: <77F2B44468E242738F00F487FA309E9F@RichsLaptop> References: <009CCEB07A82462383B5FAF431448497@RichsLaptop> <9483E60A879B4BE293A00D296BF48A6A@RichsLaptop> <77F2B44468E242738F00F487FA309E9F@RichsLaptop> Message-ID: <02DD9B5C5157425BA19D756FB8395EE9@RichsLaptop> For those interested in correctness of evaluating this integral in pw.mac. There is an easy way to get rid of the discontinuity of the antidiff() using pw.mac functions (at least in this case). You can't use the function continuousp() that I wrote to verify it because limit causes a bind stack overflow in this case. You can plot it and it looks continuous, but that is about the only way to tell that I know of without resorting to another CAS. (%i14) integrate(exp(-x^4),x); (%o14) -gamma_incomplete(1/4,x^4)*x/(4*abs(x)) (%i15) F(x):=''(ratsimp(zerospikes(pw(pwsimp(linearize(abs2signum(%)),x,'list),x,'connect)))); (%o15) F(x):=-((gamma_incomplete(1/4,x^4)-gamma(1/4))*signum(x)-gamma(1/4))/4 Now you can use integrate(exp(-x^4),x,a,b) = F(b)-F(a). Rich -----Original Message----- From: Richard Hennessy Sent: Tuesday, January 03, 2012 8:31 PM To: Barton Willis Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate (%i10) continuousp(abs(x),x,0); (%o10) true (%i11) continuousp(abs(x)^2,x,0); (%o11) true (%i12) continuousp(1/abs(x-a),x,a); expt: undefined: 0 to a negative exponent. (%o12) false (%i13) continuousp(1/(x-a),x,a); (%o13) false (%i14) continuousp(1/(x-a)^3,x,a); (%o14) false (%i15) continuousp(1/(sqrt(x-a))^3,x,a); Rich From toy.raymond at gmail.com Wed Jan 4 15:38:31 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Wed, 4 Jan 2012 13:38:31 -0800 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: Message-ID: On Tue, Jan 3, 2012 at 7:06 AM, Aleksas Domarkas wrote: > from > http://www.math.utexas.edu/pipermail/maxima/2012/027277.html > > On Jan. 1, 2012, Barton Willis wrote: > --------------------------- > >*Some definite integrals of exp(-x^4) are broken:*>**>* (%i6) integrate(exp(-t^4),t,0,1);*>* (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4* > > I believe Dan Gildea has fixed this issue; get the latest git code to see the new results. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From peterknicol at gmail.com Wed Jan 4 15:44:34 2012 From: peterknicol at gmail.com (Peter Nicol) Date: Wed, 4 Jan 2012 21:44:34 +0000 Subject: [Maxima] Maxima Tutorial In-Reply-To: <1325713039.4106.1.camel@peter-laptop-x31> References: <1325713039.4106.1.camel@peter-laptop-x31> Message-ID: Happy New Year. I had a look at the Maxima Tutorial and was very impressed. Please also have a look at the Formula Handbook at http://ubuntuone.com/p/ZOF It is also linked from the Mathcentre website. http://www.mathcentre.ac.uk/links/ In particular please look at the top of p67 (p69 in the pdf document) http://ubuntuone.com/p/x77 Although the handbook was created for the engineering students at Aberdeen College it is intended that it should be kept alive by being adopted, extended or altered by other people. That is the reason it is on a Creative Commons licence. There are many hyperlinks within the handbook to link to related topics, to the Mathcentre website to promote the use of their videos and worksheets and to Geogebra (mostly interactive) worksheets. There is a lot of work yet to be done in getting the Intro to wxMaxima up to scratch and comments and suggestions would be appreciated. Peter K Nicol Aberdeen College p.nicol at abcol.ac.uk -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Wed Jan 4 16:18:32 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 4 Jan 2012 14:18:32 -0800 Subject: [Maxima] Bug in limit or integrate Message-ID: <2BAFCD0991DB463B936C15FE40F00CD4@edwinc367e16bd> On Jan. 2, 2012, I wrote ------------------------ > the definite integral of the real function exp(-x^n) over > the real interval (0,1) is broken (spurious imaginary parts, > wrong real parts) for n = 3 through 15, and probably forever. ------------------------ A corrected version of defint.lisp has been checked into git by Dan Gildea in response to my bug report. The corrected version solves my problem. -------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) load("defint-new.lisp"); (%o1) "c:/work2/defint-new.lisp" (%i2) exp_test(n) := ( print (n," qags = ", first( quad_qags (exp(-x^n),x,0,1)), " integrate = ", expand(float(rectform(integrate(exp(-x^n),x,0,1))))))$ (%i3) for m thru 15 do exp_test(m)$ 1 qags = 0.63212055882856 integrate = 0.63212055882856 2 qags = 0.74682413281243 integrate = 0.74682413281243 3 qags = 0.80751118213967 integrate = 0.80751118213967 4 qags = 0.8448385947571 integrate = 0.8448385947571 5 qags = 0.87007466768589 integrate = 0.87007466768589 6 qags = 0.88826369875194 integrate = 0.88826369875194 7 qags = 0.90199160301324 integrate = 0.90199160301324 8 qags = 0.91271857185875 integrate = 0.91271857185875 9 qags = 0.9213308364909 integrate = 0.9213308364909 10 qags = 0.92839720283799 integrate = 0.92839720283799 11 qags = 0.93429939205577 integrate = 0.93429939205577 12 qags = 0.93930307080183 integrate = 0.93930307080183 13 qags = 0.94359882032526 integrate = 0.94359882032526 14 qags = 0.94732690220079 integrate = 0.94732690220079 15 qags = 0.95059283193 integrate = 0.95059283193 -------------------- Ted Woollett From woollett at charter.net Wed Jan 4 17:09:20 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 4 Jan 2012 15:09:20 -0800 Subject: [Maxima] Maxima Tutorial Message-ID: <3986880259AA4DF3BC838BBEFD707ED5@edwinc367e16bd> On Jan. 4, 2012, Peter Nicol wrote: ------------------ >In particular please look at the top of p67 (p69 in the pdf document) >http://ubuntuone.com/p/x77 ------------- This link brings up a 40 page pdf document which is a very nice introduction to wxmaxima with interesting examples worked out. I don't find the advertised "page 69". Also, there is no mention of author(s) or contact email addresses for feedback. The link to the Formula Handbook brings up a nice review of many practical math topics. Ted Woollett From woollett at charter.net Wed Jan 4 17:21:08 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 4 Jan 2012 15:21:08 -0800 Subject: [Maxima] Help Message-ID: <686A18A581D24D7E9402268A231E4F3F@edwinc367e16bd> On Jan. 4, 2012, aishen wrote: ------------------ >I would like to integrate yin or yang... >As I am not an expert, I can't solve the 1/2 circle on the right side ? >Is there a way of doing it ? --------------------------- Could you describe in words what you want the image to look like, relating your verbal description to the functions you have defined? Ted Woollett From rich.hennessy at verizon.net Wed Jan 4 21:00:26 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Wed, 04 Jan 2012 22:00:26 -0500 Subject: [Maxima] Bug in limit or integrate In-Reply-To: References: <2D6DEA23C6D94F9EAA3A92F1126B4760@RichsLaptop>, <009CCEB07A82462383B5FAF431448497@RichsLaptop> <248DBA1BC0D749118FC65FC4DD1D9345@RichsLaptop> Message-ID: Okay, maybe you can't use my function for non real limits of integration and say integrate(exp(-x^4),x,a,b) = F(b)-F(a) when b and a are not real. In the case that they are real you can use it. Rich -----Original Message----- From: Barton Willis Sent: Sunday, January 01, 2012 9:11 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Bug in limit or integrate ----"Richard Hennessy" wrote: ----- >I should not have used the abs() function. This is a simpler answer and it >does not blow up at zero. >(gamma(1/4)/4-gamma_incomplete(1/4,x^4)/4)*signum(x); OK, this antiderivative is valid on the reals. An antiderivative that is valid on the entire complex plane is x |-> x*hypergeometric([1/4],[5/4],-x^4). But Maxima is unable to compute limits of hypergeometric functions, you are out of luck if you used this antiderivative to try to compute integrate(exp(-x^4),x,minf,inf). Some definite integrals of exp(-x^4) are broken: (%i6) integrate(exp(-t^4),t,0,1); (%o6) (%i*(gamma(1/4)-gamma_incomplete(1/4,1)))/4 --bw From bhakta.jim at gmail.com Wed Jan 4 21:48:02 2012 From: bhakta.jim at gmail.com (James Nesta) Date: Wed, 4 Jan 2012 19:48:02 -0800 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Message-ID: <45C72280-356A-4962-89D8-2D9E6E8B3E18@gmail.com> In fooling with this integral I was able to get what I think is a manageable solution. As follows: Transform the variable x to z by the transformation x = z^(1/k), dx = z^(1/k-1)dz, the integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]. I think that Maxima should be able to handle each of these functions. I hope that this helps. Jim From rich.hennessy at verizon.net Wed Jan 4 23:43:56 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 05 Jan 2012 00:43:56 -0500 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In-Reply-To: <45C72280-356A-4962-89D8-2D9E6E8B3E18@gmail.com> References: <45C72280-356A-4962-89D8-2D9E6E8B3E18@gmail.com> Message-ID: <8E22D5C3297E4B689516C8C5C486E4C4@RichsLaptop> "integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]" I think you made a mistake, it should be the integral becomes (1/k)*[gamma(1/k)-incomplete_gamma(1/k, k)] Rich -----Original Message----- From: James Nesta Sent: Wednesday, January 04, 2012 10:48 PM To: maxima at math.utexas.edu Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In fooling with this integral I was able to get what I think is a manageable solution. As follows: Transform the variable x to z by the transformation x = z^(1/k), dx = z^(1/k-1)dz, the integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]. I think that Maxima should be able to handle each of these functions. I hope that this helps. Jim _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Wed Jan 4 23:45:37 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 05 Jan 2012 00:45:37 -0500 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Message-ID: I meant the integral becomes (1/k)*[gamma(1/k)-incomplete_gamma(1/k, z)]. Typo. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 05, 2012 12:43 AM To: James Nesta ; maxima at math.utexas.edu Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) "integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]" I think you made a mistake, it should be the integral becomes (1/k)*[gamma(1/k)-incomplete_gamma(1/k, k)] Rich -----Original Message----- From: James Nesta Sent: Wednesday, January 04, 2012 10:48 PM To: maxima at math.utexas.edu Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In fooling with this integral I was able to get what I think is a manageable solution. As follows: Transform the variable x to z by the transformation x = z^(1/k), dx = z^(1/k-1)dz, the integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]. I think that Maxima should be able to handle each of these functions. I hope that this helps. Jim _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From aishen at free.fr Thu Jan 5 01:29:12 2012 From: aishen at free.fr (aishen) Date: Thu, 05 Jan 2012 08:29:12 +0100 Subject: [Maxima] Help In-Reply-To: <686A18A581D24D7E9402268A231E4F3F@edwinc367e16bd> References: <686A18A581D24D7E9402268A231E4F3F@edwinc367e16bd> Message-ID: <4F055148.8090703@free.fr> Le 05/01/2012 00:21, Edwin Woollett a ?crit : > On Jan. 4, 2012, aishen wrote: > ------------------ >> I would like to integrate yin or yang... >> As I am not an expert, I can't solve the 1/2 circle on the right side ? >> Is there a way of doing it ? > --------------------------- > Could you describe in words what you want > the image to look like, relating your verbal description to the > functions you have defined? > > Ted Woollett > > > > Yes, sorry :) At hawaii edu there is an aera_between_curves.wxm tutorial, after doing it with few curves, I wanted to try it with taijiwu (yin/yang symbol). But I am unable to hide 1/2 small upper circle as the following included pictures : Yin.png is what I obtained, but i would like to delete the 1/2 circle on the right, like I did with gimp for yang.png, but with a function if possible. Maybe my design is uncomplete or wrong ? After I would like to integrate the grey one, I guess it's pi ? (depending x,y). I hope I explain myself clearly enaugh ? Regards Henri Girard -------------- next part -------------- A non-text attachment was scrubbed... Name: yang.png Type: image/png Size: 7039 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: yin.png Type: image/png Size: 6588 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: taiji.wxm Type: application/wxmaxima Size: 1959 bytes Desc: not available URL: From biomates at telefonica.net Thu Jan 5 04:04:20 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 05 Jan 2012 11:04:20 +0100 Subject: [Maxima] Help In-Reply-To: <4F055148.8090703@free.fr> References: <686A18A581D24D7E9402268A231E4F3F@edwinc367e16bd> <4F055148.8090703@free.fr> Message-ID: <1325757860.1650.1.camel@pc> El jue, 05-01-2012 a las 08:29 +0100, aishen escribi?: > Le 05/01/2012 00:21, Edwin Woollett a ?crit : > > On Jan. 4, 2012, aishen wrote: > > ------------------ > >> I would like to integrate yin or yang... > >> As I am not an expert, I can't solve the 1/2 circle on the right side ? > >> Is there a way of doing it ? > > --------------------------- > > Could you describe in words what you want > > the image to look like, relating your verbal description to the > > functions you have defined? > > > > Ted Woollett > > > > > > > > > Yes, sorry :) > > At hawaii edu there is an aera_between_curves.wxm tutorial, after doing > it with few curves, I wanted to try it with taijiwu (yin/yang symbol). > But I am unable to hide 1/2 small upper circle as the following included > pictures : Yin.png is what I obtained, but i would like to delete the > 1/2 circle on the right, like I did with gimp for yang.png, but with a > function if possible. Maybe my design is uncomplete or wrong ? > After I would like to integrate the grey one, I guess it's pi ? > (depending x,y). > I hope I explain myself clearly enaugh ? > Regards > Henri Girard draw2d( proportional_axes = xy, title = "Ying-Yang", ellipse(0,0,2,2,0,360), fill_color = black, filled_func = -sqrt(4-x^2), explicit(if x < 0 then sqrt(-x^2-2*x) else -sqrt(-x^2+2*x),x,-2,2))$ -- Mario From aishen at free.fr Thu Jan 5 04:27:41 2012 From: aishen at free.fr (aishen) Date: Thu, 05 Jan 2012 11:27:41 +0100 Subject: [Maxima] Help In-Reply-To: <1325757860.1650.1.camel@pc> References: <686A18A581D24D7E9402268A231E4F3F@edwinc367e16bd> <4F055148.8090703@free.fr> <1325757860.1650.1.camel@pc> Message-ID: <4F057B1D.8080304@free.fr> Le 05/01/2012 11:04, Mario Rodriguez a ?crit : > El jue, 05-01-2012 a las 08:29 +0100, aishen escribi?: >> Le 05/01/2012 00:21, Edwin Woollett a ?crit : >>> On Jan. 4, 2012, aishen wrote: >>> ------------------ >>>> I would like to integrate yin or yang... >>>> As I am not an expert, I can't solve the 1/2 circle on the right side ? >>>> Is there a way of doing it ? >>> --------------------------- >>> Could you describe in words what you want >>> the image to look like, relating your verbal description to the >>> functions you have defined? >>> >>> Ted Woollett >>> >>> >>> >>> >> Yes, sorry :) >> >> At hawaii edu there is an aera_between_curves.wxm tutorial, after doing >> it with few curves, I wanted to try it with taijiwu (yin/yang symbol). >> But I am unable to hide 1/2 small upper circle as the following included >> pictures : Yin.png is what I obtained, but i would like to delete the >> 1/2 circle on the right, like I did with gimp for yang.png, but with a >> function if possible. Maybe my design is uncomplete or wrong ? >> After I would like to integrate the grey one, I guess it's pi ? >> (depending x,y). >> I hope I explain myself clearly enaugh ? >> Regards >> Henri Girard > > > draw2d( > proportional_axes = xy, > title = "Ying-Yang", > ellipse(0,0,2,2,0,360), > fill_color = black, > filled_func = -sqrt(4-x^2), > explicit(if x< 0 then sqrt(-x^2-2*x) else -sqrt(-x^2+2*x),x,-2,2))$ > > > -- > Mario Thanks, I am really impressed how compact you can do it ? I found myself so ridiculous I didn't ask help for many years, but as I was in a "wall and a bit fed up" I gave up !!! All wx/maxima doers you make my year sunny ! regards Henri > > From lapeyre.math122a at gmail.com Thu Jan 5 09:14:43 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Thu, 05 Jan 2012 16:14:43 +0100 Subject: [Maxima] taylor series, bfloat, zerop enhancements, something to think about, vs. Macsyma In-Reply-To: <4F0484FA.3010104@eecs.berkeley.edu> References: <4F03227D.3040905@eecs.berkeley.edu> <4F048161.5050006@gmail.com> <4F0484FA.3010104@eecs.berkeley.edu> Message-ID: <4F05BE63.2050106@gmail.com> On 01/04/2012 05:57 PM, Richard Fateman wrote: > On 1/4/2012 8:42 AM, John Lapeyre wrote: >> btw. I don't know if maxima has something like Head() or lisp's >> type-of. It's useful to have a what_is_this() function. > > what_is_this(x):=if ?atom(x) then ?type\-of(x) else ?caar(x) Mathematica would use this as well. (defmfun $complexp (x) ($numberp ($substitute 1 '$%i x))) what_is_this(x):= if complexp(x) then 'complex elseif ?atom(x) then ?type\-of(x) else ?caar(x)$ But it's not clear that would be useful for maxima. Eg, if maxima used native lisp complex numbers it would be natural. > print_one_number_prec(x,p):=block([fpprintprec:p], print(x))$ mixima Np() does this. But the return value, unless suppressed, is also displayed normally. -- John Lapeyre From macrakis at alum.mit.edu Thu Jan 5 09:46:48 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 5 Jan 2012 10:46:48 -0500 Subject: [Maxima] taylor series, bfloat, zerop enhancements, something to think about, vs. Macsyma In-Reply-To: <4F05BE63.2050106@gmail.com> References: <4F03227D.3040905@eecs.berkeley.edu> <4F048161.5050006@gmail.com> <4F0484FA.3010104@eecs.berkeley.edu> <4F05BE63.2050106@gmail.com> Message-ID: On Thu, Jan 5, 2012 at 10:14, John Lapeyre wrote: > > On 01/04/2012 05:57 PM, Richard Fateman wrote: > > On 1/4/2012 8:42 AM, John Lapeyre wrote: > >> btw. I don't know if maxima has something like Head() or lisp's > >> type-of. It's useful to have a what_is_this() function. > > > > what_is_this(x):=if ?atom(x) then ?type\-of(x) else ?caar(x) > Not sure what exactly the goal is here. This will return internal objects like RAT (prints as /) and BIGFLOAT (prints as bfloat) which are confusing: (%i16) what_is_this(1/2); (%o16) / (%i17) is(what_is_this(1/2)="/"); (%o17) false (%i18) is(what_is_this(1/2)='rat); (%o18) false (%i19) is(what_is_this(1/2)='?rat); (%o19) true Also need to think about cases like: what_is_this(f[3](x)) => mqapply (prints as subvar) what_is_this('(lambda([x],x)(3))) => => mqapply (prints as subvar) > (defmfun $complexp (x) ($numberp ($substitute 1 '$%i x))) > Poor definition: complexp(log(-%i)) => false OK complexp(log(%i)) => true ??? complexp(f(2)-f(1)) => false OK complexp(f(%i)-f(1)) => true ??? complexp(%i/(%i+1)) => true well, it does simplify to a complex, but is not in canonical form -s -------------- next part -------------- An HTML attachment was scrubbed... URL: From fateman at eecs.berkeley.edu Thu Jan 5 10:53:32 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Thu, 05 Jan 2012 08:53:32 -0800 Subject: [Maxima] taylor series, bfloat, zerop enhancements, something to think about, vs. Macsyma In-Reply-To: References: <4F03227D.3040905@eecs.berkeley.edu> <4F048161.5050006@gmail.com> <4F0484FA.3010104@eecs.berkeley.edu> <4F05BE63.2050106@gmail.com> Message-ID: <4F05D58C.2080502@eecs.berkeley.edu> On 1/5/2012 7:46 AM, Stavros Macrakis wrote: > On Thu, Jan 5, 2012 at 10:14, John Lapeyre > wrote: > > On 01/04/2012 05:57 PM, Richard Fateman wrote: > > On 1/4/2012 8:42 AM, John Lapeyre wrote: > >> btw. I don't know if maxima has something like Head() or lisp's > >> type-of. It's useful to have a what_is_this() function. > > > > what_is_this(x):=if ?atom(x) then ?type\-of(x) else ?caar(x) > > Not sure what exactly the goal is here. Not sure either, but it could be used to dispatch to different numerical-style routines for bigfloats flonums fixnums bignums um, other stuff. -------------- next part -------------- An HTML attachment was scrubbed... URL: From peterknicol at gmail.com Thu Jan 5 14:19:25 2012 From: peterknicol at gmail.com (Peter Nicol) Date: Thu, 5 Jan 2012 20:19:25 +0000 Subject: [Maxima] Maxima Tutorial In-Reply-To: <3986880259AA4DF3BC838BBEFD707ED5@edwinc367e16bd> References: <3986880259AA4DF3BC838BBEFD707ED5@edwinc367e16bd> Message-ID: Dear Ted, Sorry, I got my hyperlinks a bit mixed up. (p67 of the handbook has a link to the wxMaxima document). I have remedied the deficiencies. Also, I realised that I had failed to make reference to your excellent Maxima by Example. That is now corrected. Thanks for the comments, All the Best, Peter On 4 January 2012 23:09, Edwin Woollett wrote: > On Jan. 4, 2012, Peter Nicol wrote: > ------------------ > > In particular please look at the top of p67 (p69 in the pdf document) >> http://ubuntuone.com/p/x77 >> > ------------- > This link brings up a 40 page pdf document > which is a very nice introduction to > wxmaxima with interesting examples worked out. > > I don't find the advertised "page 69". > > Also, there is no mention of author(s) or > contact email addresses for feedback. > > The link to the Formula Handbook brings up a nice > review of many practical math topics. > > Ted Woollett > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Thu Jan 5 16:05:16 2012 From: woollett at charter.net (Edwin Woollett) Date: Thu, 5 Jan 2012 14:05:16 -0800 Subject: [Maxima] new defint.lisp and radexpand:false? Message-ID: <919F4FE57FBC49248589F3726F28108F@edwinc367e16bd> In the git notes http://maxima.git.sourceforge.net/git/gitweb.cgi?p=maxima/maxima;a=commit;h=883dc433283808ff53d04477c540489273197ea3 for the new version of defint.lisp, Dan Gildea has the comment: ------------- integrate(exp(sqrt(x^3)),x,0,1) no longer gives correct answer unless we specify radexpand:false -------------------------------------- I find (gcl) that the previous version of defint.lisp gives the correct integral with radexpand : true (default). ------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) first(quad_qags(exp(sqrt(x^3)),x,0,1)); (%o1) 1.562394062214541 /* v 5.25.1 defint.lisp and radexpand=true */ (%i2) radexpand; (%o2) true (%i3) integrate(exp(sqrt(x^3)),x,0,1); (%o3) -(sqrt(3)*%i+1)*(gamma(2/3)-gamma_incomplete(2/3,-1))/3 (%i4) expand(float(%)); (%o4) 1.562394062217312-4.4408920985006262E-16*%i /* ok except for roundoff errors */ ---------------------------------------------- When I load in the new version of defint.lisp, and leave radexpand : true I get an answer, albeit a wrong answer. But if I set radexpand to false, I only get a noun form. ------------------------------------------------------ (%i5) load("defint-new.lisp"); (%o5) "c:/work2/defint-new.lisp" (%i6) radexpand; (%o6) true /* with new defint.lisp and radexpand=true */ (%i7) integrate(exp(sqrt(x^3)),x,0,1); (%o7) 2*(gamma(2/3)-gamma_incomplete(2/3,-1))/3 (%i8) expand(float(%)); (%o8) 1.353072948602157*%i-0.78119703110866 /* which is a wrong answer as advertised . */ /* now set radexpand to false */ (%i9) radexpand:false$ (%i10) integrate(exp(sqrt(x^3)),x,0,1); (%o10) 'integrate(%e^sqrt(x^3),x,0,1) /* unexpected noun form */ --------------------------------------------------- Ted Woollett From andre.maute at gmx.de Thu Jan 5 17:42:15 2012 From: andre.maute at gmx.de (andre maute) Date: Fri, 06 Jan 2012 00:42:15 +0100 Subject: [Maxima] colorizing matrix elements Message-ID: <4F063557.10303@gmx.de> Hi list, I would like to ask, if someone thinks it is possible to colorize some matrix elements. I have set display2d : true and would like to colorize the zeros of some binary matrices. Regards Andre From aleksasd873 at gmail.com Wed Jan 4 14:43:45 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Wed, 4 Jan 2012 22:43:45 +0200 Subject: [Maxima] Plot region Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2012/027306.html Hi, I would like to integrate yin or yang... As I am not an expert, I can't solve the 1/2 circle on the right side ? Is there a way of doing it ? thank you and best wishes for 2012, regards --------------------that's what I have done yet------------------------------ f(x):= sqrt(4-x^2)$g(x):=sqrt(4-x^2)$p(x):=sqrt(1-x^2)$ o(x):= -sqrt(1-x^2)$n(x):= -sqrt(4-x^2)$m(x):=-sqrt(4-x^2)$ wxdraw2d(user_preamble = ["set size ratio 1","set zeroaxis"],xaxis = true, yaxis = true, /*filling*/ fill_color = grey, filled_func =(f(x),x,0,2), filled_func =(g(x),x,-2,0), filled_func =(o(x-1),x,-2,0), color = red,explicit(p(x+1),x,-2,0), color = red,explicit(n(x),x,-2,0), color = red,explicit(m(x),x,0,2), filled_func = false, /*unfilling*/ filled_func = false, /*NE*/ color = black,explicit(f(x),x,0,2), /*NO*/ color = red,explicit(n(x),x,-2,0), /*1/2SE*/color = black,explicit(o(x-1),x,0,2), /*SW */ color = black,explicit(g(x),x,-2,0), /*1/2NO*/color = red,explicit(p(x+1),x,-2,0), /*SE*/ color = red,explicit(m(x),x,0,2))$ ******************************************************************* load(draw)$ wxdraw2d( proportional_axes=xy, x_voxel = 30, y_voxel = 30, fill_color = grey, region(y<=sqrt(-2*x-x^2) and x^2+y^2<=4, x,-2,2, y,-2,2), region(y<=-sqrt(2*x-x^2) and x^2+y^2<=4, x,-2,2, y,-2,2), color=black, implicit(x^2+y^2=4,x,-2,2, y,-2,2)); Best, Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Thu Jan 5 01:17:27 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Thu, 5 Jan 2012 09:17:27 +0200 Subject: [Maxima] expintegral_e: series failed Message-ID: Double integral of oscilatoring function expintegral_e: series failed A.Domarkas Maxima sin integral funkcion expintegral_si(x)=integrate(sin(t)/t,t,0,x) fail for large x. See http://permalink.gmane.org/gmane.comp.mathematics.maxima.general/36455 This can fix, if we use asymptotic expansion Si(x)~pi/2-sin(x)/x*(1!/x-3!/x^3+5!/x^5-..)-cos(x)/x*(1!-2!/x^2+4!/x^4-..), for x>>1 see http://maji.utsi.edu/courses/06_690_perturbations_2/handout_p6_SpFuncExps.pdf (%i1) si(x):=if x<0 then -si(-x) elseif x>=0 and x<=20 then float(expintegral_si(x)) elseif x>20 and x<10^20 then float(%pi/2-sin(x)/x*(1!/x-3!/x^3+5!/x^5-(7!/x^7)) -cos(x)/x*(1!-2!/x^2+4!/x^4-(6!/x^6))) elseif x>=10^20 then float(%pi/2) else expintegral_si(x)$ Compare with function si() from Mpmath Python library http://code.google.com/p/mpmath/ Examples: (%i2) si(0); (%o2) 0.0 (%i3) si(1); (%o3) 0.946083070367183 (%i4) si(-1); (%o4) -0.946083070367183 (%i5) si(7); (%o5) 1.45459661424809 (%i6) si(10^4); (%o6) 1.570891545385962 (%i7) si(10^22); (%o7) 1.570796326794897 (%i8) si(-10^22); (%o8) -1.570796326794897 (%i9) si(2+3*%i); (%o9) expintegral_si(3*%i+2) (%i10) float(%); (%o10) 1.399196580646055*%i+4.547513889562289 (%i11) si(inf); (%o11) 1.570796326794897 (%i12) si(minf); (%o12) -1.570796326794897 (%i13) log(2); (%o13) log(2) (%i14) float(%), numer; (%o14) 0.693147180559945 Theorem. integrate(integrate(cos(x*y*log(2)),y,1,n),x,1,n)=(si(log(2)*n^2)-2*si(log(2)*n)+si(log(2)))/log(2), where si(x)=integrate(sin(t)/t,t,0,x). (%i15) r:'integrate(integrate(cos(x*y*log(2)),y,1,n),x,1,n); (%o15) integrate(sin(log(2)*n*x)/(log(2)*x)-sin(log(2)*x)/(log(2)*x),x,1,n) (%i16) r1:changevar(r, y=x*log(2), y, x); (%o16) integrate((sin(n*y)-sin(y))/y,y,log(2),log(2)*n)/log(2) (%i17) declare(integrate,linear)$ (%i18) r2:expand(r1); (%o18) integrate(sin(n*y)/y,y,log(2),log(2)*n)/log(2)-integrate(sin(y)/y,y,log(2),log(2)*n)/log(2) (%i19) S:changevar(part(r2,1), x=n*y, x, y)+changevar(part(r2,2), x=y, x, y); (%o19) integrate(sin(x)/x,x,log(2)*n,log(2)*n^2)/log(2)-integrate(sin(x)/x,x,log(2),log(2)*n)/log(2) Note, that si(x) is primitive of sin(x)/x, i.e. diff(si(x),x)=sin(x)/x . Then by Newton-Leibniz formula (%i20) ('si(n^2*log(2))-'si(n*log(2))-('si(n*log(2))-'si(log(2))))/log(2); define(F(n),(%))$ (%o20) (si(log(2)*n^2)-2*si(log(2)*n)+si(log(2)))/log(2) Examples: (%i22) F(10); ev(%, nouns),numer; (%o22) (si(100*log(2))-2*si(10*log(2))+si(log(2)))/log(2) (%o23) -0.959759281504239 (%i24) F(10^2); ev(%, nouns),numer; (%o24) (si(10000*log(2))-2*si(100*log(2))+si(log(2)))/log(2) (%o25) -1.251679029234925 (%i26) F(10^3); ev(%, nouns),numer; (%o26) (si(1000000*log(2))-2*si(1000*log(2))+si(log(2)))/log(2) (%o27) -1.294205651997974 (%i28) F(10^4); ev(%, nouns),numer; (%o28) (si(100000000*log(2))-2*si(10000*log(2))+si(log(2)))/log(2) (%o29) -1.292308315915049 (%i30) F(10^40)$ ev(%, nouns),numer; (%o31) -1.292490307176227 Note that, the standart quadrature functions from Maxima package quadpack , or "quad" from Mpmath Python library in this case return wrong results. Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Thu Jan 5 03:01:31 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Thu, 5 Jan 2012 11:01:31 +0200 Subject: [Maxima] Help Message-ID: help to http://www.math.utexas.edu/pipermail/maxima/2012/027306.html A.Domarkas We draw "Yin&yang". See http://en.wikipedia.org/wiki/Yin_and_yang (%i1) load(draw)$ (%i2) wxdraw2d( proportional_axes=xy, x_voxel = 30, y_voxel = 30, fill_color = grey, region(y<=sqrt(-2*x-x^2) and x^2+y^2<=4, x,-2,2, y,-2,2), region(y<=-sqrt(2*x-x^2) and x^2+y^2<=4, x,-2,2, y,-2,2), color=black, implicit(x^2+y^2=4,x,-2,2, y,-2,2)); (%t2) << Graphics >> (%o2) "Yin&yang" : (%i3) wxdraw2d( proportional_axes=xy, x_voxel = 30, y_voxel = 30, fill_color = black, region(x>=-sqrt(-2*y-y^2) and x^2+y^2<=4, x,-2,2, y,-2,2), region(x>=sqrt(2*y-y^2) and x^2+y^2<=4, x,-2,2, y,-2,2), color=black, implicit(x^2+y^2=4,x,-2,2, y,-2,2), point_type =filled_circle, point_size=5, points([[0,1]]), color=white, points([[0,-1]]) ); (%t3) << Graphics >> (%o3) Aleksas D. Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From harald at ccbib.org Fri Jan 6 10:48:19 2012 From: harald at ccbib.org (Harald Geyer) Date: Fri, 06 Jan 2012 17:48:19 +0100 Subject: [Maxima] colorizing matrix elements In-Reply-To: <4F063557.10303@gmx.de> References: <4F063557.10303@gmx.de> Message-ID: Hi! > I would like to ask, > if someone thinks it is possible to colorize some matrix elements. > > I have set > > display2d : true > > and would like to colorize the zeros of some binary matrices. not directly unless you hack the display code. But assuming you are on an ANSI capable terminal, you could replace the matrix elements by strings, that represent colorized expressions. Perhaps you can expand on the following idea: bold(expr) := apply(concat, [ascii(27), "[01m", string(expr), ascii(27), "[m"]); bold(x+y); bold(0.0); HTH, Harald From andre.maute at gmx.de Fri Jan 6 10:58:09 2012 From: andre.maute at gmx.de (andre maute) Date: Fri, 06 Jan 2012 17:58:09 +0100 Subject: [Maxima] colorizing matrix elements In-Reply-To: References: <4F063557.10303@gmx.de> Message-ID: <4F072821.107@gmx.de> On 01/06/2012 05:48 PM, Harald Geyer wrote: > Hi! > >> I would like to ask, >> if someone thinks it is possible to colorize some matrix elements. >> >> I have set >> >> display2d : true >> >> and would like to colorize the zeros of some binary matrices. > not directly unless you hack the display code. > > But assuming you are on an ANSI capable terminal, you could replace > the matrix elements by strings, that represent colorized expressions. > > Perhaps you can expand on the following idea: > bold(expr) := apply(concat, [ascii(27), "[01m", string(expr), ascii(27), "[m"]); > bold(x+y); > bold(0.0); > Thanks, I'm going to try the ANSI code, when I have some time. At the moment I use the 'strings' " " for 0 and "X" for 1 Regards Andre > HTH, > Harald > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From woollett at charter.net Fri Jan 6 17:16:09 2012 From: woollett at charter.net (Edwin Woollett) Date: Fri, 6 Jan 2012 15:16:09 -0800 Subject: [Maxima] quad_qagi exponential divergence returns Message-ID: For linear divergence, quad_qagi issues a console warning and some error code number > 2 as a warning. ----------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) quad_qagi(x,x,0,inf); ***MESSAGE FROM ROUTINE DQAGI IN LIBRARY SLATEC. ***INFORMATIVE MESSAGE, PROG CONTINUES, TRACEBACK REQUESTED * ABNORMAL RETURN * ERROR NUMBER = 5 * ***END OF MESSAGE (%o1) [0.49999999442512,2.2894791249616908E-5,885,5] ---------------------------------- But for exponential divergence, there is no console warning, and an error code = 0 is returned. The user needs to see the occurrence of #INF in the returned answer to infer the software/machine limit has been reached. ---------------------------------------------- (%i2) quad_qagi(%e^x,x,0,inf); (%o2) [1..#INF00e+000E+2288952,1..#INF00e+000E+2288952,75,0] ------------------------------------------ Ted Woollett From fateman at eecs.berkeley.edu Fri Jan 6 18:24:48 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Fri, 06 Jan 2012 16:24:48 -0800 Subject: [Maxima] evaluating products?? Message-ID: <4F0790D0.9070206@eecs.berkeley.edu> say I create this: s: product(f(i),i,0,n) and later I want to evaluate it with n=3, to get f(0)*f(1)*f(2)*f(3). How? subst(3,n,s) doesn't work. ev(s,n=3) doesn't work. I suspect this failure is a new "feature". RJF From vttoth at vttoth.com Fri Jan 6 18:41:15 2012 From: vttoth at vttoth.com (Viktor T. Toth) Date: Fri, 6 Jan 2012 19:41:15 -0500 Subject: [Maxima] evaluating products?? In-Reply-To: <4F0790D0.9070206@eecs.berkeley.edu> References: <4F0790D0.9070206@eecs.berkeley.edu> Message-ID: <01ca01ccccd5$12ec2cf0$38c486d0$@vttoth.com> Try ev(s,n=3,product). It seems to work for me. Viktor -----Original Message----- From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Richard Fateman Sent: Friday, January 06, 2012 7:25 PM To: Maxima - list Subject: [Maxima] evaluating products?? say I create this: s: product(f(i),i,0,n) and later I want to evaluate it with n=3, to get f(0)*f(1)*f(2)*f(3). How? subst(3,n,s) doesn't work. ev(s,n=3) doesn't work. I suspect this failure is a new "feature". RJF _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From toy.raymond at gmail.com Fri Jan 6 18:42:51 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 6 Jan 2012 16:42:51 -0800 Subject: [Maxima] quad_qagi exponential divergence returns In-Reply-To: References: Message-ID: On Fri, Jan 6, 2012 at 3:16 PM, Edwin Woollett wrote: > For linear divergence, quad_qagi issues a console > warning and some error code number > 2 as > a warning. > > [snip] > But for exponential divergence, there is no console warning, and an error > code = 0 is returned. The user needs to see the occurrence of #INF in the > returned answer to infer the software/machine limit has > been reached. > > ------------------------------**---------------- > (%i2) quad_qagi(%e^x,x,0,inf); > > (%o2) [1..#INF00e+000E+2288952,1..#**INF00e+000E+2288952,75,0] > ------------------------------------------ > > This is really an issue with gcl. It looks like gcl doesn't signal an errors on overflow and uses infinities instead. Other lisps (cmucl and ccl) do signal errors which are silently caught and a noun form is returned. I suppose the routines could check that no infinities or NaNs are returned in the result. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From willisb at unk.edu Fri Jan 6 18:57:15 2012 From: willisb at unk.edu (Barton Willis) Date: Fri, 6 Jan 2012 18:57:15 -0600 Subject: [Maxima] evaluating products?? In-Reply-To: <4F0790D0.9070206@eecs.berkeley.edu> References: <4F0790D0.9070206@eecs.berkeley.edu> Message-ID: (%i40) s : product(f(i),i,0,n)$ (%i41) [ev(s,n=3,product), ev(s,product, n=3),ev(s,n=3,nouns),ev(s,nouns,n=3)]; (%o41) [f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3)] I'd think most uses would expect subst(n=3, product(f(i),i,0,n)) to be identical to product(f(i),i,0,3) :( --Barton -----maxima-bounces at math.utexas.edu wrote: ----- To: Maxima - list From: Richard Fateman Sent by: maxima-bounces at math.utexas.edu Date: 01/06/2012 06:24PM Subject: [Maxima] evaluating products?? say I create this: ? ?s: ?product(f(i),i,0,n) and later I want to evaluate it with n=3, to get f(0)*f(1)*f(2)*f(3). How? ?subst(3,n,s) ?doesn't work. ? ev(s,n=3) doesn't work. I suspect this failure is a new "feature". RJF _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From fateman at eecs.berkeley.edu Fri Jan 6 19:16:27 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Fri, 06 Jan 2012 17:16:27 -0800 Subject: [Maxima] evaluating products?? In-Reply-To: References: <4F0790D0.9070206@eecs.berkeley.edu> Message-ID: <4F079CEB.9070908@eecs.berkeley.edu> On 1/6/2012 4:57 PM, Barton Willis wrote: > (%i40) s : product(f(i),i,0,n)$ > > (%i41) [ev(s,n=3,product), ev(s,product, n=3),ev(s,n=3,nouns),ev(s,nouns,n=3)]; > (%o41) [f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3)] > > I'd think most uses would expect subst(n=3, product(f(i),i,0,n)) to be > identical to product(f(i),i,0,3) :( > > --Barton > > Right. I didn't know it was a product, at first. From bhakta.jim at gmail.com Fri Jan 6 22:02:27 2012 From: bhakta.jim at gmail.com (James Nesta) Date: Fri, 6 Jan 2012 20:02:27 -0800 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In-Reply-To: References: Message-ID: Hi everybody, Thanks for checking my math on this Rich. In looking back at what I wrote I noticed that I had omitted a factor of (1/k) in the transform of the differential. The transform should look like dx = (1/k)*z^(1/k - 1)*dz. I'm sorry if this might have caused confusion; I should monitor my typing more carefully! The version of the incomplete gamma function that I used is from Abramowitz & Stegun (6.5.3); this is the version that I was familiar with from other books. Using this definition I still get the answer that I originally got. In the Maxima reference on this function the integral form of this function follows A&S (6.5.3) but it is identified as A&S (6.5.2), an alternative version. The situation is confusing as to what form Maxima really uses. I think that your solution Rich corresponds to the integral form of incomplete gamma from zero to x, vs my form from x to infinity. In doing a numerical test on Maxima's gamma_incomplete(5,0) I get 24 = 4!, which seems to correspond to the integral form that I used. So it seems to me that the formula reference in Maxima's manual has a typo that is highly misleading. I again apologize to the readers for any confusion that might have arisen from any of my statements and extend my thanks to those, including you, who attempted to clarify the problem. Jim On Wed, Jan 4, 2012 at 9:45 PM, Richard Hennessy wrote: > I meant the integral becomes (1/k)*[gamma(1/k)-incomplete_**gamma(1/k, > z)]. Typo. > > Rich > > -----Original Message----- From: Richard Hennessy > Sent: Thursday, January 05, 2012 12:43 AM > To: James Nesta ; maxima at math.utexas.edu > > Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) > > "integral becomes(1/k)*[gamma(1/k)-**incomplete_gamma(1/k, 1)]" > > I think you made a mistake, it should be > > the integral becomes (1/k)*[gamma(1/k)-incomplete_**gamma(1/k, k)] > > Rich > > -----Original Message----- From: James Nesta > Sent: Wednesday, January 04, 2012 10:48 PM > To: maxima at math.utexas.edu > Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) > > In fooling with this integral I was able to get what I think is a > manageable > solution. As follows: > > Transform the variable x to z by the transformation x = z^(1/k), dx = > z^(1/k-1)dz, > > the integral becomes(1/k)*[gamma(1/k)-**incomplete_gamma(1/k, 1)]. I think > that Maxima should be able to handle each of these functions. I hope that > this helps. > > Jim > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikael at jetmik.dk Sat Jan 7 01:20:09 2012 From: mikael at jetmik.dk (=?ISO-8859-1?Q?Mikael_Sams=F8e_S=F8rensen?=) Date: Sat, 7 Jan 2012 08:20:09 +0100 Subject: [Maxima] New Maxima equation solver Message-ID: I have created a package with a new equation solver for solving equations within real numbers. I have attached the package and a readme file in a zip-file. It will also be available via this link for a short while: https://www.sugarsync.com/pf/D012577_0526777_765876 The package has some other nice functions as well, which are described in the readme file. Here is an example of the usage: (%i3) solvereal(a=72*%e^((0.619/0.22*(%e^22-%e^0.22*t ))),t); Assumptions: [a>0] (%o3) [t=(4588*%e^22)/5717-(1009360*log(a/72))/3538823] I made this package as part of a another project, WordMat, which is available here: www.eduap.com Maybe this can go in the contrib directory. Mikael Sams?e S?rensen -------------- next part -------------- A non-text attachment was scrubbed... Name: SolveReal.zip Type: application/zip Size: 13800 bytes Desc: not available URL: From yasuaki.honda at gmail.com Sat Jan 7 03:38:46 2012 From: yasuaki.honda at gmail.com (=?ISO-2022-JP?B?GyRCS1xFRDkvOTgbKEI=?=) Date: Sat, 7 Jan 2012 18:38:46 +0900 Subject: [Maxima] imaxima mode under mac os X In-Reply-To: References: Message-ID: As soon as I introduced Mac OS X Lion, I experienced the same bug.I fixed it locally, but forgot to push it to the git. (I noticed this mistake by carefully looking at 5.26.0). Today I committed the changes to the git so that next maxima release will come with imaxima with the fix. Thanks and best regards, Yasuaki Honda 2011/11/4 Michel Talon > While i am playing with my new maxima installation, i have seen that > imaxima > doesn't work here on the Mac OS X. > > The solution is simple, one needs to remove the > imaxima-subst-char-in-string > in the computation of the temporary directory, because this chokes with the > way it is formed on the mac. Hence the substitution: > ; (make-directory > ; (setq imaxima-tmp-subdir > ; ;; For some reason TeX doesn't grok underscores in file names > ; (imaxima-subst-char-in-string ?_ ?= > ; (make-temp-name (expand-file-name "imaxima" > imaxima-tmp-dir))))) > (make-directory > (setq imaxima-tmp-subdir > (make-temp-name (expand-file-name "imaxima" imaxima-tmp-dir)))) > > > After that imaxima works OK. At first sight slime is able to coexist. > (Note that TeX has no problem here with the underscore in the name). > > > -- > Michel Talon > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Sat Jan 7 13:13:58 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 7 Jan 2012 12:13:58 -0700 Subject: [Maxima] colorizing matrix elements In-Reply-To: <4F063557.10303@gmx.de> References: <4F063557.10303@gmx.de> Message-ID: On 1/5/12, andre maute wrote: > if someone thinks it is possible to colorize some matrix elements. That's an interesting idea. I see a couple of ways to do it. (1) colorized MathML (XML) output. There is a share package to generate MathML if I recall correctly. Maybe colors can be imposed as attributes or something? (2) colorized wxMaxima output. I think wxMaxima generates HTML or XML for display. Same idea here -- use attributes to set the color. (3) colorized console pretty printer output. I spent a few minutes experimenting with that. It's easy enough to introduce colors via VT100 escape codes. I tried to convert elements to strings, and colorize those, and then punt to the existing display code, but appending color codes makes the strings longer (more characters) and the matrix display then misjudges the display width of the matrix; the matrix is actually narrower. Now that I think about it, I guess a better way to do it is to append the colorization stuff after calculating the size of the element. I would have to go back & dig around in DIM-$MATRIX to figure it out. Anyway perhaps this is interesting in some way. best, Robert Dodier ------------------- begin patch for src/displa.lisp ------------------- $ diff -u /tmp/dim-\$matrix.lisp '/home/robert/maxima/playpen/dim-$matrix-color.lisp' --- /tmp/dim-$matrix.lisp 2012-01-07 11:36:54.000000000 -0700 +++ /home/robert/maxima/playpen/dim-$matrix-color.lisp 2012-01-07 12:10:54.000000000 -0700 @@ -1,7 +1,7 @@ -(displa-def $matrix dim-$matrix) +(displa-def $matrix dim-$matrix-color) -(defun dim-$matrix (form result) - (prog (dmstr rstr cstr consp cols) +(defun dim-$matrix-color (form result) + (prog (dmstr rstr cstr consp cols element-string element-string-display) (setq cols (if ($listp (cadr form)) (length (cadr form)) 0)) (if (or (null (cdr form)) (memalike '((mlist simp)) (cdr form)) @@ -24,7 +24,9 @@ (nc dmstr (cdr nc)) (cs cstr (cdr cs)) (dummy) (h2 0) (d2 0)) ((null c) (setq d1 (+ d1 h1 h2) h1 (1+ d2))) - (setq dummy (dimension (car c) nil 'mparen 'mparen nil 0) + (setq element-string (strgrind (car c))) + (setq element-string-display (concatenate 'string ($vt100 '$red) element-string ($vt100 '$black))) + (setq dummy (dimension element-string-display nil 'mparen 'mparen nil 0) h2 (max h2 height) d2 (max d2 depth)) (cond ((not (checkfit (+ 14. width))) (setq consp t) (return nil)) (t (rplaca nc (cons (list* width height depth dummy) (car nc))) ------------------- end patch for src/displa.lisp ------------------- --------------------- begin vt00.lisp ------------------- ;; vt100.lisp -- change VT100 terminal output foreground color ;; copyright 2012 by Robert Dodier ;; I release this work under terms of the GNU General Public License ;; VT100 foreground colors -- nicked from share/contrib/colorterm.lisp ;;; 30 Black ;;; 31 Red ;;; 32 Green ;;; 33 Yellow ;;; 34 Blue ;;; 35 Magenta ;;; 36 Cyan ;;; 37 White (let ((vt100-colors (make-hash-table))) (setf (gethash '$black vt100-colors) 30.) (setf (gethash '$red vt100-colors) 31.) (setf (gethash '$green vt100-colors) 32.) (setf (gethash '$yellow vt100-colors) 33.) (setf (gethash '$blue vt100-colors) 34.) (setf (gethash '$magenta vt100-colors) 35.) (setf (gethash '$cyan vt100-colors) 36.) (setf (gethash '$white vt100-colors) 37.) (defun $vt100 (color-symbol) (let ((color-code (gethash color-symbol vt100-colors)) (escape-char (code-char 27))) (if color-code (format nil "~a[00;~am" escape-char color-code))))) --------------------- end vt100.lisp ------------------- From robert.dodier at gmail.com Sat Jan 7 13:25:58 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 7 Jan 2012 12:25:58 -0700 Subject: [Maxima] evaluating products?? In-Reply-To: References: <4F0790D0.9070206@eecs.berkeley.edu> Message-ID: On 1/6/12, Barton Willis wrote: > (%i40) s : product(f(i),i,0,n)$ > > (%i41) [ev(s,n=3,product), ev(s,product, > n=3),ev(s,n=3,nouns),ev(s,nouns,n=3)]; > (%o41) > [f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3)] > > I'd think most uses would expect subst(n=3, product(f(i),i,0,n)) to be > identical to product(f(i),i,0,3) :( The observed behavior is consistent with Maxima's general policy for handling nouns vs verbs. In addition, there are simplification flags (simpsum and simpproduct) for sum and product nouns, which simplify to "+" and "*" expressions when (upper minus lower) is an integer. best Robert Dodier From robert.dodier at gmail.com Sat Jan 7 13:25:58 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 7 Jan 2012 12:25:58 -0700 Subject: [Maxima] evaluating products?? In-Reply-To: References: <4F0790D0.9070206@eecs.berkeley.edu> Message-ID: On 1/6/12, Barton Willis wrote: > (%i40) s : product(f(i),i,0,n)$ > > (%i41) [ev(s,n=3,product), ev(s,product, > n=3),ev(s,n=3,nouns),ev(s,nouns,n=3)]; > (%o41) > [f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3),f(0)*f(1)*f(2)*f(3)] > > I'd think most uses would expect subst(n=3, product(f(i),i,0,n)) to be > identical to product(f(i),i,0,3) :( The observed behavior is consistent with Maxima's general policy for handling nouns vs verbs. In addition, there are simplification flags (simpsum and simpproduct) for sum and product nouns, which simplify to "+" and "*" expressions when (upper minus lower) is an integer. best Robert Dodier From woollett at charter.net Sat Jan 7 13:51:20 2012 From: woollett at charter.net (Edwin Woollett) Date: Sat, 7 Jan 2012 11:51:20 -0800 Subject: [Maxima] quad_qagi exponential divergence returns Message-ID: On Jan. 6, 2012, Raymond Toy wrote: ------------------------------- >This is really an issue with gcl. It looks like gcl doesn't signal an >errors on overflow and uses infinities instead. Other lisps (cmucl and >ccl) do signal errors which are silently caught and a noun form is >returned. > >I suppose the routines could check that no infinities or NaNs are returned >in the result. ------------------------------- Thanks for the info. I have inserted an additional check in parts of nint.mac, such as ------------------------ rL : apply ('quad_qagi, argL), if (substring(string(rL[1]),1,8) = "1..#INF" ) then (print(" quad_qagi: overflow"), ans : false) etc., ----------------- which is no big deal. If some of the experts would post Windows binaries using other lisps (cmucl, ccl,..) it would make it easier for Windows slaves (like myself) to check code construction problems of this type. Ted From woollett at charter.net Sat Jan 7 14:38:56 2012 From: woollett at charter.net (Edwin Woollett) Date: Sat, 7 Jan 2012 12:38:56 -0800 Subject: [Maxima] New Maxima equation solver Message-ID: <30F7CBCB63B642BBAF4A3C47406ECC4A@edwinc367e16bd> On Jan. 7, 2012, Mikael Sams?e S?rensen wrote: -------------------------- >I have created a package with a new equation solver for solving >equations within real numbers. --------------------------------- This looks very interesting. I have not tried it out yet, but this package might be the basis for a new section of a revised Ch. 4, Solving Equations (Maxima by Example). In the text file description you mention desolvemore but in the mac code file I only find desolvereal. Perhaps you changed the name? Best Wishes, Ted Woollett From fateman at eecs.berkeley.edu Sat Jan 7 14:38:40 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sat, 07 Jan 2012 12:38:40 -0800 Subject: [Maxima] evaluating products?? In-Reply-To: References: <4F0790D0.9070206@eecs.berkeley.edu> Message-ID: <4F08AD50.1000709@eecs.berkeley.edu> On 1/7/2012 11:25 AM, Robert Dodier wrote: > In addition, there are simplification flags (simpsum and simpproduct) > for sum and product nouns,which simplify to "+" and "*" expressions > when (upper minus lower) is an integer. best Robert Dodier simpproduct is undocumented, at least in 5.23.2 From rich.hennessy at verizon.net Sat Jan 7 15:16:02 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sat, 07 Jan 2012 16:16:02 -0500 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In-Reply-To: References: Message-ID: ?The situation is confusing as to what form Maxima really uses.? 6.5.3 makes sense to me. As for my email I think I misunderstood what you did. Sorry for your confusion, your answer is correct. Rich From: James Nesta Sent: Friday, January 06, 2012 11:02 PM To: Richard Hennessy Cc: maxima at math.utexas.edu Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Hi everybody, Thanks for checking my math on this Rich. In looking back at what I wrote I noticed that I had omitted a factor of (1/k) in the transform of the differential. The transform should look like dx = (1/k)*z^(1/k - 1)*dz. I'm sorry if this might have caused confusion; I should monitor my typing more carefully! The version of the incomplete gamma function that I used is from Abramowitz & Stegun (6.5.3); this is the version that I was familiar with from other books. Using this definition I still get the answer that I originally got. In the Maxima reference on this function the integral form of this function follows A&S (6.5.3) but it is identified as A&S (6.5.2), an alternative version. The situation is confusing as to what form Maxima really uses. I think that your solution Rich corresponds to the integral form of incomplete gamma from zero to x, vs my form from x to infinity. In doing a numerical test on Maxima's gamma_incomplete(5,0) I get 24 = 4!, which seems to correspond to the integral form that I used. So it seems to me that the formula reference in Maxima's manual has a typo that is highly misleading. I again apologize to the readers for any confusion that might have arisen from any of my statements and extend my thanks to those, including you, who attempted to clarify the problem. Jim On Wed, Jan 4, 2012 at 9:45 PM, Richard Hennessy wrote: I meant the integral becomes (1/k)*[gamma(1/k)-incomplete_gamma(1/k, z)]. Typo. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 05, 2012 12:43 AM To: James Nesta ; maxima at math.utexas.edu Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) "integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]" I think you made a mistake, it should be the integral becomes (1/k)*[gamma(1/k)-incomplete_gamma(1/k, k)] Rich -----Original Message----- From: James Nesta Sent: Wednesday, January 04, 2012 10:48 PM To: maxima at math.utexas.edu Subject: Re: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In fooling with this integral I was able to get what I think is a manageable solution. As follows: Transform the variable x to z by the transformation x = z^(1/k), dx = z^(1/k-1)dz, the integral becomes(1/k)*[gamma(1/k)-incomplete_gamma(1/k, 1)]. I think that Maxima should be able to handle each of these functions. I hope that this helps. Jim _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Sat Jan 7 15:16:34 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 7 Jan 2012 14:16:34 -0700 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: Message-ID: Hi Michael, About creating multiple concurrent Maxima sessions, take a look at share/contrib/maxima-server.lisp, which implements a conventional Unixish server. Server listens for clients, accepts a client, and forks a child process to handle the client. Since child processes are in separate virtual address spaces, changes to variables in one don't affect another. I suppose the server could be run with chroot to prevent access to the file system. maxima-server.lisp uses SBCL's POSIX interface. About your project to create a Quicklisp-able Maxima, I think that is a valuable goal, and I'm 100% in favor of you (or anyone) creating their own projects based on Maxima. That said, since you have changed the build system a lot, I am hesitant to merge those changes into Maxima. I am no big fan of defsystem, but changing the build system could affect people who are building packages or installations. If you want to try (or not, that's OK too) to convince me & other developers to merge in your changes, perhaps you can describe how the build machinery will work. I can't guarantee that we'll accept it, but I am interested to hear about it. best Robert Dodier From robert.dodier at gmail.com Sat Jan 7 15:35:16 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 7 Jan 2012 14:35:16 -0700 Subject: [Maxima] Read_array Question In-Reply-To: <1325369187.6799.54.camel@asus> References: <1325369187.6799.54.camel@asus> Message-ID: On 12/31/11, Thomas D. Dean wrote: > The data is > Qth 23 41 a+bx > Z9 3 7 41 > > or, > number number > I want to read this file into maxima. Well, there are a couple of functions to read data from a file when the number of rows isn't known ahead of time. read_matrix reads all the lines and creates a matrix with that many rows. read_hashed_array reads the first item on each line and uses that as a hash key for the remaining items on the line. It returns an "undeclared array" (Maxima terminology for a hash table). But a problem is that the various read_* functions treat each token as a separate item. E.g. a + b is read as two items, a and +b. If your data contain some general expressions, you will probably have to read line by line and play some games with the parser. Sorry for the late reply, hope this helps. Robert Dodier From toy.raymond at gmail.com Sat Jan 7 16:23:02 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sat, 07 Jan 2012 14:23:02 -0800 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: Message-ID: <4F08C5C6.4070608@gmail.com> On 1/7/12 1:16 PM, Robert Dodier wrote: > About your project to create a Quicklisp-able Maxima, I think that > is a valuable goal, and I'm 100% in favor of you (or anyone) > creating their own projects based on Maxima. That said, since > you have changed the build system a lot, I am hesitant to > merge those changes into Maxima. I am no big fan of defsystem, > but changing the build system could affect people who are > building packages or installations. I haven't tried it, but I think using asdf instead of defsystem to build maxima shouldn't be very hard. Switching the existing defsystems to asdf shouldn't be too hard either since the basic syntax is pretty much compatible. The main issue is if asdf will work with gcl. We still build maxima with gcl, right? That would be a show stopper. > > If you want to try (or not, that's OK too) to convince me & other > developers to merge in your changes, perhaps you can describe > how the build machinery will work. I can't guarantee that we'll accept it, > but I am interested to hear about it. > I don't understand why we would need to change the maxima.asd we already have. That should work to build maxima. Oh, there is one hairy issue. If you notice, make will compile maxima and then reload it all again into a fresh image before saving the image. I think James had to do this long ago because of some issues with compile and load order. We haven't been very good about having things defined before they are used. And there used to be issues with different files defining the same function with slightly different behaviors. Don't know if those exist or not anymore. Ray From filonenko.mikhail at gmail.com Sun Jan 8 02:03:49 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Sun, 8 Jan 2012 10:03:49 +0200 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: Message-ID: Hi; > Quicklisp-able 2012/1/8 Robert Dodier : > Hi Michael, > > About creating multiple concurrent Maxima sessions, take a look > at share/contrib/maxima-server.lisp, which implements a conventional > Unixish server. Server listens for clients, accepts a client, and forks > a child process to handle the client. Since child processes are in > separate virtual address spaces, changes to variables in one don't > affect another. I suppose the server could be run with chroot to > prevent access to the file system. maxima-server.lisp uses SBCL's > POSIX interface. Thanks, I will try it. > About your project to create a Quicklisp-able Maxima, I think that > is a valuable goal, and I'm 100% in favor of you (or anyone) > creating their own projects based on Maxima. That said, since > you have changed the build system a lot, I am hesitant to > merge those changes into Maxima. I am no big fan of defsystem, > but changing the build system could affect people who are > building packages or installations. Thanks. I would not want to look like a revolutionary, but for now asdf is widespread and quicklisp supports only it. Quicklisp repositories can make maxima developers free to solve some problems like: filenames, socket, interprocess communication, etc. Today state of my fork is: - repository url: http://github.com/filonenko-mikhail/maxima - all previous git history is saved, so, I only did "quicklisp" branch, in which I repair existing maxima asdf system; - merge changes from "master" to "quicklisp" is easy because git is smart and can handle moving of files; - merge changes from "quicklisp" to "master" is not so easy, because I refactor following things: - lapack, quadpack modules are compiled on-fly, now. I use asdf system examples from f2cl/packages repository; - setup of maxima paths depends on environment variables, and if it does not exist, on asd file path; - there are some external dependencies, which are available from quicklisp repositaries. cl-fad, f2cl (embedded is removed now), getopt (embedded is removed now), trivial-features (windows detection by #+windows, instead of (string= "true" autoconf:**win32*)); - I remove archive/ directory, because lightweight packages are better for quicklisp; - I remove binary output path handling, because asdf and quicklisp do it itself; - I also move source files into directories in accordance with maxima.asd, it is mostly cosmetic change; There are all my changes: https://github.com/filonenko-mikhail/maxima/commits/quicklisp > If you want to try ?(or not, that's OK too) to convince me & other > developers to merge in your changes, perhaps you can describe > how the build machinery will work. I can't guarantee that we'll accept it, > but I am interested to hear about it. There is quicklisp request for adding embedded maxima into repositories. I am trying to find how many peoples are interested in this project. Also, as I said, it is easy to merge mathematical parts of "master" branch into "quicklisp" branch and I can maintain it. The main problem is that I broke mk-defsystem, and I can not support this system. Deploying of maxima depends on mk-defsystem and now it is broken too. If there will be many users, I can repair packaging of maxima, but it will be something, like: sbcl (ql:quickload :maxima) (crossplatform:save-lisp-and-die (lambda() (cl-user::run)) ) For windows/macos/linux bat/sh file: fill environment variables with maxima share, doc, etc paths; execute maxima image. From filonenko.mikhail at gmail.com Sun Jan 8 02:17:35 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Sun, 8 Jan 2012 10:17:35 +0200 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: <4F08C5C6.4070608@gmail.com> References: <4F08C5C6.4070608@gmail.com> Message-ID: 2012/1/8 Raymond Toy : > On 1/7/12 1:16 PM, Robert Dodier wrote: >> About your project to create a Quicklisp-able Maxima, I think that >> is a valuable goal, and I'm 100% in favor of you (or anyone) >> creating their own projects based on Maxima. That said, since >> you have changed the build system a lot, I am hesitant to >> merge those changes into Maxima. I am no big fan of defsystem, >> but changing the build system could affect people who are >> building packages or installations. > I haven't tried it, but I think using asdf instead of defsystem to build > maxima shouldn't be very hard. ?Switching the existing defsystems to > asdf shouldn't be too hard either since the basic syntax is pretty much > compatible. > > The main issue is if asdf will work with gcl. ? We still build maxima > with gcl, right? ?That would be a show stopper. sbcl supports all major operating systems. >> >> If you want to try ?(or not, that's OK too) to convince me & other >> developers to merge in your changes, perhaps you can describe >> how the build machinery will work. I can't guarantee that we'll accept it, >> but I am interested to hear about it. >> > I don't understand why we would need to change the maxima.asd we already > have. ?That should work to build maxima. > > Oh, there is one hairy issue. ?If you notice, make will compile maxima > and then reload it all again into a fresh image before saving the > image. ?I think James had to do this long ago because of some issues > with compile and load order. ?We haven't been very good about having > things defined before they are used. ?And there used to be issues with > different files defining the same function with slightly different > behaviors. ?Don't know if those exist or not anymore. > > Ray > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- With best regards, Michael Filonenko From mmse89 at gmail.com Sun Jan 8 08:02:37 2012 From: mmse89 at gmail.com (=?ISO-8859-1?Q?Moln=E1r_Emese?=) Date: Sun, 8 Jan 2012 15:02:37 +0100 Subject: [Maxima] perform the operation Message-ID: Hi, All! I have a task : solute a system of differential equations. I thougt it so easy.. I have used the desolve command, it's working, but the result is a function (ilt), inverse laplace, and I can't to get the maxima to perform this operate. Have you any idea for this? Mesi -------------- next part -------------- An HTML attachment was scrubbed... URL: From willisb at unk.edu Sun Jan 8 10:20:12 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 8 Jan 2012 10:20:12 -0600 Subject: [Maxima] perform the operation In-Reply-To: References: Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- > I have used the desolve command, it's working, but the result is a function (ilt), inverse laplace, > and I can't ?to get the maxima to perform this operate. If you posted the equations, maybe somebody will find a workaround. To post the equations, please set display2d : false. --Barton From robert.dodier at gmail.com Sun Jan 8 11:24:00 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 8 Jan 2012 10:24:00 -0700 Subject: [Maxima] need Maxima 5.26 for Windows Message-ID: Hi everybody, Can someone build a Windows installer for Maxima 5.26 ? I just looked at the list of files at Sourceforge and I don't see one. I'd like to make a general announcement about 5.26 (sorry for the delay). If nobody builds a Windows installer, I'm not sure what to do. The only thing that comes to mind is to compile Maxima w/ GCL on Windows, dump an image, and package everything as a zip file. Other ideas? best, Robert Dodier From paratribulations at free.fr Sun Jan 8 12:00:34 2012 From: paratribulations at free.fr (TP) Date: Sun, 08 Jan 2012 19:00:34 +0100 Subject: [Maxima] dyadic/vector package by Michael Wirth Message-ID: <1680337.bOQ7bk7Hq4@rama> Hello, I am looking for powerful vector (and possibly dyadic) CAS capabilities, *without introducing components*. Look at the following article: http://www.apmaths.uwo.ca/~djeffrey/Offprints/LJcalculemus.pdf In the interesting state-of-the-art part of this article, the authors mention a Macsyma package, which is the work of Stoutemeyer, described in: [12]. Stoutemyer, D.R., 1979. Symbolic computer vector analysis. Computers & Mathematics with Applications, 5, 1-9. It seems that David Stoutemyer contributes to this newsgroup from time to time. The package mentioned in [12] seems to be vect.mac. Can you confirm? $ head share/vector/vect.mac /*-*-MACSYMA-*-*/ eval_when(batch,ttyoff:true)$ /* Or use the BATCHLOAD command to load this with TTYOFF:TRUE */ /* NOTE: THE CURRENT VERSION OF VECT IS THE ONE DUE TO STOUTEMYER. IT WILL BE REPLACED SOON BY AN EXTENDED VERSION WHICH HANDLES BOTH VECTORS AND DYADICS. MICHAEL C. WIRTH (MCW) 12/18/78 So, this package should have been superseded by the work of Michael Wirth, described in the following article: SIAM J. Comput. 8, pp. 306-319 Symbolic Vector and Dyadic Analysis Michael C. Wirth http://epubs.siam.org/sicomp/resource/1/smjcat/v8/i3/p306_s1?isAuthorized=no By looking in the source code of Macsyma, I find only one mention of Michael Wirth: $ grep -ril "wirth" * share/vector/vect.mac share/vector/vect.usg Has the package of Wirth ever been commited? What happened exactly? Thanks in advance, TP From paratribulations at free.fr Sun Jan 8 11:56:10 2012 From: paratribulations at free.fr (TP) Date: Sun, 08 Jan 2012 18:56:10 +0100 Subject: [Maxima] dyadic/vector package by Michael Wirth Message-ID: Hello, I am looking for powerful vector (and possibly dyadic) CAS capabilities, *without introducing components*. Look at the following article: http://www.apmaths.uwo.ca/~djeffrey/Offprints/LJcalculemus.pdf In the interesting state-of-the-art part of this article, the authors mention a Macsyma package, which is the work of Stoutemeyer, described in: [12]. Stoutemyer, D.R., 1979. Symbolic computer vector analysis. Computers & Mathematics with Applications, 5, 1-9. It seems that David Stoutemyer contributes to this newsgroup from time to time. The package mentioned in [12] seems to be vect.mac. Can you confirm? $ head share/vector/vect.mac /*-*-MACSYMA-*-*/ eval_when(batch,ttyoff:true)$ /* Or use the BATCHLOAD command to load this with TTYOFF:TRUE */ /* NOTE: THE CURRENT VERSION OF VECT IS THE ONE DUE TO STOUTEMYER. IT WILL BE REPLACED SOON BY AN EXTENDED VERSION WHICH HANDLES BOTH VECTORS AND DYADICS. MICHAEL C. WIRTH (MCW) 12/18/78 So, this package should have been superseded by the work of Michael Wirth, described in the following article: SIAM J. Comput. 8, pp. 306-319 Symbolic Vector and Dyadic Analysis Michael C. Wirth http://epubs.siam.org/sicomp/resource/1/smjcat/v8/i3/p306_s1?isAuthorized=no By looking in the source code of Macsyma, I find only one mention of Michael Wirth: $ grep -ril "wirth" * share/vector/vect.mac share/vector/vect.usg Has the package of Wirth ever been commited? What happened exactly? Thanks in advance, TP From jan.mueller at math.uni-dortmund.de Sun Jan 8 13:08:38 2012 From: jan.mueller at math.uni-dortmund.de (=?ISO-8859-15?Q?Jan_Hendrik_M=FCller?=) Date: Sun, 08 Jan 2012 20:08:38 +0100 Subject: [Maxima] bug in is()? Message-ID: <4F09E9B6.8060909@math.uni-dortmund.de> Hi, the commands is() and is(equal()) evaluate differently: expand((x+1)*(x+2)*(x+3)); -> x^3+6*x^2+11*x+6 is(equal(x^3+6*x^2+11*x+6,(x+1)*(x+2)*(x+3))); -> true is(x^3+6*x^2+11*x+6=(x+1)*(x+2)*(x+3)); -> false is this a bug in is()? Jan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: isequal.wxm URL: From robert.dodier at gmail.com Sun Jan 8 13:17:43 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 8 Jan 2012 12:17:43 -0700 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: <4F08C5C6.4070608@gmail.com> References: <4F08C5C6.4070608@gmail.com> Message-ID: On 1/7/12, Raymond Toy wrote: > I haven't tried it, but I think using asdf instead of defsystem to build > maxima shouldn't be very hard. Switching the existing defsystems to > asdf shouldn't be too hard either since the basic syntax is pretty much > compatible. Well, there exists a maxima.asd and it successfully compiles & loads Maxima. I'll append a quick n dirty patch to get make to build Maxima via asdf instead of defsystem. (Defsystem is also used to generate dependencies and translate Fortran to Lisp, and maybe other stuff, so there is some additional work to do.) > The main issue is if asdf will work with gcl. We still build maxima > with gcl, right? That would be a show stopper. Well, if we can find another Lisp for Windows, we wouldn't need GCL .... > Oh, there is one hairy issue. If you notice, make will compile maxima > and then reload it all again into a fresh image before saving the > image. I think James had to do this long ago because of some issues > with compile and load order. We haven't been very good about having > things defined before they are used. And there used to be issues with > different files defining the same function with slightly different > behaviors. Don't know if those exist or not anymore. Yeah -- I guess that stuff should be cleaned up. That's independent of asdf vs defsystem, right? best Robert Dodier PS. I built Maxima (./configure --enable cmucl && make) after making this change. diff --git a/src/Makefile.am b/src/Makefile.am index f94cf13..5b1d6ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,11 +6,10 @@ else bin_SCRIPTS = maxima rmaxima endif -LOADDEFSYSTEM = (load "$(top_srcdir)/lisp-utils/defsystem.lisp") +LOADDEFSYSTEM = (require :asdf) LOADMAKEDEPENDS = (load "$(top_srcdir)/lisp-utils/make-depends.lisp") -DEFSYSTEMCOMPILE = (funcall (intern (symbol-name :operate-on-system) :mk) "maxima" :compile :verbose t) -DEFSYSTEMLOAD = (funcall (intern (symbol-name :operate-on-system) :mk) "maxima" :load :verbose t) -DEFSYSTEMTESTLOAD = (funcall (intern (symbol-name :operate-on-system) :mk) "maxima" :load :verbose t :test t) +DEFSYSTEMCOMPILE = (funcall (intern (symbol-name :operate) :asdf) (intern (symbol-name :compile-op) :asdf) :maxima) +DEFSYSTEMLOAD = (funcall (intern (symbol-name :operate) :asdf) (intern (symbol-name :load-op) :asdf) :maxima) if CLISP EXECUTECLISP = $(CLISP_NAME) -norc -q -x From robert.dodier at gmail.com Sun Jan 8 13:19:59 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 8 Jan 2012 12:19:59 -0700 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <4F08C5C6.4070608@gmail.com> Message-ID: On 1/8/12, Michael Filonenko wrote: > sbcl supports all major operating systems. Last time I tried SBCL on Windows (a couple of years ago) it printed some kind of message about "use at your own risk, the kitten of death awaits" or something like that. Is SBCL for Windows really finished at this point? (I hope so.) best Robert Dodier From macrakis at alum.mit.edu Sun Jan 8 13:22:45 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 8 Jan 2012 14:22:45 -0500 Subject: [Maxima] bug in is()? In-Reply-To: <4F09E9B6.8060909@math.uni-dortmund.de> References: <4F09E9B6.8060909@math.uni-dortmund.de> Message-ID: No, is(equal(A,B)) compares for equality of *value*, while is(A=B) compares for equality of *form*. Some examples: (%i25) apply('matrix,makelist([is(i[1]=i[2]),is(equal(i[1],i[2])), i[1],i[2]], i, [[1,1.0], [.5,1/2], [(x-1)/x,1-1/x], [(x-1)*(x+1),x^2-1], [x,rat(x)], [1+x,taylor(1+x,x,0,3)], [1+x,taylor(1+x,x,1,3)]])); (%o25) matrix([false,true,1,1.0], [false,true,0.5,1/2], [false,true,(x-1)/x,1-1/x], [false,true,(x-1)*(x+1),x^2-1], [true,true,x,x], << rat(x) is first ratdisrep'ed [true,true,x+1,1+x], << taylor(x,...) is first ratdisrep'ed [true,true,x+1,2+(x-1)]) << general simplifier converts 2+(x-1) to x+1 after ratdisrep On Sun, Jan 8, 2012 at 14:08, Jan Hendrik M?ller < jan.mueller at math.uni-dortmund.de> wrote: > Hi, > the commands is() and is(equal()) evaluate differently: > expand((x+1)*(x+2)*(x+3)); > -> x^3+6*x^2+11*x+6 > is(equal(x^3+6*x^2+11*x+6,(x+**1)*(x+2)*(x+3))); > -> true > is(x^3+6*x^2+11*x+6=(x+1)*(x+**2)*(x+3)); > -> false > is this a bug in is()? > Jan > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Sun Jan 8 15:39:36 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 08 Jan 2012 13:39:36 -0800 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <4F08C5C6.4070608@gmail.com> Message-ID: On 1/8/12 11:17 AM, Robert Dodier wrote: > On 1/7/12, Raymond Toy wrote: > >> I haven't tried it, but I think using asdf instead of defsystem to build >> maxima shouldn't be very hard. Switching the existing defsystems to >> asdf shouldn't be too hard either since the basic syntax is pretty much >> compatible. > > Well, there exists a maxima.asd and it successfully compiles & > loads Maxima. I'll append a quick n dirty patch to get make to build > Maxima via asdf instead of defsystem. (Defsystem is also used to > generate dependencies and translate Fortran to Lisp, and maybe > other stuff, so there is some additional work to do.) The conversion to asdf for the defsystems that translate Fortran to Lisp will be a bit harder, but I already do a lot of that work with f2cl (so that it could be included with quicklisp), so we can steal most of it from f2cl. > >> The main issue is if asdf will work with gcl. We still build maxima >> with gcl, right? That would be a show stopper. > > Well, if we can find another Lisp for Windows, we wouldn't need GCL .... Sure, but we haven't really done that yet. Ccl seems to work pretty well on Windows and didn't someone already do a windows installer with ccl? Perhaps it's time to drop support for gcl? > >> Oh, there is one hairy issue. If you notice, make will compile maxima >> and then reload it all again into a fresh image before saving the >> image. I think James had to do this long ago because of some issues >> with compile and load order. We haven't been very good about having >> things defined before they are used. And there used to be issues with >> different files defining the same function with slightly different >> behaviors. Don't know if those exist or not anymore. > > Yeah -- I guess that stuff should be cleaned up. That's independent > of asdf vs defsystem, right? Sort of. I don't know if these issues exist anymore, but to be safe, we'd have to arrange it so that asdf:oos will actually build everything and then load everything again. I, for one, have a hard enough time dealing with bug reports from maxima and I don't want to have to deal with a quicklisp version that builds things in the same but slightly different way. Ray From willisb at unk.edu Sun Jan 8 15:58:06 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 8 Jan 2012 15:58:06 -0600 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <4F08C5C6.4070608@gmail.com> Message-ID: maxima-bounces at math.utexas.edu wrote on 01/08/2012 03:39:36 PM: > Sure, but we haven't really done that yet. Ccl seems to work pretty > well on Windows and didn't someone already do a windows installer with > ccl? Perhaps it's time to drop support for gcl? Yes, Andrej Vodopivec built a Maxima installer for windows + ccl; see, for example: http://www.math.utexas.edu/pipermail/maxima/2011/024381.html Two problems: (1) CCL uses the SSE2 instruction set. This will be a problem for older computers. (2) Last I tried, the 32 bit CCL has a bug that creates one test suite failure. I'd guess the CCL developers would fix (2) if we could isolate the problem. Problem (1) is harder--I've been know to use old computers. --Barton -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Sun Jan 8 16:35:53 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 08 Jan 2012 14:35:53 -0800 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <4F08C5C6.4070608@gmail.com> Message-ID: <4F0A1A49.8020705@gmail.com> On 1/8/12 1:58 PM, Barton Willis wrote: > maxima-bounces at math.utexas.edu wrote on 01/08/2012 03:39:36 PM: > > >> Sure, but we haven't really done that yet. Ccl seems to work pretty >> well on Windows and didn't someone already do a windows installer with >> ccl? Perhaps it's time to drop support for gcl? > > Yes, Andrej Vodopivec built a Maxima installer for windows + ccl; see, > for example: > http://www.math.utexas.edu/pipermail/maxima/2011/024381.html > > Two problems: > > (1) CCL uses the /SSE2 instruction set. This will be a problem for > older computers./ > (2) Last I tried, the 32 bit CCL has a bug that creates one test suite > failure. > > I'd guess the CCL developers would fix (2) if we could isolate the > problem. > Problem (1) is harder--I've been know to use old computers. I have some old machines, but only one does not have sse2. And that machine is so old and slow (1.2 GHz I think) that I don't even want to use it anymore. I need to take it to the Great Computer Recycling Center someday. I'll try to isolate the test suite failure since I do sometimes use 32-bit ccl. Ray From toy.raymond at gmail.com Sun Jan 8 16:35:53 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 08 Jan 2012 14:35:53 -0800 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <4F08C5C6.4070608@gmail.com> Message-ID: <4F0A1A49.8020705@gmail.com> On 1/8/12 1:58 PM, Barton Willis wrote: > maxima-bounces at math.utexas.edu wrote on 01/08/2012 03:39:36 PM: > > >> Sure, but we haven't really done that yet. Ccl seems to work pretty >> well on Windows and didn't someone already do a windows installer with >> ccl? Perhaps it's time to drop support for gcl? > > Yes, Andrej Vodopivec built a Maxima installer for windows + ccl; see, > for example: > http://www.math.utexas.edu/pipermail/maxima/2011/024381.html > > Two problems: > > (1) CCL uses the /SSE2 instruction set. This will be a problem for > older computers./ > (2) Last I tried, the 32 bit CCL has a bug that creates one test suite > failure. > > I'd guess the CCL developers would fix (2) if we could isolate the > problem. > Problem (1) is harder--I've been know to use old computers. I have some old machines, but only one does not have sse2. And that machine is so old and slow (1.2 GHz I think) that I don't even want to use it anymore. I need to take it to the Great Computer Recycling Center someday. I'll try to isolate the test suite failure since I do sometimes use 32-bit ccl. Ray From andre.maute at gmx.de Sun Jan 8 17:53:20 2012 From: andre.maute at gmx.de (andre maute) Date: Mon, 09 Jan 2012 00:53:20 +0100 Subject: [Maxima] invert_by_lu does not work as expected Message-ID: <4F0A2C70.2080600@gmx.de> Hi list, I have the following maxima file with output, where a double invocation of invert_by_lu results in an error Regards Andre ----------- matrix_bug.max ---------------- display2d : false; M : matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]); /* works */ Minv : invert(M); Minvinv : invert(invert(M)); /* doesn't work */ Minv : invert_by_lu(M); Minvinv : invert_by_lu(invert_by_lu(M)); ----------- matrix_bug.max ---------------- ----------- matrix_bug.txt ---------------- Maxima 5.24.0 http://maxima.sourceforge.net using Lisp SBCL 1.0.40-1.fc14 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) batch(matrix_bug.max) read and interpret file: /home/user/matrix_bug.max (%i2) display2d : false (%o2) false (%i3) M:matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%o3) matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%i4) Minv:invert(M) (%o4) matrix([1,0,0],[-v[[1,0],[0,0]],1,0], [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]) (%i5) Minvinv:invert(invert(M)) (%o5) matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%i6) Minv:invert_by_lu(M) (%o6) matrix([1,0,0],[-v[[1,0],[0,0]],1,0], [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]) (%i7) Minvinv:invert_by_lu(invert_by_lu(M)) Maxima encountered a Lisp error: The value NIL is not of type CHARACTER. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. (%o8) "/home/user/matrix_bug.max" ----------- matrix_bug.txt ---------------- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: matrix_bug.max URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: matrix_bug.txt URL: From rich.hennessy at verizon.net Sun Jan 8 20:35:11 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 08 Jan 2012 21:35:11 -0500 Subject: [Maxima] Difference between area under curve and integrate Message-ID: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> Hi list, Is there a way to force Maxima to try to find a real solution to an integration problem so that it represents the area under the curve in cases where you get a complex number? Consider, kill(all)$ load(abs_integrate)$ rectform(float(rectform(integrate(exp(-signum(x-1)*x^3),x,-1,2)))); 0.22200130530517 - 1.162123315419017 %i If you plot the integrand it is just a real valued function with a well defined area under it but in this case it gives a complex number for an answer. Rich -------------- next part -------------- An HTML attachment was scrubbed... URL: From alserkli at inbox.ru Mon Jan 9 04:53:24 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Mon, 9 Jan 2012 12:53:24 +0200 Subject: [Maxima] Difference between area under curve and integrate In-Reply-To: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> References: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> Message-ID: On Sun, 8 Jan 2012, Richard Hennessy wrote: > Is there a way to force Maxima to try to find a real solution to an > integration problem so that it represents the area under the curve > in cases where you get a complex number? > > Consider, > kill(all)$ > load(abs_integrate)$ > rectform(float(rectform(integrate(exp(-signum(x-1)*x^3),x,-1,2)))); > 0.22200130530517 - 1.162123315419017 %i > > If you plot the integrand it is just a real valued function with a > well defined area under it but in this case it gives a complex > number for an answer. If you want the number there is no point to do symbolic integration: (%i1) quad_qags(exp(-signum(x-1)*x^3),x,-1,2); (%o1) [2.234857932271402, 7.871672202952595e-10, 441, 0] -- Regards, ASK From willisb at unk.edu Mon Jan 9 07:14:56 2012 From: willisb at unk.edu (Barton Willis) Date: Mon, 9 Jan 2012 07:14:56 -0600 Subject: [Maxima] Difference between area under curve and integrate In-Reply-To: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> References: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> Message-ID: This is a abs_integrate bug; if you report it, I'll try to fix it. --Barton -----maxima-bounces at math.utexas.edu wrote: ----- To: "Maxima List" From: "Richard Hennessy" Sent by: maxima-bounces at math.utexas.edu Date: 01/08/2012 08:35PM Subject: [Maxima] Difference between area under curve and integrate Hi list, ? Is there a way to force Maxima to try to find a real solution to an integration problem so that it represents the area under the curve in cases where you get a complex number?? ? Consider, kill(all)$ load(abs_integrate)$ rectform(float(rectform(integrate(exp(-signum(x-1)*x^3),x,-1,2)))); 0.22200130530517 - 1.162123315419017 %i ? If you plot the integrand it is just a real valued function with a well defined area under it but in this case it gives a complex number for an answer. ? Rich ? _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From ferriste at gmail.com Mon Jan 9 07:39:09 2012 From: ferriste at gmail.com (Stefano Ferri) Date: Mon, 9 Jan 2012 14:39:09 +0100 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: <4F0A1A49.8020705@gmail.com> References: <4F08C5C6.4070608@gmail.com> <4F0A1A49.8020705@gmail.com> Message-ID: About the problem of ccl and sse2 there was a discussion on the list some time ago, and the solution was to condinue with the distribution of an installer based on gcl (or any lisp with no need for sse2, indeed). This is a problem to think about: users with such old pcs are not so negligible in number (for a statistic, I am one of them with an old Sempron 2800+), moreover I don't see why some users should be excluded if there are other lisps as valid options. Sorry for going OT from the original argument of the discussion. Stefano 2012/1/8 Raymond Toy > On 1/8/12 1:58 PM, Barton Willis wrote: > > maxima-bounces at math.utexas.edu wrote on 01/08/2012 03:39:36 PM: > > > > > >> Sure, but we haven't really done that yet. Ccl seems to work pretty > >> well on Windows and didn't someone already do a windows installer with > >> ccl? Perhaps it's time to drop support for gcl? > > > > Yes, Andrej Vodopivec built a Maxima installer for windows + ccl; see, > > for example: > > http://www.math.utexas.edu/pipermail/maxima/2011/024381.html > > > > Two problems: > > > > (1) CCL uses the /SSE2 instruction set. This will be a problem for > > older computers./ > > (2) Last I tried, the 32 bit CCL has a bug that creates one test suite > > failure. > > > > I'd guess the CCL developers would fix (2) if we could isolate the > > problem. > > Problem (1) is harder--I've been know to use old computers. > > I have some old machines, but only one does not have sse2. And that > machine is so old and slow (1.2 GHz I think) that I don't even want to > use it anymore. I need to take it to the Great Computer Recycling > Center someday. > > I'll try to isolate the test suite failure since I do sometimes use > 32-bit ccl. > > Ray > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From filonenko.mikhail at gmail.com Mon Jan 9 13:58:20 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Mon, 9 Jan 2012 21:58:20 +0200 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: References: <4F08C5C6.4070608@gmail.com> Message-ID: Not fully finished, I saw that x86 version is available and supported, and x86_64 is in progress. 2012/1/8 Robert Dodier : > On 1/8/12, Michael Filonenko wrote: > >> sbcl supports all major operating systems. > > Last time I tried SBCL on Windows (a couple of years ago) > it printed some kind of message about "use at your own risk, > the kitten of death awaits" or something like that. > Is SBCL for Windows really finished at this point? (I hope so.) > > best > > Robert Dodier -- With best regards, Michael Filonenko From camm at maguirefamily.org Mon Jan 9 14:02:55 2012 From: camm at maguirefamily.org (Camm Maguire) Date: Mon, 09 Jan 2012 15:02:55 -0500 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: (Raymond Toy's message of "Sun, 08 Jan 2012 13:39:36 -0800") References: <4F08C5C6.4070608@gmail.com> Message-ID: <877h10abkg.fsf@maguirefamily.org> >>> The main issue is if asdf will work with gcl. We still build maxima >>> with gcl, right? That would be a show stopper. >> Greetings! Needless to say, if you need asdf to work on gcl, it will work on gcl. But I'd like to focus my development time on what is being actually used in real applications. Take care, -- Camm Maguire camm at maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah From rich.hennessy at verizon.net Mon Jan 9 16:51:02 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Mon, 09 Jan 2012 17:51:02 -0500 Subject: [Maxima] Difference between area under curve and integrate In-Reply-To: References: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> Message-ID: Done. -----Original Message----- From: Barton Willis Sent: Monday, January 09, 2012 8:14 AM To: rich.hennessy at verizon.net Cc: maxima at math.utexas.edu Subject: Re: [Maxima] Difference between area under curve and integrate This is a abs_integrate bug; if you report it, I'll try to fix it. --Barton -----maxima-bounces at math.utexas.edu wrote: ----- To: "Maxima List" From: "Richard Hennessy" Sent by: maxima-bounces at math.utexas.edu Date: 01/08/2012 08:35PM Subject: [Maxima] Difference between area under curve and integrate Hi list, Is there a way to force Maxima to try to find a real solution to an integration problem so that it represents the area under the curve in cases where you get a complex number? Consider, kill(all)$ load(abs_integrate)$ rectform(float(rectform(integrate(exp(-signum(x-1)*x^3),x,-1,2)))); 0.22200130530517 - 1.162123315419017 %i If you plot the integrand it is just a real valued function with a well defined area under it but in this case it gives a complex number for an answer. Rich _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Mon Jan 9 16:58:18 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Mon, 09 Jan 2012 17:58:18 -0500 Subject: [Maxima] Difference between area under curve and integrate In-Reply-To: References: <4BB43C2CBC7F45F6BC7C2FCC380CF889@RichsLaptop> Message-ID: <06BB8DD3EB0040229C210A31874A4D7F@RichsLaptop> "If you want the number there is no point to do symbolic integration:" Yes, but sometimes you want the solution in exact form. This integral evaluates to gamma_incomplete(1/3,-1)/3-gamma_incomplete(1/3,8)/3 which is an exact form and better than just a number. Except that in this case it is wrong. Rich -----Original Message----- From: Alexander Klimov Sent: Monday, January 09, 2012 5:53 AM To: Richard Hennessy Cc: Maxima List Subject: Re: [Maxima] Difference between area under curve and integrate On Sun, 8 Jan 2012, Richard Hennessy wrote: > Is there a way to force Maxima to try to find a real solution to an > integration problem so that it represents the area under the curve > in cases where you get a complex number? > > Consider, > kill(all)$ > load(abs_integrate)$ > rectform(float(rectform(integrate(exp(-signum(x-1)*x^3),x,-1,2)))); > 0.22200130530517 - 1.162123315419017 %i > > If you plot the integrand it is just a real valued function with a > well defined area under it but in this case it gives a complex > number for an answer. If you want the number there is no point to do symbolic integration: (%i1) quad_qags(exp(-signum(x-1)*x^3),x,-1,2); (%o1) [2.234857932271402, 7.871672202952595e-10, 441, 0] -- Regards, ASK From toy.raymond at gmail.com Mon Jan 9 21:13:06 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 09 Jan 2012 19:13:06 -0800 Subject: [Maxima] Fork of maxima for make it more embeddable. In-Reply-To: <877h10abkg.fsf@maguirefamily.org> References: <4F08C5C6.4070608@gmail.com> <877h10abkg.fsf@maguirefamily.org> Message-ID: <4F0BACC2.6030502@gmail.com> On 1/9/12 12:02 PM, Camm Maguire wrote: >>>> The main issue is if asdf will work with gcl. We still build maxima >>>> with gcl, right? That would be a show stopper. > Greetings! Needless to say, if you need asdf to work on gcl, it will > work on gcl. But I'd like to focus my development time on what is being > actually used in real applications. > Are you saying asdf does not currently work with gcl, but you'll make it work? That would be very nice. I suspect quicklisp does not run with gcl, but we don't really care about that right now as long as gcl can use asdf to build maxima. Ray From willisb at unk.edu Mon Jan 9 22:04:37 2012 From: willisb at unk.edu (Barton Willis) Date: Mon, 9 Jan 2012 22:04:37 -0600 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <4F0A2C70.2080600@gmx.de> References: <4F0A2C70.2080600@gmx.de> Message-ID: It seems to work for me: (%i10) Minvinv:invert_by_lu(invert_by_lu(M)); (%o10) matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%i11) build_info(); Maxima version: 5.25.0 Maxima build date: 16:14 8/15/2011 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 (%o11) --Barton -----maxima-bounces at math.utexas.edu wrote: ----- To: maxima at math.utexas.edu From: andre maute Sent by: maxima-bounces at math.utexas.edu Date: 01/08/2012 06:00PM Subject: [Maxima] invert_by_lu does not work as expected Hi list, I have the following maxima file with output, where a double invocation of invert_by_lu results in an error Regards Andre ----------- matrix_bug.max ---------------- display2d : false; M : matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]); /* works */ Minv : invert(M); Minvinv : invert(invert(M)); /* doesn't work */ Minv : invert_by_lu(M); Minvinv : invert_by_lu(invert_by_lu(M)); ----------- matrix_bug.max ---------------- ----------- matrix_bug.txt ---------------- Maxima 5.24.0 http://maxima.sourceforge.net using Lisp SBCL 1.0.40-1.fc14 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) ? ? ? ? ? ? ? ? ? ? ? ?batch(matrix_bug.max) read and interpret file: /home/user/matrix_bug.max (%i2) ? ? ? ? ? ? ? ? ? ? ? ? ?display2d : false (%o2) false (%i3) M:matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%o3) matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%i4) Minv:invert(M) (%o4) matrix([1,0,0],[-v[[1,0],[0,0]],1,0], ?? ? ? ? ? ? ? [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]) (%i5) Minvinv:invert(invert(M)) (%o5) matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) (%i6) Minv:invert_by_lu(M) (%o6) matrix([1,0,0],[-v[[1,0],[0,0]],1,0], ?? ? ? ? ? ? ? [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]) (%i7) Minvinv:invert_by_lu(invert_by_lu(M)) Maxima encountered a Lisp error: ??The value NIL is not of type CHARACTER. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. (%o8) "/home/user/matrix_bug.max" ----------- matrix_bug.txt ---------------- _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima [attachment "matrix_bug.max" removed by Barton Willis/MATH/UNK/UNEBR] [attachment "matrix_bug.txt" removed by Barton Willis/MATH/UNK/UNEBR] From robert.dodier at gmail.com Tue Jan 10 00:56:16 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 9 Jan 2012 23:56:16 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <4F0A2C70.2080600@gmx.de> References: <4F0A2C70.2080600@gmx.de> Message-ID: On 1/8/12, andre maute wrote: > M:matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) > (%i7) Minvinv:invert_by_lu(invert_by_lu(M)) > Maxima encountered a Lisp error: > > The value NIL is not of type CHARACTER. >From what I can tell, the error is not in invert_by_lu but somewhere downstream from GENSYM-READABLE, which calls AFORMAT and eventually OUTPUT-TEXT*, where it barfs. Unfortunately I can't tell what's going on in the source code (src/mformt.lisp); too much macrology for my tiny brain to comprehend. Oh well. I find that :lisp (defun gensym-readable (x) (gensym)) makes the error go away. Does that work for you? Sorry I can't be more helpful -- Robert Dodier From robert.dodier at gmail.com Tue Jan 10 00:58:07 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 9 Jan 2012 23:58:07 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> Message-ID: On 1/9/12, Barton Willis wrote: > It seems to work for me: > Lisp implementation type: GNU Common Lisp (GCL) GCL doesn't detect some errors, such as null arguments that aren't supposed to be null. I think that's what's going on here. Maybe that's a consequence of compiling with safety = 0, I don't know. best, Robert Dodier From andre.maute at gmx.de Tue Jan 10 03:08:37 2012 From: andre.maute at gmx.de (andre maute) Date: Tue, 10 Jan 2012 10:08:37 +0100 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> Message-ID: <4F0C0015.2070209@gmx.de> On 01/10/2012 07:56 AM, Robert Dodier wrote: > On 1/8/12, andre maute wrote: > >> M:matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) >> (%i7) Minvinv:invert_by_lu(invert_by_lu(M)) >> Maxima encountered a Lisp error: >> >> The value NIL is not of type CHARACTER. > > From what I can tell, the error is not in invert_by_lu > but somewhere downstream from GENSYM-READABLE, > which calls AFORMAT and eventually OUTPUT-TEXT*, > where it barfs. Unfortunately I can't tell what's going on > in the source code (src/mformt.lisp); too much macrology > for my tiny brain to comprehend. Oh well. > > I find that > :lisp (defun gensym-readable (x) (gensym)) > makes the error go away. Does that work for you? Yes, thanks for the workaround. Here two slightly smaller test cases, which give the error too. --------------------------------- display2d : false; Minv : matrix([1,0,0],[-v[[1,0],[0,0]],1,0], [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]); invert_by_lu(Minv); --------------------------------- display2d : false; Minv : matrix([1,0,0],[-v[1,0,0,0],1,0], [v[0,1,1,0]*v[1,0,0,0]-v[0,1,0,0],-v[0,1,1,0],1]); invert_by_lu(Minv); --------------------------------- whereas the following works --------------------------------- display2d : false; Minv : matrix([1,0,0],[-v_1_0_0_0,1,0], [v_0_1_1_0*v_1_0_0_0-v_0_1_0_0,-v_0_1_1_0,1]); invert_by_lu(Minv); --------------------------------- Regards Andre From hawe at chefmail.de Sat Jan 7 07:29:41 2012 From: hawe at chefmail.de (Hans W. Hofmann) Date: Sat, 7 Jan 2012 13:29:41 +0000 (UTC) Subject: [Maxima] find integer Message-ID: Hi, I want to find values x to make [p1=-(4*x-300)/11,p2=-(35*x-1800)/44] p1 and p2 integer. How to do this in maxima? Gr??e HW From aleksasd873 at gmail.com Sat Jan 7 07:45:05 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sat, 7 Jan 2012 15:45:05 +0200 Subject: [Maxima] evaluating products?? Message-ID: This work fine (%i1) s(n):=prod(f(k),k,1,n)$ (%i2) s(3); (%o2) f(1)*f(2)*f(3) (%i3) build_info()$ Maxima version: 5.25.1 Maxima build date: 9:23 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r14925M (WindowsX8632) Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From paratribulations at free.fr Sun Jan 8 03:24:49 2012 From: paratribulations at free.fr (TP) Date: Sun, 08 Jan 2012 10:24:49 +0100 Subject: [Maxima] dyadic/vector package by Michael Wirth Message-ID: <104ot8-9ss.ln1@rama.fbx.proxad.net> Hello, I am looking for powerful vector (and possibly dyadic) CAS capabilities, *without introducing components*. Look at the following article: http://www.apmaths.uwo.ca/~djeffrey/Offprints/LJcalculemus.pdf In the interesting state-of-the-art part of this article, the authors mention a Macsyma package, which is the work of Stoutemeyer, described in: [12]. Stoutemyer, D.R., 1979. Symbolic computer vector analysis. Computers & Mathematics with Applications, 5, 1-9. It seems that David Stoutemyer contributes to this newsgroup from time to time. The package mentioned in [12] seems to be vect.mac. Can you confirm? $ head share/vector/vect.mac /*-*-MACSYMA-*-*/ eval_when(batch,ttyoff:true)$ /* Or use the BATCHLOAD command to load this with TTYOFF:TRUE */ /* NOTE: THE CURRENT VERSION OF VECT IS THE ONE DUE TO STOUTEMYER. IT WILL BE REPLACED SOON BY AN EXTENDED VERSION WHICH HANDLES BOTH VECTORS AND DYADICS. MICHAEL C. WIRTH (MCW) 12/18/78 So, this package should have been superseded by the work of Michael Wirth, described in the following article: SIAM J. Comput. 8, pp. 306-319 Symbolic Vector and Dyadic Analysis Michael C. Wirth http://epubs.siam.org/sicomp/resource/1/smjcat/v8/i3/p306_s1?isAuthorized=no By looking in the source code of Macsyma, I find only one mention of Michael Wirth: $ grep -ril "wirth" * share/vector/vect.mac share/vector/vect.usg Has the package of Wirth ever been commited? What happened exactly? Thanks in advance, TP From aleksasd873 at gmail.com Sun Jan 8 04:38:17 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sun, 8 Jan 2012 12:38:17 +0200 Subject: [Maxima] The definite integral Message-ID: The definite integral A.Domarkas Example (%i1) S:'integrate(exp(x^4),x,0,1); (%o1) integrate(%e^x^4,x,0,1) (%i2) changevar(S, x=y^(1/4), y, x); "Is "x" positive, negative, or zero?"p; (%o2) integrate(%e^y/y^(3/4),y,0,1)/4 Symbolic solution: (%i3) s_sol:ev(%, nouns),factor; (%o3) ((-1)^(3/4)*(gamma_incomplete(1/4,-1)-gamma(1/4)))/4 Numeric solution: (%i4) float(s_sol),expand; (%o4) -.8989357327127359*(-1)^(3/4)*%i-.8989357327127361*(-1)^(3/4) (%i5) rectform(%); (%o5) 1.797871465425472/sqrt(2)-(2.220446049250313*10^-16*%i)/sqrt(2) (%i6) n_sol:float(realpart(%)); (%o6) 1.271287104904147 Test of solution with quad_qags: (%i7) first(quad_qags(exp(x^4), x, 0, 1)); (%o7) 1.271287104904147 (%i8) %-n_sol; (%o8) 2.220446049250313*10^-16 Direct short solution wrong: (%i9) integrate(exp(x^4),x,0,1); (%o9) (%i*((-1)^(3/4)*gamma_incomplete(1/4,-1)-(-1)^(3/4)*gamma(1/4)))/4 (%i10) float(%),expand; (%o10) .8989357327127359*(-1)^(3/4)-.8989357327127361*(-1)^(3/4)*%i (%i11) rectform(%); (%o11) (1.797871465425472*%i)/sqrt(2)+(2.220446049250313*10^-16)/sqrt(2) (%i12) float(realpart(%)); (%o12) 1.570092458683775*10^-16 In a similar way you can find other integrals integrate(exp(x^k),x,0,1), integrate(exp(-x^k),x,0,1). (%i13) build_info()$ Maxima version: 5.26.0 Maxima build date: 18:42 12/19/2011 Host type: i686-pc-linux-gnu Lisp implementation type: SBCL Lisp implementation version: 1.0.50.0.debian Conclusion: Full solution of the problem must include: a) show steps (perhaps by hand) b) test of solution(numeric, other solving way, other CAS) Direct short solution of the problem is bad for the following reasons: a) pedagogically incorrect b) may be wrong c) may be fail Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From asau at inbox.ru Sun Jan 8 14:00:20 2012 From: asau at inbox.ru (Aleksej Saushev) Date: Mon, 09 Jan 2012 00:00:20 +0400 Subject: [Maxima] Fork of maxima for make it more embeddable. References: <4F08C5C6.4070608@gmail.com> Message-ID: <87r4zax8vf.fsf@inbox.ru> Michael Filonenko writes: > 2012/1/8 Raymond Toy : >> On 1/7/12 1:16 PM, Robert Dodier wrote: >>> About your project to create a Quicklisp-able Maxima, I think that >>> is a valuable goal, and I'm 100% in favor of you (or anyone) >>> creating their own projects based on Maxima. That said, since >>> you have changed the build system a lot, I am hesitant to >>> merge those changes into Maxima. I am no big fan of defsystem, >>> but changing the build system could affect people who are >>> building packages or installations. >> I haven't tried it, but I think using asdf instead of defsystem to build >> maxima shouldn't be very hard. ?Switching the existing defsystems to >> asdf shouldn't be too hard either since the basic syntax is pretty much >> compatible. >> >> The main issue is if asdf will work with gcl. ? We still build maxima >> with gcl, right? ?That would be a show stopper. > > sbcl supports all major operating systems. Except that it doesn't support some of them well enough. (That GCL is even worse in this respect is another issue.) -- HE CE3OH... From fatmarauder at gmail.com Sun Jan 8 15:39:04 2012 From: fatmarauder at gmail.com (Steve Stevenson) Date: Sun, 8 Jan 2012 16:39:04 -0500 Subject: [Maxima] Is there a Chrome app interfacing to Maxima? Message-ID: I'm teaching a software development class this semester. One of the things I thought would make a good project was to make an app for Chrome to interface with Maxima. Has this been done? If it has, I'll find another project. -- D. E. (Steve) Stevenson, Associate Professor Director, Institute for Modeling and Simulation Applications. Clemson University steve at clemson dot edu Anyone who has ever looked into the glazed eyes of a soldier dying on the battlefield will think hard before starting a war. -Otto von Bismarck, statesman (1815-1898) -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Mon Jan 9 03:17:34 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Mon, 9 Jan 2012 11:17:34 +0200 Subject: [Maxima] (no subject) Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2012/027370.html Problem. Compute inntegrate(f,x,-1,2), where (%i1) f:exp(-signum(x-1)*x^3); (%o1) %e^(-x^3*signum(x-1)) Solving with step by step and test: (%i2) wxplot2d([f], [x,-1,2])$ (%t2) << Graphics >> Let integrate(f,x,-1,2)= integrate(f,x,-1,0)+integrate(f,x,0,1)+integrate(f,x,1,2)= S1+S2+S3 (%i3) S1:'integrate(exp(x^3),x,-1,0); (%o3) integrate(%e^x^3,x,-1,0) (%i4) ev(%, nouns); (%o4) (gamma(1/3)-gamma_incomplete(1/3,1))/3 (%i5) sol1:float(%); (%o5) 0.807511182139671 (%i6) /* test*/ first(quad_qags(exp(x^3),x,-1,0)); (%o6) 0.807511182139671 (%i7) S2:'integrate(exp(x^3),x,0,1); (%o7) integrate(%e^x^3,x,0,1) (%i8) changevar(S2, y=x^3, y, x); (%o8) ((sqrt(3)*%i-1)*integrate(%e^y/y^(2/3),y,0,1))/6 (%i9) ev(%, nouns); (%o9) ((sqrt(3)*%i-1)*(gamma_incomplete(1/3,-1)-gamma(1/3)))/6 (%i10) expand(float(%)); (%o10) 1.34190441797742-1.4802973661668753*10^-16*%i (%i11) sol2:realpart(%); (%o11) 1.34190441797742 (%i12) /* test*/ first(quad_qags(exp(x^3),x,0,1)); (%o12) 1.34190441797742 Note that integral S2 direct Maxima compute wrong. The correct formula is integrate(exp(x^k),x,0,1)= (gamma(1/k)-gamma_incomplete(1/k,-1))*%e^(-(%i*%pi)/k))/k, where k is natural number. Proof. (%i13) S:'integrate(exp(x^k),x,0,1); (%o13) integrate(%e^x^k,x,0,1) (%i14) assume(k>0)$ declare(k,integer)$ (%i16) changevar(S, y=x^k, y, x); (%o16) integrate(%e^y/y^((k-1)/k),y,0,1)/k (%i17) ev(%, nouns),factor; (%o17) -(gamma_incomplete(1/k,-1)-gamma(1/k))/(k*(-1)^(1/k)) (%i18) subst(-1=polarform(-1),%),ratsimp; (%o18) -((gamma_incomplete(1/k,-1)-gamma(1/k))*%e^(-(%i*%pi)/k))/k q. e. d. (%i19) define(F(k),%); (%o19) F(k):=-((gamma_incomplete(1/k,-1)-gamma(1/k))*%e^(-(%i*%pi)/k))/k Next we compute S2 using this formula: (%i20) F(3); (%o20) -((1/2-(sqrt(3)*%i)/2)*(gamma_incomplete(1/3,-1)-gamma(1/3)))/3 (%i21) float(%),expand; realpart(%); (%o21) 1.34190441797742-3.33066907387547*10^-16*%i (%o22) 1.34190441797742 (%i23) S3:'integrate(exp(-x^3),x,1,2); (%o23) integrate(%e^(-x^3),x,1,2) (%i24) ev(%, nouns); (%o24) (gamma_incomplete(1/3,1)-gamma_incomplete(1/3,8))/3 (%i25) sol3:float(%), numer; (%o25) 0.085442332154205 (%i26) /* test*/ first(quad_qags(exp(-x^3),x,1,2)); (%o26) 0.0854423321542049 Answer: (%i27) ans:sol1+sol2+sol3; (%o27) 2.234857932271296 (%i28) /* test again*/ first(quad_qags(f,x,-1,2)); (%o28) 2.234857932271401 (%i29) build_info()$ Maxima version: 5.25.1 Maxima build date: 9:23 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r14925M (WindowsX8632) Aleksas Domarkas -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Mon Jan 9 04:10:18 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Mon, 9 Jan 2012 12:10:18 +0200 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Message-ID: About computing integral integrate(exp(-x^k),x,0,1) A.Domarkas The correct formula is integrate(exp(x^k),x,0,1)=(gamma(1/k)-gamma_incomplete(1/k,-1))*%e^(-(%i*%pi)/k))/k, where k is natural number. Proof. (%i13) S:'integrate(exp(x^k),x,0,1); (%o13) integrate(%e^x^k,x,0,1) (%i14) assume(k>0)$ declare(k,integer)$ (%i16) changevar(S, y=x^k, y, x); (%o16) integrate(%e^y/y^((k-1)/k),y,0,1)/k (%i17) ev(%, nouns),factor; (%o17) -(gamma_incomplete(1/k,-1)-gamma(1/k))/(k*(-1)^(1/k)) (%i18) subst(-1=polarform(-1),%),ratsimp; (%o18) -((gamma_incomplete(1/k,-1)-gamma(1/k))*%e^(-(%i*%pi)/k))/k q. e. d. (%i19) define(F(k),%); (%o19) F(k):=-((gamma_incomplete(1/k,-1)-gamma(1/k))*%e^(-(%i*%pi)/k))/k For example, we compute 'integrate(exp(x^3),x,0,1) using this formula: (%i20) F(3); (%o20) -((1/2-(sqrt(3)*%i)/2)*(gamma_incomplete(1/3,-1)-gamma(1/3)))/3 (%i21) float(%),expand; realpart(%); (%o21) 1.34190441797742-3.33066907387547*10^-16*%i (%o22) 1.34190441797742 (%i22) /* test*/ first(quad_qags(exp(x^3),x,0,1)); (%o23) 1.34190441797742 Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Mon Jan 9 04:49:47 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Mon, 9 Jan 2012 12:49:47 +0200 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Message-ID: Sorry, in previous message was formula for integrate(exp(x^k),x,0,1) For integrate(exp(-x^k),x,0,1) formula is more simpler: integrate(exp(-x^k),x,0,1)=(gamma(1/k)-gamma_incomplete(1/k,1))/k, where k is natural number. Proof. (%i1) S:'integrate(exp(-x^k),x,0,1); (%o1) integrate(%e^(-x^k),x,0,1) (%i2) assume(k>0)$ declare(k,integer)$ (%i4) changevar(S, y=x^k, y, x); (%o4) integrate(%e^(-y)/y^((k-1)/k),y,0,1)/k (%i5) ev(%, nouns),factor; (%o5) -(gamma_incomplete(1/k,1)-gamma(1/k))/k (%i6) subst(-1=polarform(-1),%),ratsimp; (%o6) -(gamma_incomplete(1/k,1)-gamma(1/k))/k q. e. d. (%i7) define(F(k),%); (%o7) F(k):=-(gamma_incomplete(1/k,1)-gamma(1/k))/k For example, we compute integral, if k=3 or k=4. (%i8) F(3); (%o8) -(gamma_incomplete(1/3,1)-gamma(1/3))/3 (%i9) float(%), numer; (%o9) 0.807511182139671 (%i10) /* test*/ first(quad_qags(exp(-x^3),x,0,1)); (%o10) 0.807511182139671 (%i11) F(4); (%o11) -(gamma_incomplete(1/4,1)-gamma(1/4))/4 (%i12) float(%), numer; (%o12) 0.844838594757102 (%i13) /* test*/ first(quad_qags(exp(-x^4),x,0,1)); (%o13) 0.844838594757102 Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Mon Jan 9 13:28:47 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Mon, 9 Jan 2012 21:28:47 +0200 Subject: [Maxima] Difference between area under curve and integrate Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2012/027370.html Problem. Compute inntegrate(f,x,-1,2), where (%i1) f:exp(-signum(x-1)*x^3); (%o1) %e^(-x^3*signum(x-1)) More shorter solution: (%i2) wxplot2d([f], [x,-1,2])$ (%t2) << Graphics >> Let integrate(f,x,-1,2)= integrate(f,x,-1,0)+integrate(f,x,0,1)+integrate(f,x,1,2) (%i3) integrate(f,x,-1,0)+integrate(f,x,0,1)+integrate(f,x,1,2)$ (%i4) float(%),expand; (%o4) 2.234857932271296-3.33066907387547*10^-16*%i Solution: (%i5) sol:realpart(%); (%o5) 2.234857932271296 (%i6) /* test */ first(quad_qags(f,x,-1,2)); (%o6) 2.234857932271401 Sorry, integrate(exp(x^3),x,0,1) Maxima compute correct. But wrong (%i7) integrate(exp(x^4),x,0,1); (%o7) (%i*((-1)^(3/4)*gamma_incomplete(1/4,-1)-(-1)^(3/4)*gamma(1/4)))/4 (%i8) float(%),expand; (%o8) 0.898935732712736*(-1)^(3/4)-0.898935732712736*(-1)^(3/4)*%i (%i9) float(rectform(%)); (%o9) 1.271287104904147*%i+7.850462293418875*10^-17 (%i10) /* test */ first(quad_qags(exp(x^4),x,0,1)); (%o10) 1.271287104904147 Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfrangos123 at gmail.com Tue Jan 10 06:41:53 2012 From: cfrangos123 at gmail.com (Constantine Frangos) Date: Tue, 10 Jan 2012 14:41:53 +0200 Subject: [Maxima] Double integration. Message-ID: Dear List, Any assistance with using the Maxima function quad_qags() in the following application would be appreciated: (1) I am trying to compute the area of regions in the (X,Y)-plane bounded by lines/curves and am using two nested calls to quad_qags() with the integrand being an indicator-type function ind() defined below. It is not clear where the error is ? (2) I dont know whether it is possible to define an indicator-type function where the constraints specifying the region in the (X,Y)-plane are included in a boolean expression passed to the function, for example, ind2( is(x2>= abs(x1)) and is(x2 <= 3) and ....). Thanks very much. Constantine. (%i136) I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1)[1],x2,-1,1); COERCE-FLOAT-FUN: no such Lisp or Maxima function: s -- an error. To debug this try: debugmode(true); (%i137) ind(x,y) := block( [s], if is(x*x + y*y <= 1) then (s : 1) else (s : 0), return(s) ); From mxue at vroomlab.com Tue Jan 10 09:56:59 2012 From: mxue at vroomlab.com (Michael Xue) Date: Tue, 10 Jan 2012 15:56:59 +0000 (UTC) Subject: [Maxima] Is there a Chrome app interfacing to Maxima? References: Message-ID: Steve Stevenson gmail.com> writes: > > > I'm teaching a software development class this semester. One of the things I thought would make a good project was to make an app for Chrome to interface with Maxima. Has this been done? If it has, I'll find another project. > -- D. E. (Steve) Stevenson, Associate ProfessorDirector, Institute for Modeling and Simulation Applications.Clemson Universitysteve at clemson dot eduAnyone who has ever looked into the glazed eyes of a soldier dying on the battlefield will think hard before starting a war. -Otto von Bismarck, statesman (1815-1898) > > > _______________________________________________ > Maxima mailing list > Maxima math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > do you mean something like: http://www.vroomlab.com click on the calculator-like image. From wilsonjp at gmail.com Tue Jan 10 10:09:59 2012 From: wilsonjp at gmail.com (John Wilson) Date: Tue, 10 Jan 2012 11:09:59 -0500 Subject: [Maxima] Unable to unsubscribe Message-ID: Dear Maxima mailing list administrators, Twice now I've been unsuccessful in unsubscribing; is there a bug in the mailing list as well? My apologies to bother everyone. Sincerely, John -- Dr. John P. Wilson Postdoctoral Researcher Pappin Laboratory of Protein Analysis and Mass Spectrometry Cold Spring Harbor Laboratory ---------- Forwarded message ---------- From: Date: Tue, Jan 10, 2012 at 10:52 AM Subject: You have been unsubscribed from the Maxima mailing list To: wilsonjp at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Tue Jan 10 11:00:37 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 10 Jan 2012 09:00:37 -0800 Subject: [Maxima] find integer In-Reply-To: References: Message-ID: On Sat, Jan 7, 2012 at 5:29 AM, Hans W. Hofmann wrote: > Hi, > > I want to find values x to make > > [p1=-(4*x-300)/11,p2=-(35*x-1800)/44] > > p1 and p2 integer. How to do this in maxima? > > Not sure if this is the best approach, but here is one way. solve(p1=(4*x-300)/11,x) solve(p2=(35*x-1800)/44,x); This gives two equations for x. Make them equal so we get an equation in p1 and p2, where p1 and p2 are integers. This is a Diophantine equation. A Google search shows that someone posted a Diophantine equation solver, but I can't find the code right now. If I do it by hand, I get x = 44*r+64, where r is any integer. This gives p1 = 16*r+4 and p2 = 35*r+10. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From alserkli at inbox.ru Tue Jan 10 11:03:00 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Tue, 10 Jan 2012 19:03:00 +0200 Subject: [Maxima] Double integration. In-Reply-To: References: Message-ID: On Tue, 10 Jan 2012, Constantine Frangos wrote: > Any assistance with using the Maxima function quad_qags() in the > following application would be appreciated: > > (1) I am trying to compute the area of regions in the (X,Y)-plane > bounded by lines/curves and am using two nested calls to quad_qags() > with the integrand being an indicator-type function ind() > defined below. It is not clear where the error is ? The error is due to your definition of ind. You can do it as follows: (%i1) ind(x,y) := if x*x + y*y <= 1 then 1 else 0$ (%i2) I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1,'epsrel=0.1)[1],x2,-1,1,'epsrel=0.1); (%o2) [3.147364455231505, .06760267083066201, 147, 0] Note that this approch is very roundabout (and takes forever with default epsrel). Instead you can solve(x*x+y*y=1,x); and use a simple integral: (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1); (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0] -- Regards, ASK From mikael at jetmik.dk Tue Jan 10 15:06:32 2012 From: mikael at jetmik.dk (=?ISO-8859-1?Q?Mikael_Sams=F8e_S=F8rensen?=) Date: Tue, 10 Jan 2012 22:06:32 +0100 Subject: [Maxima] New Maxima equation solver In-Reply-To: <30F7CBCB63B642BBAF4A3C47406ECC4A@edwinc367e16bd> References: <30F7CBCB63B642BBAF4A3C47406ECC4A@edwinc367e16bd> Message-ID: You are right. I just changed the name but not in both places. I would like to help write a new section. What is the format for the help file? best regards Mikael Sams?e S?rensen 2012/1/7 Edwin Woollett : > On Jan. 7, 2012, Mikael Sams?e S?rensen wrote: > -------------------------- > >> I have created a package with a new equation solver for solving >> equations within real numbers. > > --------------------------------- > This looks very interesting. I have not tried it out yet, but > this package might be the basis for a new section of a > revised Ch. 4, Solving Equations (Maxima by Example). > > In the text file description you mention > ?desolvemore > but in the mac code file I only find > ?desolvereal. > Perhaps you changed the name? > > Best Wishes, > > Ted Woollett > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Tue Jan 10 15:55:44 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Tue, 10 Jan 2012 16:55:44 -0500 Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) In-Reply-To: References: Message-ID: <608D5B6B8F3F4EF2A6308798453D9193@RichsLaptop> I am aware that this problem can be done by breaking the problem into pieces and doing it that way. The amazing thing is that abs_integrate.mac and pw.mac can usually do it without all of this extra work. You generally only have to call integrate once. Except that in this case both packages get the wrong answer. I think the reason is that the gamma_incomplete() function is evaluated with a negative argument in some place where it does not cancel out (but I am not sure of that.) BTW I am using the new defint.lisp from git, not the one that ships with Maxima 5.25.1. I should have mentioned that. It does not matter in this case which defint.lisp you use. Rich From: Aleksas Domarkas Sent: Monday, January 09, 2012 5:49 AM To: maxima Subject: [Maxima] About computing integral integrate(exp(-x^k),x,0,1) Sorry, in previous message was formula for integrate(exp(x^k),x,0,1) For integrate(exp(-x^k),x,0,1) formula is more simpler: integrate(exp(-x^k),x,0,1)=(gamma(1/k)-gamma_incomplete(1/k,1))/k, where k is natural number. Proof. (%i1) S:'integrate(exp(-x^k),x,0,1); (%o1) integrate(%e^(-x^k),x,0,1) (%i2) assume(k>0)$ declare(k,integer)$ (%i4) changevar(S, y=x^k, y, x); (%o4) integrate(%e^(-y)/y^((k-1)/k),y,0,1)/k (%i5) ev(%, nouns),factor; (%o5) -(gamma_incomplete(1/k,1)-gamma(1/k))/k (%i6) subst(-1=polarform(-1),%),ratsimp; (%o6) -(gamma_incomplete(1/k,1)-gamma(1/k))/k q. e. d. (%i7) define(F(k),%); (%o7) F(k):=-(gamma_incomplete(1/k,1)-gamma(1/k))/k For example, we compute integral, if k=3 or k=4. (%i8) F(3); (%o8) -(gamma_incomplete(1/3,1)-gamma(1/3))/3 (%i9) float(%), numer; (%o9) 0.807511182139671 (%i10) /* test*/ first(quad_qags(exp(-x^3),x,0,1)); (%o10) 0.807511182139671 (%i11) F(4); (%o11) -(gamma_incomplete(1/4,1)-gamma(1/4))/4 (%i12) float(%), numer; (%o12) 0.844838594757102 (%i13) /* test*/ first(quad_qags(exp(-x^4),x,0,1)); (%o13) 0.844838594757102 Aleksas D. -------------------------------------------------------------------------------- _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Tue Jan 10 17:33:08 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 10 Jan 2012 16:33:08 -0700 Subject: [Maxima] New Maxima equation solver In-Reply-To: References: <30F7CBCB63B642BBAF4A3C47406ECC4A@edwinc367e16bd> Message-ID: Maxima documentation files for the built-in reference manual (what's returned by ? at the input prompt) are written in Texinfo. share/template.texi and share/template-standalone.texi are templates you can use. Texinfo is kind of clumsy but it works OK. best Robert Dodier On 1/10/12, Mikael Sams?e S?rensen wrote: > You are right. I just changed the name but not in both places. > I would like to help write a new section. What is the format for the help > file? > > best regards > Mikael Sams?e S?rensen > > 2012/1/7 Edwin Woollett : >> On Jan. 7, 2012, Mikael Sams?e S?rensen wrote: >> -------------------------- >> >>> I have created a package with a new equation solver for solving >>> equations within real numbers. >> >> --------------------------------- >> This looks very interesting. I have not tried it out yet, but >> this package might be the basis for a new section of a >> revised Ch. 4, Solving Equations (Maxima by Example). >> >> In the text file description you mention >> ?desolvemore >> but in the mac code file I only find >> ?desolvereal. >> Perhaps you changed the name? >> >> Best Wishes, >> >> Ted Woollett >> >> _______________________________________________ >> 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 Tue Jan 10 18:34:49 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 10 Jan 2012 17:34:49 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <4F0C0015.2070209@gmx.de> References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: OK, here is an even smaller example which triggers the bug: invert_by_lu (matrix ([v [0]])); The error is caused by a name collision: there is a special variable LB in src/grind.lisp (left bracket for arrays) and apparently the symbol LB in share/linearalgebra/lu.lisp refers to that same variable and clobbers it. Renaming LB in lu.lisp to FOO-LB avoids the error. I would have expected LB in lu.lisp to be a lexical variable; why not? best, Robert Dodier On 1/10/12, andre maute wrote: > On 01/10/2012 07:56 AM, Robert Dodier wrote: >> On 1/8/12, andre maute wrote: >> >>> M:matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1]) >>> (%i7) Minvinv:invert_by_lu(invert_by_lu(M)) >>> Maxima encountered a Lisp error: >>> >>> The value NIL is not of type CHARACTER. >> > From what I can tell, the error is not in invert_by_lu >> but somewhere downstream from GENSYM-READABLE, >> which calls AFORMAT and eventually OUTPUT-TEXT*, >> where it barfs. Unfortunately I can't tell what's going on >> in the source code (src/mformt.lisp); too much macrology >> for my tiny brain to comprehend. Oh well. >> >> I find that >> :lisp (defun gensym-readable (x) (gensym)) >> makes the error go away. Does that work for you? > > Yes, thanks for the workaround. > Here two slightly smaller test cases, which give the error too. > --------------------------------- > display2d : false; > Minv : matrix([1,0,0],[-v[[1,0],[0,0]],1,0], > [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]); > invert_by_lu(Minv); > --------------------------------- > display2d : false; > Minv : matrix([1,0,0],[-v[1,0,0,0],1,0], > [v[0,1,1,0]*v[1,0,0,0]-v[0,1,0,0],-v[0,1,1,0],1]); > invert_by_lu(Minv); > --------------------------------- > > whereas the following works > --------------------------------- > display2d : false; > Minv : matrix([1,0,0],[-v_1_0_0_0,1,0], > [v_0_1_1_0*v_1_0_0_0-v_0_1_0_0,-v_0_1_1_0,1]); > invert_by_lu(Minv); > --------------------------------- > > Regards > Andre > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From rich.hennessy at verizon.net Tue Jan 10 19:25:13 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Tue, 10 Jan 2012 20:25:13 -0500 Subject: [Maxima] new defint.lisp and radexpand:false? In-Reply-To: <919F4FE57FBC49248589F3726F28108F@edwinc367e16bd> References: <919F4FE57FBC49248589F3726F28108F@edwinc367e16bd> Message-ID: <592EDD42328D4C55869E9967D8C97CD2@RichsLaptop> integrate(exp(x^n),x,1,2) for odd n gives wrong result too. integrate(exp(x^n),x,-2,-1) for odd n seems okay. integrate(exp(x^n),x,a,b) works for odd n and negative a and b. This might be related to abs_integrate.mac bug. https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3471545&group_id=4933 Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 05, 2012 5:05 PM To: maxima mailing list Subject: [Maxima] new defint.lisp and radexpand:false? In the git notes http://maxima.git.sourceforge.net/git/gitweb.cgi?p=maxima/maxima;a=commit;h=883dc433283808ff53d04477c540489273197ea3 for the new version of defint.lisp, Dan Gildea has the comment: ------------- integrate(exp(sqrt(x^3)),x,0,1) no longer gives correct answer unless we specify radexpand:false -------------------------------------- I find (gcl) that the previous version of defint.lisp gives the correct integral with radexpand : true (default). ------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) first(quad_qags(exp(sqrt(x^3)),x,0,1)); (%o1) 1.562394062214541 /* v 5.25.1 defint.lisp and radexpand=true */ (%i2) radexpand; (%o2) true (%i3) integrate(exp(sqrt(x^3)),x,0,1); (%o3) -(sqrt(3)*%i+1)*(gamma(2/3)-gamma_incomplete(2/3,-1))/3 (%i4) expand(float(%)); (%o4) 1.562394062217312-4.4408920985006262E-16*%i /* ok except for roundoff errors */ ---------------------------------------------- When I load in the new version of defint.lisp, and leave radexpand : true I get an answer, albeit a wrong answer. But if I set radexpand to false, I only get a noun form. ------------------------------------------------------ (%i5) load("defint-new.lisp"); (%o5) "c:/work2/defint-new.lisp" (%i6) radexpand; (%o6) true /* with new defint.lisp and radexpand=true */ (%i7) integrate(exp(sqrt(x^3)),x,0,1); (%o7) 2*(gamma(2/3)-gamma_incomplete(2/3,-1))/3 (%i8) expand(float(%)); (%o8) 1.353072948602157*%i-0.78119703110866 /* which is a wrong answer as advertised . */ /* now set radexpand to false */ (%i9) radexpand:false$ (%i10) integrate(exp(sqrt(x^3)),x,0,1); (%o10) 'integrate(%e^sqrt(x^3),x,0,1) /* unexpected noun form */ --------------------------------------------------- Ted Woollett _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Tue Jan 10 20:20:53 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Tue, 10 Jan 2012 21:20:53 -0500 Subject: [Maxima] new defint.lisp and radexpand:false? In-Reply-To: <592EDD42328D4C55869E9967D8C97CD2@RichsLaptop> References: <919F4FE57FBC49248589F3726F28108F@edwinc367e16bd> <592EDD42328D4C55869E9967D8C97CD2@RichsLaptop> Message-ID: I guess I should show my reasons for my claim. (%i14) kill(all); (%o0) done (%i1) load(defint); (%o1) "C:/Maxima-5.25.1/share/maxima/5.25.1/src/defint.lisp" new defint.lisp (%i2) display2d:false; (%o2) false (%i3) integrate(exp(x^n),x,a,b),a=1,b=2,n=5; (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 (%i4) rectform(float(%)); (%o4) -6.213553389862085E+11*%i-8.5522225476885498E+11 (%i5) quad_qags(exp(x^n),x,a,b),a=1,b=2,n=5; (%o5) [1.0132394896940184E+12,0.66155076101722,147,0] (%i6) integrate(exp(x^n),x,a,b),a=-1,b=-2,n=5; (%o6) -(gamma_incomplete(1/5,1)-gamma_incomplete(1/5,32))/5 (%i7) rectform(float(%)); (%o7) -0.048094074713868 (%i8) quad_qags(exp(x^n),x,a,b),a=-1,b=-2,n=5; (%o8) [-0.048094074713868,9.9292941840488248E-16,63,0] (%i9) radexpand; (%o9) true (%i10) radexpand:false; (%o10) false (%i11) integrate(exp(x^n),x,a,b),a=1,b=2,n=5; (%o11) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 (%i12) rectform(float(%)); (out12) -6.213553389862085E+11*%i-8.5522225476885498E+11 (%i13) I think the answer should be real in all cases. The integrand is real valued everywhere. Rich -----Original Message----- From: Richard Hennessy Sent: Tuesday, January 10, 2012 8:25 PM To: Edwin Woollett ; maxima mailing list Subject: Re: [Maxima] new defint.lisp and radexpand:false? integrate(exp(x^n),x,1,2) for odd n gives wrong result too. integrate(exp(x^n),x,-2,-1) for odd n seems okay. integrate(exp(x^n),x,a,b) works for odd n and negative a and b. This might be related to abs_integrate.mac bug. https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3471545&group_id=4933 Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 05, 2012 5:05 PM To: maxima mailing list Subject: [Maxima] new defint.lisp and radexpand:false? In the git notes http://maxima.git.sourceforge.net/git/gitweb.cgi?p=maxima/maxima;a=commit;h=883dc433283808ff53d04477c540489273197ea3 for the new version of defint.lisp, Dan Gildea has the comment: ------------- integrate(exp(sqrt(x^3)),x,0,1) no longer gives correct answer unless we specify radexpand:false -------------------------------------- I find (gcl) that the previous version of defint.lisp gives the correct integral with radexpand : true (default). ------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) first(quad_qags(exp(sqrt(x^3)),x,0,1)); (%o1) 1.562394062214541 /* v 5.25.1 defint.lisp and radexpand=true */ (%i2) radexpand; (%o2) true (%i3) integrate(exp(sqrt(x^3)),x,0,1); (%o3) -(sqrt(3)*%i+1)*(gamma(2/3)-gamma_incomplete(2/3,-1))/3 (%i4) expand(float(%)); (%o4) 1.562394062217312-4.4408920985006262E-16*%i /* ok except for roundoff errors */ ---------------------------------------------- When I load in the new version of defint.lisp, and leave radexpand : true I get an answer, albeit a wrong answer. But if I set radexpand to false, I only get a noun form. ------------------------------------------------------ (%i5) load("defint-new.lisp"); (%o5) "c:/work2/defint-new.lisp" (%i6) radexpand; (%o6) true /* with new defint.lisp and radexpand=true */ (%i7) integrate(exp(sqrt(x^3)),x,0,1); (%o7) 2*(gamma(2/3)-gamma_incomplete(2/3,-1))/3 (%i8) expand(float(%)); (%o8) 1.353072948602157*%i-0.78119703110866 /* which is a wrong answer as advertised . */ /* now set radexpand to false */ (%i9) radexpand:false$ (%i10) integrate(exp(sqrt(x^3)),x,0,1); (%o10) 'integrate(%e^sqrt(x^3),x,0,1) /* unexpected noun form */ --------------------------------------------------- Ted Woollett _______________________________________________ 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 andrej.vodopivec at gmail.com Wed Jan 11 03:31:29 2012 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Wed, 11 Jan 2012 10:31:29 +0100 Subject: [Maxima] find integer In-Reply-To: References: Message-ID: On Tue, Jan 10, 2012 at 6:00 PM, Raymond Toy wrote: > > > On Sat, Jan 7, 2012 at 5:29 AM, Hans W. Hofmann wrote: >> >> Hi, >> >> I want to find values x to make >> >> [p1=-(4*x-300)/11,p2=-(35*x-1800)/44] >> >> p1 and p2 integer. How to do this in maxima? >> > > Not sure if this is the best approach, but here is one way. > > solve(p1=(4*x-300)/11,x) > solve(p2=(35*x-1800)/44,x); > > This gives two equations for x.? Make them equal so we get an equation in p1 > and p2, where p1 and p2 are integers.? This is a Diophantine equation.? A > Google search shows that someone posted a Diophantine equation solver, but I > can't find the code right now.? If I do it by hand, I get x = 44*r+64, where > r is any integer.? This gives p1 = 16*r+4 and p2 = 35*r+10. > > Ray There is a solve_lde function in the discrete package (https://github.com/andrejv/discrete.mac): (%i2) eliminate([p1=-(4*x-300)/11,p2=-(35*x-1800)/44], [x]); (%o2) [-11*(-16*p2+35*p1-300)] (%i3) solve_lde(%[1]); (%o3) [p1=16*%k1-12,p2=35*%k1-45] (%i4) subst(%, [p1=-(4*x-300)/11,p2=-(35*x-1800)/44]); (%o4) [16*%k1-12=(300-4*x)/11,35*%k1-45=(1800-35*x)/44] (%i5) solve(%[1], x); (%o5) [x=108-44*%k1] (of course %k1 is an integer) Andrej From rswarbrick at gmail.com Wed Jan 11 04:04:41 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 11 Jan 2012 10:04:41 +0000 Subject: [Maxima] invert_by_lu does not work as expected References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: Robert Dodier writes: > OK, here is an even smaller example which triggers the bug: > invert_by_lu (matrix ([v [0]])); > > The error is caused by a name collision: there is a special > variable LB in src/grind.lisp (left bracket for arrays) > and apparently the symbol LB in share/linearalgebra/lu.lisp > refers to that same variable and clobbers it. > Renaming LB in lu.lisp to FOO-LB avoids the error. > I would have expected LB in lu.lisp to be a lexical variable; why not? > best, Robert Dodier Grepping shows it declared special in src/fortra.lisp. I haven't looked further into why. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From dbmaxima at gmail.com Wed Jan 11 04:50:45 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Wed, 11 Jan 2012 21:50:45 +1100 Subject: [Maxima] need Maxima 5.26 for Windows In-Reply-To: References: Message-ID: <4F0D6985.4000404@gmail.com> On 9/01/2012 4:24 AM, Robert Dodier wrote: > Hi everybody, > > Can someone build a Windows installer for Maxima 5.26 ? > I just looked at the list of files at Sourceforge and I don't see one. > I'd like to make a general announcement about 5.26 (sorry for the delay). I have one that seems OK at http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe How do I upload it? My sourceforge username is billingd From aleksasd873 at gmail.com Wed Jan 11 02:02:07 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Wed, 11 Jan 2012 10:02:07 +0200 Subject: [Maxima] new defint.lisp and radexpand:false? Message-ID: About integrate(exp(x^n),x,a,b). A.Domarkas We discuss problems from http://www.math.utexas.edu/pipermail/maxima/2012/027403.html Theorem. For any real n>0, a>=0, b>0 integrate(exp(x^n),x,a,b)=((gamma_incomplete(1/n,-a^n)-gamma_incomplete(1/n,-b^n))*%e^(-(%i*%pi)/n))/n Proof. (%i1) S:'integrate(exp(x^n),x)$ (%i2) assume(x>0,y>0,n>0)$ (%i3) changevar(S, x=y^(1/n), y, x); (%o3) integrate(%e^y/y^((n-1)/n),y)/n (%i4) ev(%, nouns); (%o4) -gamma_incomplete(1/n,-y)/(n*(-1)^(1/n)) By Newton-Leibniz formula S is equal (%i5) ev(%,y=b^n)-ev(%,y=a^n)$ (%i6) subst(-1=polarform(-1),%)$ (%i7) define(F(n,a,b),factor(%)); (%o7) F(n,a,b):=-((gamma_incomplete(1/n,-b^n)-gamma_incomplete(1/n,-a^n))*%e^(-(%i*%pi)/n))/n q.e.d. Example 1 We compute integrate(exp(x^5),x,1,2). Exact form of solution is (%i8) F(5,1,2); (%o8) -(%e^(-(%i*%pi)/5)*(gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1)))/5 (%i9) float(rectform(float(%))); (%o9) 1.057112842764948*10^12-9.765625*10^-5*%i (%i10) realpart(%); (%o10) 1.057112842764948*10^12 (%i11) /* test*/ first(quad_qags(exp(x^5),x,1,2)); (%o11) 1.013239489694018*10^12 Maxima float value (%i12) float(gamma_incomplete(1/5,-32)); (%o12) -3.106776694934643*10^12*%i-4.276111273844638*10^12 is is not sufficiently accurate, because from WolframAlpha or Python mpmath module ( http://code.google.com/p/mpmath/ ) Gamma(1/5,-32) ~~ -4.098639833*10^12 - 2.977836145*10^12 I Example 2 We compute integrate(exp(x^5),x,-1,-2): (%i13) S:'integrate(exp(x^5),x,-1,-2)$ (%i14) changevar(%, y=-x, y, x); (%o14) -integrate(%e^(-y^5),y,1,2) (%i15) ev(%, nouns); (%o15) -(gamma_incomplete(1/5,1)-gamma_incomplete(1/5,32))/5 (%i16) float(%), numer; (%o16) -0.0480940747138679 (%i17) /* test*/ first(quad_qags(exp(x^5),x,-1,-2)); (%o17) -0.0480940747138678 Example 3 integrate(exp(x^3),x,0,1); (%i18) F(3,0,1); (%o18) -((1/2-(sqrt(3)*%i)/2)*(gamma_incomplete(1/3,-1)-gamma(1/3)))/3 (%i19) float(%), numer,expand; (%o19) 1.34190441797742-1.4802973661668753*10^-16*%i (%i20) /* test*/ first(quad_qags(exp(x^3),x,0,1)); (%o20) 1.34190441797742 Example 4 integrate(exp(x^(3.5)),x,0,1); (%i21) F(3.5,0,1); (%o21) -0.285714285714286*(-3.564215493727561*%i-2.84236700849009)*%e^(-0.285714285714286*%i*%pi) (%i22) float(%), numer,expand; (%o22) 1.302515064637093-1.2688263138573217*10^-16*%i (%i23) F(7/2,0,1); (%o23) -(2*%e^(-(2*%i*%pi)/7)*(gamma_incomplete(2/7,-1)-gamma(2/7)))/7 (%i24) float(%), numer,expand; (%o24) 1.302515064637093-1.2688263138573217*10^-16*%i (%i25) /* test*/ first(quad_qags(exp(x^(7/2)),x,0,1)); (%o25) 1.302515064637389 Example 5 integrate(exp(x^4,x,0,1); (%i26) F(4,0,1); (%o26) -((1/sqrt(2)-%i/sqrt(2))*(gamma_incomplete(1/4,-1)-gamma(1/4)))/4 (%i27) float(%), numer,expand; (%o27) 1.271287104904147 (%i28) /* test*/ first(quad_qags(exp(x^4),x,0,1)); (%o28) 1.271287104904147 (%i29) build_info()$ Maxima version: 5.25.1 Maxima build date: 9:23 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r14925M (WindowsX8632) Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rswarbrick at gmail.com Wed Jan 11 05:13:47 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 11 Jan 2012 11:13:47 +0000 Subject: [Maxima] invert_by_lu does not work as expected References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: Rupert Swarbrick writes: >> OK, here is an even smaller example which triggers the bug: >> invert_by_lu (matrix ([v [0]])); >> >> The error is caused by a name collision: there is a special >> variable LB in src/grind.lisp (left bracket for arrays) >> and apparently the symbol LB in share/linearalgebra/lu.lisp >> refers to that same variable and clobbers it. >> Renaming LB in lu.lisp to FOO-LB avoids the error. >> I would have expected LB in lu.lisp to be a lexical variable; why not? >> best, Robert Dodier > > Grepping shows it declared special in src/fortra.lisp. I haven't looked > further into why. > > Rupert The attached patch fixes this problem. Indeed, grepping further showed that there were name collisions in quite a few places (lb stands for "left bracket", "limit B" and "lower bound" it seems). Note that the patch updates share/numeric/cfortr.lisp to follow the new names, but that file is not going to load on any modern lisp implementation without some serious changes. I would include a new testsuite test, but I don't think I can work out how because grind() works by printing a string (and returns false!). Comments? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Rename-lb-and-rb-special-variables-in-src-grind.lisp.patch Type: text/x-diff Size: 12058 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From dbmaxima at gmail.com Wed Jan 11 05:42:06 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Wed, 11 Jan 2012 22:42:06 +1100 Subject: [Maxima] need Maxima 5.26 for Windows In-Reply-To: <4F0D6985.4000404@gmail.com> References: <4F0D6985.4000404@gmail.com> Message-ID: <4F0D758E.9020002@gmail.com> On 11/01/2012 9:50 PM, David Billinghurst wrote: > On 9/01/2012 4:24 AM, Robert Dodier wrote: >> Hi everybody, >> >> Can someone build a Windows installer for Maxima 5.26 ? >> I just looked at the list of files at Sourceforge and I don't see one. >> I'd like to make a general announcement about 5.26 (sorry for the >> delay). > > I have one that seems OK at > http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe > > How do I upload it? My sourceforge username is billingd This is broken. The describe command doesn't work. I will investigate as time allows. From robert.dodier at gmail.com Wed Jan 11 10:39:32 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 11 Jan 2012 09:39:32 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: On 1/11/12, Rupert Swarbrick wrote: > Grepping shows it declared special in src/fortra.lisp. I haven't looked > further into why. Well, the Fortran code changes the usual [ ] for array subscripts to ( ), that's why LB and RB are special. Thanks for sending the patch, but I've taken the simpler approach of just changing LB and RB to *LB* and *RB*, respectively; to the extent that other stuff changes, it makes it harder to see what is the purpose of the patch. What puzzles me about this problem is that LB is used in a lexical binding in share/linearalgebra/lu.lisp, but it affects the special variable by the same name -- I thought a declaration would be required in lu.lisp to cause that. What's going on there? best, Robert Dodier From rswarbrick at gmail.com Wed Jan 11 11:38:25 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 11 Jan 2012 17:38:25 +0000 Subject: [Maxima] invert_by_lu does not work as expected References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: Robert Dodier writes: > On 1/11/12, Rupert Swarbrick wrote: > >> Grepping shows it declared special in src/fortra.lisp. I haven't looked >> further into why. > > Well, the Fortran code changes the usual [ ] for array subscripts > to ( ), that's why LB and RB are special. > > Thanks for sending the patch, but I've taken the simpler approach > of just changing LB and RB to *LB* and *RB*, respectively; > to the extent that other stuff changes, it makes it harder to see > what is the purpose of the patch. > > What puzzles me about this problem is that LB is used in a > lexical binding in share/linearalgebra/lu.lisp, but it affects the > special variable by the same name -- I thought a declaration > would be required in lu.lisp to cause that. What's going on there? No, I don't think so. Consider the following: (defun print-to-stdout (x) (princ x *standard-output*)) (with-output-to-string (*standard-output*) (print-to-stdout "Hello world") (values)) More convoluted and more similar to the original: (with-output-to-string (strm) (let ((*standard-output* strm)) (print-to-stdout "Hello world") (values))) has the same effect. I've just been staring at CLHS and can't find the relevant passage unfortunately. I think I want to say something like "LET binds a variable X to a new lexical binding, unless it already had a dynamic binding in which case it binds it dynamically", but I'm not sure where to look. Re the patch, part of the reason I renamed the variables was to make the names more unambiguous. Maybe at least a docstring on the two defvars would be nice? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From rswarbrick at gmail.com Wed Jan 11 11:44:24 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 11 Jan 2012 17:44:24 +0000 Subject: [Maxima] invert_by_lu does not work as expected References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: Rupert Swarbrick writes: > (defun print-to-stdout (x) (princ x *standard-output*)) > > (with-output-to-string (*standard-output*) > (print-to-stdout "Hello world") > (values)) > > More convoluted and more similar to the original: > > (with-output-to-string (strm) > (let ((*standard-output* strm)) > (print-to-stdout "Hello world") > (values))) > > has the same effect. I've just been staring at CLHS and can't find the > relevant passage unfortunately. I think I want to say something like > "LET binds a variable X to a new lexical binding, unless it already had > a dynamic binding in which case it binds it dynamically", but I'm not > sure where to look. Of course, I found the passage I was looking for just after sending the email. In the documentation for DECLARE: When used in a proclamation, a special declaration specifier applies to all bindings as well as to all references of the mentioned variables. For example, after (declaim (special x)) then in a function definition such as (defun example (x) ...) the parameter x is bound as a dynamic variable rather than as a lexical variable. Ta-Da! Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From woollett at charter.net Wed Jan 11 12:21:25 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 11 Jan 2012 10:21:25 -0800 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? Message-ID: <1E2DD2D53F7844A9912495644840333E@edwinc367e16bd> On Jan. 10, 2012, Richard Hennessy wrote: ------------------------- >integrate(exp(x^n),x,1,2) for odd n gives wrong result too. ----------------------------------------------------- Here is an example which starts with the current 5.25.1 defint.lisp, resulting in a wrong answer, then we load in the new improved defint.lisp, which results in the same wrong answer (as is obvious since the symbolic definite integral is the same expression as a function of gamma_incomplete). --------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) radexpand; (%o1) true (%i2) quad_qags(exp(x^5),x,1,2); (%o2) [1.0132394896940184E+12,0.66155076101722,147,0] (%i3) integrate(exp(x^5),x,1,2); (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 (%i4) expand(float(%)); (%o4) -6.213553389862085E+11*%i-8.5522225476885498E+11 (%i5) load("defint-new.lisp"); (%o5) "c:/work2/defint-new.lisp" (%i6) integrate(exp(x^5),x,1,2); (%o6) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 (%i7) expand(float(%)); (%o7) -6.213553389862085E+11*%i-8.5522225476885498E+11 --------------------------------- Ted From woollett at charter.net Wed Jan 11 12:36:21 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 11 Jan 2012 10:36:21 -0800 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? Message-ID: On Jan. 11, 2012, I wrote: -------------------------- >Here is an example which starts with the current >5.25.1 defint.lisp, resulting in a wrong answer, ------------------------- To demonstrate that the wrong answer is not due to insufficient precision in the numerical work, I use mfloat(expr, ndigits), previously discussed on the list, which goes for an answer accurate to ndigits using bfloat methods. -------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) mfloat1(ex,ndigits) := block([fpprec:16,old,new,kk,small,goodans:false], small:bfloat(10^(-(ndigits+1))), old : expand(bfloat(ex)), for kk:2 thru 10 do (new:realpart(block([fpprec:kk*10],expand(bfloat(ex)))), if abs(new-old) < small then (goodans:true,return()), old:new), if not goodans then false else if not numberp(new) then false else float(new))$ (%i2) mfloat(expr,mdigits):= block([er,ei,err], er : realpart(expr), err : mfloat1(er,mdigits), if not complex_number_p(err) then (print(" realpart not evaluated"), return(false)), if expand(expr - er) = 0 then err else (ei : imagpart(expr), ei : mfloat1(ei,mdigits), if not complex_number_p(ei) then (print(" imagpart not evaluated"), return(false)), err + %i*ei))$ (%i3) quad_qags(exp(x^5),x,1,2); (%o3) [1.0132394896940184E+12,0.66155076101722,147,0] (%i4) i1: integrate(exp(x^5),x,1,2); (%o4) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 (%i5) mfloat(i1,15); (%o5) -5.9556722908249524E+11*%i-8.1972796653426025E+11 ---------------------------- Ted From fateman at eecs.berkeley.edu Wed Jan 11 12:47:27 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 11 Jan 2012 10:47:27 -0800 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? In-Reply-To: <1E2DD2D53F7844A9912495644840333E@edwinc367e16bd> References: <1E2DD2D53F7844A9912495644840333E@edwinc367e16bd> Message-ID: <4F0DD93F.4010405@eecs.berkeley.edu> I've been ignoring this, so far. But... On 1/11/2012 10:21 AM, Edwin Woollett wrote:... ... > (%i3) integrate(exp(x^5),x,1,2); > (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 for what it is worth, Mathematica 7 returns 1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} Notice the factor of (-1)^(4/5). From tomdean at speakeasy.org Wed Jan 11 13:36:25 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Wed, 11 Jan 2012 11:36:25 -0800 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? In-Reply-To: <4F0DD93F.4010405@eecs.berkeley.edu> References: <1E2DD2D53F7844A9912495644840333E@edwinc367e16bd> <4F0DD93F.4010405@eecs.berkeley.edu> Message-ID: <1326310585.15514.8.camel@asus> On Wed, 2012-01-11 at 10:47 -0800, Richard Fateman wrote: > integrate(exp(x^5),x,1,2); Maple returns -1/5*(-1)^(4/5)*( (x*(-1)^(1/5)*Pi*csc(Pi/5))/(gamma(4/5)*(-x^5)^(1/5)) - (x*(-1)^(1/5)*gamma(1/5,-x^5))/((-x^5)^(1/5)) ); gamma(m,n) is the incomplete gamma function Tom Dean From william.wood3 at comcast.net Wed Jan 11 14:55:01 2012 From: william.wood3 at comcast.net (Bill Wood) Date: Wed, 11 Jan 2012 14:55:01 -0600 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> Message-ID: <1326315301.1548.19.camel@ubuntu> On Wed, 2012-01-11 at 17:38 +0000, Rupert Swarbrick wrote: . . . > has the same effect. I've just been staring at CLHS and can't find the > relevant passage unfortunately. I think I want to say something like > "LET binds a variable X to a new lexical binding, unless it already had > a dynamic binding in which case it binds it dynamically", but I'm not > sure where to look. This from the CLHS entry for "Declaration Special" may be relevant (the part after my elipsis is to the point): A special declaration does not affect inner bindings of a var; the inner bindings implicitly shadow a special declaration and must be explicitly re-declared to be special. special declarations never apply to function bindings. . . . When used in a proclamation, a special declaration specifier applies to all bindings as well as to all references of the mentioned variables. For example, after (declaim (special x)) then in a function definition such as (defun example (x) ...) the parameter x is bound as a dynamic variable rather than as a lexical variable. ============================================================== Section 5.2.2, "Lambda Expressions", pg. 77 of CLtL2 has this to say about binding of required parameters of the lambda list of a lambda expression when it is applied to arguments: Here, and in general, the parameter is bound as a lexical variable unless a declaration has been made that it should be a special binding. See defvar, proclaim, and declare. ============================================================== It would seem that some but not all special declarations can override the default bindings of a variable as lexical. -- Bill Wood From rich.hennessy at verizon.net Wed Jan 11 16:24:04 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Wed, 11 Jan 2012 17:24:04 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? In-Reply-To: <1326310585.15514.8.camel@asus> References: <1E2DD2D53F7844A9912495644840333E@edwinc367e16bd> <4F0DD93F.4010405@eecs.berkeley.edu> <1326310585.15514.8.camel@asus> Message-ID: <9FD0E94CB3A046328098A4DEF1D03034@RichsLaptop> "Theorem. For any real n>0, a>=0, b>0 integrate(exp(x^n),x,a,b)=((gamma_incomplete(1/n,-a^n)-gamma_incomplete(1/n,-b^n))*%e^(-(%i*%pi)/n))/n" I think this may be right but it is not what the new defint.lisp gives. (%i5) kill(all); (%o0) done (%i1) assume(a>0,b>0,b>a,n>0); (%o1) [a > 0,b > 0,b > a,n > 0] (%i2) load(defint); (%o2) "C:/Maxima-5.25.1/share/maxima/5.25.1/src/defint.lisp" (%i3) integrate(exp(x^5),x,a,b); (%o3) (gamma_incomplete(1/5,-b^5)-gamma_incomplete(1/5,-a^5))/5 (%i4) F(n,a,b):=((gamma_incomplete(1/n,-a^n)-gamma_incomplete(1/n,-b^n))*%e^(-(%i*%pi)/n))/n$ (%i5) F(5,a,b); (%o5) %e^-(%i*%pi/5)*(gamma_incomplete(1/5,-a^5)-gamma_incomplete(1/5,-b^5))/5 Which is a new defint.lisp bug if your formula is right. But the calculation is not accurate to enough precision also. (%i8) float(rectform(float(F(5,1,2)))); (%o8) 1.0571128427649482E+12 - 9.7656250000000005E-5 * %i (%i9) taylor(exp(x^5),x,0,1700)$ (%i10) integrate(%,x)$ (%i11) float(at(%,[x=2])-at(%,[x=1])); ($o11) 1.0132394896940182E+12 (%i12) taylor(exp(x^5),x,0,2700)$ (%i13) integrate(%,x)$ (%i14) float(at(%,[x=2])-at(%,[x=1])); (%o14) 1.0132394896940182E+12 Maybe this is a little of both, a lack of precision and a defint.lisp error. FWIW, Rich -----Original Message----- From: Thomas D. Dean Sent: Wednesday, January 11, 2012 2:36 PM To: Richard Fateman Cc: Edwin Woollett ; Maxima - list Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? On Wed, 2012-01-11 at 10:47 -0800, Richard Fateman wrote: > integrate(exp(x^5),x,1,2); Maple returns -1/5*(-1)^(4/5)*( (x*(-1)^(1/5)*Pi*csc(Pi/5))/(gamma(4/5)*(-x^5)^(1/5)) - (x*(-1)^(1/5)*gamma(1/5,-x^5))/((-x^5)^(1/5)) ); gamma(m,n) is the incomplete gamma function Tom Dean _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From tomdean at speakeasy.org Wed Jan 11 20:27:37 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Wed, 11 Jan 2012 18:27:37 -0800 Subject: [Maxima] [Maxima} New defint.lisp bug Message-ID: <87ehv5bqp2.fsf@P9X79.tddhome> I tried this integral in Maple 15. > restart;assume(n>0, a>0, b>a); integrate(exp(x^n),x=a..b); b~ / | n~ | exp(x ) dx | / a~ evalc(%); b~ / | | exp(exp(n~ ln(| x |)) cos(n~ (1/2 - 1/2 signum(x)) Pi)) | / a~ cos(exp(n~ ln(| x |)) sin(n~ (1/2 - 1/2 signum(x)) Pi)) dx expand(%); n~ n~ -a~ exp(a~ ) + exp(b~ ) b~ about({a,b,n}); {a, b, n}: is used in the following assumed objects [a] assumed RealRange(Open(0),infinity) [b] assumed real [n] assumed RealRange(Open(0),infinity) [-b+a] assumed RealRange(-infinity,Open(0)) Tom Dean From smh at franz.com Wed Jan 11 22:23:22 2012 From: smh at franz.com (Steve Haflich) Date: Wed, 11 Jan 2012 20:23:22 -0800 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <1326315301.1548.19.camel@ubuntu> References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> Message-ID: <23737.1326342202@gemini.franz.com> Bill Wood wrote: It would seem that some but not all special declarations can overridending is if it ao the default bindings of a variable as lexical. Bill, this imprecise conclusion leaves binding semantics floating in midair. The ANS (often surrogated to the CLHS) wasnd';t intended as expository; it was intended as a specification. (Translation: It isn't easy to understand unless one has studied it in its entirety.) To understand declarations as anything other than magic formulae, you need to read the _entire_ ANS, including the glossary. The thing you are missing is the definition of "declaration", which is: declaration: n. a global declaration or local declaration. These two terms are defined: global declaration: n. a form that makes certain kinds of information about code globally available; that is, a proclaim form or a declaim form. local declaration: n. an expression which may appear only in specially designated positions of certain forms, and which provides information about the code contained within the containing form; that is, a declare expression. It should follow from this (coupled with the specifications for defvar, defparameter, snd defconstant, and the sections on the scoping of declarations) that the only way a declare special declaration can affect the special/lexical nature of a _binding_ form is if that declaration appears at the head of the form that establishes the binding. Proclamations (aka declamations) such as are estabished by the macroexpansions if DEFVAR etc. affect all subsequently-compiled or executed bindings and references. It's a simple as simple as that. See the macroexpansion of a defvar form on your favorite implementation. From cfrangos123 at gmail.com Thu Jan 12 01:33:44 2012 From: cfrangos123 at gmail.com (Constantine Frangos) Date: Thu, 12 Jan 2012 09:33:44 +0200 Subject: [Maxima] Double integration. In-Reply-To: References: Message-ID: Hi Alexander, Thanks for the fast response. Any assistance with the following would be appreciated: (1) Its not clear why the function definition I am using does not work. According to the Maxima 5.24 manual, paragraph 20.4, the integrand can be the name of a Maxima function, presumably defined by the user in a file, for example, integrand.mac (2) Are there perhaps other Maxima numerical integration functions that may perform better ? Thanks very much. Regards, Constantine. On 1/10/12, Alexander Klimov wrote: > On Tue, 10 Jan 2012, Constantine Frangos wrote: >> Any assistance with using the Maxima function quad_qags() in the >> following application would be appreciated: >> >> (1) I am trying to compute the area of regions in the (X,Y)-plane >> bounded by lines/curves and am using two nested calls to quad_qags() >> with the integrand being an indicator-type function ind() >> defined below. It is not clear where the error is ? > > The error is due to your definition of ind. You can do it as follows: > > (%i1) ind(x,y) := if x*x + y*y <= 1 then 1 else 0$ > (%i2) > I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1,'epsrel=0.1)[1],x2,-1,1,'epsrel=0.1); > (%o2) [3.147364455231505, .06760267083066201, 147, 0] > > Note that this approch is very roundabout (and takes forever with > default epsrel). Instead you can > > solve(x*x+y*y=1,x); > > and use a simple integral: > > (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1); > (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0] > > -- > Regards, > ASK > From hawe at chefmail.de Thu Jan 12 02:53:15 2012 From: hawe at chefmail.de (Hans W. Hofmann) Date: Thu, 12 Jan 2012 08:53:15 +0000 (UTC) Subject: [Maxima] find integer References: Message-ID: Andrej Vodopivec gmail.com> writes: Great, Thanks for the code... I coded simple loop to get a result find_Integers4x(_L_,_von_,_bis_):=block( makelist(ev(_L_,x=i),i, flatten(makelist(( if map(denom,ev(_L_,x=i))=makelist(1,i,1,length(_L_)) then i else []) ,i,_von_,_bis_)) ))$ (%i5) find_Integers4x([(300-4*x)/11,(1800-35*x)/44],0,150); (%o5) [[20,25],[4,-10],[-12,-45]] Gru? HW From alserkli at inbox.ru Thu Jan 12 04:38:08 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Thu, 12 Jan 2012 12:38:08 +0200 Subject: [Maxima] Double integration. In-Reply-To: References: Message-ID: Hi. On Thu, 12 Jan 2012, Constantine Frangos wrote: > (1) Its not clear why the function definition I am using does not > work. According to the Maxima 5.24 manual, paragraph 20.4, the > integrand can be the name of a Maxima function, presumably defined by > the user in a file, for example, integrand.mac Your function does not always return a number. Consider your original definition: (%i1) ind(x,y) := block([s],if is(x*x + y*y <= 1) then (s : 1) else (s : 0),return(s))$ Let us see how it works (%i2) trace(ind); (%o2) [ind] If one gives numerical arguments, then your function returns the number which is assigned to "s" (%i3) ind(0,1); 1 Enter ind [0, 1] 1 Exit ind 1 (%o3) 1 but with symbols as arguments nothing is assigned to "s" and thus the function returns just a symbol "s" (%i4) ind(x1,x2); 1 Enter ind [x1, x2] 1 Exit ind s (%o4) s and this is exactly what happens when you use it in integration (%i5) I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1)[1],x2,-1,1); 1 Enter ind [x1, x2] 1 Exit ind s COERCE-FLOAT-FUN: no such Lisp or Maxima function: s -- an error. To debug this try: debugmode(true); > (2) Are there perhaps other Maxima numerical integration functions > that may perform better ? As I said, it is better to > > use a simple integral: > > > > (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1); > > (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0] the problem with indicators is that while they may be suitable for symbolic manipulations, they are bad functions for Gaussian quadrature rule which is only good if the function is similar to a polynomial. -- Regards, ASK From rswarbrick at gmail.com Thu Jan 12 06:14:08 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Thu, 12 Jan 2012 12:14:08 +0000 Subject: [Maxima] Bug 690510 (problem with display of Taylor series) Message-ID: <87fwflw227.fsf@hake.rswarbrick.dnsalias.com> Hi, I dug in to the cause of bug 690510[1] and attach a patch that fixes it. There's a detailed explanation of what was going wrong at the top of the patch. Is this the right place to send such messages? I would add it to the bug tracker, but Sourceforge doesn't seem to allow me to attach a patch to the bug report (!!!). Rupert Footnotes: [1] https://sourceforge.net/tracker/?func=detail&aid=690510&group_id=4933&atid=104933 -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Ignore-factors-of-1-when-displaying-products.patch Type: text/x-diff Size: 1179 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From macrakis at alum.mit.edu Thu Jan 12 10:04:48 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 12 Jan 2012 11:04:48 -0500 Subject: [Maxima] Double integration. In-Reply-To: References: Message-ID: As Alexander says, you don't need the temporary variable etc. Also, if you explicitly quote everything, you are less likely to have bad surprises. Something like this: (%i27) (cnt:0,quad_qags('(quad_qags('(cnt:cnt+1,if x>y then 1 else 0),x,0,1)[1]),y,0,1)); (%o27) [0.49999763949292, 3.4177098928722671E-9, 735, 0] (%i28) cnt; (%o28) 621243 Note the number of function evaluations for a very simple case! Note also that the result is not very accurate, and that the error estimate is way off. I imagine there are better routines for this kind of integration. Obviously in this case it is easy to transform to a single integral (even analytical), but presumably you want to handle more complicated integrands. -s On Thu, Jan 12, 2012 at 05:38, Alexander Klimov wrote: > Hi. > > On Thu, 12 Jan 2012, Constantine Frangos wrote: > > (1) Its not clear why the function definition I am using does not > > work. According to the Maxima 5.24 manual, paragraph 20.4, the > > integrand can be the name of a Maxima function, presumably defined by > > the user in a file, for example, integrand.mac > > Your function does not always return a number. Consider your original > definition: > > (%i1) ind(x,y) := block([s],if is(x*x + y*y <= 1) then (s : 1) else (s : > 0),return(s))$ > > Let us see how it works > > (%i2) trace(ind); > (%o2) [ind] > > If one gives numerical arguments, then your function returns the > number which is assigned to "s" > > (%i3) ind(0,1); > 1 Enter ind [0, 1] > 1 Exit ind 1 > (%o3) 1 > > but with symbols as arguments nothing is assigned to "s" and thus the > function returns just a symbol "s" > > (%i4) ind(x1,x2); > 1 Enter ind [x1, x2] > 1 Exit ind s > (%o4) s > > and this is exactly what happens when you use it in integration > > (%i5) I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1)[1],x2,-1,1); > 1 Enter ind [x1, x2] > 1 Exit ind s > COERCE-FLOAT-FUN: no such Lisp or Maxima function: s > -- an error. To debug this try: debugmode(true); > > > (2) Are there perhaps other Maxima numerical integration functions > > that may perform better ? > > As I said, it is better to > > > > use a simple integral: > > > > > > (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1); > > > (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0] > > the problem with indicators is that while they may be suitable for > symbolic manipulations, they are bad functions for Gaussian quadrature > rule which is only good if the function is similar to a polynomial. > > -- > Regards, > ASK > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Thu Jan 12 14:28:44 2012 From: woollett at charter.net (Edwin Woollett) Date: Thu, 12 Jan 2012 12:28:44 -0800 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp and radexpand:false? Message-ID: On Jan. 11, 2012, Richard Fateman wrote: ---------------------------------- >> (%i3) integrate(exp(x^5),x,1,2); >> (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 > >for what it is worth, Mathematica 7 returns > >1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} > > >Notice the factor of (-1)^(4/5). ------------------------------------------- This is a very important observation, and explains a difference between Maxima and Mathematica results for these type of integrals. Maxima evaluates the factor (-1)^(4/5) numerically to 1.0, which differs from Mathematica's evaluation (see below). Here I consider a different (but related via a simple change of variables) integral, and compare in detail the results from Maxima and Mathematica (using the Wolfram alpha site). ----------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(exp(y)/y^(4/5),y,1,2); (%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) /* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) does not agree with Maxima, since in Mathematica (-1)^(4/5) float value is not 1.0, whereas is does have value 1.0 in Maxima. */ (%i2) expand(float(%o1)); (%o2) -1.951024982232477*%i-2.685355511932373 /* this Maxima float value agrees with the first 14 digits of Mma's N[Gamma[1/5,-2] - Gamma[1/5,-1]] which gives -2.685355511932382... -1.951024982232483... i which translates into -2.685355511932382 - 1.951024982232483*%i */ /* the approximate (real) value of the integral is given by quad_qags */ (%i3) quad_qags(exp(y)/y^(4/5),y,1,2); (%o3) [3.319281956502171,3.6851432533315483E-14,21,0] /* Maxima gives value 1.0 to (-1)^(4/5) */ (%i4) expand(float(-1)^(4/5)); (%o4) 1.0 /* whereas Mathematica gives N[(-1)^(4/5)] ---> -0.8090169943749474... + 0.5877852522924731... i which translates into -0.8090169943749474 + 0.5877852522924731*%i If we multiply this factor by %o2 and expand we get the correct numerical answer to within floating point roundoff errors: */ (%i5) expand((-0.8090169943749474 + 0.5877852522924731*%i)*%o2); (%o5) 4.4408920985006262E-16*%i+3.319281956502161 /* the above was with 5.25.1 defint.lisp. The updated version makes no difference here */ (%i6) load("defint-new.lisp"); (%o6) "c:/work2/defint-new.lisp" (%i7) integrate(exp(y)/y^(4/5),y,1,2); (%o7) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) (%i8) expand(float(%)); (%o8) -1.951024982232477*%i-2.685355511932373 -------------------------------------- Ted From rich.hennessy at verizon.net Thu Jan 12 17:04:35 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 12 Jan 2012 18:04:35 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? In-Reply-To: References: Message-ID: <15157AEB5DDE4A3393803DDC42AF0988@RichsLaptop> Since maxima does simplify this factor to 1.0 then we could fix that by using the value of polarform(-1) in the answer as suggested by Aleksas. integrate(exp(x^7),x); should give -%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7 and integrate(exp(x^5),x); should give -%e^-(%i*%pi/5)*gamma_incomplete(1/5,-x^5)/5 etc . . . That would fix the problem, since Maxima's simplifier does not simplify away the exponential term. Aleksas has already shown the proof but his method will not work in integrate(exp(x^n),x) when n is a known integer. The reason is that Maxima has already converted the (-1) expression to 1. Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 12, 2012 3:28 PM To: Richard Fateman Cc: maxima mailing list Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? On Jan. 11, 2012, Richard Fateman wrote: ---------------------------------- >> (%i3) integrate(exp(x^5),x,1,2); >> (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 > >for what it is worth, Mathematica 7 returns > >1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} > > >Notice the factor of (-1)^(4/5). ------------------------------------------- This is a very important observation, and explains a difference between Maxima and Mathematica results for these type of integrals. Maxima evaluates the factor (-1)^(4/5) numerically to 1.0, which differs from Mathematica's evaluation (see below). Here I consider a different (but related via a simple change of variables) integral, and compare in detail the results from Maxima and Mathematica (using the Wolfram alpha site). ----------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(exp(y)/y^(4/5),y,1,2); (%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) /* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) does not agree with Maxima, since in Mathematica (-1)^(4/5) float value is not 1.0, whereas is does have value 1.0 in Maxima. */ (%i2) expand(float(%o1)); (%o2) -1.951024982232477*%i-2.685355511932373 /* this Maxima float value agrees with the first 14 digits of Mma's N[Gamma[1/5,-2] - Gamma[1/5,-1]] which gives -2.685355511932382... -1.951024982232483... i which translates into -2.685355511932382 - 1.951024982232483*%i */ /* the approximate (real) value of the integral is given by quad_qags */ (%i3) quad_qags(exp(y)/y^(4/5),y,1,2); (%o3) [3.319281956502171,3.6851432533315483E-14,21,0] /* Maxima gives value 1.0 to (-1)^(4/5) */ (%i4) expand(float(-1)^(4/5)); (%o4) 1.0 /* whereas Mathematica gives N[(-1)^(4/5)] ---> -0.8090169943749474... + 0.5877852522924731... i which translates into -0.8090169943749474 + 0.5877852522924731*%i If we multiply this factor by %o2 and expand we get the correct numerical answer to within floating point roundoff errors: */ (%i5) expand((-0.8090169943749474 + 0.5877852522924731*%i)*%o2); (%o5) 4.4408920985006262E-16*%i+3.319281956502161 /* the above was with 5.25.1 defint.lisp. The updated version makes no difference here */ (%i6) load("defint-new.lisp"); (%o6) "c:/work2/defint-new.lisp" (%i7) integrate(exp(y)/y^(4/5),y,1,2); (%o7) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) (%i8) expand(float(%)); (%o8) -1.951024982232477*%i-2.685355511932373 -------------------------------------- Ted _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Thu Jan 12 17:28:45 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 12 Jan 2012 18:28:45 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? In-Reply-To: <15157AEB5DDE4A3393803DDC42AF0988@RichsLaptop> References: <15157AEB5DDE4A3393803DDC42AF0988@RichsLaptop> Message-ID: <82C33953E03549ED812A8FE2AE754CB2@RichsLaptop> Actually a more general answer that works for positive and negative x is integrate(exp(x^7),x); (-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7+%e^-(%i*%pi/7)*gamma(1/7)/7+gamma(1/7)/7)*(signum(x)+1)/2 +gamma_incomplete(1/7,-x^7)*(1-signum(x))/14 which is very complicated but more correct. Maybe someone can suggest a better form or we have to fix the -1 problem. Maybe if assume(x>0) should affect the answer. Then integrate would have to check for that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:04 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Since maxima does simplify this factor to 1.0 then we could fix that by using the value of polarform(-1) in the answer as suggested by Aleksas. integrate(exp(x^7),x); should give -%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7 and integrate(exp(x^5),x); should give -%e^-(%i*%pi/5)*gamma_incomplete(1/5,-x^5)/5 etc . . . That would fix the problem, since Maxima's simplifier does not simplify away the exponential term. Aleksas has already shown the proof but his method will not work in integrate(exp(x^n),x) when n is a known integer. The reason is that Maxima has already converted the (-1) expression to 1. Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 12, 2012 3:28 PM To: Richard Fateman Cc: maxima mailing list Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? On Jan. 11, 2012, Richard Fateman wrote: ---------------------------------- >> (%i3) integrate(exp(x^5),x,1,2); >> (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 > >for what it is worth, Mathematica 7 returns > >1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} > > >Notice the factor of (-1)^(4/5). ------------------------------------------- This is a very important observation, and explains a difference between Maxima and Mathematica results for these type of integrals. Maxima evaluates the factor (-1)^(4/5) numerically to 1.0, which differs from Mathematica's evaluation (see below). Here I consider a different (but related via a simple change of variables) integral, and compare in detail the results from Maxima and Mathematica (using the Wolfram alpha site). ----------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(exp(y)/y^(4/5),y,1,2); (%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) /* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) does not agree with Maxima, since in Mathematica (-1)^(4/5) float value is not 1.0, whereas is does have value 1.0 in Maxima. */ (%i2) expand(float(%o1)); (%o2) -1.951024982232477*%i-2.685355511932373 /* this Maxima float value agrees with the first 14 digits of Mma's N[Gamma[1/5,-2] - Gamma[1/5,-1]] which gives -2.685355511932382... -1.951024982232483... i which translates into -2.685355511932382 - 1.951024982232483*%i */ /* the approximate (real) value of the integral is given by quad_qags */ (%i3) quad_qags(exp(y)/y^(4/5),y,1,2); (%o3) [3.319281956502171,3.6851432533315483E-14,21,0] /* Maxima gives value 1.0 to (-1)^(4/5) */ (%i4) expand(float(-1)^(4/5)); (%o4) 1.0 /* whereas Mathematica gives N[(-1)^(4/5)] ---> -0.8090169943749474... + 0.5877852522924731... i which translates into -0.8090169943749474 + 0.5877852522924731*%i If we multiply this factor by %o2 and expand we get the correct numerical answer to within floating point roundoff errors: */ (%i5) expand((-0.8090169943749474 + 0.5877852522924731*%i)*%o2); (%o5) 4.4408920985006262E-16*%i+3.319281956502161 /* the above was with 5.25.1 defint.lisp. The updated version makes no difference here */ (%i6) load("defint-new.lisp"); (%o6) "c:/work2/defint-new.lisp" (%i7) integrate(exp(y)/y^(4/5),y,1,2); (%o7) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) (%i8) expand(float(%)); (%o8) -1.951024982232477*%i-2.685355511932373 -------------------------------------- Ted _______________________________________________ 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 rich.hennessy at verizon.net Thu Jan 12 17:36:20 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 12 Jan 2012 18:36:20 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Message-ID: <92B4901587C24839AF27E5062EDEFB17@RichsLaptop> Sorry about the multiple posts but here is my last one. integrate(exp(x^7),x); gamma_incomplete(1/7,-x^7)*(1-signum(x))/14-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)*(signum(x)+1)/14; This is simpler but it is discontinuous at 0. I can live with that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:28 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Actually a more general answer that works for positive and negative x is integrate(exp(x^7),x); (-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7+%e^-(%i*%pi/7)*gamma(1/7)/7+gamma(1/7)/7)*(signum(x)+1)/2 +gamma_incomplete(1/7,-x^7)*(1-signum(x))/14 which is very complicated but more correct. Maybe someone can suggest a better form or we have to fix the -1 problem. Maybe if assume(x>0) should affect the answer. Then integrate would have to check for that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:04 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Since maxima does simplify this factor to 1.0 then we could fix that by using the value of polarform(-1) in the answer as suggested by Aleksas. integrate(exp(x^7),x); should give -%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7 and integrate(exp(x^5),x); should give -%e^-(%i*%pi/5)*gamma_incomplete(1/5,-x^5)/5 etc . . . That would fix the problem, since Maxima's simplifier does not simplify away the exponential term. Aleksas has already shown the proof but his method will not work in integrate(exp(x^n),x) when n is a known integer. The reason is that Maxima has already converted the (-1) expression to 1. Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 12, 2012 3:28 PM To: Richard Fateman Cc: maxima mailing list Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? On Jan. 11, 2012, Richard Fateman wrote: ---------------------------------- >> (%i3) integrate(exp(x^5),x,1,2); >> (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 > >for what it is worth, Mathematica 7 returns > >1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} > > >Notice the factor of (-1)^(4/5). ------------------------------------------- This is a very important observation, and explains a difference between Maxima and Mathematica results for these type of integrals. Maxima evaluates the factor (-1)^(4/5) numerically to 1.0, which differs from Mathematica's evaluation (see below). Here I consider a different (but related via a simple change of variables) integral, and compare in detail the results from Maxima and Mathematica (using the Wolfram alpha site). ----------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(exp(y)/y^(4/5),y,1,2); (%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) /* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) does not agree with Maxima, since in Mathematica (-1)^(4/5) float value is not 1.0, whereas is does have value 1.0 in Maxima. */ (%i2) expand(float(%o1)); (%o2) -1.951024982232477*%i-2.685355511932373 /* this Maxima float value agrees with the first 14 digits of Mma's N[Gamma[1/5,-2] - Gamma[1/5,-1]] which gives -2.685355511932382... -1.951024982232483... i which translates into -2.685355511932382 - 1.951024982232483*%i */ /* the approximate (real) value of the integral is given by quad_qags */ (%i3) quad_qags(exp(y)/y^(4/5),y,1,2); (%o3) [3.319281956502171,3.6851432533315483E-14,21,0] /* Maxima gives value 1.0 to (-1)^(4/5) */ (%i4) expand(float(-1)^(4/5)); (%o4) 1.0 /* whereas Mathematica gives N[(-1)^(4/5)] ---> -0.8090169943749474... + 0.5877852522924731... i which translates into -0.8090169943749474 + 0.5877852522924731*%i If we multiply this factor by %o2 and expand we get the correct numerical answer to within floating point roundoff errors: */ (%i5) expand((-0.8090169943749474 + 0.5877852522924731*%i)*%o2); (%o5) 4.4408920985006262E-16*%i+3.319281956502161 /* the above was with 5.25.1 defint.lisp. The updated version makes no difference here */ (%i6) load("defint-new.lisp"); (%o6) "c:/work2/defint-new.lisp" (%i7) integrate(exp(y)/y^(4/5),y,1,2); (%o7) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) (%i8) expand(float(%)); (%o8) -1.951024982232477*%i-2.685355511932373 -------------------------------------- Ted _______________________________________________ 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 rich.hennessy at verizon.net Thu Jan 12 19:52:16 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 12 Jan 2012 20:52:16 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? In-Reply-To: <92B4901587C24839AF27E5062EDEFB17@RichsLaptop> References: <92B4901587C24839AF27E5062EDEFB17@RichsLaptop> Message-ID: <5280E133A3E341B5B80CB72AED81A8A0@RichsLaptop> Sorry, but my last post below is not valid. Theorem, For odd integer n>0, integrate(exp(x^n),x) = F(x,n), F(x,n) is real valued and continuous and F(x,n)= (-gamma_incomplete(1/n,-x^n)*%e^-(%i*%pi/n)/n+gamma(1/n)*%e^-(%i*%pi/n)/n+gamma(1/n)/n)*(signum(x)+1)/2 +gamma_incomplete(1/n,-x^n)*(1-signum(x))/(2*n) for all real x. FWIW, Rich PS It seems to work for negative odd n too, I think. -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:36 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Sorry about the multiple posts but here is my last one. integrate(exp(x^7),x); gamma_incomplete(1/7,-x^7)*(1-signum(x))/14-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)*(signum(x)+1)/14; This is simpler but it is discontinuous at 0. I can live with that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:28 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Actually a more general answer that works for positive and negative x is integrate(exp(x^7),x); (-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7+%e^-(%i*%pi/7)*gamma(1/7)/7+gamma(1/7)/7)*(signum(x)+1)/2 +gamma_incomplete(1/7,-x^7)*(1-signum(x))/14 which is very complicated but more correct. Maybe someone can suggest a better form or we have to fix the -1 problem. Maybe if assume(x>0) should affect the answer. Then integrate would have to check for that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:04 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Since maxima does simplify this factor to 1.0 then we could fix that by using the value of polarform(-1) in the answer as suggested by Aleksas. integrate(exp(x^7),x); should give -%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7 and integrate(exp(x^5),x); should give -%e^-(%i*%pi/5)*gamma_incomplete(1/5,-x^5)/5 etc . . . That would fix the problem, since Maxima's simplifier does not simplify away the exponential term. Aleksas has already shown the proof but his method will not work in integrate(exp(x^n),x) when n is a known integer. The reason is that Maxima has already converted the (-1) expression to 1. Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 12, 2012 3:28 PM To: Richard Fateman Cc: maxima mailing list Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? On Jan. 11, 2012, Richard Fateman wrote: ---------------------------------- >> (%i3) integrate(exp(x^5),x,1,2); >> (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 > >for what it is worth, Mathematica 7 returns > >1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} > > >Notice the factor of (-1)^(4/5). ------------------------------------------- This is a very important observation, and explains a difference between Maxima and Mathematica results for these type of integrals. Maxima evaluates the factor (-1)^(4/5) numerically to 1.0, which differs from Mathematica's evaluation (see below). Here I consider a different (but related via a simple change of variables) integral, and compare in detail the results from Maxima and Mathematica (using the Wolfram alpha site). ----------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(exp(y)/y^(4/5),y,1,2); (%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) /* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) does not agree with Maxima, since in Mathematica (-1)^(4/5) float value is not 1.0, whereas is does have value 1.0 in Maxima. */ (%i2) expand(float(%o1)); (%o2) -1.951024982232477*%i-2.685355511932373 /* this Maxima float value agrees with the first 14 digits of Mma's N[Gamma[1/5,-2] - Gamma[1/5,-1]] which gives -2.685355511932382... -1.951024982232483... i which translates into -2.685355511932382 - 1.951024982232483*%i */ /* the approximate (real) value of the integral is given by quad_qags */ (%i3) quad_qags(exp(y)/y^(4/5),y,1,2); (%o3) [3.319281956502171,3.6851432533315483E-14,21,0] /* Maxima gives value 1.0 to (-1)^(4/5) */ (%i4) expand(float(-1)^(4/5)); (%o4) 1.0 /* whereas Mathematica gives N[(-1)^(4/5)] ---> -0.8090169943749474... + 0.5877852522924731... i which translates into -0.8090169943749474 + 0.5877852522924731*%i If we multiply this factor by %o2 and expand we get the correct numerical answer to within floating point roundoff errors: */ (%i5) expand((-0.8090169943749474 + 0.5877852522924731*%i)*%o2); (%o5) 4.4408920985006262E-16*%i+3.319281956502161 /* the above was with 5.25.1 defint.lisp. The updated version makes no difference here */ (%i6) load("defint-new.lisp"); (%o6) "c:/work2/defint-new.lisp" (%i7) integrate(exp(y)/y^(4/5),y,1,2); (%o7) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) (%i8) expand(float(%)); (%o8) -1.951024982232477*%i-2.685355511932373 -------------------------------------- Ted _______________________________________________ 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 rich.hennessy at verizon.net Thu Jan 12 19:58:41 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Thu, 12 Jan 2012 20:58:41 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Message-ID: This whole effort is probably not worth the time I spent. The general real valued formula is probably too complicated to be useful. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 8:52 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Sorry, but my last post below is not valid. Theorem, For odd integer n>0, integrate(exp(x^n),x) = F(x,n), F(x,n) is real valued and continuous and F(x,n)= (-gamma_incomplete(1/n,-x^n)*%e^-(%i*%pi/n)/n+gamma(1/n)*%e^-(%i*%pi/n)/n+gamma(1/n)/n)*(signum(x)+1)/2 +gamma_incomplete(1/n,-x^n)*(1-signum(x))/(2*n) for all real x. FWIW, Rich PS It seems to work for negative odd n too, I think. -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:36 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Sorry about the multiple posts but here is my last one. integrate(exp(x^7),x); gamma_incomplete(1/7,-x^7)*(1-signum(x))/14-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)*(signum(x)+1)/14; This is simpler but it is discontinuous at 0. I can live with that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:28 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Actually a more general answer that works for positive and negative x is integrate(exp(x^7),x); (-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7+%e^-(%i*%pi/7)*gamma(1/7)/7+gamma(1/7)/7)*(signum(x)+1)/2 +gamma_incomplete(1/7,-x^7)*(1-signum(x))/14 which is very complicated but more correct. Maybe someone can suggest a better form or we have to fix the -1 problem. Maybe if assume(x>0) should affect the answer. Then integrate would have to check for that. Rich -----Original Message----- From: Richard Hennessy Sent: Thursday, January 12, 2012 6:04 PM To: Edwin Woollett ; Richard Fateman Cc: maxima mailing list ; Aleksas Domarkas Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Since maxima does simplify this factor to 1.0 then we could fix that by using the value of polarform(-1) in the answer as suggested by Aleksas. integrate(exp(x^7),x); should give -%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)/7 and integrate(exp(x^5),x); should give -%e^-(%i*%pi/5)*gamma_incomplete(1/5,-x^5)/5 etc . . . That would fix the problem, since Maxima's simplifier does not simplify away the exponential term. Aleksas has already shown the proof but his method will not work in integrate(exp(x^n),x) when n is a known integer. The reason is that Maxima has already converted the (-1) expression to 1. Rich -----Original Message----- From: Edwin Woollett Sent: Thursday, January 12, 2012 3:28 PM To: Richard Fateman Cc: maxima mailing list Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? On Jan. 11, 2012, Richard Fateman wrote: ---------------------------------- >> (%i3) integrate(exp(x^5),x,1,2); >> (%o3) (gamma_incomplete(1/5,-32)-gamma_incomplete(1/5,-1))/5 > >for what it is worth, Mathematica 7 returns > >1/5 (-1)^(4/5) (Gamma[1/5, -32] - Gamma[1/5, -1])} > > >Notice the factor of (-1)^(4/5). ------------------------------------------- This is a very important observation, and explains a difference between Maxima and Mathematica results for these type of integrals. Maxima evaluates the factor (-1)^(4/5) numerically to 1.0, which differs from Mathematica's evaluation (see below). Here I consider a different (but related via a simple change of variables) integral, and compare in detail the results from Maxima and Mathematica (using the Wolfram alpha site). ----------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(exp(y)/y^(4/5),y,1,2); (%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) /* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) does not agree with Maxima, since in Mathematica (-1)^(4/5) float value is not 1.0, whereas is does have value 1.0 in Maxima. */ (%i2) expand(float(%o1)); (%o2) -1.951024982232477*%i-2.685355511932373 /* this Maxima float value agrees with the first 14 digits of Mma's N[Gamma[1/5,-2] - Gamma[1/5,-1]] which gives -2.685355511932382... -1.951024982232483... i which translates into -2.685355511932382 - 1.951024982232483*%i */ /* the approximate (real) value of the integral is given by quad_qags */ (%i3) quad_qags(exp(y)/y^(4/5),y,1,2); (%o3) [3.319281956502171,3.6851432533315483E-14,21,0] /* Maxima gives value 1.0 to (-1)^(4/5) */ (%i4) expand(float(-1)^(4/5)); (%o4) 1.0 /* whereas Mathematica gives N[(-1)^(4/5)] ---> -0.8090169943749474... + 0.5877852522924731... i which translates into -0.8090169943749474 + 0.5877852522924731*%i If we multiply this factor by %o2 and expand we get the correct numerical answer to within floating point roundoff errors: */ (%i5) expand((-0.8090169943749474 + 0.5877852522924731*%i)*%o2); (%o5) 4.4408920985006262E-16*%i+3.319281956502161 /* the above was with 5.25.1 defint.lisp. The updated version makes no difference here */ (%i6) load("defint-new.lisp"); (%o6) "c:/work2/defint-new.lisp" (%i7) integrate(exp(y)/y^(4/5),y,1,2); (%o7) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) (%i8) expand(float(%)); (%o8) -1.951024982232477*%i-2.685355511932373 -------------------------------------- Ted _______________________________________________ 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 rswarbrick at gmail.com Thu Jan 12 18:45:47 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Fri, 13 Jan 2012 00:45:47 +0000 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? References: <92B4901587C24839AF27E5062EDEFB17@RichsLaptop> Message-ID: "Richard Hennessy" writes: > Sorry about the multiple posts but here is my last one. > > integrate(exp(x^7),x); > gamma_incomplete(1/7,-x^7)*(1-signum(x))/14-%e^-(%i*%pi/7)*gamma_incomplete(1/7,-x^7)*(signum(x)+1)/14; > > This is simpler but it is discontinuous at 0. I can live with that. > > Rich I confess I've been pretty much ignoring this discussion but: Are you claiming that you have a function that is not continuous but is an antiderivative of exp(x^7)? I presume that you have some understanding of how continuity is affected by integration and differentation. Also, x |-> exp(x^7) is smooth. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From oldenbur at math.uni-frankfurt.de Fri Jan 13 02:45:37 2012 From: oldenbur at math.uni-frankfurt.de (Reinhard Oldenburg) Date: Fri, 13 Jan 2012 09:45:37 +0100 Subject: [Maxima] Summation problem Message-ID: <4F0FEF31.70909@math.uni-frankfurt.de> Hi all. The following rather simple sum is not reported properly by nusum: nusum(k*(5/6)^(k-1),k,1,inf) Is it a good idea to fix the problem in the following way: mySum(expr,var,a,b):= block([k],limit(subst(k,inf,nusum(expr,var,a,b)),k,inf)); Reinhard Oldenburg From aleksasd873 at gmail.com Fri Jan 13 02:53:26 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Fri, 13 Jan 2012 10:53:26 +0200 Subject: [Maxima] defint.lisp bug - was: new defint.lisp andradexpand:false? Message-ID: About integrate(exp(x)*x^k,x,a,b) We discus problems from http://www.math.utexas.edu/pipermail/maxima/2012/027431.html A.Domarkas From Oiler's formula exp(i*x)=cos(x)+i*sin(x). Then exp(i*pi)=-1. Maxima wrong compute (%i1) (-1)^(4/5); (%o1) 1 Should be (%i2) polarform(-1)^(4/5); (%o2) %e^((4*%i*%pi)/5) (%i3) float(%), numer; (%o3) 0.587785252292473*%i-0.809016994374947 This is same as Mathematica gives. Theorem. For any real k, a, b integrate(exp(x)*x^k,x,a,b)=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) Proof. (%i4) S:'integrate(exp(x)*x^k,x); (%o4) integrate(x^k*%e^x,x) (%i5) S1:ev(S, nouns); (%o5) -gamma_incomplete(k+1,-x)*(-x)^(-k-1)*x^(k+1) (%i6) subst(-x=exp(%i*pi)*x,S1); (%o6) -gamma_incomplete(k+1,%e^(%i*pi)*x)*x^(k+1)*(%e^(%i*pi)*x)^(-k-1) Froom Newton-Leibnitz formula S is equal (%i7) subst(x=b,%)-subst(x=a,%); (%o7) a^(k+1)*gamma_incomplete(k+1,a*%e^(%i*pi))*(a*%e^(%i*pi))^(-k-1)-b^(k+1)*gamma_incomplete(k+1,b*%e^(%i*pi))*(b*%e^(%i*pi))^(-k-1) (%i8) radcan(%); (%o8) -(gamma_incomplete(k+1,b*%e^(%i*pi))-gamma_incomplete(k+1,a*%e^(%i*pi)))*%e^(-(%i*k+%i)*pi) (%i9) subst(pi=%pi,%); (%o9) %e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) (%i10) define(F(k,a,b),%); (%o10) F(k,a,b):=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) q.e.d. --> Example 1. integrate(exp(y)/y^(4/5),y,1,2); (%i11) F(-4/5,1,2); (%o11) %e^((4*%i*%pi)/5)*(gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1)) (%i12) expand(float(rectform(%))); (%o12) 3.319281956502161-4.440892098500626*10^-16*%i (%i13) realpart(%); (%o13) 3.319281956502161 (%i14) /*test*/ first(quad_qags(exp(y)/y^(4/5),y,1,2)); (%o14) 3.319281956502171 Example 2. integrate(exp(x)*x^(1/2),x,0,2); (%i15) F(1/2,0,2); (%o15) -%i*(gamma_incomplete(3/2,-2)-sqrt(%pi)/2) (%i16) expand(float(rectform(%))); (%o16) 7.105860585432373-1.4432899320127035*10^-15*%i (%i17) realpart(%); (%o17) 7.105860585432373 (%i18) /*test*/ first(quad_qags(exp(x)*x^(1/2),x,0,2)); (%o18) 7.105860585432362 Example 3. integrate(exp(x)*x^(1/2),x,1,4); (%i19) F(1/2,1,4); (%o19) -%i*(gamma_incomplete(3/2,-4)-gamma_incomplete(3/2,-1)) (%i20) expand(float(rectform(%))); (%o20) 91.48804221822935-1.6764367671839864*10^-14*%i (%i21) realpart(%); (%o21) 91.48804221822935 (%i22) /*test*/ first(quad_qags(exp(x)*x^(1/2),x,1,4)); (%o22) 91.4880422182294 Example 3. integrate(exp(x)*x^3,x,1,4); (%i23) F(3,1,4); (%o23) gamma_incomplete(4,-1)-gamma_incomplete(4,-4) (%i24) expand(float(rectform(%))); (%o24) 1861.773664783822-9.119759437093765*10^-13*%i (%i25) realpart(%); (%o25) 1861.773664783822 (%i26) /*test*/ first(quad_qags(exp(x)*x^3,x,1,4)); (%o26) 1861.773664783822 Example 4. integrate(exp(x)*x^3,x,-1,1); (%i27) F(3,-1,1); (%o27) gamma_incomplete(4,1)-gamma_incomplete(4,-1) (%i28) expand(float(rectform(%))); (%o28) 0.449507401824987-2.759950902850205*10^-16*%i (%i29) realpart(%); (%o29) 0.449507401824987 (%i30) /*test*/ first(quad_qags(exp(x)*x^3,x,-1,1)); (%o30) 0.449507401824987 Example 5. integrate(exp(x)*x^4,x,-1,1); (%i31) F(4,-1,1); (%o31) gamma_incomplete(5,-1)-gamma_incomplete(5,1) (%i32) expand(float(rectform(%))); (%o32) 0.552372779987653-2.844371478803256*10^-16*%i (%i33) realpart(%); (%o33) 0.552372779987653 (%i34) /*test*/ first(quad_qags(exp(x)*x^4,x,-1,1)); (%o34) 0.552372779987656 Example 6. integrate(exp(x)*x^sqrt(2),x,0,1); (%i35) F(sqrt(2),0,1); (%o35) %e^(-sqrt(2)*%i*%pi)*(gamma_incomplete(sqrt(2)+1,-1)-gamma(sqrt(2)+1)) (%i36) expand(float(rectform(%))); (%o36) 0.858969157722264-5.551115123125783*10^-17*%i (%i37) realpart(%); (%o37) 0.858969157722264 (%i38) /*test*/ first(quad_qags(exp(x)*x^sqrt(2),x,0,1)); (%o38) 0.85896915771574 Example 7. integrate(exp(x)*x^4,x,-2,-1); (%i39) F(4,-2,-1); (%o39) gamma_incomplete(5,1)-gamma_incomplete(5,2) (%i40) expand(float(rectform(%))); (%o40) 1.175836092392821 (%i41) /*test*/ first(quad_qags(exp(x)*x^4,x,-2,-1)); (%o41) 1.175836092392819 Example 8. integrate(exp(x)*x^3,x,-2,-1); (%i42) F(3,-2,-1); (%o42) gamma_incomplete(4,2)-gamma_incomplete(4,1) (%i43) expand(float(rectform(%))); (%o43) -0.743330295751795 (%i44) /*test*/ first(quad_qags(exp(x)*x^3,x,-2,-1)); (%o44) -0.743330295751795 (%i45) build_info()$ Maxima version: 5.25.1 Maxima build date: 9:23 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r14925M (WindowsX8632) Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gandrusz at gmail.com Fri Jan 13 10:09:39 2012 From: gandrusz at gmail.com (=?ISO-8859-2?Q?Grze=B6_Andruszkiewicz?=) Date: Fri, 13 Jan 2012 16:09:39 +0000 Subject: [Maxima] Differentiating sums Message-ID: Hi, I have the following sum: sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); which I want to differenciate wrt. a: diff(%, a); but Maxima (wxMaxima to be precise) just prints d/da . Can I make it actually differentiate the sum (so because N is finite is should differentiate every element in the sum separately)? If I set N to some constant, e.g.: sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, 100); then I get explicit sum of 100 elements (takes about 2 pages), and then differentiation works (but again I get 2 pages instead of a small sum). Cheers, Grzegorz From robert.dodier at gmail.com Fri Jan 13 10:32:07 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 13 Jan 2012 09:32:07 -0700 Subject: [Maxima] Summation problem In-Reply-To: <4F0FEF31.70909@math.uni-frankfurt.de> References: <4F0FEF31.70909@math.uni-frankfurt.de> Message-ID: On 1/13/12, Reinhard Oldenburg wrote: > The following rather simple sum is not reported properly by nusum: > nusum(k*(5/6)^(k-1),k,1,inf) Well, if I remember correctly, nusum expects the upper limit to be a variable e.g. n instead of inf. Try simplify_sum, which applies nusum and several other algorithms. load (simplify_sum); simplify_sum (sum (k*(5/6)^(k - 1), k, 1, inf)); => 36 Hope this helps Robert Dodier From robert.dodier at gmail.com Fri Jan 13 10:44:21 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 13 Jan 2012 09:44:21 -0700 Subject: [Maxima] Differentiating sums In-Reply-To: References: Message-ID: On 1/13/12, Grze? Andruszkiewicz wrote: > I have the following sum: > sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); > > which I want to differenciate wrt. a: > > diff(%, a); > > but Maxima (wxMaxima to be precise) just prints d/da . Can I > make it actually differentiate the sum (so because N is finite is > should differentiate every element in the sum separately)? Well, there isn't a built-in function to carry out that operation, but I think it can be implemented via simplification rules (tellsimp, defrule, etc). I think this has come up before -- take a look at the mailing list archive. See: http://maxima.sourceforge.net/maximalist.html best Robert Dodier From gandrusz at gmail.com Fri Jan 13 11:13:17 2012 From: gandrusz at gmail.com (=?ISO-8859-2?Q?Grze=B6_Andruszkiewicz?=) Date: Fri, 13 Jan 2012 17:13:17 +0000 Subject: [Maxima] Differentiating sums In-Reply-To: References: Message-ID: Hi, Thanks for a prompt reply. I actually managed to get it working by setting simplify_sum:true. But now I am trying to solve for first order conditions: 2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0 solve(%, a) which gives: [sum(((c^2*X[i]^3+(2*c*d-2*a)*X[i]^2+(d^2-2*b)*X[i])*t+2*R[i]*X[i])/(2*c^2*X[i]^2+4*c*d*X[i]+2*d^2),i,1,M)=0] instead of splitting the sum into 2 sums (1 dependent on a and the other not) and dividing accordingly. Any ideas how to achieve this? Cheers, Grzegorz 2012/1/13 Robert Dodier : > On 1/13/12, Grze? Andruszkiewicz wrote: > >> I have the following sum: >> sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); >> >> which I want to differenciate wrt. a: >> >> diff(%, a); >> >> but Maxima (wxMaxima to be precise) just prints d/da . Can I >> make it actually differentiate the sum (so because N is finite is >> should differentiate every element in the sum separately)? > > Well, there isn't a built-in function to carry out that operation, > but I think it can be implemented via simplification rules > (tellsimp, defrule, etc). I think this has come up before -- take > a look at the mailing list archive. > See: http://maxima.sourceforge.net/maximalist.html > > best > > Robert Dodier From rich.hennessy at verizon.net Fri Jan 13 11:19:54 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Fri, 13 Jan 2012 12:19:54 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? In-Reply-To: References: <92B4901587C24839AF27E5062EDEFB17@RichsLaptop> Message-ID: <1D09626EF80B4908AFD8A4AF6E97D13C@RichsLaptop> "I confess I've been pretty much ignoring this discussion but: Are you claiming that you have a function that is not continuous but is an antiderivative of exp(x^7)? I presume that you have some understanding of how continuity is affected by integration and differentation. Also, x |-> exp(x^7) is smooth." My mistake. No, I not claiming anything now, I took back that post. I was trying to find a general anti-derivative. Aleksas has done it correctly, mine was wrong. Sorry for the confusion. Just feel free to ignore my posts as you were doing. Sorry about that. Thank you Aleksas for posting the answer and it's proof. Rich -----Original Message----- From: Rupert Swarbrick Sent: Thursday, January 12, 2012 7:45 PM To: maxima at math.utexas.edu Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Fri Jan 13 11:21:51 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Fri, 13 Jan 2012 12:21:51 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? In-Reply-To: References: Message-ID: <075ACF5857B746AF96519B898945871D@RichsLaptop> Thank you Aleksas for posting the answer and it's proof. Rich From: Aleksas Domarkas Sent: Friday, January 13, 2012 4:02 AM To: Richard Hennessy Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? About integrate(exp(x)*x^k,x,a,b) We discus problems from http://www.math.utexas.edu/pipermail/maxima/2012/027431.html A.Domarkas >From Oiler's formula exp(i*x)=cos(x)+i*sin(x). Then exp(i*pi)=-1. Maxima wrong compute (%i1) (-1)^(4/5); (%o1) 1 Should be (%i2) polarform(-1)^(4/5); (%o2) %e^((4*%i*%pi)/5) (%i3) float(%), numer; (%o3) 0.587785252292473*%i-0.809016994374947 This is same as Mathematica gives. Theorem. For any real k, a, b integrate(exp(x)*x^k,x,a,b)=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) Proof. (%i4) S:'integrate(exp(x)*x^k,x); (%o4) integrate(x^k*%e^x,x) (%i5) S1:ev(S, nouns); (%o5) -gamma_incomplete(k+1,-x)*(-x)^(-k-1)*x^(k+1) (%i6) subst(-x=exp(%i*pi)*x,S1); (%o6) -gamma_incomplete(k+1,%e^(%i*pi)*x)*x^(k+1)*(%e^(%i*pi)*x)^(-k-1) Froom Newton-Leibnitz formula S is equal (%i7) subst(x=b,%)-subst(x=a,%); (%o7) a^(k+1)*gamma_incomplete(k+1,a*%e^(%i*pi))*(a*%e^(%i*pi))^(-k-1)-b^(k+1)*gamma_incomplete(k+1,b*%e^(%i*pi))*(b*%e^(%i*pi))^(-k-1) (%i8) radcan(%); (%o8) -(gamma_incomplete(k+1,b*%e^(%i*pi))-gamma_incomplete(k+1,a*%e^(%i*pi)))*%e^(-(%i*k+%i)*pi) (%i9) subst(pi=%pi,%); (%o9) %e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) (%i10) define(F(k,a,b),%); (%o10) F(k,a,b):=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) q.e.d. --> Example 1. integrate(exp(y)/y^(4/5),y,1,2); (%i11) F(-4/5,1,2); (%o11) %e^((4*%i*%pi)/5)*(gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1)) (%i12) expand(float(rectform(%))); (%o12) 3.319281956502161-4.440892098500626*10^-16*%i (%i13) realpart(%); (%o13) 3.319281956502161 (%i14) /*test*/ first(quad_qags(exp(y)/y^(4/5),y,1,2)); (%o14) 3.319281956502171 Example 2. integrate(exp(x)*x^(1/2),x,0,2); (%i15) F(1/2,0,2); (%o15) -%i*(gamma_incomplete(3/2,-2)-sqrt(%pi)/2) (%i16) expand(float(rectform(%))); (%o16) 7.105860585432373-1.4432899320127035*10^-15*%i (%i17) realpart(%); (%o17) 7.105860585432373 (%i18) /*test*/ first(quad_qags(exp(x)*x^(1/2),x,0,2)); (%o18) 7.105860585432362 Example 3. integrate(exp(x)*x^(1/2),x,1,4); (%i19) F(1/2,1,4); (%o19) -%i*(gamma_incomplete(3/2,-4)-gamma_incomplete(3/2,-1)) (%i20) expand(float(rectform(%))); (%o20) 91.48804221822935-1.6764367671839864*10^-14*%i (%i21) realpart(%); (%o21) 91.48804221822935 (%i22) /*test*/ first(quad_qags(exp(x)*x^(1/2),x,1,4)); (%o22) 91.4880422182294 Example 3. integrate(exp(x)*x^3,x,1,4); (%i23) F(3,1,4); (%o23) gamma_incomplete(4,-1)-gamma_incomplete(4,-4) (%i24) expand(float(rectform(%))); (%o24) 1861.773664783822-9.119759437093765*10^-13*%i (%i25) realpart(%); (%o25) 1861.773664783822 (%i26) /*test*/ first(quad_qags(exp(x)*x^3,x,1,4)); (%o26) 1861.773664783822 Example 4. integrate(exp(x)*x^3,x,-1,1); (%i27) F(3,-1,1); (%o27) gamma_incomplete(4,1)-gamma_incomplete(4,-1) (%i28) expand(float(rectform(%))); (%o28) 0.449507401824987-2.759950902850205*10^-16*%i (%i29) realpart(%); (%o29) 0.449507401824987 (%i30) /*test*/ first(quad_qags(exp(x)*x^3,x,-1,1)); (%o30) 0.449507401824987 Example 5. integrate(exp(x)*x^4,x,-1,1); (%i31) F(4,-1,1); (%o31) gamma_incomplete(5,-1)-gamma_incomplete(5,1) (%i32) expand(float(rectform(%))); (%o32) 0.552372779987653-2.844371478803256*10^-16*%i (%i33) realpart(%); (%o33) 0.552372779987653 (%i34) /*test*/ first(quad_qags(exp(x)*x^4,x,-1,1)); (%o34) 0.552372779987656 Example 6. integrate(exp(x)*x^sqrt(2),x,0,1); (%i35) F(sqrt(2),0,1); (%o35) %e^(-sqrt(2)*%i*%pi)*(gamma_incomplete(sqrt(2)+1,-1)-gamma(sqrt(2)+1)) (%i36) expand(float(rectform(%))); (%o36) 0.858969157722264-5.551115123125783*10^-17*%i (%i37) realpart(%); (%o37) 0.858969157722264 (%i38) /*test*/ first(quad_qags(exp(x)*x^sqrt(2),x,0,1)); (%o38) 0.85896915771574 Example 7. integrate(exp(x)*x^4,x,-2,-1); (%i39) F(4,-2,-1); (%o39) gamma_incomplete(5,1)-gamma_incomplete(5,2) (%i40) expand(float(rectform(%))); (%o40) 1.175836092392821 (%i41) /*test*/ first(quad_qags(exp(x)*x^4,x,-2,-1)); (%o41) 1.175836092392819 Example 8. integrate(exp(x)*x^3,x,-2,-1); (%i42) F(3,-2,-1); (%o42) gamma_incomplete(4,2)-gamma_incomplete(4,1) (%i43) expand(float(rectform(%))); (%o43) -0.743330295751795 (%i44) /*test*/ first(quad_qags(exp(x)*x^3,x,-2,-1)); (%o44) -0.743330295751795 (%i45) build_info()$ Maxima version: 5.25.1 Maxima build date: 9:23 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r14925M (WindowsX8632) Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.hennessy at verizon.net Fri Jan 13 11:36:51 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Fri, 13 Jan 2012 12:36:51 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? In-Reply-To: <075ACF5857B746AF96519B898945871D@RichsLaptop> References: <075ACF5857B746AF96519B898945871D@RichsLaptop> Message-ID: Thank you again. I am weak with complex numbers, I am a little embarrassed that I did not understand how to work around the (-1) problem. At least there is a way if you know what you are doing, obviously I don?t. The proof of that is obvious, just read my posts. Rich From: Richard Hennessy Sent: Friday, January 13, 2012 12:21 PM To: Aleksas Domarkas Cc: Maxima List Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? Thank you Aleksas for posting the answer and it's proof. Rich From: Aleksas Domarkas Sent: Friday, January 13, 2012 4:02 AM To: Richard Hennessy Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lisp andradexpand:false? About integrate(exp(x)*x^k,x,a,b) We discus problems from http://www.math.utexas.edu/pipermail/maxima/2012/027431.html A.Domarkas >From Oiler's formula exp(i*x)=cos(x)+i*sin(x). Then exp(i*pi)=-1. Maxima wrong compute (%i1) (-1)^(4/5); (%o1) 1 Should be (%i2) polarform(-1)^(4/5); (%o2) %e^((4*%i*%pi)/5) (%i3) float(%), numer; (%o3) 0.587785252292473*%i-0.809016994374947 This is same as Mathematica gives. Theorem. For any real k, a, b integrate(exp(x)*x^k,x,a,b)=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) Proof. (%i4) S:'integrate(exp(x)*x^k,x); (%o4) integrate(x^k*%e^x,x) (%i5) S1:ev(S, nouns); (%o5) -gamma_incomplete(k+1,-x)*(-x)^(-k-1)*x^(k+1) (%i6) subst(-x=exp(%i*pi)*x,S1); (%o6) -gamma_incomplete(k+1,%e^(%i*pi)*x)*x^(k+1)*(%e^(%i*pi)*x)^(-k-1) Froom Newton-Leibnitz formula S is equal (%i7) subst(x=b,%)-subst(x=a,%); (%o7) a^(k+1)*gamma_incomplete(k+1,a*%e^(%i*pi))*(a*%e^(%i*pi))^(-k-1)-b^(k+1)*gamma_incomplete(k+1,b*%e^(%i*pi))*(b*%e^(%i*pi))^(-k-1) (%i8) radcan(%); (%o8) -(gamma_incomplete(k+1,b*%e^(%i*pi))-gamma_incomplete(k+1,a*%e^(%i*pi)))*%e^(-(%i*k+%i)*pi) (%i9) subst(pi=%pi,%); (%o9) %e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) (%i10) define(F(k,a,b),%); (%o10) F(k,a,b):=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a)) q.e.d. --> Example 1. integrate(exp(y)/y^(4/5),y,1,2); (%i11) F(-4/5,1,2); (%o11) %e^((4*%i*%pi)/5)*(gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1)) (%i12) expand(float(rectform(%))); (%o12) 3.319281956502161-4.440892098500626*10^-16*%i (%i13) realpart(%); (%o13) 3.319281956502161 (%i14) /*test*/ first(quad_qags(exp(y)/y^(4/5),y,1,2)); (%o14) 3.319281956502171 Example 2. integrate(exp(x)*x^(1/2),x,0,2); (%i15) F(1/2,0,2); (%o15) -%i*(gamma_incomplete(3/2,-2)-sqrt(%pi)/2) (%i16) expand(float(rectform(%))); (%o16) 7.105860585432373-1.4432899320127035*10^-15*%i (%i17) realpart(%); (%o17) 7.105860585432373 (%i18) /*test*/ first(quad_qags(exp(x)*x^(1/2),x,0,2)); (%o18) 7.105860585432362 Example 3. integrate(exp(x)*x^(1/2),x,1,4); (%i19) F(1/2,1,4); (%o19) -%i*(gamma_incomplete(3/2,-4)-gamma_incomplete(3/2,-1)) (%i20) expand(float(rectform(%))); (%o20) 91.48804221822935-1.6764367671839864*10^-14*%i (%i21) realpart(%); (%o21) 91.48804221822935 (%i22) /*test*/ first(quad_qags(exp(x)*x^(1/2),x,1,4)); (%o22) 91.4880422182294 Example 3. integrate(exp(x)*x^3,x,1,4); (%i23) F(3,1,4); (%o23) gamma_incomplete(4,-1)-gamma_incomplete(4,-4) (%i24) expand(float(rectform(%))); (%o24) 1861.773664783822-9.119759437093765*10^-13*%i (%i25) realpart(%); (%o25) 1861.773664783822 (%i26) /*test*/ first(quad_qags(exp(x)*x^3,x,1,4)); (%o26) 1861.773664783822 Example 4. integrate(exp(x)*x^3,x,-1,1); (%i27) F(3,-1,1); (%o27) gamma_incomplete(4,1)-gamma_incomplete(4,-1) (%i28) expand(float(rectform(%))); (%o28) 0.449507401824987-2.759950902850205*10^-16*%i (%i29) realpart(%); (%o29) 0.449507401824987 (%i30) /*test*/ first(quad_qags(exp(x)*x^3,x,-1,1)); (%o30) 0.449507401824987 Example 5. integrate(exp(x)*x^4,x,-1,1); (%i31) F(4,-1,1); (%o31) gamma_incomplete(5,-1)-gamma_incomplete(5,1) (%i32) expand(float(rectform(%))); (%o32) 0.552372779987653-2.844371478803256*10^-16*%i (%i33) realpart(%); (%o33) 0.552372779987653 (%i34) /*test*/ first(quad_qags(exp(x)*x^4,x,-1,1)); (%o34) 0.552372779987656 Example 6. integrate(exp(x)*x^sqrt(2),x,0,1); (%i35) F(sqrt(2),0,1); (%o35) %e^(-sqrt(2)*%i*%pi)*(gamma_incomplete(sqrt(2)+1,-1)-gamma(sqrt(2)+1)) (%i36) expand(float(rectform(%))); (%o36) 0.858969157722264-5.551115123125783*10^-17*%i (%i37) realpart(%); (%o37) 0.858969157722264 (%i38) /*test*/ first(quad_qags(exp(x)*x^sqrt(2),x,0,1)); (%o38) 0.85896915771574 Example 7. integrate(exp(x)*x^4,x,-2,-1); (%i39) F(4,-2,-1); (%o39) gamma_incomplete(5,1)-gamma_incomplete(5,2) (%i40) expand(float(rectform(%))); (%o40) 1.175836092392821 (%i41) /*test*/ first(quad_qags(exp(x)*x^4,x,-2,-1)); (%o41) 1.175836092392819 Example 8. integrate(exp(x)*x^3,x,-2,-1); (%i42) F(3,-2,-1); (%o42) gamma_incomplete(4,2)-gamma_incomplete(4,1) (%i43) expand(float(rectform(%))); (%o43) -0.743330295751795 (%i44) /*test*/ first(quad_qags(exp(x)*x^3,x,-2,-1)); (%o44) -0.743330295751795 (%i45) build_info()$ Maxima version: 5.25.1 Maxima build date: 9:23 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r14925M (WindowsX8632) Aleksas D. -------------------------------------------------------------------------------- _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From ephemeris at grayswandir.com Fri Jan 13 13:07:14 2012 From: ephemeris at grayswandir.com (Norman Beam) Date: Fri, 13 Jan 2012 14:07:14 -0500 Subject: [Maxima] Evaluating gamma_incomplete() for large values Message-ID: <4F1080E2.3060602@grayswandir.com> What I'm doing is somewhat silly but I ran into a limitation I can't seem to work around although I had assumed I could. I can't seem to get numerical results from gamma_incomplete (and thus cdf_poisson()) for values above about 450000. bfloat(cdf_poisson(460000,460000)); gamma_incomplete: series expansion failed for gamma_incomplete(4.60001b5, 4.6b5). Are there setting that would allow me to do this or am I bumping into some fundamental numerical limit? Regards, Norman From toy.raymond at gmail.com Fri Jan 13 13:55:19 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 13 Jan 2012 11:55:19 -0800 Subject: [Maxima] Evaluating gamma_incomplete() for large values In-Reply-To: <4F1080E2.3060602@grayswandir.com> References: <4F1080E2.3060602@grayswandir.com> Message-ID: On Fri, Jan 13, 2012 at 11:07 AM, Norman Beam wrote: > What I'm doing is somewhat silly but I ran into a limitation I can't seem > to work around although I had assumed I could. > > I can't seem to get numerical results from gamma_incomplete (and thus > cdf_poisson()) for values above about 450000. > > bfloat(cdf_poisson(460000,**460000)); > gamma_incomplete: series expansion failed for > gamma_incomplete(4.60001b5, 4.6b5). > > Are there setting that would allow me to do this or am I bumping into some > fundamental numerical limit? > > This is a known bug in gamma_incomplete. I am sort of working on it. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.hennessy at verizon.net Fri Jan 13 14:10:45 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Fri, 13 Jan 2012 15:10:45 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? In-Reply-To: References: <92B4901587C24839AF27E5062EDEFB17@RichsLaptop> Message-ID: "Are you claiming that you have a function that is not continuous but is an antiderivative of exp(x^7)?" No, I am claiming that this function below is piecewise defined but continuous anyway and is real valued and is an antiderivative of exp(x^n) when n > 0, n is real and x is real. When n is an odd integer > 0 then it also is real valued antiderivative for all real x both positive and negative. I used Aleksas Domarkas' answer for the positive piece, I just spliced the negative and positive answers into one function, which could also be done with "if then else" if you like that better. My goal was to get one expression for the antiderivative which was true and real valued for all x and integer n>2. I succeeded. integrate(exp(x^n),x); (-gamma_incomplete(1/n,-x^n)*%e^-(%i*%pi/n)/n+gamma(1/n)*%e^-(%i*%pi/n)/n+gamma(1/n)/n)*(signum(x)+1)/2 +gamma_incomplete(1/n,-x^n)*(1-signum(x))/(2*n) Rich -----Original Message----- From: Rupert Swarbrick Sent: Thursday, January 12, 2012 7:45 PM To: maxima at math.utexas.edu Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Fri Jan 13 14:32:09 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Fri, 13 Jan 2012 15:32:09 -0500 Subject: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? Message-ID: I succeeded (partially), when x is negative and n is an even integer then this is not real valued. I hope this clarifies everything. I want to add one last thing. It was not worth the time. As Edwin Woollett pointed out (-1)^(4/5) is not numerically equal to 1 but Maxima evaluated it to one anyway, which is a bug I guess and I don?t know if anyone is planning on fixing it. Does everyone have no problem with this? Rich -----Original Message----- From: Richard Hennessy Sent: Friday, January 13, 2012 3:10 PM To: Rupert Swarbrick Cc: Maxima List Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? "Are you claiming that you have a function that is not continuous but is an antiderivative of exp(x^7)?" No, I am claiming that this function below is piecewise defined but continuous anyway and is real valued and is an antiderivative of exp(x^n) when n > 0, n is real and x is real. When n is an odd integer > 0 then it also is real valued antiderivative for all real x both positive and negative. I used Aleksas Domarkas' answer for the positive piece, I just spliced the negative and positive answers into one function, which could also be done with "if then else" if you like that better. My goal was to get one expression for the antiderivative which was true and real valued for all x and integer n>2. I succeeded. integrate(exp(x^n),x); (-gamma_incomplete(1/n,-x^n)*%e^-(%i*%pi/n)/n+gamma(1/n)*%e^-(%i*%pi/n)/n+gamma(1/n)/n)*(signum(x)+1)/2 +gamma_incomplete(1/n,-x^n)*(1-signum(x))/(2*n) Rich -----Original Message----- From: Rupert Swarbrick Sent: Thursday, January 12, 2012 7:45 PM To: maxima at math.utexas.edu Subject: Re: [Maxima] new defint.lisp bug - was: new defint.lispandradexpand:false? _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From cloos at jhcloos.com Fri Jan 13 15:21:41 2012 From: cloos at jhcloos.com (James Cloos) Date: Fri, 13 Jan 2012 16:21:41 -0500 Subject: [Maxima] Differentiating sums In-Reply-To: (=?utf-8?Q?=22Grze=C5=9B?= Andruszkiewicz"'s message of "Fri, 13 Jan 2012 16:09:39 +0000") References: Message-ID: >>>>> "GA" == Grze? Andruszkiewicz writes: GA> sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); GA> diff(%, a); I get: :; rmaxima Maxima 5.26.0 http://maxima.sourceforge.net using Lisp SBCL 1.0.54 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) display2d:false; (%o1) false (%i2) sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); (%o2) ('sum(((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])^2/(c*X[i]+d)^2,i,1,N))/t (%i3) diff(%, a); (%o3) -2*'sum(X[i]*((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])/(c*X[i]+d)^2,i,1,N) (%i4) -JimC -- James Cloos OpenPGP: 1024D/ED7DAEA6 From l.couraud at gmail.com Fri Jan 13 15:56:59 2012 From: l.couraud at gmail.com (laurent couraud) Date: Fri, 13 Jan 2012 22:56:59 +0100 Subject: [Maxima] RE : Differentiating sums In-Reply-To: Message-ID: <58187D85405E4A79BC2E886CA4D717B1@PASSERELLE> > -----Message d'origine----- > De?: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] De la part de > Grze? Andruszkiewicz > Envoy??: vendredi 13 janvier 2012 18:13 > ??: Robert Dodier > Cc?: maxima at math.utexas.edu > Objet?: Re: [Maxima] Differentiating sums > > Hi, > > Thanks for a prompt reply. I actually managed to get it working by > setting simplify_sum:true. But now I am trying to solve for first > order conditions: > 2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0 > solve(%, a) > > which gives: > [sum(((c^2*X[i]^3+(2*c*d-2*a)*X[i]^2+(d^2- > 2*b)*X[i])*t+2*R[i]*X[i])/(2*c^2*X[i]^2+4*c*d*X[i]+2*d^2),i,1,M)=0] > > instead of splitting the sum into 2 sums (1 dependent on a and the > other not) and dividing accordingly. Any ideas how to achieve this? > > Cheers, > Grzegorz > Hi, You have to declare sum to be linear. (%i9) display2d:false; (%o9) false (%i10) declare(sum,linear); (%o10) done (%i11) eq:2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0; (%o11) 2*'sum(X[i]*((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])/(c*X[i]+d)^2,i,1,M) = 0 (%i12) solve(eq,a); (%o12) [a = -((2*b*'sum(X[i]/(c*X[i]+d)^2,i,1,M)-'sum(X[i],i,1,M))*t-2*'sum(R[i]*X[i]/(c*X[i]+d)^2,i,1,M))/ (2*('sum(X[i]^2/(c*X[i]+d)^2,i,1,M))*t)] From woollett at charter.net Fri Jan 13 16:27:01 2012 From: woollett at charter.net (Edwin Woollett) Date: Fri, 13 Jan 2012 14:27:01 -0800 Subject: [Maxima] defint.lisp and limit.lisp ver. 1-12-2012: gcl bug? Message-ID: On Jan. 12, 2012, Dan Gildea wrote, in fixing and closing bug # 3470385 - integrate (exp (sqrt) ) gcl bug the following: ------------------------------ >Fixed in limit.lisp and defint.lisp. >We still need domain:complex to prevent (-1)^(2/3) => -1. > >(%i4) domain:complex; >(%o4) complex >(%i5) integrate(exp(sqrt(x^3)),x,0,1); >(%o5) 2*((-1)^(1/3)*gamma_incomplete(2/3,-1)-(-1)^(1/3)*gamma(2/3))/3 -------------------------------------------- I have downloaded the new limit.lisp and new defint.lisp from git, and ** gcl ** does not get the same results. Effectively a meaningless result is returned, so I can not check the above. ---------------------------------------------------------------- Maxima 5.25.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) load("defint-new.lisp"); (%o1) "c:/work2/defint-new.lisp" (%i2) load("limit-new.lisp"); (%o2) "c:/work2/limit-new.lisp" (%i3) domain:complex; (%o3) complex (%i4) integrate(exp(sqrt(x^3)),x,0,1); (%o4) %e^sqrt(x^3) ------------------------------- Just to explore other options in gcl: try domain = real and try radexpand=false first domain = real (%i5) domain:real; (%o5) real (%i6) integrate(exp(sqrt(x^3)),x,0,1); (%o6) %e^x^(3/2) (%i7) radexpand; (%o7) true next domain = real, radexpand=false (%i8) radexpand:false; (%o8) false (%i9) domain; (%o9) real (%i10) integrate(exp(sqrt(x^3)),x,0,1); (%o10) %e^sqrt(x^3) finally domain=complex, radexpand=false (%i13) domain:complex; (%o13) complex (%i14) integrate(exp(sqrt(x^3)),x,0,1); (%o14) %e^sqrt(x^3) ------------------------------------ On Jan 12 I wrote >Here I consider a different (but related via a simple >change of variables) integral, and compare in detail >the results from Maxima and Mathematica (using the >Wolfram alpha site). >(%i1) integrate(exp(y)/y^(4/5),y,1,2); >(%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) >/* MMa NIntegrate[Exp[y]/y^(4/5),{y,1,2}] yields > > (-1)^(4/5)*(Gamma[1/5,-2] - Gamma[1/5,-1]) > > does not agree with Maxima, since in Mathematica > (-1)^(4/5) float value is not 1.0, whereas > is does have value 1.0 in Maxima. */ > > >(%i1) integrate(exp(y)/y^(4/5),y,1,2); >(%o1) gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1) > etc. ----------------------------- Here I try that same integral using the defint-new.lisp and limit-new.lisp (versions posted 1-12-2012) (%i15) radexpand:true; (%o15) true (%i16) [radexpand,domain]; (%o16) [true,complex] (%i17) integrate(exp(y)/y^(4/5),y,1,2); (%o17) %e^y/y^(4/5) -------------------------------------- The new defint.lisp (1-12-2012) does change the evaluation of (-1)^(4/5) if domain=complex: ----------------------------------- (%i18) (-1)^(4/5); (%o18) (-1)^(4/5) (%i19) float(%); (%o19) 1.0*(-1)^(4/5) (%i20) expand(float(rectform( (-1)^(4/5)))); (%o20) 0.58778525229247*%i-0.80901699437495 (%i21) domain; (%o21) complex (%i22) domain:real; (%o22) real (%i23) expand(float(rectform( (-1)^(4/5)))); (%o23) 1.0 --------------------------------------------- Ted Woollett From tomdean at speakeasy.org Fri Jan 13 16:53:53 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Fri, 13 Jan 2012 14:53:53 -0800 Subject: [Maxima] Factor the following number Message-ID: <87lipbqkn2.fsf@P9X79.tddhome> I factored the two 135-digit numbers, n and n+1 using cado-nfs-1.1 on an Intel i7-3930K overclocked to 4.2GHz with 18GiB RAM, running up to 10 threads. Factoring the numbers, n and n+1 took 10 days each, a total of 20 days. n has 5 factors and n+1 has two factors. n:= [2, 5, 2122943609450249057621, 405620061201508643988375124643817406843652803, 34444340671702467488860342883734479061576134487870291451728421045657]; mn+1:= [17222170335851233744430171441867239530788067265164581820366701099039, 17222170335851233744430577061928441039432055599953297058218812657049]; The sum of the factors is 34444340671702467488860748503795680570220122865117878878585513756088 So, this is a Ruth-Aaron pair. Tom Dean From robert.dodier at gmail.com Sat Jan 14 13:40:28 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 14 Jan 2012 12:40:28 -0700 Subject: [Maxima] still need Maxima 5.26 for Windows Message-ID: On 1/11/12, David Billinghurst wrote: > On 11/01/2012 9:50 PM, David Billinghurst wrote: >> I have one that seems OK at >> http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe >> >> How do I upload it? My sourceforge username is billingd > > This is broken. The describe command doesn't work. I will investigate > as time allows. David, thanks for taking the time to work on it. Can someone figure out how to construct a Windows package? I think it's fine if it's just a zip archive and not an executable installer. best, Robert Dodier From dbmaxima at gmail.com Sun Jan 15 07:57:17 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Mon, 16 Jan 2012 00:57:17 +1100 Subject: [Maxima] need Maxima 5.26 for Windows In-Reply-To: <4F0D758E.9020002@gmail.com> References: <4F0D6985.4000404@gmail.com> <4F0D758E.9020002@gmail.com> Message-ID: <4F12DB3D.5090708@gmail.com> On 11/01/2012 10:42 PM, David Billinghurst wrote: > On 11/01/2012 9:50 PM, David Billinghurst wrote: >> On 9/01/2012 4:24 AM, Robert Dodier wrote: >>> Hi everybody, >>> >>> Can someone build a Windows installer for Maxima 5.26 ? >>> I just looked at the list of files at Sourceforge and I don't see one. >>> I'd like to make a general announcement about 5.26 (sorry for the >>> delay). >> >> I have one that seems OK at >> http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe >> >> How do I upload it? My sourceforge username is billingd > > This is broken. The describe command doesn't work. I will > investigate as time allows. I have uploaded a new version to the same spot http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe - current version of wxMaxima - thanks Andrej - working info files, copied from a cygwin/clisp build The problem with describe is that the version of makeinfo was too old, and I wasn't able to update it in the ancient version of mingw/msys needed for gcl. From woollett at charter.net Sun Jan 15 13:12:18 2012 From: woollett at charter.net (Edwin Woollett) Date: Sun, 15 Jan 2012 11:12:18 -0800 Subject: [Maxima] defint.lisp and limit.lisp ver. 1-12-2012: gcl bug? Message-ID: I consider this apparent bug as fixed, based on Dan Gildea's latest files on git and his test of gcl using the current git. Those (like me, at present) who do not maintain a clone of the current git and hence do not check the compiled behavior, should see correct behavior with ver. 5.26.1. Another issue, however, is the requirement of setting domain:complex to get correct results from integrate in some cases (such as here). How is the novice etc user to know when and when not to set domain=complex? We always want a user to get a correct answer to a symbolic integral (for its float value) if possible. Is there any reason why domain=complex should not be the default? Or, perhaps integrate (or defint) should set domain:false locally? Ted Woollett From willisb at unk.edu Sun Jan 15 14:09:32 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 15 Jan 2012 14:09:32 -0600 Subject: [Maxima] building under windows + file permissions In-Reply-To: References: Message-ID: I haven't tried "make install" under windows for years--I thought I'd try again using (fairly current) cgywin + ccl 1.7. I think "make" finished OK. After working for some time, make install gives ++ pwd + d=/cygdrive/c/maximagit/maxima/doc/info + cd /tmp/maxima-texinfo-categories-1XKXN8 + for f in '*.texi' $ + sed 's/^@def\(fn\|vr\) *{[^}]*} *\([^[:blank:]]*\).*/@anchor{Item: \2}\ \0/; s/^@node *\([^,]*\).*/@anchor{Item: \1}\ \0/' Affine.texi sed: can't read Affine.texi: Permission denied + mv tmp.texi Affine.texi mv: try to overwrite `Affine.texi', overriding mode 0000 (---------)? make[4]: * Switching to tmp/maxima-texinfo-categories-1XKXN8, I discover: Barton at Barton-PC /tmp/maxima-texinfo-categories-1XKXN8 $ ls affine.texi -l ---------- 1 Barton None 8018 Jan 15 13:49 affine.texi Barton at Barton-PC /tmp/maxima-texinfo-categories-1XKXN8 $ cat affine.texi cat: affine.texi: Permission denied I tried something like chmod -R a+rw tmp. Didn't work. --Barton From hawe at chefmail.de Fri Jan 13 14:36:51 2012 From: hawe at chefmail.de (Hans W. Hofmann) Date: Fri, 13 Jan 2012 20:36:51 +0000 (UTC) Subject: [Maxima] define bug? Message-ID: (%i2) f(x):=-k*x^3+3*k^2*x^2; 3 2 2 (%o2) f(x) := (- k) x + 3 k x (%i3) df(x):=diff(f(x),x)$ df(x); 2 2 (%o3) 6 k x - 3 k x (%i4) df(k)=3; 3 (%o4) 8 k = 3 whats this? should have (%i5) 6*k^2*x-3*k*x^2 = 3, x=k; (%o5) 3*k^3 = 3 using define all works fine.... Gru? HW From gandrusz at gmail.com Fri Jan 13 15:36:56 2012 From: gandrusz at gmail.com (=?ISO-8859-2?Q?Grze=B6_Andruszkiewicz?=) Date: Fri, 13 Jan 2012 21:36:56 +0000 Subject: [Maxima] Differentiating sums In-Reply-To: References: Message-ID: Hi James, I think you have the setting simplify_sum:true. After I tried setting it to true (it was false by default on my machine), then I got it working as well. But now I am trying to solve for first order conditions: 2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0 solve(%, a) which gives: [sum(((c^2*X[i]^3+(2*c*d-2*a)*X[i]^2+(d^2-2*b)*X[i])*t+2*R[i]*X[i])/(2*c^2*X[i]^2+4*c*d*X[i]+2*d^2),i,1,M)=0] instead of splitting the sum into 2 sums (1 dependent on a and the other not) and dividing accordingly. Any ideas how to achieve this? Cheers, Grzegorz 2012/1/13 James Cloos : >>>>>> "GA" == Grze? Andruszkiewicz writes: > > GA> sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); > GA> diff(%, a); > > I get: > > :; rmaxima > Maxima 5.26.0 http://maxima.sourceforge.net > using Lisp SBCL 1.0.54 > Distributed under the GNU Public License. See the file COPYING. > Dedicated to the memory of William Schelter. > The function bug_report() provides bug reporting information. > (%i1) display2d:false; > > (%o1) false > (%i2) sum((R[i]-(a*X[i]+b)*t + 1/2*(c*X[i]+d)^2*t)^2/((c*X[i]+d)^2*t), i, 1, N); > > (%o2) ('sum(((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])^2/(c*X[i]+d)^2,i,1,N))/t > (%i3) diff(%, a); > > (%o3) -2*'sum(X[i]*((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])/(c*X[i]+d)^2,i,1,N) > (%i4) > > -JimC > -- > James Cloos ? ? ? ? OpenPGP: 1024D/ED7DAEA6 From gandrusz at gmail.com Sat Jan 14 03:48:32 2012 From: gandrusz at gmail.com (=?ISO-8859-2?Q?Grze=B6_Andruszkiewicz?=) Date: Sat, 14 Jan 2012 09:48:32 +0000 Subject: [Maxima] RE : Differentiating sums In-Reply-To: <58187D85405E4A79BC2E886CA4D717B1@PASSERELLE> References: <58187D85405E4A79BC2E886CA4D717B1@PASSERELLE> Message-ID: Hi, It works, thanks! but it doesn't return any results. > (%i9) display2d:false; > (%o9) false > (%i10) declare(sum,linear); > (%o10) done > (%i11) eq:2*sum((X[i]*(((c*X[i]+d)^2*t)/2-(a*X[i]+b)*t+R[i]))/(c*X[i]+d)^2,i,1,M)=0; > (%o11) 2*'sum(X[i]*((c*X[i]+d)^2*t/2-(a*X[i]+b)*t+R[i])/(c*X[i]+d)^2,i,1,M) = 0 > (%i12) solve(eq,a); > (%o12) [a = > -((2*b*'sum(X[i]/(c*X[i]+d)^2,i,1,M)-'sum(X[i],i,1,M))*t-2*'sum(R[i]*X[i]/(c*X[i]+d)^2,i,1,M))/ > (2*('sum(X[i]^2/(c*X[i]+d)^2,i,1,M))*t)] > The next thing I wanted is to do is: solve([diff(L, a), diff(L,b)], [a,b]); but it doesn't return any results. I managed to work around it by doing: solve([solve(diff(L, a), a)[1], solve(diff(L,b),b)[1]], [a,b]); but probably I am doing something wrong again... Regards, Grzegorz And how can I plug these values back into the original equation L (or some other equation that contains a and b)? From aleksasd873 at gmail.com Sun Jan 15 02:47:45 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sun, 15 Jan 2012 10:47:45 +0200 Subject: [Maxima] Functions with any number of arguments Message-ID: Functions with any number of arguments. How in Maxima define functions with any number of arguments ? For example, i need function MIN(arg1,arg2, ...) MIN(2) => 2 MIN(3,4) =>3 MIN(2/3,1/2,sqrt(2)/2) => 1/2 Other example. How define G with following properties: G(n) => gamma(n) G(5) => 24 G(a, x) => gamma_incomplete (a, x) G(a, z1, z2) => gamma_incomplete_generalized (a, z1, z2) (%i1) gamma(5); (%o1) 24 Aleksas D. -------------- next part -------------- An HTML attachment was scrubbed... URL: From extranjero27 at yahoo.com Sun Jan 15 07:37:47 2012 From: extranjero27 at yahoo.com (Brian) Date: Sun, 15 Jan 2012 13:37:47 +0000 (UTC) Subject: [Maxima] =?utf-8?q?_unit=5Fstep=28=29_and_integrate=28=29?= Message-ID: Hello, I am using a very old computer to run Maxima 5.21.1 so all of my work is performed using a maxima file and command line. My issue is with "unit_step()" and "integrate()". f1a(x):= +2 * unit_step( x )$ f1b(x):= -2 * unit_step( x - 2 )$ f1(x):= f1a(x) + f1b(x)$ f2a(x):= integrate( f1a(x), x ); f2b(x):= integrate( f1b(x), x ); f2(x):= integrate( f1(x), x ); f3(x):= f2a(x) + f2b(x); I expect f1(x) to be a squarewave with the value of 2 from x=0 to x=2 and zero everywhere else. I expect f2(x) to be a "ramp" with a slope of 2...starting at x=0 to x=2 (where f2(2)=4). f2(x) is zero everywhere else. I expect f3(x) to equal f2(x). My maxima script-> http://pastebin.com/hhnbckqy When I run my script, a plot is generated of f1(x), f2(x), and f3(x). f1(x) plots as I expected. I see that f2(x) and f3(x) have the correct shape. But f2(x) is shifted down by 2. f3(x) is the result I expect. Is my understanding of elementary functions incorrect (unit step, unit ramp, impulse)? Am I missing a something? I am reviewing some classes I had years ago (Signals & Systems). Tools like Maxima and Octave have been wonderful. Thanks! From macrakis at alum.mit.edu Sun Jan 15 16:15:03 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 15 Jan 2012 17:15:03 -0500 Subject: [Maxima] Functions with any number of arguments In-Reply-To: References: Message-ID: (%i1) xxx([l]):=length(l)$ (%i2) xxx(3,4,5); (%o2) 3 On Sun, Jan 15, 2012 at 03:47, Aleksas Domarkas wrote: > Functions with any number of arguments. > > How in Maxima define functions with any number of arguments ? > > For example, i need function MIN(arg1,arg2, ...) > MIN(2) => 2 > MIN(3,4) =>3 > MIN(2/3,1/2,sqrt(2)/2) => 1/2 > > Other example. How define G with following properties: > G(n) => gamma(n) > G(5) => 24 > G(a, x) => gamma_incomplete (a, x) > G(a, z1, z2) => gamma_incomplete_generalized (a, z1, z2) > > (%i1) gamma(5); > (%o1) 24 > > Aleksas D. > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Sun Jan 15 16:20:26 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 15 Jan 2012 17:20:26 -0500 Subject: [Maxima] define bug? In-Reply-To: References: Message-ID: The key to the answer is "define works fine". The ":=" operator -- like function definition in all ordinary programming languages -- defers the evaluation of its arguments until the function is called. The "define" function evaluates the right-hand side (also the left) *at the time of definition*. For example: (%i1) f(x):=print(x); (%o1) f(x) := print(x) <<< function definition includes "print" <<< no printing (%i2) f(4); 4 <<< print when *evaluating* f (%o2) 4 (%i3) define('(g(x)),print(x)); x <<< print when *defining* g (%o3) g(x) := x <<< function definition does not include "print" (%i4) g(4); (%o4) 4 Doing something like h(x) := diff(f(x),x) will then try to evaluate diff(f(4),4), which is of course nonsensical. -s On Fri, Jan 13, 2012 at 15:36, Hans W. Hofmann wrote: > (%i2) f(x):=-k*x^3+3*k^2*x^2; > 3 2 2 > (%o2) f(x) := (- k) x + 3 k x > > (%i3) df(x):=diff(f(x),x)$ df(x); > 2 2 > (%o3) 6 k x - 3 k x > > (%i4) df(k)=3; > 3 > (%o4) 8 k = 3 > > whats this? should have > > (%i5) 6*k^2*x-3*k*x^2 = 3, x=k; > (%o5) 3*k^3 = 3 > > using define all works fine.... > > Gru? HW > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fateman at eecs.berkeley.edu Sun Jan 15 17:02:22 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 15 Jan 2012 15:02:22 -0800 Subject: [Maxima] define bug? In-Reply-To: References: Message-ID: <4F135AFE.8000106@eecs.berkeley.edu> On 1/13/2012 12:36 PM, Hans W. Hofmann wrote: > (%i2) f(x):=-k*x^3+3*k^2*x^2; > 3 2 2 > (%o2) f(x) := (- k) x + 3 k x > > (%i3) df(x):=diff(f(x),x)$ df(x); > 2 2 > (%o3) 6 k x - 3 k x > > (%i4) df(k)=3; > 3 > (%o4) 8 k = 3 > > whats this? should have > > (%i5) 6*k^2*x-3*k*x^2 = 3, x=k; > (%o5) 3*k^3 = 3 > > using define all works fine.... > > Gru? HW > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima no, f(k) is -k*k^3+3*k^2*k^2 or 2*k^4. compute its derivative with respect to k, and one gets 8*k^3. RJF From fateman at eecs.berkeley.edu Sun Jan 15 17:04:40 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 15 Jan 2012 15:04:40 -0800 Subject: [Maxima] Functions with any number of arguments In-Reply-To: References: Message-ID: <4F135B88.2080201@eecs.berkeley.edu> On 1/15/2012 12:47 AM, Aleksas Domarkas wrote: > Functions with any number of arguments. > > How in Maxima define functions with any number of arguments ? > > For example, i need function MIN(arg1,arg2, ...) try MIN([args]):= args to see how it works. Then write the function for real.. From rich.hennessy at verizon.net Sun Jan 15 19:16:14 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 15 Jan 2012 20:16:14 -0500 Subject: [Maxima] unit_step() and integrate() In-Reply-To: References: Message-ID: <809D5FF9FD58468A82205446D5551555@RichsLaptop> Brian: You are probably forgetting that the indefinite integral has an arbitrary constant which may result in the answer from integrate to be different by a constant amount than from what you expect. To get the results you want you have to add the appropriate constant yourself. Rich -----Original Message----- From: Brian Sent: Sunday, January 15, 2012 8:37 AM To: maxima at math.utexas.edu Subject: [Maxima] unit_step() and integrate() Hello, I am using a very old computer to run Maxima 5.21.1 so all of my work is performed using a maxima file and command line. My issue is with "unit_step()" and "integrate()". f1a(x):= +2 * unit_step( x )$ f1b(x):= -2 * unit_step( x - 2 )$ f1(x):= f1a(x) + f1b(x)$ f2a(x):= integrate( f1a(x), x ); f2b(x):= integrate( f1b(x), x ); f2(x):= integrate( f1(x), x ); f3(x):= f2a(x) + f2b(x); I expect f1(x) to be a squarewave with the value of 2 from x=0 to x=2 and zero everywhere else. I expect f2(x) to be a "ramp" with a slope of 2...starting at x=0 to x=2 (where f2(2)=4). f2(x) is zero everywhere else. I expect f3(x) to equal f2(x). My maxima script-> http://pastebin.com/hhnbckqy When I run my script, a plot is generated of f1(x), f2(x), and f3(x). f1(x) plots as I expected. I see that f2(x) and f3(x) have the correct shape. But f2(x) is shifted down by 2. f3(x) is the result I expect. Is my understanding of elementary functions incorrect (unit step, unit ramp, impulse)? Am I missing a something? I am reviewing some classes I had years ago (Signals & Systems). Tools like Maxima and Octave have been wonderful. Thanks! _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From rich.hennessy at verizon.net Sun Jan 15 19:32:26 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 15 Jan 2012 20:32:26 -0500 Subject: [Maxima] unit_step() and integrate() In-Reply-To: <809D5FF9FD58468A82205446D5551555@RichsLaptop> References: <809D5FF9FD58468A82205446D5551555@RichsLaptop> Message-ID: "I expect f2(x) to be a "ramp" with a slope of 2...starting at vx=0 to x=2 (where f2(2)=4). f2(x) is zero everywhere else." You said "f2(x) is zero everywhere else". That is wrong. The indefinite integral of the unit_step function is continuous everywhere. If it dropped down to zero at the point x=2 that would be a discontinuity which would be an error. The answer from integrate is correct. Rich -----Original Message----- From: Richard Hennessy Sent: Sunday, January 15, 2012 8:16 PM To: Brian ; maxima at math.utexas.edu Subject: Re: [Maxima] unit_step() and integrate() Brian: You are probably forgetting that the indefinite integral has an arbitrary constant which may result in the answer from integrate to be different by a constant amount than from what you expect. To get the results you want you have to add the appropriate constant yourself. Rich -----Original Message----- From: Brian Sent: Sunday, January 15, 2012 8:37 AM To: maxima at math.utexas.edu Subject: [Maxima] unit_step() and integrate() Hello, I am using a very old computer to run Maxima 5.21.1 so all of my work is performed using a maxima file and command line. My issue is with "unit_step()" and "integrate()". f1a(x):= +2 * unit_step( x )$ f1b(x):= -2 * unit_step( x - 2 )$ f1(x):= f1a(x) + f1b(x)$ f2a(x):= integrate( f1a(x), x ); f2b(x):= integrate( f1b(x), x ); f2(x):= integrate( f1(x), x ); f3(x):= f2a(x) + f2b(x); I expect f1(x) to be a squarewave with the value of 2 from x=0 to x=2 and zero everywhere else. I expect f2(x) to be a "ramp" with a slope of 2...starting at x=0 to x=2 (where f2(2)=4). f2(x) is zero everywhere else. I expect f3(x) to equal f2(x). My maxima script-> http://pastebin.com/hhnbckqy When I run my script, a plot is generated of f1(x), f2(x), and f3(x). f1(x) plots as I expected. I see that f2(x) and f3(x) have the correct shape. But f2(x) is shifted down by 2. f3(x) is the result I expect. Is my understanding of elementary functions incorrect (unit step, unit ramp, impulse)? Am I missing a something? I am reviewing some classes I had years ago (Signals & Systems). Tools like Maxima and Octave have been wonderful. Thanks! _______________________________________________ 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 rich.hennessy at verizon.net Sun Jan 15 19:41:54 2012 From: rich.hennessy at verizon.net (Richard Hennessy) Date: Sun, 15 Jan 2012 20:41:54 -0500 Subject: [Maxima] unit_step() and integrate() In-Reply-To: References: <809D5FF9FD58468A82205446D5551555@RichsLaptop> Message-ID: I meant the indefinite integral of the square wave function is continuous everywhere. Sorry. In general if a function involves step functions the integral in usually continuous, even though the original function is not. Rich -----Original Message----- From: Richard Hennessy Sent: Sunday, January 15, 2012 8:32 PM To: Brian ; maxima at math.utexas.edu Subject: Re: [Maxima] unit_step() and integrate() "I expect f2(x) to be a "ramp" with a slope of 2...starting at vx=0 to x=2 (where f2(2)=4). f2(x) is zero everywhere else." You said "f2(x) is zero everywhere else". That is wrong. The indefinite integral of the unit_step function is continuous everywhere. If it dropped down to zero at the point x=2 that would be a discontinuity which would be an error. The answer from integrate is correct. Rich -----Original Message----- From: Richard Hennessy Sent: Sunday, January 15, 2012 8:16 PM To: Brian ; maxima at math.utexas.edu Subject: Re: [Maxima] unit_step() and integrate() Brian: You are probably forgetting that the indefinite integral has an arbitrary constant which may result in the answer from integrate to be different by a constant amount than from what you expect. To get the results you want you have to add the appropriate constant yourself. Rich -----Original Message----- From: Brian Sent: Sunday, January 15, 2012 8:37 AM To: maxima at math.utexas.edu Subject: [Maxima] unit_step() and integrate() Hello, I am using a very old computer to run Maxima 5.21.1 so all of my work is performed using a maxima file and command line. My issue is with "unit_step()" and "integrate()". f1a(x):= +2 * unit_step( x )$ f1b(x):= -2 * unit_step( x - 2 )$ f1(x):= f1a(x) + f1b(x)$ f2a(x):= integrate( f1a(x), x ); f2b(x):= integrate( f1b(x), x ); f2(x):= integrate( f1(x), x ); f3(x):= f2a(x) + f2b(x); I expect f1(x) to be a squarewave with the value of 2 from x=0 to x=2 and zero everywhere else. I expect f2(x) to be a "ramp" with a slope of 2...starting at x=0 to x=2 (where f2(2)=4). f2(x) is zero everywhere else. I expect f3(x) to equal f2(x). My maxima script-> http://pastebin.com/hhnbckqy When I run my script, a plot is generated of f1(x), f2(x), and f3(x). f1(x) plots as I expected. I see that f2(x) and f3(x) have the correct shape. But f2(x) is shifted down by 2. f3(x) is the result I expect. Is my understanding of elementary functions incorrect (unit step, unit ramp, impulse)? Am I missing a something? I am reviewing some classes I had years ago (Signals & Systems). Tools like Maxima and Octave have been wonderful. Thanks! _______________________________________________ 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 gwpublic at wp.pl Sun Jan 15 19:43:27 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Mon, 16 Jan 2012 02:43:27 +0100 Subject: [Maxima] lsquares fitting and constrains for parameters (looking for positive values of parameters) In-Reply-To: References: Message-ID: Hello, I use least squares method to fit functions to data : load(lsquares)$ DataM: matrix( [1,1], [4,4], [10,9] ); lsquares_estimates (DataM, [x,y], y = a2*x**2 + a1*x + a0, [a2,a1,a0], iprint=[-1,0]); Maxima finds negative solutions: (%i) grind(%); (%o) [[a2 = -1/54,a1 = 59/54,a0 = -2/27]]$ What should I do to constrain parameters ? To be more specific : * I must ensure all are positive : a2>=0 a1>=0 a0>=0 * would be nice to specify upper limits as well : a2 References: Message-ID: <4F1389B0.4040309@gmail.com> On 1/15/12 5:43 PM, gwpublic at wp.pl wrote: > Hello, > > I use least squares method to fit functions to data : > > load(lsquares)$ > DataM: matrix( [1,1], [4,4], [10,9] ); > lsquares_estimates (DataM, [x,y], y = a2*x**2 + a1*x + a0, [a2,a1,a0], > iprint=[-1,0]); > > Maxima finds negative solutions: > > (%i) grind(%); > (%o) [[a2 = -1/54,a1 = 59/54,a0 = -2/27]]$ > > What should I do to constrain parameters ? > To be more specific : > > * I must ensure all are positive : a2>=0 a1>=0 a0>=0 > * would be nice to specify upper limits as well : a2 * Maybe other constrains if solution can handle any predicate. > > But only "must" is to make them positive. > > I've tried : "assume()", but with no success. > If you do not need a symbolic solution, you might be interested in fmin_cobyla, which will produce the minimum of a function subject to equality or inequality constraints. Use "? fmin_cobyla" for more information. Ray From rswarbrick at gmail.com Mon Jan 16 04:10:11 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Mon, 16 Jan 2012 10:10:11 +0000 Subject: [Maxima] unit_step() and integrate() References: <809D5FF9FD58468A82205446D5551555@RichsLaptop> Message-ID: <4l9du8xl4s.ln2@hake.rswarbrick.dnsalias.com> "Richard Hennessy" writes: > I meant the indefinite integral of the square wave function is > continuous everywhere. Sorry. In general if a function involves step > functions the integral in usually continuous, even though the original > function is not. > > Rich *sigh* If f is a function from the real line to itself and you define a new function F by F(x) = integrate (f(y), y, a, x) for any choice of a, then F is called the "indefinite integral" of f. A theorem, which is sort of trivial once you've set up all the machinery for Riemann integration, says that F is always continuous (unit steps or no!) Occasionally, people talk of "functions" like the Dirac delta function ?(x). This isn't, strictly speaking, a function R?R because it doesn't evaluate to a number at x=0. Rather it is defined by integrate (?(x), x, a, b) = 1 if a<0 From robert.dodier at gmail.com Mon Jan 16 10:15:12 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 16 Jan 2012 09:15:12 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <23737.1326342202@gemini.franz.com> References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> Message-ID: On 1/11/12, Steve Haflich wrote: > Proclamations (aka declamations) such as are estabished by the > macroexpansions if DEFVAR etc. affect all subsequently-compiled or > executed bindings and references. That's unfortunate, isn't it? since it means, in effect, that there is in fact no lexical scope in Common Lisp, because the behavior of a given snippet of code can only be understood by considering the entire program. Robert Dodier From macrakis at alum.mit.edu Mon Jan 16 10:23:12 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 16 Jan 2012 11:23:12 -0500 Subject: [Maxima] Double integration. In-Reply-To: References: Message-ID: Costa, There are two difficulties in the double numerical integration: 1) The issues around correct quoting etc. of functions. 2) Numerical properties of these integrals when there is an indicator function. Issue (1) is easily taken care of with something like what you propose. It is also taken care of by careful quoting. But issue (2) is not. As Alexander says, standard numerical integration techniques are designed for smooth functions -- the step created by an indicator function "confuses" them. Also, doing a double integration as the composition of two single integrations is generally going to be far from optimal both in speed and in accuracy. I suspect that there are numerical packages (perhaps even in Maxima) designed specifically for cases like this, but that is beyond my competence. -s On Mon, Jan 16, 2012 at 03:08, Constantine Frangos wrote: > Hi Stavro, > > Thanks for the detailed response. I was wondering whether the > difficutlies you mention > can be overcome in the following manner. > > A new Maxima integration function, num_integration, internally calls a > user defined Maxima function, say integrandf, and passes the values of > the integration variables, x1, x2, together with the values of other > parameters, p1,p2,..., needed to compute the integrand, as follows, > > ........ > I1 : apply(integrandf,[x1,x2,p1,p2,...]); > ......... > > The user would call num_integration with something like, > > I : num_integration(integrandf,list_of_limits,p1,p2,....); > > Any suggestions would be appreciated. > > Regards, > Constantine. > > On 1/12/12, Stavros Macrakis wrote: > > As Alexander says, you don't need the temporary variable etc. > > > > Also, if you explicitly quote everything, you are less likely to have bad > > surprises. Something like this: > > > > (%i27) (cnt:0,quad_qags('(quad_qags('(cnt:cnt+1,if x>y then 1 else > > 0),x,0,1)[1]),y,0,1)); > > (%o27) [0.49999763949292, 3.4177098928722671E-9, 735, 0] > > (%i28) cnt; > > (%o28) 621243 > > > > Note the number of function evaluations for a very simple case! Note > also > > that the result is not very accurate, and that the error estimate is way > > off. I imagine there are better routines for this kind of integration. > > Obviously in this case it is easy to transform to a single integral > (even > > analytical), but presumably you want to handle more complicated > integrands. > > > > -s > > > > On Thu, Jan 12, 2012 at 05:38, Alexander Klimov > wrote: > > > >> Hi. > >> > >> On Thu, 12 Jan 2012, Constantine Frangos wrote: > >> > (1) Its not clear why the function definition I am using does not > >> > work. According to the Maxima 5.24 manual, paragraph 20.4, the > >> > integrand can be the name of a Maxima function, presumably defined by > >> > the user in a file, for example, integrand.mac > >> > >> Your function does not always return a number. Consider your original > >> definition: > >> > >> (%i1) ind(x,y) := block([s],if is(x*x + y*y <= 1) then (s : 1) else (s : > >> 0),return(s))$ > >> > >> Let us see how it works > >> > >> (%i2) trace(ind); > >> (%o2) [ind] > >> > >> If one gives numerical arguments, then your function returns the > >> number which is assigned to "s" > >> > >> (%i3) ind(0,1); > >> 1 Enter ind [0, 1] > >> 1 Exit ind 1 > >> (%o3) 1 > >> > >> but with symbols as arguments nothing is assigned to "s" and thus the > >> function returns just a symbol "s" > >> > >> (%i4) ind(x1,x2); > >> 1 Enter ind [x1, x2] > >> 1 Exit ind s > >> (%o4) s > >> > >> and this is exactly what happens when you use it in integration > >> > >> (%i5) I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1)[1],x2,-1,1); > >> 1 Enter ind [x1, x2] > >> 1 Exit ind s > >> COERCE-FLOAT-FUN: no such Lisp or Maxima function: s > >> -- an error. To debug this try: debugmode(true); > >> > >> > (2) Are there perhaps other Maxima numerical integration functions > >> > that may perform better ? > >> > >> As I said, it is better to > >> > >> > > use a simple integral: > >> > > > >> > > (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1); > >> > > (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0] > >> > >> the problem with indicators is that while they may be suitable for > >> symbolic manipulations, they are bad functions for Gaussian quadrature > >> rule which is only good if the function is similar to a polynomial. > >> > >> -- > >> Regards, > >> ASK > >> _______________________________________________ > >> Maxima mailing list > >> Maxima at math.utexas.edu > >> http://www.math.utexas.edu/mailman/listinfo/maxima > >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwpublic at wp.pl Mon Jan 16 11:19:44 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Mon, 16 Jan 2012 18:19:44 +0100 Subject: [Maxima] lsquares fitting and constrains for parameters (looking for positive values of parameters) In-Reply-To: <4F1389B0.4040309@gmail.com> References: <4F1389B0.4040309@gmail.com> Message-ID: > If you do not need a symbolic solution, You're right. I need concrete values. (I've forgot to say it in problem statement). > you might be interested in > fmin_cobyla, which will produce the minimum of a function subject to > equality or inequality constraints. fmin_cobyla, I haven't knew about it. (btw. I see it's implemented in Scipy as well.) I try to figure out how to make it to obey constraints, with no success. Results are not positive, and even worse than lsquares_estimate. As I doing sth wrong ? Or sum equations are not fmin_cobyla's purpose, are they ? To show clearly what is my problem, I've prepared this toy example , benchmarking lsquares with fmin_cobyla: ____________________________ display2d:false$ load(lsquares)$ load(fmin_cobyla)$ DataM: matrix( [1,2], [2,4], [3,6], [4,8] )$ D_vars: [x,y]$ pattern: y = a3*x**3 + a2*x**2 + a1*x + a0$ parameters: [a3,a2,a1,a0]$ mse : lsquares_mse (DataM, D_vars, pattern); lsq_val: lsquares_estimates (DataM, D_vars, pattern, parameters); cob_val: fmin_cobyla(mse, parameters, [1,1,1,1], constraints = [a3>=0, a2>=0, a1>=0, a0>=0], iprint=1); lsq_expr: ev(pattern,lsq_val); cob_expr: ev(pattern,cob_val[1]); quality_of_lsq: ev(mse,lsq_val),nouns; quality_of_cob: ev(mse,cob_val[1]),nouns; ____________________________ Here is how it works: ____________________________ $ maxima -b /tmp/t.mac 2>/dev/null Maxima 5.24.0 http://maxima.sourceforge.net using Lisp SBCL 1.0.51 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) batch(/tmp/t.mac) (%i2) display2d : false (%i3) load(lsquares) (%i4) load(fmin_cobyla) (%i5) DataM:matrix([1,2],[2,4],[3,6],[4,8]) (%i6) D_vars:[x,y] (%i7) pattern:y = a0+a1*x+a2*x^2+a3*x^3 (%i8) parameters:[a3,a2,a1,a0] (%i9) mse:lsquares_mse(DataM,D_vars,pattern) (%o9) ('sum(('DataM[i,2]-a3*'DataM[i,1]^3-a2*'DataM[i,1]^2-a1*'DataM[i,1]-a0) ^2,i,1,4)) /4 (%i10) lsq_val:lsquares_estimates(DataM,D_vars,pattern,parameters) (%o10) [[a3 = 0,a2 = 0,a1 = 2,a0 = 0]] (%i11) cob_val:fmin_cobyla(mse,parameters,[1,1,1,1], constraints = [a3 >= 0,a2 >= 0,a1 >= 0,a0 >= 0], iprint = 1) Return from subroutine COBYLA because the MAXFUN limit has been reached. NFVALS = 1000 F = 3.415514E-02 MAXCV = 5.648753E-20 X =-5.648753E-20 1.754386E-01 1.073534E+00 1.018859E+00 (%o11) [[a3 = -5.648753124436182e-20,a2 = .1754386264111758, a1 = 1.073533597507375,a0 = 1.018858888779015],0.0341551363982473, 1000,1] (%i12) lsq_expr:ev(pattern,lsq_val) (%o12) y = 2*x (%i13) cob_expr:ev(pattern,cob_val[1]) (%o13) y = -5.648753124436182e-20*x^3+.1754386264111758*x^2 +1.073533597507375*x+1.018858888779015 (%i14) ev(quality_of_lsq:ev(mse,lsq_val),nouns) (%o14) 0 (%i15) ev(quality_of_cob:ev(mse,cob_val[1]),nouns) (%o15) 0.0341551363982473 ____________________________ Greg From toy.raymond at gmail.com Mon Jan 16 12:27:49 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 16 Jan 2012 10:27:49 -0800 Subject: [Maxima] lsquares fitting and constrains for parameters (looking for positive values of parameters) In-Reply-To: References: <4F1389B0.4040309@gmail.com> Message-ID: On Mon, Jan 16, 2012 at 9:19 AM, wrote: > > If you do not need a symbolic solution, > > You're right. I need concrete values. (I've forgot to say it in > problem statement). > > > you might be interested in > > fmin_cobyla, which will produce the minimum of a function subject to > > equality or inequality constraints. > > fmin_cobyla, I haven't knew about it. (btw. I see it's implemented in > Scipy as well.) > > I try to figure out how to make it to obey constraints, with no > success. Results are not positive, and even worse than > lsquares_estimate. > > As I doing sth wrong ? > Or sum equations are not fmin_cobyla's purpose, are they ? > > >From what I can see, you're doing everything correctly. I have noticed that fmin_cobyla is sensitive to the initial guess. With your example, fmin_cobyla does return positive values for the parameters, except a3, which is very small and slightly negative. It's also possible that by giving a too-complicated expression makes cobyla less efficient. Just from looking at the data matrix, it's clear that the relationship is linear (difference each y value is a constant). Perhaps a better example would be a real cubic with some noise added to the y values. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwpublic at wp.pl Mon Jan 16 14:12:04 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Mon, 16 Jan 2012 21:12:04 +0100 Subject: [Maxima] lsquares fitting and constrains for parameters (looking for positive values of parameters) In-Reply-To: References: <4F1389B0.4040309@gmail.com> Message-ID: >> > If you do not need a symbolic solution, >> >> You're right. I need concrete values. (I've forgot to say it in >> problem statement). >> >> > you might be interested in >> > fmin_cobyla, which will produce the minimum of a function subject to >> > equality or inequality constraints. >> >> fmin_cobyla, I haven't knew about it. (btw. I see it's implemented in >> Scipy as well.) >> >> I try to figure out how to make it to obey constraints, with no >> success. Results are not positive, and even worse than >> lsquares_estimate. >> >> As I doing sth wrong ? >> Or sum equations are not fmin_cobyla's purpose, are they ? >> > > From what I can see, you're doing everything correctly.? I have noticed that > fmin_cobyla is sensitive to the initial guess.?? With your example, > fmin_cobyla does return positive values for the parameters, except a3, which > is very small and slightly negative. > > It's also possible that by giving a too-complicated expression makes cobyla > less efficient.? Just from looking at the data matrix, it's clear that the > relationship is linear (difference each y value is a constant). > > Perhaps a better example would be a real cubic with some noise added to the > y values. > > Ray Thanks for ensuring me I am doing everything fine. Now I know, it's question of "workarounds" and "tuning" to make all this stuff work as expected :). All Best, Greg From smh at franz.com Mon Jan 16 19:53:45 2012 From: smh at franz.com (Steve Haflich) Date: Mon, 16 Jan 2012 17:53:45 -0800 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> Message-ID: <27714.1326765225@gemini.franz.com> Robert Dodier wrote: On 1/11/12, Steve Haflich wrote: > Proclamations (aka declamations) such as are estabished by the > macroexpansions if DEFVAR etc. affect all subsequently-compiled or > executed bindings and references. That's unfortunate, isn't it? since it means, in effect, that there is in fact no lexical scope in Common Lisp, because the behavior of a given snippet of code can only be understood by considering the entire program. I understand your argument, but it is either incorrect in a strict language-lawyer sense, or irrelevant in that the issue almost never causes problems in real code. Since I'm a language lawyer (:-) I'll make that response first. It is true that when one writes code that lambda binds a variable such as cl-user::foo one cannot be absolutely certain that some remote, even irrelevant, module has sneakily declaimed foo to be globally special. (The package system is designed to reduce the possibility of inadvertent name collisions, but the package system remains in Chapter 11 (U.S. bankruptcy law) as X3J13 nonbindingly instructed the ANS editor.) If some body of code were either so pernicious or so disorganized, one would be wise not to use it. Nonetheless, writing as language lawyer, it is indeed possible to guarantee that a variable is bound lexically: (defun foo (x) (let ((#1=#:y (1+ x))) (bar #1#))) It is guaranteed that the gensym #:y will bound lexically, since that variable name is visible nowhere else than this defun form when it is read by the reader. (Of course, no one _ever_ does this, even though macrology could do it automatically. But I digress.) A related issue (actually the same issue) would be a promiscuous declamation like (declaim (type (mod 256) foo)) which (when not obeyed) could cause the compiler to miscompile references to the special variable "foo". (It would, fortunately, not affect any lexical binding.) There is nothing special [sic] about a special declaration. The above comments, other than being a virtuoso exercise of language lawyering, are otherwise both uninteresting and irrelevant. My serious comment follows: Common Lisp binding and scoping semantics are about 20 years old. They are in practice, and in most details, somewhat older, but they are based on years of post-MACLISP practice, are consistent, and when reasonable conventions are used generally don't cause practical programming problems. Maxima binding semantics date from MACLISP, about 50 years ago, before the distinction between "special" and "lexical" bindings had been clearly delineated in practice. The issue you suggest about a pernicious promiscuous special proclamation is a real issue, but it is almost never an actual issue, assuming accepted reasonable coding practices. That is why CL programmers always name special variables with leading and trailing *stars*. (Sometimes low-level constants are decorated differently, e.g. .data-offset. or %data-offset%.) These conventions both reduce the possibility of collisions and improve readability of code. I've previously proposed, perhaps mischievously, that the code in both Maxima implementation and Maxima user applications would be improved if the language were changed to mimic CL bding and scoping semantics. This is an honest and sincerely-considered opinion; it is mischievous only because that would be an impractically-high back compatibility hill to traverse. (I'd apologize here if this message is unbearably tedious, but certainly no reader will have gotten far enough to read the apology.) From dbmaxima at gmail.com Mon Jan 16 21:13:24 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Tue, 17 Jan 2012 14:13:24 +1100 Subject: [Maxima] maxima for windows with modern gcc/gcl Message-ID: <4F14E754.2070100@gmail.com> A couple of days ago I posted a windows installer for maxima-5.26.0 at http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe See http://www.math.utexas.edu/pipermail/maxima/2012/027451.html Having set up the build system, I decided to try it on a current mingw/msys installation. As some of you know, it is a tricky build as gcl on windows is touchy. The last version of gcc that could be used to build gcl was gcc-3.3.1 from August 2003, and you need to have an ancient mingw/msys install. See the INSTALL.win32 file in maxima cvs for the details. There has been some progress with gcl. One can now build gcl with the latest mingw32/msys using gcc-4.6.2 and successfully build a working maxima. While the build works on 32-bit WinXP, I haven't managed to reproduce it (yet) on a 64-bit Windows 7 machine. Anyway, I have uploaded a test installer of maxima cvs 2012-01-16 using gcc-4.6.2 to http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe This is still work in progress, and some documentation is required, but I'd welcome feedback. David -------------- next part -------------- An HTML attachment was scrubbed... URL: From ferriste at gmail.com Tue Jan 17 02:21:45 2012 From: ferriste at gmail.com (Stefano Ferri) Date: Tue, 17 Jan 2012 09:21:45 +0100 Subject: [Maxima] maxima for windows with modern gcc/gcl In-Reply-To: <4F14E754.2070100@gmail.com> References: <4F14E754.2070100@gmail.com> Message-ID: I was also trying to build a Maxima installer when Robert asked for that, but I was stuck with the compilation of gcl. I've read the install.win32 but I've installed the latest version of Minsys/Mingw to see if they worked. First, the ./confgure was extremely slow (I have a slow pc, but while on a Linux box it takes 1-2 minutes to complete, on windows it takes about 20 minutes), but maybe this is a Mingw/Minsys-related issue. The problem is that configure complains about a missing xdr_double and stops with an error. I've not found a solution for that, how have you set up the build environment? I've made a complete installation via installer, and not manually downloaded and installed files and suggested in install.win32. Do I need some other package? Thanks Stefano 2012/1/17 David Billinghurst > ** > A couple of days ago I posted a windows installer for maxima-5.26.0 at > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exeSee http://www.math.utexas.edu/pipermail/maxima/2012/027451.html > > > Having set up the build system, I decided to try it on a current > mingw/msys installation. As some of you know, it is a tricky build as gcl > on windows is touchy. The last version of gcc that could be used to build > gcl was gcc-3.3.1 from August 2003, and you need to have an ancient > mingw/msys install. See the INSTALL.win32 file in maxima cvs for the > details. There has been some progress with gcl. One can now build gcl > with the latest mingw32/msys using gcc-4.6.2 and successfully build a > working maxima. While the build works on 32-bit WinXP, I haven't managed > to reproduce it (yet) on a 64-bit Windows 7 machine. > > Anyway, I have uploaded a test installer of maxima cvs 2012-01-16 using > gcc-4.6.2 to > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe > > This is still work in progress, and some documentation is required, but I'd welcome feedback. > > David > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbmaxima at gmail.com Tue Jan 17 04:46:11 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Tue, 17 Jan 2012 21:46:11 +1100 Subject: [Maxima] maxima for windows with modern gcc/gcl In-Reply-To: References: <4F14E754.2070100@gmail.com> Message-ID: <4F155173.5070607@gmail.com> On 17/01/2012 7:21 PM, Stefano Ferri wrote: > I was also trying to build a Maxima installer when Robert asked for > that, but I was stuck with the compilation of gcl. I've read the > install.win32 but I've installed the latest version of Minsys/Mingw to > see if they worked. > > First, the ./confgure was extremely slow (I have a slow pc, but while > on a Linux box it takes 1-2 minutes to complete, on windows it takes > about 20 minutes), but maybe this is a Mingw/Minsys-related issue. > > The problem is that configure complains about a missing xdr_double and > stops with an error. I've not found a solution for that, how have you > set up the build environment? I've made a complete installation via > installer, and not manually downloaded and installed files and > suggested in install.win32. Do I need some other package? > > Thanks > Stefano > Here are some rough notes. Happy to explain further as required. I may have missed a step or two. This works for me in WinXP 32-bit but not on Window 7 64-bit, where gcl configure chokes. If you are getting the xdr error then you are past the tests that fail for me. It is slow, and anti-virus software will make it even worse To compile gcl * latest mingw installation with gcc-4.6.2. Not sure exactly which packages are installed, but I just added them using mingw-get as required. I don't recall any problems here. * gcl-2.6.8pre from CVS * xdr isn't needed for maxima. I couldn't disable it in configure, and the test seems broken, so I just removed the tests using the patch below. * /configure --enable-ansi --enable-dynsysgmp; make; make install It would be better to provide xdr or fix gcl configure so that --disable-xdr or enable-xdr=no works. To compile maxima * ActiveState perl and python (32-bit) with wrapper scripts for perl and python in /usr/local/bin. Can also do this with PATH but wrappers work better for me. * some other tools as given in INSTALL.win32, but using latest versions I could find. You don't need many of them until you build an installer * sh bootstrap; configure; make; make check * if you are building an installer then you need the configure line as given in INSTALL.win32 To install maxima and make installer * wxMaxima binary from Andrej (as I haven't tried to build it from source yet). Just copy the whole folder from latest installer, and put it where "make iss" can find it - see interfaces/xmaxima/win32/Makefile * ActiveState tcl * Other tools as given in INSTALL.win32, but using latest versions I could find. * Changes to interfaces/xmaxima/win32/Makefile (attached) after running configure. o use tcl header, library and dll from c:/tcl o install parts of gcc needed to compile maxima using gcl * make install; make iss * run the maxima.iss file through InnoSetup $ diff -u configure.orig configure --- configure.orig 2012-01-16 21:59:22 +1100 +++ configure 2012-01-17 21:12:25 +1100 @@ -2546,11 +2546,11 @@ # Check whether --enable-xdr was given. -if test "${enable_xdr+set}" = set; then : - enableval=$enable_xdr; try_xdr=$enableval -else +#if test "${enable_xdr+set}" = set; then : +# enableval=$enable_xdr; try_xdr=$enableval +#else try_xdr="no" -fi +#fi # Check whether --enable-xgcl was given. @@ @@ -5691,56 +5691,6 @@ fi -ac_fn_c_check_func "$LINENO" "xdr_double" "ac_cv_func_xdr_double" -if test "x$ac_cv_func_xdr_double" = xyes; then : - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_double in -ltirpc" >&5 -$as_echo_n "checking for xdr_double in -ltirpc... " >&6; } -if ${ac_cv_lib_tirpc_xdr_double+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ltirpc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char xdr_double (); -int -main () -{ -return xdr_double (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_tirpc_xdr_double=yes -else - ac_cv_lib_tirpc_xdr_double=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tirpc_xdr_double" >&5 -$as_echo "$ac_cv_lib_tirpc_xdr_double" >&6; } -if test "x$ac_cv_lib_tirpc_xdr_double" = xyes; then : - TLIBS="$TLIBS -ltirpc" -else - as_fn_error $? "Need xdr_double" "$LINENO" 5 -fi - -fi - - - -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Makefile URL: From camm at maguirefamily.org Tue Jan 17 11:02:57 2012 From: camm at maguirefamily.org (Camm Maguire) Date: Tue, 17 Jan 2012 12:02:57 -0500 Subject: [Maxima] Debian bugs In-Reply-To: (Robert Dodier's message of "Mon, 16 Jan 2012 09:15:12 -0700") References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> Message-ID: <87pqeiw9by.fsf_-_@maguirefamily.org> Greetings! The Debian BTS has a tagging mechanism supporting bug forwarding, and uses an email address for the forwarding. In the past, I've forwarded to this list. I imagine the developers would prefer entries at sourceforge, but then we'd drop the connection in the BTS. I have a few piled up now, and would like to forward. Suggestions? -- Camm Maguire camm at maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah From camm at maguirefamily.org Tue Jan 17 11:23:48 2012 From: camm at maguirefamily.org (Camm Maguire) Date: Tue, 17 Jan 2012 12:23:48 -0500 Subject: [Maxima] maxima for windows with modern gcc/gcl In-Reply-To: <4F14E754.2070100@gmail.com> (David Billinghurst's message of "Tue, 17 Jan 2012 14:13:24 +1100") References: <4F14E754.2070100@gmail.com> Message-ID: <87lip6w8d7.fsf@maguirefamily.org> Greetings! Great to hear of your progress. BTW, I build frequently under latest wine/mingw packages in Debian, together with maxima/acl2/axiom, without issue. Had a native windows box too recently and got things working. axiom needs xdr. Latest glibc moves the functions, and my configure fix was too stringent. How about this: --- configure.in 16 Jan 2012 20:08:03 -0000 1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.70 +++ configure.in 17 Jan 2012 17:21:56 -0000 @@ -66,7 +66,7 @@ [try_japi=$enableval],[try_japi="no"]) AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR], -[try_xdr=$enableval],[try_xdr="no"]) +[enable_xdr=$enableval],[enable_xdr="yes"]) AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for XGCL], [enable_xgcl=$enableval],[enable_xgcl="yes"]) @@ -1046,8 +1046,12 @@ fi -AC_CHECK_FUNC(xdr_double,, - AC_CHECK_LIB(tirpc,xdr_double,TLIBS="$TLIBS -ltirpc",AC_MSG_ERROR([Need xdr_double]))) +if test "$enable_xdr" = "yes" ; then + AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR), + AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -ltirpc", + AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -lrpc", + AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -loncrpc")))) +fi AC_MSG_CHECKING(__builtin___clear_cache) AC_TRY_COMPILE([], @@ -1373,17 +1377,17 @@ EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o" LIBS="${LIBS} -ljapi -lwsock32"] ) fi -if test "$use" = "mingw" ; then - if test "$try_xdr" = "yes" ; then - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) - LIBS="${LIBS} -loncrpc"] ) - fi -else - if test "$try_xdr" = "yes" ; then - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) - LIBS="${LIBS} -lrpc"] ) - fi -fi +dnl if test "$use" = "mingw" ; then +dnl if test "$try_xdr" = "yes" ; then +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) +dnl LIBS="${LIBS} -loncrpc"] ) +dnl fi +dnl else +dnl if test "$try_xdr" = "yes" ; then +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) +dnl LIBS="${LIBS} -lrpc"] ) +dnl fi +dnl fi # Should really find a way to check for prototypes, but this # basically works for now. CM David Billinghurst writes: > A couple of days ago I posted a windows installer for maxima-5.26.0 at > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe > > See http://www.math.utexas.edu/pipermail/maxima/2012/027451.html > > Having set up the build system, I decided to try it on a current mingw/msys installation. As some of you know, it is a tricky build as gcl on > windows is touchy. The last version of gcc that could be used to build gcl was gcc-3.3.1 from August 2003, and you need to have an ancient mingw/ > msys install. See the INSTALL.win32 file in maxima cvs for the details. There has been some progress with gcl. One can now build gcl with the > latest mingw32/msys using gcc-4.6.2 and successfully build a working maxima. While the build works on 32-bit WinXP, I haven't managed to reproduce > it (yet) on a 64-bit Windows 7 machine. > > Anyway, I have uploaded a test installer of maxima cvs 2012-01-16 using gcc-4.6.2 to > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe > > This is still work in progress, and some documentation is required, but I'd welcome feedback. > > David > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- Camm Maguire camm at maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah From robert.dodier at gmail.com Tue Jan 17 15:13:03 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 17 Jan 2012 14:13:03 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <27714.1326765225@gemini.franz.com> References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: Steve, I'm glad to hear that lexical scope is indeed achievable, although I'm dismayed to find it's rather clumsy. About macrology, a LET-like macro which guaranteed lexical binding seems useful. The stuff about programming conventions is beside the point; either the programming language guarantees lexical binding or it doesn't. You will recall we arrived here because reasonable people made different assumptions about symbol LB. I'm in favor of implementing lexical scope in Maxima, although there's no need to replicate CL's craziness. I suspect most user programs would work the same if function and block variables obeyed lexical binding, so, while it would be a substantial change, the trouble it causes for users would be tractable; no need to dismiss lexical binding out of hand. best Robert Dodier From toy.raymond at gmail.com Tue Jan 17 15:20:13 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 17 Jan 2012 13:20:13 -0800 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: On Tue, Jan 17, 2012 at 1:13 PM, Robert Dodier wrote: > Steve, I'm glad to hear that lexical scope is indeed achievable, > although I'm dismayed to find it's rather clumsy. > About macrology, a LET-like macro which guaranteed lexical > binding seems useful. > Like emacs' lexical-let? > > The stuff about programming conventions is beside the point; > either the programming language guarantees lexical binding > or it doesn't. You will recall we arrived here because > reasonable people made different assumptions about symbol LB. > Recall that maxima has the declare unspecial feature that makes symbols that were special no longer special. I think all the lisps we build with have this ability. But I'd rather make all special symbols follow the *convention*. Unfortunately, I don't think we can do this without a lot of manual work because we need to be able to tell if the variable is really the same as some other special variable in some other file. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Tue Jan 17 15:29:09 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 17 Jan 2012 16:29:09 -0500 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: Not sure what lexical scope in the Maxima language (call it MaximaL) has to do with lexical scope in the implementation Lisp, call it MaxLisp (which was the original issue). Both MaximaL and MaxLisp use a variety of global variables to control the behavior of various functions. Things like $simp, $algebraic, $gcd, $fpprec, $ratvars, etc. It is a common idiom to write block([algebraic:false], ...) or its equivalent in Lisp. This is ugly and error-prone, but very convenient, and pretty common. Of course, you could always have some way of exempting some variables (declare them "dynamic") but then you're back to the original problem of lack of referential transparency. This is without addressing the question of the interpretation of symbolic variables. For example, what is the value of block([x],x)-x? Is it 0? Or is the inner x a different symbolic variable? -s On Tue, Jan 17, 2012 at 16:13, Robert Dodier wrote: > Steve, I'm glad to hear that lexical scope is indeed achievable, > although I'm dismayed to find it's rather clumsy. > About macrology, a LET-like macro which guaranteed lexical > binding seems useful. > > The stuff about programming conventions is beside the point; > either the programming language guarantees lexical binding > or it doesn't. You will recall we arrived here because > reasonable people made different assumptions about symbol LB. > > I'm in favor of implementing lexical scope in Maxima, > although there's no need to replicate CL's craziness. > I suspect most user programs would work the same if function and block > variables > obeyed lexical binding, so, while it would be a substantial change, > the trouble it causes for users would be tractable; no need to dismiss > lexical binding out of hand. > > best > > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rswarbrick at gmail.com Tue Jan 17 16:31:32 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Tue, 17 Jan 2012 22:31:32 +0000 Subject: [Maxima] invert_by_lu does not work as expected References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: <4f9hu8xhff.ln2@hake.rswarbrick.dnsalias.com> Raymond Toy writes: >> The stuff about programming conventions is beside the point; >> either the programming language guarantees lexical binding >> or it doesn't. You will recall we arrived here because >> reasonable people made different assumptions about symbol LB. >> > > Recall that maxima has the declare unspecial feature that makes symbols > that were special no longer special. I think all the lisps we build with > have this ability. But I'd rather make all special symbols follow the > *convention*. Unfortunately, I don't think we can do this without a lot of > manual work because we need to be able to tell if the variable is really > the same as some other special variable in some other file. I agree about it being nice to add earmuffs, but are there backwards compatibility issues to worry about? About deciding on possible naming conflicts, I wouldn't think it's too difficult. Something as short as LB was pretty obvious to work out who was doing what. Presumably most variables would be considerably easier. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From willisb at unk.edu Tue Jan 17 17:14:25 2012 From: willisb at unk.edu (Barton Willis) Date: Tue, 17 Jan 2012 17:14:25 -0600 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: , <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- > Not sure what lexical scope in the Maxima language (call it MaximaL) has to do with lexical scope in the implementation Lisp, Maybe would be possible to modify the Maxima to CL translator to remove most of the special declarations, and to insert a few lines of code in the read-eval-print loop that translates all inputs. That might be a quick way to experiment with MaximaL? Likely, I don't know what I'm talking about. --bw From toy.raymond at gmail.com Tue Jan 17 17:19:15 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 17 Jan 2012 15:19:15 -0800 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: <4f9hu8xhff.ln2@hake.rswarbrick.dnsalias.com> References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> <4f9hu8xhff.ln2@hake.rswarbrick.dnsalias.com> Message-ID: On Tue, Jan 17, 2012 at 2:31 PM, Rupert Swarbrick wrote: > Raymond Toy writes: > >> The stuff about programming conventions is beside the point; > >> either the programming language guarantees lexical binding > >> or it doesn't. You will recall we arrived here because > >> reasonable people made different assumptions about symbol LB. > >> > > > > Recall that maxima has the declare unspecial feature that makes symbols > > that were special no longer special. I think all the lisps we build with > > have this ability. But I'd rather make all special symbols follow the > > *convention*. Unfortunately, I don't think we can do this without a lot > of > > manual work because we need to be able to tell if the variable is really > > the same as some other special variable in some other file. > > I agree about it being nice to add earmuffs, but are there backwards > compatibility issues to worry about? About deciding on possible naming > Why would there be backward compatibility issues? Do you mean on some third-party code that uses these renamed variables? Yes, that would be a problem, but should be pretty obvious. > conflicts, I wouldn't think it's too difficult. Something as short as LB > was pretty obvious to work out who was doing what. Presumably most > variables would be considerably easier. > I think LB was easy because the number of places where it was used was fairly small and the code using it was pretty readable. That's not true for a lot of the code. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwpublic at wp.pl Tue Jan 17 18:12:07 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Wed, 18 Jan 2012 01:12:07 +0100 Subject: [Maxima] lsquares fitting and constrains for parameters (looking for positive values of parameters) In-Reply-To: References: <4F1389B0.4040309@gmail.com> Message-ID: On Mon, Jan 16, 2012 at 9:12 PM, wrote: >>> > If you do not need a symbolic solution, >>> >>> You're right. I need concrete values. (I've forgot to say it in >>> problem statement). >>> >>> > you might be interested in >>> > fmin_cobyla, which will produce the minimum of a function subject to >>> > equality or inequality constraints. >>> >>> fmin_cobyla, I haven't knew about it. (btw. I see it's implemented in >>> Scipy as well.) >>> >>> I try to figure out how to make it to obey constraints, with no >>> success. Results are not positive, and even worse than >>> lsquares_estimate. >>> >>> As I doing sth wrong ? >>> Or sum equations are not fmin_cobyla's purpose, are they ? >>> >> >> From what I can see, you're doing everything correctly.? I have noticed that >> fmin_cobyla is sensitive to the initial guess.?? With your example, >> fmin_cobyla does return positive values for the parameters, except a3, which >> is very small and slightly negative. >> >> It's also possible that by giving a too-complicated expression makes cobyla >> less efficient.? Just from looking at the data matrix, it's clear that the >> relationship is linear (difference each y value is a constant). >> >> Perhaps a better example would be a real cubic with some noise added to the >> y values. >> >> Ray > > Thanks for ensuring me I am doing everything fine. > > Now I know, it's question of "workarounds" and "tuning" to make all > this stuff work as expected :). > > All Best, > Greg Hi ! I've found solution for main part of my problem and I'd like to share :). As a reminder: "How to fit parametrized function to data, to achieve grater than zero parameters?" I've started by asking about lsquare_estimate, Raymond Toy pointed fmin_cobyla. I've found it can be done, not by constraining, but with "trick". I think it's universal and works for many many problems, when numerical or symbolic method does not provide way of "feeding" with constraints: abs ! Yes, that was that simple. So instead of fitting with lsquares_estimate expression like this: a*x^4 + b*x^3 + d*x + e I fit expression with all parameters after "abs" : abs(a)*x^4 + abs(b)*x^3 + abs(d)*x + abs(e) :) Again - Thanks Raymond Toy for showing fmin_cobyla, I've missed it when going thought manual :). Cheers, Greg From robert.dodier at gmail.com Wed Jan 18 01:05:39 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 18 Jan 2012 00:05:39 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: On 1/17/12, Raymond Toy wrote: > Like emacs' lexical-let? Maybe, I don't know anything about Emacs Lisp. > Recall that maxima has the declare unspecial feature that makes symbols > that were special no longer special. I think all the lisps we build with > have this ability. Nope. The default implementation of the unspecial stuff attempts to remove the SPECIAL property from a symbol. Needless to say that's nonportable, and more to the point, generally has no effect. There are a couple of per-implementation versions of unspecial; the GCL version reaches into generated C code to fiddle with some bits. Yikes. I'm inclined to nuke all the unspecial declarations. They can't be necessary, since Maxima apparently works OK with implementations for which unspecial is a no-op. > But I'd rather make all special symbols follow the > *convention*. Unfortunately, I don't think we can do this without a lot of > manual work because we need to be able to tell if the variable is really > the same as some other special variable in some other file. I think it's worth the effort to paste the earmuffs onto all special variables (except for Maxima global variables). It makes the code clearer, reduces bugs, it's not too difficult, and it's the kind of project that can be carried out a little bit at a time. best Robert Dodier From robert.dodier at gmail.com Wed Jan 18 01:16:21 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 18 Jan 2012 00:16:21 -0700 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <27714.1326765225@gemini.franz.com> Message-ID: On 1/17/12, Stavros Macrakis wrote: > Not sure what lexical scope in the Maxima language (call it MaximaL) has to > do with lexical scope in the implementation Lisp, call it MaxLisp (which > was the original issue). Well, of course there is no necessary connection. But the one topic seems to lead to the other. > Both MaximaL and MaxLisp use a variety of global variables to control the > behavior of various functions. Things like $simp, $algebraic, $gcd, > $fpprec, $ratvars, etc. It is a common idiom to write > block([algebraic:false], ...) or its equivalent in Lisp. This is ugly and > error-prone, but very convenient, and pretty common. Yup. > Of course, you could always have some way of exempting > some variables (declare them "dynamic") > but then you're back to the original problem of lack of referential > transparency. Well, would it be OK if such "unlexical" declarations were local in effect? The bug we ran into with LB stems from the unbounded scope of PROCLAIM .... > This is without addressing the question of the interpretation of symbolic > variables. For example, what is the value of block([x],x)-x? Is it 0? Or > is the inner x a different symbolic variable? Well, to be consistent, wouldn't we have to say that the inner x is a different symbol, and therefore the result will look like x - x ? I agree that would be puzzling to users, but consistency is less puzzling in the long run, I hope. best Robert Dodier From lapeyre.math122a at gmail.com Wed Jan 18 08:41:23 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Wed, 18 Jan 2012 15:41:23 +0100 Subject: [Maxima] make-array with initial-contents in gcl is slow Message-ID: <4F16DA13.70209@gmail.com> In gcl make-array with :initial-contents from a list is poorly implemented in that the copying is O(n^2). A test on one machine shows that initializing a list of length of 5 10^4 takes 1 minute in gcl and a few ms in sbcl. This potentially affects some code in the share directory. The relevant part of the gcl code in make-array is: ((= (length dimensions) 1) (let ((x (si:make-vector element-type (car dimensions) adjustable fill-pointer displaced-to displaced-index-offset static initial-element))) (when initial-contents-supplied-p (do ((n (car dimensions)) (i 0 (1+ i))) ((>= i n)) (declare (fixnum n i)) (si:aset x i (elt initial-contents i)))) x)) The following passed a quick test: ((= (length dimensions) 1) (let ((x (si:make-vector element-type (car dimensions) adjustable fill-pointer displaced-to displaced-index-offset static initial-element))) (when initial-contents-supplied-p (if (listp initial-contents) (do ( (e initial-contents (cdr e)) (i 0 (1+ i))) ((null e)) (declare (fixnum i)) (si:aset x i (car e))) (do ((n (car dimensions)) (i 0 (1+ i))) ((>= i n)) (declare (fixnum n i)) (si:aset x i (elt initial-contents i))))) x)) -- John Lapeyre From rswarbrick at gmail.com Wed Jan 18 08:47:52 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 18 Jan 2012 14:47:52 +0000 Subject: [Maxima] make-array with initial-contents in gcl is slow References: <4F16DA13.70209@gmail.com> Message-ID: John Lapeyre writes: > In gcl make-array with :initial-contents from a list > is poorly implemented in that the copying is O(n^2). > A test on one machine shows that initializing a > list of length of 5 10^4 takes 1 minute in gcl and a few ms in sbcl. Have you reported this to the GCL project? It would be bizarre, to say the least, for Maxima to ship with fixes to various lisp implementations' basic algorithms. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From cfrangos123 at gmail.com Mon Jan 16 02:08:59 2012 From: cfrangos123 at gmail.com (Constantine Frangos) Date: Mon, 16 Jan 2012 10:08:59 +0200 Subject: [Maxima] Double integration. In-Reply-To: References: Message-ID: Hi Stavro, Thanks for the detailed response. I was wondering whether the difficutlies you mention can be overcome in the following manner. A new Maxima integration function, num_integration, internally calls a user defined Maxima function, say integrandf, and passes the values of the integration variables, x1, x2, together with the values of other parameters, p1,p2,..., needed to compute the integrand, as follows, ........ I1 : apply(integrandf,[x1,x2,p1,p2,...]); ......... The user would call num_integration with something like, I : num_integration(integrandf,list_of_limits,p1,p2,....); Any suggestions would be appreciated. Regards, Constantine. On 1/12/12, Stavros Macrakis wrote: > As Alexander says, you don't need the temporary variable etc. > > Also, if you explicitly quote everything, you are less likely to have bad > surprises. Something like this: > > (%i27) (cnt:0,quad_qags('(quad_qags('(cnt:cnt+1,if x>y then 1 else > 0),x,0,1)[1]),y,0,1)); > (%o27) [0.49999763949292, 3.4177098928722671E-9, 735, 0] > (%i28) cnt; > (%o28) 621243 > > Note the number of function evaluations for a very simple case! Note also > that the result is not very accurate, and that the error estimate is way > off. I imagine there are better routines for this kind of integration. > Obviously in this case it is easy to transform to a single integral (even > analytical), but presumably you want to handle more complicated integrands. > > -s > > On Thu, Jan 12, 2012 at 05:38, Alexander Klimov wrote: > >> Hi. >> >> On Thu, 12 Jan 2012, Constantine Frangos wrote: >> > (1) Its not clear why the function definition I am using does not >> > work. According to the Maxima 5.24 manual, paragraph 20.4, the >> > integrand can be the name of a Maxima function, presumably defined by >> > the user in a file, for example, integrand.mac >> >> Your function does not always return a number. Consider your original >> definition: >> >> (%i1) ind(x,y) := block([s],if is(x*x + y*y <= 1) then (s : 1) else (s : >> 0),return(s))$ >> >> Let us see how it works >> >> (%i2) trace(ind); >> (%o2) [ind] >> >> If one gives numerical arguments, then your function returns the >> number which is assigned to "s" >> >> (%i3) ind(0,1); >> 1 Enter ind [0, 1] >> 1 Exit ind 1 >> (%o3) 1 >> >> but with symbols as arguments nothing is assigned to "s" and thus the >> function returns just a symbol "s" >> >> (%i4) ind(x1,x2); >> 1 Enter ind [x1, x2] >> 1 Exit ind s >> (%o4) s >> >> and this is exactly what happens when you use it in integration >> >> (%i5) I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1)[1],x2,-1,1); >> 1 Enter ind [x1, x2] >> 1 Exit ind s >> COERCE-FLOAT-FUN: no such Lisp or Maxima function: s >> -- an error. To debug this try: debugmode(true); >> >> > (2) Are there perhaps other Maxima numerical integration functions >> > that may perform better ? >> >> As I said, it is better to >> >> > > use a simple integral: >> > > >> > > (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1); >> > > (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0] >> >> the problem with indicators is that while they may be suitable for >> symbolic manipulations, they are bad functions for Gaussian quadrature >> rule which is only good if the function is similar to a polynomial. >> >> -- >> Regards, >> ASK >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> > From camm at maguirefamily.org Wed Jan 18 12:00:27 2012 From: camm at maguirefamily.org (Camm Maguire) Date: Wed, 18 Jan 2012 13:00:27 -0500 Subject: [Maxima] make-array with initial-contents in gcl is slow In-Reply-To: <4F16DA13.70209@gmail.com> (John Lapeyre's message of "Wed, 18 Jan 2012 15:41:23 +0100") References: <4F16DA13.70209@gmail.com> Message-ID: <87fwfcevr8.fsf@maguirefamily.org> Greetings! And thanks for your report! If you would cae to try out the pach below, I'd be most appreciative! ============================================================================= Index: lsp/gcl_arraylib.lsp =================================================================== RCS file: /sources/gcl/gcl/lsp/gcl_arraylib.lsp,v retrieving revision 1.1.2.1 diff -u -u -r1.1.2.1 gcl_arraylib.lsp --- lsp/gcl_arraylib.lsp 14 Sep 2003 02:30:35 -0000 1.1.2.1 +++ lsp/gcl_arraylib.lsp 18 Jan 2012 17:58:46 -0000 @@ -74,47 +74,73 @@ (defun make-array (dimensions &key (element-type t) - (initial-element nil) + initial-element (initial-contents nil initial-contents-supplied-p) adjustable fill-pointer displaced-to (displaced-index-offset 0) static) (when (integerp dimensions) (setq dimensions (list dimensions))) - (setq element-type (best-array-element-type element-type)) - (cond ((= (length dimensions) 1) - (let ((x (si:make-vector element-type (car dimensions) - adjustable fill-pointer - displaced-to displaced-index-offset - static initial-element))) - (when initial-contents-supplied-p - (do ((n (car dimensions)) - (i 0 (1+ i))) - ((>= i n)) - (declare (fixnum n i)) - (si:aset x i (elt initial-contents i)))) - x)) - (t - (let ((x - (make-array1 - (the fixnum(get-aelttype element-type)) - static initial-element - displaced-to (the fixnum displaced-index-offset) - dimensions))) - (if fill-pointer (error "fill pointer for 1 dimensional arrays only")) - (unless (member 0 dimensions) - (when initial-contents-supplied-p - (do ((cursor - (make-list (length dimensions) - :initial-element 0))) - (nil) - (declare (:dynamic-extent cursor)) - (aset-by-cursor x - (sequence-cursor initial-contents - cursor) - cursor) - (when (increment-cursor cursor dimensions) - (return nil))))) - x)))) + (setq element-type (or (upgraded-array-element-type element-type) 'character)) + (if (= (length dimensions) 1) + (let ((x (si:make-vector element-type (car dimensions) adjustable (when fill-pointer (car dimensions)) + displaced-to displaced-index-offset static initial-element))) + (when initial-contents-supplied-p + (replace x initial-contents)) + (when (and fill-pointer (not (eq t fill-pointer))) (setf (fill-pointer x) fill-pointer)) + x) + (let ((x (make-array1 (get-aelttype element-type) static initial-element displaced-to displaced-index-offset dimensions))) + (if fill-pointer (error "fill pointer for 1 dimensional arrays only")) + (unless (member 0 dimensions) + (when initial-contents-supplied-p + (do ((j nil t)(cursor (make-list (length dimensions) :initial-element 0))) + ((when j (increment-cursor cursor dimensions))) + (declare (:dynamic-extent cursor)) + (aset-by-cursor x (sequence-cursor initial-contents cursor) cursor)))) + x))) + +;; (defun make-array (dimensions +;; &key (element-type t) +;; (initial-element nil) +;; (initial-contents nil initial-contents-supplied-p) +;; adjustable fill-pointer +;; displaced-to (displaced-index-offset 0) +;; static) +;; (when (integerp dimensions) (setq dimensions (list dimensions))) +;; (setq element-type (best-array-element-type element-type)) +;; (cond ((= (length dimensions) 1) +;; (let ((x (si:make-vector element-type (car dimensions) +;; adjustable fill-pointer +;; displaced-to displaced-index-offset +;; static initial-element))) +;; (when initial-contents-supplied-p +;; (do ((n (car dimensions)) +;; (i 0 (1+ i))) +;; ((>= i n)) +;; (declare (fixnum n i)) +;; (si:aset x i (elt initial-contents i)))) +;; x)) +;; (t +;; (let ((x +;; (make-array1 +;; (the fixnum(get-aelttype element-type)) +;; static initial-element +;; displaced-to (the fixnum displaced-index-offset) +;; dimensions))) +;; (if fill-pointer (error "fill pointer for 1 dimensional arrays only")) +;; (unless (member 0 dimensions) +;; (when initial-contents-supplied-p +;; (do ((cursor +;; (make-list (length dimensions) +;; :initial-element 0))) +;; (nil) +;; (declare (:dynamic-extent cursor)) +;; (aset-by-cursor x +;; (sequence-cursor initial-contents +;; cursor) +;; cursor) +;; (when (increment-cursor cursor dimensions) +;; (return nil))))) +;; x)))) (defun increment-cursor (cursor dimensions) Index: lsp/gcl_seqlib.lsp =================================================================== RCS file: /sources/gcl/gcl/lsp/gcl_seqlib.lsp,v retrieving revision 1.1.2.2 diff -u -u -r1.1.2.2 gcl_seqlib.lsp --- lsp/gcl_seqlib.lsp 20 Mar 2004 02:00:01 -0000 1.1.2.2 +++ lsp/gcl_seqlib.lsp 18 Jan 2012 17:58:46 -0000 @@ -149,33 +149,53 @@ (setf (elt sequence i) item)))) -(defun replace (sequence1 sequence2 - &key start1 end1 - start2 end2 ) - (with-start-end start1 end1 sequence1 - (with-start-end start2 end2 sequence2 - (if (and (eq sequence1 sequence2) - (> start1 start2)) - (do* ((i 0 (f+ 1 i)) - (l (if (< (f- end1 start1) - (f- end2 start2)) - (f- end1 start1) - (f- end2 start2))) - (s1 (f+ start1 (f+ -1 l)) (f+ -1 s1)) - (s2 (f+ start2 (f+ -1 l)) (f+ -1 s2))) - ((>= i l) sequence1) - (declare (fixnum i l s1 s2)) - (setf (elt sequence1 s1) (elt sequence2 s2))) - (do ((i 0 (f+ 1 i)) - (l (if (< (f- end1 start1) - (f- end2 start2)) - (f- end1 start1) - (f- end2 start2))) - (s1 start1 (f+ 1 s1)) - (s2 start2 (f+ 1 s2))) - ((>= i l) sequence1) - (declare (fixnum i l s1 s2)) - (setf (elt sequence1 s1) (elt sequence2 s2))))))) +(defun replace (s1 s2 &key (start1 0) end1 (start2 0) end2 &aux (os1 s1) s3) + (declare (optimize (safety 1))(notinline make-list)(dynamic-extent s3)) + (check-type s1 sequence) + (check-type s2 sequence) + (check-type start1 seqind) + (check-type start2 seqind) + (check-type end1 (or null seqind)) + (check-type end2 (or null seqind)) + (when (and (eq s1 s2) (> start1 start2)) + (setq s3 (make-list (length s2)) s2 (replace s3 s2))) + (let* ((lp1 (listp s1)) (lp2 (listp s2)) + (e1 (or end1 (if lp1 array-dimension-limit (length s1)))) + (e2 (or end2 (if lp2 array-dimension-limit (length s2))))) + (do ((i1 start1 (1+ i1))(i2 start2 (1+ i2)) + (s1 (if lp1 (nthcdr start1 s1) s1) (if lp1 (cdr s1) s1)) + (s2 (if lp2 (nthcdr start2 s2) s2) (if lp2 (cdr s2) s2))) + ((or (not s1) (>= i1 e1) (not s2) (>= i2 e2)) os1) + (let ((e2 (if lp2 (car s2) (aref s2 i2)))) + (if lp1 (setf (car s1) e2) (setf (aref s1 i1) e2)))))) + +;; (defun replace (sequence1 sequence2 +;; &key start1 end1 +;; start2 end2 ) +;; (with-start-end start1 end1 sequence1 +;; (with-start-end start2 end2 sequence2 +;; (if (and (eq sequence1 sequence2) +;; (> start1 start2)) +;; (do* ((i 0 (f+ 1 i)) +;; (l (if (< (f- end1 start1) +;; (f- end2 start2)) +;; (f- end1 start1) +;; (f- end2 start2))) +;; (s1 (f+ start1 (f+ -1 l)) (f+ -1 s1)) +;; (s2 (f+ start2 (f+ -1 l)) (f+ -1 s2))) +;; ((>= i l) sequence1) +;; (declare (fixnum i l s1 s2)) +;; (setf (elt sequence1 s1) (elt sequence2 s2))) +;; (do ((i 0 (f+ 1 i)) +;; (l (if (< (f- end1 start1) +;; (f- end2 start2)) +;; (f- end1 start1) +;; (f- end2 start2))) +;; (s1 start1 (f+ 1 s1)) +;; (s2 start2 (f+ 1 s2))) +;; ((>= i l) sequence1) +;; (declare (fixnum i l s1 s2)) +;; (setf (elt sequence1 s1) (elt sequence2 s2))))))) ;;; DEFSEQ macro. ============================================================================= John Lapeyre writes: > In gcl make-array with :initial-contents from a list > is poorly implemented in that the copying is O(n^2). > A test on one machine shows that initializing a > list of length of 5 10^4 takes 1 minute in gcl and a few ms in sbcl. > > This potentially affects some code in the share directory. > > The relevant part of the gcl code in make-array is: > > ((= (length dimensions) 1) > (let ((x (si:make-vector element-type (car dimensions) > adjustable fill-pointer > displaced-to displaced-index-offset > static initial-element))) > (when initial-contents-supplied-p > (do ((n (car dimensions)) > (i 0 (1+ i))) > ((>= i n)) > (declare (fixnum n i)) > (si:aset x i (elt initial-contents i)))) > x)) > > The following passed a quick test: > > ((= (length dimensions) 1) > (let ((x (si:make-vector element-type (car dimensions) > adjustable fill-pointer > displaced-to displaced-index-offset > static initial-element))) > (when initial-contents-supplied-p > (if (listp initial-contents) > (do ( (e initial-contents (cdr e)) > (i 0 (1+ i))) > ((null e)) > (declare (fixnum i)) > (si:aset x i (car e))) > (do ((n (car dimensions)) > (i 0 (1+ i))) > ((>= i n)) > (declare (fixnum n i)) > (si:aset x i (elt initial-contents i))))) > x)) > > -- John Lapeyre > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > > > -- Camm Maguire camm at maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah From camm at maguirefamily.org Wed Jan 18 12:09:39 2012 From: camm at maguirefamily.org (Camm Maguire) Date: Wed, 18 Jan 2012 13:09:39 -0500 Subject: [Maxima] make-array with initial-contents in gcl is slow In-Reply-To: <4F16DA13.70209@gmail.com> (John Lapeyre's message of "Wed, 18 Jan 2012 15:41:23 +0100") References: <4F16DA13.70209@gmail.com> Message-ID: <87k44o7uho.fsf@maguirefamily.org> Greetings! P.S. you need this ahead of the defun replace in 2.6.8pre: (deftype seqind nil `(integer 0 ,array-dimension-limit)) Take care, John Lapeyre writes: > In gcl make-array with :initial-contents from a list > is poorly implemented in that the copying is O(n^2). > A test on one machine shows that initializing a > list of length of 5 10^4 takes 1 minute in gcl and a few ms in sbcl. > > This potentially affects some code in the share directory. > > The relevant part of the gcl code in make-array is: > > ((= (length dimensions) 1) > (let ((x (si:make-vector element-type (car dimensions) > adjustable fill-pointer > displaced-to displaced-index-offset > static initial-element))) > (when initial-contents-supplied-p > (do ((n (car dimensions)) > (i 0 (1+ i))) > ((>= i n)) > (declare (fixnum n i)) > (si:aset x i (elt initial-contents i)))) > x)) > > The following passed a quick test: > > ((= (length dimensions) 1) > (let ((x (si:make-vector element-type (car dimensions) > adjustable fill-pointer > displaced-to displaced-index-offset > static initial-element))) > (when initial-contents-supplied-p > (if (listp initial-contents) > (do ( (e initial-contents (cdr e)) > (i 0 (1+ i))) > ((null e)) > (declare (fixnum i)) > (si:aset x i (car e))) > (do ((n (car dimensions)) > (i 0 (1+ i))) > ((>= i n)) > (declare (fixnum n i)) > (si:aset x i (elt initial-contents i))))) > x)) > > -- John Lapeyre > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > > > -- Camm Maguire camm at maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah From dlakelan at street-artists.org Wed Jan 18 13:39:01 2012 From: dlakelan at street-artists.org (dlakelan) Date: Wed, 18 Jan 2012 11:39:01 -0800 Subject: [Maxima] draw package, multiple plots with different sizes? Message-ID: <4F171FD5.20108@street-artists.org> Using draw, is it possible to do something like put one plot above the other, with the upper plot being say a square and the lower plot being a thin rectangle. To explain here is some sort of ascii art showing the relative aspect ratios I want to achieve. ------------- | | | | | | | | | | ------------- | | ------------- All I see is the option to specify more than one plot, the number of columns, and the overall size of the plot (the bounding box using "dimensions"). I want to do this with the pdfcairo terminal. Any suggestions, other than to make them separate plots and glue them together by hand? From maxima at mm.pl Wed Jan 18 13:53:56 2012 From: maxima at mm.pl (Piotr) Date: Wed, 18 Jan 2012 20:53:56 +0100 Subject: [Maxima] solution of system odes Message-ID: <4F172354.40809@mm.pl> Dear Users of the Forum, I have a problem with a program which I would like to solve system of odes, originating form method of lines. There is my program: kill(all); N:2;h:1/N; zz:2; fun(x):=1; for i:1 while i References: <4F14E754.2070100@gmail.com> <87lip6w8d7.fsf@maguirefamily.org> Message-ID: Thanks David and Camm. I've succesfully built gcl with the latest Mingw/Msys without pain. A simple checkout and a configure worked fine. Yes, I've noticed too that the option to disable xdr was broken, I didn't mention this fact in my previous email. Now I will try to finish the build process and the creation of the installer (just to learn how to do it). I think we should update the information given by install.win32, they are obsolete in some points and now the procedure is easier, at least for the gcl-related part. Stefano 2012/1/17 Camm Maguire > Greetings! Great to hear of your progress. BTW, I build frequently > under latest wine/mingw packages in Debian, together with > maxima/acl2/axiom, without issue. Had a native windows box too recently > and got things working. > > axiom needs xdr. Latest glibc moves the functions, and my configure fix > was too stringent. How about this: > > --- configure.in 16 Jan 2012 20:08:03 -0000 > 1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.70 > +++ configure.in 17 Jan 2012 17:21:56 -0000 > @@ -66,7 +66,7 @@ > [try_japi=$enableval],[try_japi="no"]) > > AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR], > -[try_xdr=$enableval],[try_xdr="no"]) > +[enable_xdr=$enableval],[enable_xdr="yes"]) > > AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for XGCL], > [enable_xgcl=$enableval],[enable_xgcl="yes"]) > @@ -1046,8 +1046,12 @@ > fi > > > -AC_CHECK_FUNC(xdr_double,, > - AC_CHECK_LIB(tirpc,xdr_double,TLIBS="$TLIBS > -ltirpc",AC_MSG_ERROR([Need xdr_double]))) > +if test "$enable_xdr" = "yes" ; then > + AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR), > + AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS > -ltirpc", > + AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS > -lrpc", > + AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) > TLIBS="$TLIBS -loncrpc")))) > +fi > > AC_MSG_CHECKING(__builtin___clear_cache) > AC_TRY_COMPILE([], > @@ -1373,17 +1377,17 @@ > EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o" > LIBS="${LIBS} -ljapi -lwsock32"] ) > fi > -if test "$use" = "mingw" ; then > - if test "$try_xdr" = "yes" ; then > - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) > - LIBS="${LIBS} -loncrpc"] ) > - fi > -else > - if test "$try_xdr" = "yes" ; then > - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) > - LIBS="${LIBS} -lrpc"] ) > - fi > -fi > +dnl if test "$use" = "mingw" ; then > +dnl if test "$try_xdr" = "yes" ; then > +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) > +dnl LIBS="${LIBS} -loncrpc"] ) > +dnl fi > +dnl else > +dnl if test "$try_xdr" = "yes" ; then > +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) > +dnl LIBS="${LIBS} -lrpc"] ) > +dnl fi > +dnl fi > > # Should really find a way to check for prototypes, but this > # basically works for now. CM > > David Billinghurst writes: > > > A couple of days ago I posted a windows installer for maxima-5.26.0 at > > > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe > > > > See http://www.math.utexas.edu/pipermail/maxima/2012/027451.html > > > > Having set up the build system, I decided to try it on a current > mingw/msys installation. As some of you know, it is a tricky build as gcl on > > windows is touchy. The last version of gcc that could be used to build > gcl was gcc-3.3.1 from August 2003, and you need to have an ancient mingw/ > > msys install. See the INSTALL.win32 file in maxima cvs for the details. > There has been some progress with gcl. One can now build gcl with the > > latest mingw32/msys using gcc-4.6.2 and successfully build a working > maxima. While the build works on 32-bit WinXP, I haven't managed to > reproduce > > it (yet) on a 64-bit Windows 7 machine. > > > > Anyway, I have uploaded a test installer of maxima cvs 2012-01-16 using > gcc-4.6.2 to > > > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe > > > > This is still work in progress, and some documentation is required, but > I'd welcome feedback. > > > > David > > > > _______________________________________________ > > Maxima mailing list > > Maxima at math.utexas.edu > > http://www.math.utexas.edu/mailman/listinfo/maxima > > -- > Camm Maguire camm at maguirefamily.org > ========================================================================== > "The earth is but one country, and mankind its citizens." -- Baha'u'llah > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From caecos at hotmail.ca Thu Jan 19 07:47:35 2012 From: caecos at hotmail.ca (Marc Demers) Date: Thu, 19 Jan 2012 08:47:35 -0500 Subject: [Maxima] No file at SourceForge Message-ID: There is no file to download under the folder 5.26.0 at SourceForge. Regards, Marc -------------- next part -------------- An HTML attachment was scrubbed... URL: From biomates at telefonica.net Thu Jan 19 08:41:54 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 19 Jan 2012 15:41:54 +0100 Subject: [Maxima] draw package, multiple plots with different sizes? In-Reply-To: <4F171FD5.20108@street-artists.org> References: <4F171FD5.20108@street-artists.org> Message-ID: <1326984114.1569.17.camel@pc> El mi?, 18-01-2012 a las 11:39 -0800, dlakelan escribi?: > Using draw, is it possible to do something like put one plot above the > other, with the upper plot being say a square and the lower plot being a > thin rectangle. To explain here is some sort of ascii art showing the > relative aspect ratios I want to achieve. > > ------------- > | | > | | > | | > | | > | | > ------------- > | | > ------------- > > All I see is the option to specify more than one plot, the number of > columns, and the overall size of the plot (the bounding box using > "dimensions"). I want to do this with the pdfcairo terminal. > > Any suggestions, other than to make them separate plots and glue them > together by hand? Hello, There is not any special draw options to declare the internal dimensions of the scenes, but you can make use of user_preamble to add some gnuplot code to maxout.gnuplot. Here is a workaround: draw( dimensions = 100*[21,29.7], terminal = pdfcairo, gr2d( explicit(x^2,x,-1,1), user_preamble=["set size 1.0, 0.75","set origin 0.0, 0.25"]), gr3d( explicit(x^2+y^2,x,-1,1,y,-1,1), user_preamble=["set size 1.0, 0.25","set origin 0.0, 0.0"]))$ With variable 'origin', you tell Gnuplot where to start drawing the scene (lower-left corner). Since you are allocating the scenes by hand, you don't need to use option 'columns'. With variable 'size', you declare the dimensions, in relative units, of a particular scene. For example, with "set size 1.0, 0.75", the 2D scene will use 100% and 75% of the available width and height, respectively. Finally, with the values given to option 'dimensions' you'll get a pdf document of size A4. I hope this fits your needs. -- Mario From alserkli at inbox.ru Thu Jan 19 10:17:00 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Thu, 19 Jan 2012 18:17:00 +0200 Subject: [Maxima] Extending assignment Was: Functions with any number of arguments In-Reply-To: References: Message-ID: On Sun, 15 Jan 2012, Aleksas Domarkas wrote: > How in Maxima define functions with any number of arguments ? > > For example, i need function MIN(arg1,arg2, ...) > MIN(2) => 2 > MIN(3,4) =>3 > MIN(2/3,1/2,sqrt(2)/2) => 1/2 MIN([args]) := block([m:first(args)], for i in rest(args) do m:min(m,i), m); > Other example. How define G with following properties: > G(n) => gamma(n) > G(5) => 24 > G(a, x) => gamma_incomplete (a, x) > G(a, z1, z2) => gamma_incomplete_generalized (a, z1, z2) Use "length(args)" and "if then elseif ..." What I wonder, is whether there is a more efficient way to check that a list has empty tail than evaluate its length: I guess "empty" should be a built-in function: empty(l) := block([simp:false], ?null(?cdr(l))); list_min(l) := block([f:first(l),r:rest(l)], if empty(r) then f else min(f, list_min(r))); MIN([args]) := list_min(args); It would also be nice if "[a,b]:[1]" were not an error but instead assigns false (NIL) to b. This would allow to do [a,b,c]:args; if c then /* 3 args */ elseif b then /* 2 args */ else ... -- Regards, ASK From william.wood3 at comcast.net Thu Jan 19 11:04:15 2012 From: william.wood3 at comcast.net (Bill Wood) Date: Thu, 19 Jan 2012 11:04:15 -0600 Subject: [Maxima] Extending assignment Was: Functions with any number of arguments In-Reply-To: References: Message-ID: <1326992655.9363.4.camel@ubuntu> On Thu, 2012-01-19 at 18:17 +0200, Alexander Klimov wrote: . . . > What I wonder, is whether there is a more efficient way to check that > a list has empty tail than evaluate its length: I guess "empty" should > be a built-in function: > > empty(l) := block([simp:false], ?null(?cdr(l))); > list_min(l) := block([f:first(l),r:rest(l)], > if empty(r) then f else min(f, list_min(r))); > MIN([args]) := list_min(args); Apparently the set predicate "emptyp" works: (%i7) emptyp([]); (%o7) true (%i8) emptyp([1]); (%o8) false (%i9) In my release (a little out of date) it is documented with sets, where it is said to work for either sets or lists. If it is not cross-documented under lists it probably should be. I have no idea of the efficiency of its implementation. -- Bill Wood From macrakis at alum.mit.edu Thu Jan 19 11:13:59 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 19 Jan 2012 12:13:59 -0500 Subject: [Maxima] Extending assignment Was: Functions with any number of arguments In-Reply-To: References: Message-ID: Lisp not needed: if l = [] then ... On Jan 19, 2012 8:17 AM, "Alexander Klimov" wrote: > On Sun, 15 Jan 2012, Aleksas Domarkas wrote: > > How in Maxima define functions with any number of arguments ? > > > > For example, i need function MIN(arg1,arg2, ...) > > MIN(2) => 2 > > MIN(3,4) =>3 > > MIN(2/3,1/2,sqrt(2)/2) => 1/2 > > MIN([args]) := block([m:first(args)], > for i in rest(args) do m:min(m,i), > m); > > > Other example. How define G with following properties: > > G(n) => gamma(n) > > G(5) => 24 > > G(a, x) => gamma_incomplete (a, x) > > G(a, z1, z2) => gamma_incomplete_generalized (a, z1, z2) > > Use "length(args)" and "if then elseif ..." > > > What I wonder, is whether there is a more efficient way to check that > a list has empty tail than evaluate its length: I guess "empty" should > be a built-in function: > > empty(l) := block([simp:false], ?null(?cdr(l))); > list_min(l) := block([f:first(l),r:rest(l)], > if empty(r) then f else min(f, list_min(r))); > MIN([args]) := list_min(args); > > It would also be nice if "[a,b]:[1]" were not an error but instead > assigns false (NIL) to b. This would allow to do > > [a,b,c]:args; > if c then /* 3 args */ > elseif b then /* 2 args */ > else ... > > -- > Regards, > ASK > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From biomates at telefonica.net Thu Jan 19 12:31:33 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Thu, 19 Jan 2012 19:31:33 +0100 Subject: [Maxima] draw package, multiple plots with different sizes? In-Reply-To: <1326984114.1569.17.camel@pc> References: <4F171FD5.20108@street-artists.org> <1326984114.1569.17.camel@pc> Message-ID: <1326997893.1684.18.camel@pc> El jue, 19-01-2012 a las 15:41 +0100, Mario Rodriguez escribi?: > El mi?, 18-01-2012 a las 11:39 -0800, dlakelan escribi?: > > Using draw, is it possible to do something like put one plot above the > > other, with the upper plot being say a square and the lower plot being a > > thin rectangle. To explain here is some sort of ascii art showing the > > relative aspect ratios I want to achieve. > > > > ------------- > > | | > > | | > > | | > > | | > > | | > > ------------- > > | | > > ------------- > > > > All I see is the option to specify more than one plot, the number of > > columns, and the overall size of the plot (the bounding box using > > "dimensions"). I want to do this with the pdfcairo terminal. > > > > Any suggestions, other than to make them separate plots and glue them > > together by hand? > > Hello, > > There is not any special draw options to declare the internal dimensions > of the scenes, but you can make use of user_preamble to add some gnuplot > code to maxout.gnuplot. > > Here is a workaround: > > > draw( > dimensions = 100*[21,29.7], > terminal = pdfcairo, > > gr2d( > explicit(x^2,x,-1,1), > user_preamble=["set size 1.0, 0.75","set origin 0.0, 0.25"]), > > gr3d( > explicit(x^2+y^2,x,-1,1,y,-1,1), > user_preamble=["set size 1.0, 0.25","set origin 0.0, 0.0"]))$ > > > With variable 'origin', you tell Gnuplot where to start drawing the > scene (lower-left corner). Since you are allocating the scenes by hand, > you don't need to use option 'columns'. > > With variable 'size', you declare the dimensions, in relative units, of > a particular scene. For example, with "set size 1.0, 0.75", the 2D scene > will use 100% and 75% of the available width and height, respectively. > > Finally, with the values given to option 'dimensions' you'll get a pdf > document of size A4. > > I hope this fits your needs. > > -- > Mario > Another interesting example: draw( dimensions = [500,500], gr2d( explicit(x^3,x,-1,1), grid = true, user_preamble=["set size 0.5, 0.5","set origin 0.25, 0.25"]), gr2d( explicit(x^2,x,-1,1), user_preamble=["set size 1.0, 1.0","set origin 0.0, 0.0"])) $ -- Mario From dlakelan at street-artists.org Thu Jan 19 13:55:54 2012 From: dlakelan at street-artists.org (dlakelan) Date: Thu, 19 Jan 2012 11:55:54 -0800 Subject: [Maxima] draw package, multiple plots with different sizes? In-Reply-To: <1326997893.1684.18.camel@pc> References: <4F171FD5.20108@street-artists.org> <1326984114.1569.17.camel@pc> <1326997893.1684.18.camel@pc> Message-ID: <4F18754A.20309@street-artists.org> On 01/19/2012 10:31 AM, Mario Rodriguez wrote: > draw( > dimensions = [500,500], > gr2d( > explicit(x3,x,-1,1), > grid = true, > user_preamble=["set size 0.5, 0.5","set origin 0.25, 0.25"]), > gr2d( > explicit(x2,x,-1,1), > user_preamble=["set size 1.0, 1.0","set origin 0.0, 0.0"])) $ > Thank you very much for the helpful examples! If you are considering additional features to add to draw, you might consider a standardized (non preamble based) way to do this. It is often nice to do multi-plots where some plots are more prominent or have different aspect ratios than others, and inset-plots are also quite nice. Thanks for your work on the draw package! From woollett at charter.net Thu Jan 19 14:24:32 2012 From: woollett at charter.net (Edwin Woollett) Date: Thu, 19 Jan 2012 12:24:32 -0800 Subject: [Maxima] Revised Ch. 2, Maxima by Example, Plots, Files, Read, Write, and Fit Message-ID: <3EC92BAB5CAA43C8B74F8DDBE0DE91CF@edwinc367e16bd> A revised version of Maxima by Example, Chap. 2, Plots, Files, Read, Write, and Fit, has been uploaded. The Jan. 19, 2012 updates reflect the necessity of using the complete file path (in ver. 5.26.0) for all of the "file name slots" in the file manipulation functions defined in mfiles.mac. To save typing, one can define (in your maxima-init.mac file) a function mkp (make path) which makes use of a global parameter bpath which is a string which provides the base of the path to your work folder. One can then use mkp("myfile1.txt") instead of "c:/work2/myfile1.txt" as an argument to a file name slot. This is discussed at length in the introduction to the File section of chapter two. Updated files are: --mbe2plotfit.pdf : Jan. 19, 2012, Maxima 5.26.0, 44 pages --mbe2code.txt : Code file: Jan. 19, 2012, Maxima 5.26.0 --mfiles.mac : Maxima code for file work, Jan. 19, 2012, Maxima 5.26.0 Ted Woollett http://www.csulb.edu/~woollett/ From robert.dodier at gmail.com Thu Jan 19 17:38:28 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 19 Jan 2012 16:38:28 -0700 Subject: [Maxima] No file at SourceForge In-Reply-To: References: Message-ID: Thanks for the info. I don't know what's going on there. I can see the file in the upload area via sftp. Does anybody have any ideas? On 1/19/12, Marc Demers wrote: > > There is no file to download under the folder 5.26.0 at SourceForge. > > Regards, > > Marc > From lapeyre.math122a at gmail.com Thu Jan 19 17:51:57 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Fri, 20 Jan 2012 00:51:57 +0100 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: Message-ID: <4F18AC9D.3030409@gmail.com> Trying Barton's suggestion for lexical variables works somewhat. I have no idea what it breaks; it's certainly not a real solution, but it's kind of interesting. 1) copy (defun make-declares .. from transl.lisp to a file and edit the second to last line to read (unless $no_default_special (if specs (pushnew `(special . ,specs) dl :test #'eq))) 2) load the new definition. then put this in tfun.mac : ----------- g(x) := x+y; f(x) := block([y:3], g(x)+y); ---------- (%i1) load("./make-declares.lisp")$ (%i2) no_default_special : false$ (%i3) compile_file("./tfun.mac"); (%i4) f(z); (%o4) z + 6 (%i5) no_default_special : true; (%o5) true (%i6) compile_file("./tfun.mac"); (%i7) f(z); (%o7) z + y + 3 This only seems to work when the code is compiled. --- John Lapeyre From dbmaxima at gmail.com Thu Jan 19 21:37:48 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Fri, 20 Jan 2012 14:37:48 +1100 Subject: [Maxima] maxima for windows with modern gcc/gcl In-Reply-To: <87lip6w8d7.fsf@maguirefamily.org> References: <4F14E754.2070100@gmail.com> <87lip6w8d7.fsf@maguirefamily.org> Message-ID: <4F18E18C.4010108@gmail.com> On 18/01/2012 4:23 AM, Camm Maguire wrote: > Greetings! Great to hear of your progress. BTW, I build frequently > under latest wine/mingw packages in Debian, together with > maxima/acl2/axiom, without issue. Had a native windows box too recently > and got things working. > > axiom needs xdr. Latest glibc moves the functions, and my configure fix > was too stringent. How about this: Thanks. That works for me on windows XP with latest mingw/msys. What XDR package do you use? I have "successfully" built gcl using portablexdr-4.9.1 from http://people.redhat.com/~rjones/portablexdr/. success == gcl configures (with a trivial patch below) and builds. $ cvs diff -u configure.in Index: configure.in =================================================================== RCS file: /sources/gcl/gcl/configure.in,v retrieving revision 1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.72 diff -u -r1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.72 configure.in --- configure.in 18 Jan 2012 14:52:07 -0000 1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.72 +++ configure.in 20 Jan 2012 03:36:48 -0000 @@ -1050,7 +1050,8 @@ AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR), AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -ltirpc", AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -lrpc", - AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -loncrpc")))) + AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -loncrpc", + AC_CHECK_LIB(portablexdr,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS -lportablexdr"))))) fi case $use in I still have problems under windows 7 on both a 32-bit and 64-bit system. The simplest of configure tests fail, so it probably isn't a gcl issue. From robert.dodier at gmail.com Thu Jan 19 21:46:47 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 19 Jan 2012 19:46:47 -0800 Subject: [Maxima] Debian bugs In-Reply-To: <87pqeiw9by.fsf_-_@maguirefamily.org> References: <4F0A2C70.2080600@gmx.de> <4F0C0015.2070209@gmx.de> <1326315301.1548.19.camel@ubuntu> <23737.1326342202@gemini.franz.com> <87pqeiw9by.fsf_-_@maguirefamily.org> Message-ID: On 1/17/12, Camm Maguire wrote: > Greetings! The Debian BTS has a tagging mechanism supporting bug > forwarding, and uses an email address for the forwarding. In the past, > I've forwarded to this list. I imagine the developers would prefer > entries at sourceforge, but then we'd drop the connection in the BTS. I > have a few piled up now, and would like to forward. Suggestions? Hi Camm, it makes sense to me to keep the items in the Debian bug tracker and forward them to the mailing list. Thanks for your help, Robert Dodier From robert.dodier at gmail.com Thu Jan 19 21:49:40 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 19 Jan 2012 19:49:40 -0800 Subject: [Maxima] maxima for windows with modern gcc/gcl In-Reply-To: References: <4F14E754.2070100@gmail.com> <87lip6w8d7.fsf@maguirefamily.org> Message-ID: On 1/19/12, Stefano Ferri wrote: > I think we should update the information given by install.win32, they are > obsolete in some points and now the procedure is easier, at least for the > gcl-related part. If you want to post an updated version of install.win32, or or a patch or whatever, I will be happy to commit it. best Robert Dodier From caecos at hotmail.ca Fri Jan 20 09:14:55 2012 From: caecos at hotmail.ca (Marc Demers) Date: Fri, 20 Jan 2012 10:14:55 -0500 Subject: [Maxima] Still no files! Message-ID: Hi guys, Still no 5.26.0.exe files to download from SourceForge... Regards, Marc -------------- next part -------------- An HTML attachment was scrubbed... URL: From lapeyre.math122a at gmail.com Fri Jan 20 11:13:53 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Fri, 20 Jan 2012 18:13:53 +0100 Subject: [Maxima] invert_by_lu does not work as expected In-Reply-To: References: Message-ID: <4F19A0D1.4040207@gmail.com> I should have said that modifying make-declares works when the code is translated (or compiled). make-declares is only called by tr-lambda. You could: 1) add paramter declare-specials-p to tr-lambda and make-declares and all existing code calls them with flag set to true. 2) Make a copy of mprog (ie $block) called $module.. 3) Make copy of (def%tr mprog ... call (def%tr $module that calls tr-lambda with declare-specials-p set to false. You could do the same with maxima lambda, call it lambda_module or something. 3) I tried copying (defmspec $define ... to $define_trans and changing the call to meval to call translate-and-eval-macsyma-expression. This seemed to work, ie (%i13) define_trans(h(x),x); Translating: h h Then define_trans(f(x),module([y:3], ...)) should define a function f with lexically scoped y. I didn't put all the pieces together. bw wrote: > Maybe would be possible to modify the Maxima to CL > translator to remove most of the special declarations, and > to insert a few lines of code in the read-eval-print loop > that translates all inputs. That might be a quick way to > experiment with MaximaL? Likely, I don't know what I'm > talking about. -- John Lapeyre From toy.raymond at gmail.com Fri Jan 20 12:22:56 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 20 Jan 2012 10:22:56 -0800 Subject: [Maxima] No file at SourceForge In-Reply-To: References: Message-ID: On Thu, Jan 19, 2012 at 3:38 PM, Robert Dodier wrote: > Thanks for the info. I don't know what's going on there. > I can see the file in the upload area via sftp. > Does anybody have any ideas? > > I see a bunch of files at http://sourceforge.net/projects/maxima/files/Maxima-Linux/5.26.0-Linux/. But nothing for windows, though. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Fri Jan 20 13:15:10 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 20 Jan 2012 11:15:10 -0800 Subject: [Maxima] No file at SourceForge In-Reply-To: References: Message-ID: On 1/20/12, Raymond Toy wrote: > I see a bunch of files at > http://sourceforge.net/projects/maxima/files/Maxima-Linux/5.26.0-Linux/. > > But nothing for windows, though. Well, I uploaded a file to /home/frs/project/m/ma/maxima/Maxima-Windows/5.26.0-Windows (path approximate -- working from memory here) and I can see the file in sftp. From what I can tell it is just like the Linux files so it seems like it should be visible. Does someone want to try uploading another file (anything) just to see if there is something peculiar about maxima-5.26.0.exe ? I've run out of ideas at this point. best Robert Dodier From robert.dodier at gmail.com Fri Jan 20 13:20:27 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 20 Jan 2012 11:20:27 -0800 Subject: [Maxima] lsquares fitting and constrains for parameters (looking for positive values of parameters) In-Reply-To: References: <4F1389B0.4040309@gmail.com> Message-ID: On 1/17/12, gwpublic at wp.pl wrote: > So instead of fitting with lsquares_estimate expression like this: > a*x^4 + b*x^3 + d*x + e > I fit expression with all parameters after "abs" : > abs(a)*x^4 + abs(b)*x^3 + abs(d)*x + abs(e) Since abs is not differentiable at 0, that could cause some trouble, because lsquares_estimate eventually calls a function (lbfgs) which works only for differentiable functions. (I don't remember how many continuous derivatives lbfgs requires. I'll guess it's 2 but I'd have to look it up.) Anyway instead of abs(a)*x you could try a^2*x instead. best Robert Dodier From phowep at yahoo.com Sat Jan 21 09:44:50 2012 From: phowep at yahoo.com (phowep at yahoo.com) Date: Sat, 21 Jan 2012 16:44:50 +0100 Subject: [Maxima] Mailing list Message-ID: <50pxjewv3abcoyi99kllqtj3.1327160690250@email.android.com> This is my email address phowep at yahoo.com From adammaj1 at o2.pl Sat Jan 21 14:51:17 2012 From: adammaj1 at o2.pl (Adam Majewski) Date: Sat, 21 Jan 2012 21:51:17 +0100 Subject: [Maxima] string to identifier Message-ID: How can I convert string to identifier ? I would like to make a few list for draw package : list1, list2 ... for Denominator:1 thru DenominatorMax step 1 do ( name:concat("list",string(Denominator)), /* here I should convert string name to identier */ name:Givelist /* my function */ ); TIA Adam From fateman at eecs.berkeley.edu Sat Jan 21 15:01:47 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sat, 21 Jan 2012 13:01:47 -0800 Subject: [Maxima] string to identifier In-Reply-To: References: Message-ID: <4F1B27BB.2070800@eecs.berkeley.edu> On 1/21/2012 12:51 PM, Adam Majewski wrote: > How can I convert string to identifier ? > > I would like to make a few list for draw package : > list1, list2 ... > > for Denominator:1 thru DenominatorMax step 1 do > ( > name:concat("list",string(Denominator)), > /* here I should convert string name to identier */ > name:Givelist /* my function */ > ); > try ?intern(concat("list", 123)); From woollett at charter.net Sat Jan 21 16:12:45 2012 From: woollett at charter.net (Edwin Woollett) Date: Sat, 21 Jan 2012 14:12:45 -0800 Subject: [Maxima] quad_qagp behavior Message-ID: <198A83C19B7F4ACB9E95893B9ABD56EC@edwinc367e16bd> testing the new quadpack utility, quad_qagp, weird result not understood: e = realpart(1/e1) gives correct result e = 1/realpart(e1) gives really bad answer ----------------------------------------------------------------------- Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) ok: (%i1) quad_qagp (realpart (1/sqrt (sin(x))), x, 1, 5, [%pi]); (%o1) [3.209309789377543,6.1241798299249695E-9,294,0] not ok: (%i2) quad_qagp (1/realpart (sqrt (sin(x))), x, 1, 5, [%pi]); (%o2) [4.7552920825719432E+16,7.0149712E+7,294,0] (%i3) realpart(1/sqrt(sin(x))); (%o3) cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) (%i4) 1/realpart(sqrt(sin(x))); (%o4) 1/(cos(atan2(0,sin(x))/2)*sqrt(abs(sin(x)))) compare the two resulting expressions numerically: (%i5) r1(x):= realpart(1/sqrt(sin(x)))$ (%i6) r2(x) := 1/realpart(sqrt(sin(x)))$ (%i7) for y in [1,2,3] do print(y,r1(y),r2(y))$ 1 1/sqrt(sin(1)) 1/sqrt(sin(1)) 2 1/sqrt(sin(2)) 1/sqrt(sin(2)) 3 1/sqrt(sin(3)) 1/sqrt(sin(3)) (%i8) for y in [1,2,3] do print(y,float(r1(y)),float(r2(y)))$ 1 1.090135361218102 1.090135361218102 2 1.048689739767972 1.048689739767972 3 2.661985611481998 2.661985611481998 ------------------------------------------- Ted Woollett From adammaj1 at o2.pl Sat Jan 21 16:35:47 2012 From: adammaj1 at o2.pl (Adam Majewski) Date: Sat, 21 Jan 2012 23:35:47 +0100 Subject: [Maxima] string to identifier In-Reply-To: <4F1B27BB.2070800@eecs.berkeley.edu> References: <4F1B27BB.2070800@eecs.berkeley.edu> Message-ID: On 21.01.2012 22:01, Richard Fateman wrote: > ?intern(concat("list", 123));\ Thanks for the answer. It gives a symbol : (%i7) ?intern(concat("list", 123)); (%o7) LIST123 but I can't use it as a name : (%i6) ?intern(concat("list", 123)):32; assignment: cannot assign to intern(concat("list",123)) -- an error. To debug this try: debugmode(true); Adam From fateman at eecs.berkeley.edu Sat Jan 21 17:07:28 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sat, 21 Jan 2012 15:07:28 -0800 Subject: [Maxima] string to identifier In-Reply-To: References: <4F1B27BB.2070800@eecs.berkeley.edu> Message-ID: <4F1B4530.50402@eecs.berkeley.edu> Try ?intern(concat("list",123)) :: 32 which assigns 32 to a symbol that you can type in to Maxima as ?LIST123. There is a peculiarity of switching upper and lower case for convoluted reasons. Note that is "::" not ":" RJF From adammaj1 at o2.pl Sat Jan 21 18:08:11 2012 From: adammaj1 at o2.pl (Adam Majewski) Date: Sun, 22 Jan 2012 01:08:11 +0100 Subject: [Maxima] string to identifier In-Reply-To: <4F1B4530.50402@eecs.berkeley.edu> References: <4F1B27BB.2070800@eecs.berkeley.edu> <4F1B4530.50402@eecs.berkeley.edu> Message-ID: On 22.01.2012 00:07, Richard Fateman wrote: > > > Try > ?intern(concat("list",123)) :: 32 > > which assigns 32 to a symbol that you can type in to Maxima as ?LIST123. > > > There is a peculiarity of switching upper and lower case for > convoluted reasons. > > Note that is "::" not ":" > > RJF It works now. Thanks. Below is code in which I have used it in main and draw sections. It draws 5 images on the screen. Adam ============== kill(all); /* ---------- functions ---------------------- */ /* conformal map from circle to cardioid ( boundary of period 1 component of Mandelbrot set */ F(w):=w/2-w*w/4; /* circle D={w:abs(w)=1 } where w=l(t,r) t is angle in turns ; 1 turn = 360 degree = 2*Pi radians r is a radius */ ToCircle(t,r):=r*%e^(%i*t*2*%pi); /* http://en.wikipedia.org/wiki/Complex_quadratic_polynomial */ f(z,c):=z*z+c $ GiveCriticalOrbit(c,iMax):= /* computes (without escape test) critical orbit (forward orbit of critical point ) and saves it to the list for draw package */ block( [z,orbit,temp], z:0, /* first point = critical point z:0+0*%i */ orbit:[[realpart(z),imagpart(z)]], for i:1 thru iMax step 1 do ( z:expand(f(z,c)), orbit:endcons([realpart(z),imagpart(z)],orbit)), return(orbit) )$ /* find fixed point alfa , returns a list */ GiveFixed(c):= ( [z], z:float(rectform((1-sqrt(1-4*c))/2)), [[realpart(z),imagpart(z)]] )$ GiveC(angle,radius):= ( [w], /* point of unit circle w:l(internalAngle,internalRadius); */ w:ToCircle(angle,radius), /* point of circle */ float(rectform(F(w))) /* point on boundary of period 1 component of Mandelbrot set */ )$ compile(all)$ /* ---------- constant ---------------------------*/ Numerator :1; DenominatorMax :5; InternalRadius:1; iMax:500; /* -------------- main ----------------- */ for Denominator:1 thru DenominatorMax step 1 do ( InternalAngle: Numerator/Denominator, c: GiveC(InternalAngle,InternalRadius), /* */ ?intern(concat("z",string(Denominator)))::GiveFixed(c), /* */ ?intern(concat("orbit",string(Denominator)))::GiveCriticalOrbit(c,iMax) ); /*------------------draw -------------------------------------*/ load(draw); /* ( interface to gnuplot ) by Mario Rodriguez Riotorto http://www.telefonica.net/web2/biomates */ draw( terminal = screen, columns =5, gr2d( title= "1/1 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* */ color =red, key = "critical orbit", points(?ORBIT1), /* */ color =black, point_size = 1.4, key = "parabolic fixed point", points(?Z1), /* */ color =blue, key = "criitical point", points([0],[0]) ), gr2d( title= " 1/2 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* */ color =red, key = "critical orbit", points(?ORBIT2), /* */ color =black, point_size = 1.4, key = "parabolic fixed point", points(?Z2), /* */ color =blue, key = "criitical point", points([0],[0]) ), gr2d( title= " 1/3 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* */ color =red, key = "critical orbit", points(?ORBIT3), /* */ color =black, point_size = 1.4, key = "parabolic fixed point", points(?Z3), /* */ color =blue, key = "criitical point", points([0],[0]) ), gr2d( title= " 1/4 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* */ color =red, key = "critical orbit", points(?ORBIT4), /* */ color =black, point_size = 1.4, key = "parabolic fixed point", points(?Z4), /* */ color =blue, key = "criitical point", points([0],[0]) ), gr2d( title= " 1/5 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* */ color =red, key = "critical orbit", points(?ORBIT5), /* */ color =black, point_size = 1.4, key = "parabolic fixed point", points(?Z5), /* */ color =blue, key = "criitical point", points([0],[0]) ) ); From l.couraud at gmail.com Sat Jan 21 18:39:50 2012 From: l.couraud at gmail.com (laurent couraud) Date: Sun, 22 Jan 2012 01:39:50 +0100 Subject: [Maxima] RE : string to identifier In-Reply-To: Message-ID: <4D0C218C381046D9A51EAB30B6AA95BA@PASSERELLE> You can also use eval_string from the package stringproc. Laurent. > -----Message d'origine----- > De?: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] De la part de > Adam Majewski > Envoy??: dimanche 22 janvier 2012 01:08 > ??: maxima at math.utexas.edu > Objet?: Re: [Maxima] string to identifier > > On 22.01.2012 00:07, Richard Fateman wrote: > > > > > > Try > > ?intern(concat("list",123)) :: 32 > > > > which assigns 32 to a symbol that you can type in to Maxima as ?LIST123. > > > > > > There is a peculiarity of switching upper and lower case for > > convoluted reasons. > > > > Note that is "::" not ":" > > > > RJF > It works now. Thanks. > > Below is code in which I have used it in main and draw sections. > It draws 5 images on the screen. > > > Adam > > ============== > kill(all); > > > > /* ---------- functions ---------------------- */ > > /* conformal map from circle to cardioid ( boundary > of period 1 component of Mandelbrot set */ > F(w):=w/2-w*w/4; > > > /* > circle D={w:abs(w)=1 } where w=l(t,r) > t is angle in turns ; 1 turn = 360 degree = 2*Pi radians > r is a radius > */ > ToCircle(t,r):=r*%e^(%i*t*2*%pi); > > > > > /* > > http://en.wikipedia.org/wiki/Complex_quadratic_polynomial > */ > f(z,c):=z*z+c $ > > GiveCriticalOrbit(c,iMax):= > /* > computes (without escape test) > critical orbit (forward orbit of critical point ) > and saves it to the list for draw package */ > block( > [z,orbit,temp], > z:0, /* first point = critical point z:0+0*%i */ > orbit:[[realpart(z),imagpart(z)]], > for i:1 thru iMax step 1 do > ( z:expand(f(z,c)), > orbit:endcons([realpart(z),imagpart(z)],orbit)), > > return(orbit) > )$ > > > /* find fixed point alfa , returns a list */ > GiveFixed(c):= > ( > [z], > z:float(rectform((1-sqrt(1-4*c))/2)), > [[realpart(z),imagpart(z)]] > )$ > > > > GiveC(angle,radius):= > ( > [w], > /* point of unit circle w:l(internalAngle,internalRadius); */ > w:ToCircle(angle,radius), /* point of circle */ > float(rectform(F(w))) /* point on boundary of period 1 component of > Mandelbrot set */ > )$ > > > > compile(all)$ > > > > /* ---------- constant ---------------------------*/ > Numerator :1; > DenominatorMax :5; > InternalRadius:1; > iMax:500; > > > /* -------------- main ----------------- */ > > > > for Denominator:1 thru DenominatorMax step 1 do > ( > InternalAngle: Numerator/Denominator, > c: GiveC(InternalAngle,InternalRadius), > /* */ > ?intern(concat("z",string(Denominator)))::GiveFixed(c), > /* */ > ?intern(concat("orbit",string(Denominator)))::GiveCriticalOrbit(c,iMax) > ); > > > > > /*------------------draw -------------------------------------*/ > load(draw); /* ( interface to gnuplot ) by Mario Rodriguez Riotorto > http://www.telefonica.net/web2/biomates */ > > draw( > > terminal = screen, > columns =5, > gr2d( > title= "1/1 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics > ;set noytics;", > > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* */ > color =red, > key = "critical orbit", > points(?ORBIT1), > /* */ > color =black, > point_size = 1.4, > key = "parabolic fixed point", > points(?Z1), > /* */ > color =blue, > key = "criitical point", > points([0],[0]) > ), > > gr2d( > title= " 1/2 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics > ;set noytics;", > > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* */ > color =red, > key = "critical orbit", > points(?ORBIT2), > /* */ > color =black, > point_size = 1.4, > key = "parabolic fixed point", > points(?Z2), > /* */ > color =blue, > key = "criitical point", > points([0],[0]) > ), > > gr2d( > title= " 1/3 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics > ;set noytics;;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* */ > color =red, > key = "critical orbit", > points(?ORBIT3), > /* */ > color =black, > point_size = 1.4, > key = "parabolic fixed point", > points(?Z3), > /* */ > color =blue, > key = "criitical point", > points([0],[0]) > ), > > gr2d( > title= " 1/4 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics > ;set noytics;;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* */ > color =red, > key = "critical orbit", > points(?ORBIT4), > /* */ > color =black, > point_size = 1.4, > key = "parabolic fixed point", > points(?Z4), > /* */ > color =blue, > key = "criitical point", > points([0],[0]) > ), > gr2d( > title= " 1/5 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics > ;set noytics;;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* */ > color =red, > key = "critical orbit", > points(?ORBIT5), > /* */ > color =black, > point_size = 1.4, > key = "parabolic fixed point", > points(?Z5), > /* */ > color =blue, > key = "criitical point", > points([0],[0]) > ) > > > > ); > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From toy.raymond at gmail.com Sat Jan 21 22:11:34 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sat, 21 Jan 2012 20:11:34 -0800 Subject: [Maxima] quad_qagp behavior In-Reply-To: <198A83C19B7F4ACB9E95893B9ABD56EC@edwinc367e16bd> References: <198A83C19B7F4ACB9E95893B9ABD56EC@edwinc367e16bd> Message-ID: On 1/21/12 2:12 PM, Edwin Woollett wrote: > > testing the new quadpack utility, quad_qagp, weird result not understood: > > e = realpart(1/e1) gives correct result > > e = 1/realpart(e1) gives really bad answer > ----------------------------------------------------------------------- > Maxima 5.26.0 http://maxima.sourceforge.net > using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) > > ok: > (%i1) quad_qagp (realpart (1/sqrt (sin(x))), x, 1, 5, [%pi]); > > (%o1) [3.209309789377543,6.1241798299249695E-9,294,0] > > not ok: > (%i2) quad_qagp (1/realpart (sqrt (sin(x))), x, 1, 5, [%pi]); > > (%o2) [4.7552920825719432E+16,7.0149712E+7,294,0] > > > (%i3) realpart(1/sqrt(sin(x))); > > (%o3) cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) > > (%i4) 1/realpart(sqrt(sin(x))); > > (%o4) 1/(cos(atan2(0,sin(x))/2)*sqrt(abs(sin(x)))) > > compare the two resulting expressions numerically: > > (%i5) r1(x):= realpart(1/sqrt(sin(x)))$ > > (%i6) r2(x) := 1/realpart(sqrt(sin(x)))$ > > (%i7) for y in [1,2,3] do > print(y,r1(y),r2(y))$ > > 1 1/sqrt(sin(1)) 1/sqrt(sin(1)) 2 1/sqrt(sin(2)) 1/sqrt(sin(2)) 3 > 1/sqrt(sin(3)) 1/sqrt(sin(3)) You didn't take enough samples. I plotted r1(x) - r2(x) for x from %pi to 5. and the plot is not zero. It is zero for x from 1 to %pi. So I guess realpart is buggy in this case, although ratsimp(r1(x)-r2(x)) is zero. Ray From adammaj1 at o2.pl Sun Jan 22 03:14:37 2012 From: adammaj1 at o2.pl (Adam Majewski) Date: Sun, 22 Jan 2012 10:14:37 +0100 Subject: [Maxima] RE : string to identifier In-Reply-To: <4D0C218C381046D9A51EAB30B6AA95BA@PASSERELLE> References: <4D0C218C381046D9A51EAB30B6AA95BA@PASSERELLE> Message-ID: On 22.01.2012 01:39, laurent couraud wrote: > You can also use eval_string from the package stringproc. > > Laurent. Thx. It : * removes upper/lower case switching * removes one language from code ( older code have used 3 languages : Maxima, Lisp and gnuplot. New code uses 2 languages : Maxima and gnuplot. ) Below is new code. I think about making scene ( scene1, scene2 ....) in similar way to make code shorter ( I hope not obfuscated) and then use : draw(scene1, scene2) Old code and image is here : http://commons.wikimedia.org/wiki/File:Parabolic_critical_orbits.png more description : http://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/parabolic Please look also at : Category:Images with Maxima CAS source code http://commons.wikimedia.org/wiki/Category:Images_with_Maxima_CAS_source_code Category:Created with Maxima (software) http://commons.wikimedia.org/wiki/Category:Created_with_Maxima_%28software%29 Thx Adam ============== newest code ============== kill(all); /* ---------- functions ---------------------- */ /* conformal map from circle to cardioid ( boundary of period 1 component of Mandelbrot set */ F(w):=w/2-w*w/4; /* circle D={w:abs(w)=1 } where w=ToCircle(t,r) t is angle in turns ; 1 turn = 360 degree = 2*Pi radians r is a radius */ ToCircle(t,r):=r*%e^(%i*t*2*%pi); /* http://en.wikipedia.org/wiki/Complex_quadratic_polynomial */ f(z,c):=z*z+c $ GiveCriticalOrbit(c,iMax):= /* computes (without escape test) critical orbit (forward orbit of critical point ) and saves it to the list for draw package */ block( [z,orbit,temp], z:0, /* first point = critical point z:0+0*%i */ orbit:[[realpart(z),imagpart(z)]], for i:1 thru iMax step 1 do ( z:expand(f(z,c)), orbit:endcons([realpart(z),imagpart(z)],orbit)), return(orbit) )$ /* find fixed point alfa , returns a list */ GiveFixed(c):= ( [z], z:float(rectform((1-sqrt(1-4*c))/2)), [[realpart(z),imagpart(z)]] )$ GiveC(angle,radius):= ( [w], /* point of unit circle w:l(internalAngle,internalRadius); */ w:ToCircle(angle,radius), /* point of circle */ float(rectform(F(w))) /* point on boundary of period 1 component of Mandelbrot set */ )$ compile(all)$ /* ---------- constant ---------------------------*/ Numerator :1; DenominatorMax :10; InternalRadius:1; iMax:500; /* -------------- main ----------------- */ for Denominator:1 thru DenominatorMax step 1 do ( InternalAngle: Numerator/Denominator, c: GiveC(InternalAngle,InternalRadius), /* */ eval_string(concat("z",string(Denominator)))::GiveFixed(c), /* */ eval_string(concat("orbit",string(Denominator)))::GiveCriticalOrbit(c,iMax) ); /*-----------------------------------------------------------------------*/ load(draw); /* ( interface to gnuplot ) by Mario Rodriguez Riotorto http://www.telefonica.net/web2/biomates */ draw( terminal = screen, columns =5, file_name = "b", pic_width = 1000, /* Since Maxima 5.23, pic_width and pic_height are deprecated. */ pic_height = 500, /* See option dimensions. To get the same effect, write dimensions=[800,600] */ gr2d( title= "1/1 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit1), /* parabolic fixed point */ color =black, point_size = 1.4, points(z1), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/2 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* criitical orbit */ color =red, points(orbit2), /* parabolic fixed point */ color =black, point_size = 1.4, points(z2), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/3 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit3), /* parabolic fixed point */ color =black, point_size = 1.4, points(z3), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/4 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit4), /* parabolic fixed point */ color =black, point_size = 1.4, points(z4), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/5 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit5), /* parabolic fixed point */ color =black, point_size = 1.4, points(z5), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= "1/6 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit6), /* parabolic fixed point */ color =black, point_size = 1.4, points(z6), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/7 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* criitical orbit */ color =red, points(orbit7), /* parabolic fixed point */ color =black, point_size = 1.4, points(z7), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/8 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit8), /* parabolic fixed point */ color =black, point_size = 1.4, points(z8), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/9 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit9), /* parabolic fixed point */ color =black, point_size = 1.4, points(z9), /* criitical point */ color =blue, points([0],[0]) ), gr2d( title= " 1/10 ", user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbit10), /* parabolic fixed point */ color =black, point_size = 1.4, points(z10), /* criitical point */ color =blue, points([0],[0]) ) ); From korte at lite.msu.edu Sun Jan 22 07:59:45 2012 From: korte at lite.msu.edu (Gerd Kortemeyer) Date: Sun, 22 Jan 2012 08:59:45 -0500 Subject: [Maxima] Declarations Message-ID: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> Hi, We have been using MAXIMA successfully inside of LON-CAPA for homework problems for several years now - it's a great tool, thanks everybody!!! While authoring a new kind of homework, I am struggling with "declare" - why does the following (sample) code not give the expected results? (%i4) declare(x,real); (%o4) done (%i5) solve(x^3=125,x); 5 sqrt(3) %i - 5 5 sqrt(3) %i + 5 (%o5) [x = ----------------, x = - ----------------, x = 5] 2 2 (%i6) facts(); (%o6) [kind(x, real)] Is there another way to tell "solve" to stay in the real realm? Thanks! - Gerd. From alserkli at inbox.ru Sun Jan 22 08:08:28 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Sun, 22 Jan 2012 16:08:28 +0200 Subject: [Maxima] [patch] 3D curve parametric plot Message-ID: Hi. It used to be possible to do 3D parametric curve plots with plot3d([sin(t), cos(t), t], [t,-5,5], [y,-5,5], [grid,100,2], [gnuplot_pm3d,false])$ but in the current version it gives plot3d: wrong number of variables: [t]. There should be two The problem can be fixed with the attached patch. It would be nice if it were committed to the mainline. It is also a good idea to document the grid trick in plot3d documentation. -- Regards, ASK -------------- next part -------------- From 2a7852b79c0185a8e4df325b68dd22548667e599 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Sun, 22 Jan 2012 15:49:23 +0200 Subject: [PATCH] Allow 3D parametric plots --- src/plot.lisp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plot.lisp b/src/plot.lisp index e275758..6219bee 100644 --- a/src/plot.lisp +++ b/src/plot.lisp @@ -1901,7 +1901,7 @@ Several functions depending on the two variables v1 and v2: (coerce-float-fun (fourth exprn) lvars) (second lvars) (third lvars)))) (setq lvars ($listofvars `((mlist) ,vars1 ,vars2 ,vars3))) - (if (= 2 ($length lvars)) + (if (<= ($length lvars) 2) ;; we do have a valid parametric set. Push it into ;; the functions stack, along with their domain (progn @@ -1915,7 +1915,7 @@ Several functions depending on the two variables v1 and v2: (setf (getf features :const-expr) ($float (meval (fourth exprn)))))) (merror - (intl:gettext "plot3d: there must be two variables; found: ~M") + (intl:gettext "plot3d: there must be at most two variables; found: ~M") lvars)))) (3 -- 1.7.2.5 From fateman at eecs.berkeley.edu Sun Jan 22 09:22:09 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 22 Jan 2012 07:22:09 -0800 Subject: [Maxima] Declarations In-Reply-To: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> References: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> Message-ID: <4F1C29A1.7070400@eecs.berkeley.edu> Solve generally ignores declarations, except insofar as it might call some other program like simplification, that uses them. You will have to filter out the real solutions some other way. Designing another version of solve that considers assumptions and declaration might be worthwhile. RJF On 1/22/2012 5:59 AM, Gerd Kortemeyer wrote: > Hi, > > We have been using MAXIMA successfully inside of LON-CAPA for homework problems for several years now - it's a great tool, thanks everybody!!! > > While authoring a new kind of homework, I am struggling with "declare" - why does the following (sample) code not give the expected results? > > (%i4) declare(x,real); > (%o4) done > (%i5) solve(x^3=125,x); > 5 sqrt(3) %i - 5 5 sqrt(3) %i + 5 > (%o5) [x = ----------------, x = - ----------------, x = 5] > 2 2 > (%i6) facts(); > (%o6) [kind(x, real)] > > Is there another way to tell "solve" to stay in the real realm? > > Thanks! > > - Gerd. > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From hbaker1 at pipeline.com Sun Jan 22 09:59:15 2012 From: hbaker1 at pipeline.com (Henry Baker) Date: Sun, 22 Jan 2012 07:59:15 -0800 Subject: [Maxima] Declarations In-Reply-To: <4F1C29A1.7070400@eecs.berkeley.edu> References: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> <4F1C29A1.7070400@eecs.berkeley.edu> Message-ID: In the case of quadratics, cubics & quartics, it may be impossible to determine without additional information about the actual values of variables which of the solutions is real and which are not. I still think that this is a worthwhile goal, but it would require a substantial amount of work to produce what Gerd wants. At 07:22 AM 1/22/2012, Richard Fateman wrote: >Solve generally ignores declarations, except insofar as it might call some other program like simplification, that uses them. > >You will have to filter out the real solutions some other way. > >Designing another version of solve that considers assumptions and declaration might be worthwhile. > >RJF > >On 1/22/2012 5:59 AM, Gerd Kortemeyer wrote: >>Hi, >> >>We have been using MAXIMA successfully inside of LON-CAPA for homework problems for several years now - it's a great tool, thanks everybody!!! >> >>While authoring a new kind of homework, I am struggling with "declare" - why does the following (sample) code not give the expected results? >> >>(%i4) declare(x,real); >>(%o4) done >>(%i5) solve(x^3=125,x); >> 5 sqrt(3) %i - 5 5 sqrt(3) %i + 5 >>(%o5) [x = ----------------, x = - ----------------, x = 5] >> 2 2 >>(%i6) facts(); >>(%o6) [kind(x, real)] >> >>Is there another way to tell "solve" to stay in the real realm? >> >>Thanks! >> >>- Gerd. From caecos at hotmail.ca Sun Jan 22 10:29:33 2012 From: caecos at hotmail.ca (Marc Demers) Date: Sun, 22 Jan 2012 11:29:33 -0500 Subject: [Maxima] Windows binary? Message-ID: Hi, Is there a possibility to download the Windows binary 5.26.0.exe soon? Regards, Marc -------------- next part -------------- An HTML attachment was scrubbed... URL: From coolens at kahosl.be Sun Jan 22 10:58:06 2012 From: coolens at kahosl.be (Hugo Coolens) Date: Sun, 22 Jan 2012 17:58:06 +0100 Subject: [Maxima] problem plotting function In-Reply-To: References: Message-ID: I'm facing a problem when plotting the soluation of the following differential equation: q1:2*6/6.6e-3; tau=33e-6; eq:'diff(y,x)+y/tau=q1; ode2(eq,y,x); sol:ic1(%,x=0,y=-60e-3); plot2d(rhs(sol),[x,0,3.3e-3],[y,-100e-3,100e-3]); plot2d: expression evaluates to non-numeric value somewhere in plotting range. I also noticed that using u_O in stead of y gives trouble with the plot2d command, is it possible to use another variable name? thanks in advance hugo From toy.raymond at gmail.com Sun Jan 22 11:20:51 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 22 Jan 2012 09:20:51 -0800 Subject: [Maxima] problem plotting function In-Reply-To: References: Message-ID: On 1/22/12 8:58 AM, Hugo Coolens wrote: > I'm facing a problem when plotting the soluation of the following > differential equation: > q1:2*6/6.6e-3; > tau=33e-6; Perhaps you meant to say tau:33e-6? > eq:'diff(y,x)+y/tau=q1; > ode2(eq,y,x); > sol:ic1(%,x=0,y=-60e-3); > plot2d(rhs(sol),[x,0,3.3e-3],[y,-100e-3,100e-3]); > plot2d: expression evaluates to non-numeric value somewhere in plotting Not surprising because rhs(sol) is an expression containing a symbolic tau. That's kind of hard to plot. Ray From coolens at kahosl.be Sun Jan 22 11:38:06 2012 From: coolens at kahosl.be (Hugo Coolens) Date: Sun, 22 Jan 2012 18:38:06 +0100 Subject: [Maxima] problem plotting function In-Reply-To: References: Message-ID: Of course, you are right Raymond, I overlooked the equation-sign sorry hugo On Sun, 22 Jan 2012, Raymond Toy wrote: > On 1/22/12 8:58 AM, Hugo Coolens wrote: >> I'm facing a problem when plotting the soluation of the following >> differential equation: >> q1:2*6/6.6e-3; >> tau=33e-6; > Perhaps you meant to say tau:33e-6? > >> eq:'diff(y,x)+y/tau=q1; >> ode2(eq,y,x); >> sol:ic1(%,x=0,y=-60e-3); >> plot2d(rhs(sol),[x,0,3.3e-3],[y,-100e-3,100e-3]); >> plot2d: expression evaluates to non-numeric value somewhere in plotting > > Not surprising because rhs(sol) is an expression containing a symbolic > tau. That's kind of hard to plot. > > Ray > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From dwiniecki at boisestate.edu Thu Jan 19 11:28:08 2012 From: dwiniecki at boisestate.edu (Donald Winiecki) Date: Thu, 19 Jan 2012 10:28:08 -0700 Subject: [Maxima] [A/V WARNING: MESSAGE UNSCANNABLE] Re: [Gcl-devel] maxima for windows with modern gcc/gcl In-Reply-To: References: <4F14E754.2070100@gmail.com> <87lip6w8d7.fsf@maguirefamily.org> Message-ID: Stefano (or anyone!), The attached 7zip file contains documentation and other files to guide the creation of a Win32 installer for GCL. The scripts work in `Inno Setup', available from http://www.jrsoftware.org/isinfo.php Let me know if you run into any bumps. Best, _don On Thu, Jan 19, 2012 at 2:13 AM, Stefano Ferri wrote: > Thanks David and Camm. I've succesfully built gcl with the latest > Mingw/Msys without pain. A simple checkout and a configure worked fine. > Yes, I've noticed too that the option to disable xdr was broken, I didn't > mention this fact in my previous email. > Now I will try to finish the build process and the creation of the > installer (just to learn how to do it). > > I think we should update the information given by install.win32, they are > obsolete in some points and now the procedure is easier, at least for the > gcl-related part. > > Stefano > > > > > 2012/1/17 Camm Maguire > >> Greetings! Great to hear of your progress. BTW, I build frequently >> under latest wine/mingw packages in Debian, together with >> maxima/acl2/axiom, without issue. Had a native windows box too recently >> and got things working. >> >> axiom needs xdr. Latest glibc moves the functions, and my configure fix >> was too stringent. How about this: >> >> --- configure.in 16 Jan 2012 20:08:03 -0000 >> 1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.70 >> +++ configure.in 17 Jan 2012 17:21:56 -0000 >> @@ -66,7 +66,7 @@ >> [try_japi=$enableval],[try_japi="no"]) >> >> AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR], >> -[try_xdr=$enableval],[try_xdr="no"]) >> +[enable_xdr=$enableval],[enable_xdr="yes"]) >> >> AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for XGCL], >> [enable_xgcl=$enableval],[enable_xgcl="yes"]) >> @@ -1046,8 +1046,12 @@ >> fi >> >> >> -AC_CHECK_FUNC(xdr_double,, >> - AC_CHECK_LIB(tirpc,xdr_double,TLIBS="$TLIBS >> -ltirpc",AC_MSG_ERROR([Need xdr_double]))) >> +if test "$enable_xdr" = "yes" ; then >> + AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR), >> + AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR) >> TLIBS="$TLIBS -ltirpc", >> + AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS >> -lrpc", >> + AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) >> TLIBS="$TLIBS -loncrpc")))) >> +fi >> >> AC_MSG_CHECKING(__builtin___clear_cache) >> AC_TRY_COMPILE([], >> @@ -1373,17 +1377,17 @@ >> EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o" >> LIBS="${LIBS} -ljapi -lwsock32"] ) >> fi >> -if test "$use" = "mingw" ; then >> - if test "$try_xdr" = "yes" ; then >> - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >> - LIBS="${LIBS} -loncrpc"] ) >> - fi >> -else >> - if test "$try_xdr" = "yes" ; then >> - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >> - LIBS="${LIBS} -lrpc"] ) >> - fi >> -fi >> +dnl if test "$use" = "mingw" ; then >> +dnl if test "$try_xdr" = "yes" ; then >> +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >> +dnl LIBS="${LIBS} -loncrpc"] ) >> +dnl fi >> +dnl else >> +dnl if test "$try_xdr" = "yes" ; then >> +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >> +dnl LIBS="${LIBS} -lrpc"] ) >> +dnl fi >> +dnl fi >> >> # Should really find a way to check for prototypes, but this >> # basically works for now. CM >> >> David Billinghurst writes: >> >> > A couple of days ago I posted a windows installer for maxima-5.26.0 at >> > >> > http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe >> > >> > See http://www.math.utexas.edu/pipermail/maxima/2012/027451.html >> > >> > Having set up the build system, I decided to try it on a current >> mingw/msys installation. As some of you know, it is a tricky build as gcl on >> > windows is touchy. The last version of gcc that could be used to build >> gcl was gcc-3.3.1 from August 2003, and you need to have an ancient mingw/ >> > msys install. See the INSTALL.win32 file in maxima cvs for the >> details. There has been some progress with gcl. One can now build gcl >> with the >> > latest mingw32/msys using gcc-4.6.2 and successfully build a working >> maxima. While the build works on 32-bit WinXP, I haven't managed to >> reproduce >> > it (yet) on a 64-bit Windows 7 machine. >> > >> > Anyway, I have uploaded a test installer of maxima cvs 2012-01-16 using >> gcc-4.6.2 to >> > >> > http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe >> > >> > This is still work in progress, and some documentation is required, but >> I'd welcome feedback. >> > >> > David >> > >> > _______________________________________________ >> > Maxima mailing list >> > Maxima at math.utexas.edu >> > http://www.math.utexas.edu/mailman/listinfo/maxima >> >> -- >> Camm Maguire >> camm at maguirefamily.org >> ========================================================================== >> "The earth is but one country, and mankind its citizens." -- Baha'u'llah >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> > > > _______________________________________________ > Gcl-devel mailing list > Gcl-devel at gnu.org > https://lists.gnu.org/mailman/listinfo/gcl-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Building Win32 installer.7z Type: application/octet-stream Size: 3439322 bytes Desc: not available URL: From zaleksf at umich.edu Sat Jan 21 03:54:04 2012 From: zaleksf at umich.edu (Steve Zalek) Date: Sat, 21 Jan 2012 09:54:04 +0000 (UTC) Subject: [Maxima] No file at SourceForge References: Message-ID: Robert Dodier gmail.com> writes: > Well, I uploaded a file to > /home/frs/project/m/ma/maxima/Maxima-Windows/5.26.0-Windows > (path approximate -- working from memory here) > and I can see the file in sftp. From what I can tell it is just > like the Linux files so it seems like it should be visible. > > Does someone want to try uploading another file (anything) > just to see if there is something peculiar about maxima-5.26.0.exe ? > I've run out of ideas at this point. > > best > > Robert Dodier > Yep - still no files in the 5.26.0-Windows folder when viewed through a web browser. The folder indicates that there is a single item in it with a size of 30.4MB, but no file is visible. Thanks. From korte at lite.msu.edu Sun Jan 22 13:22:08 2012 From: korte at lite.msu.edu (Gerd Kortemeyer) Date: Sun, 22 Jan 2012 14:22:08 -0500 Subject: [Maxima] Declarations - how to compare two equations? In-Reply-To: References: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> <4F1C29A1.7070400@eecs.berkeley.edu> Message-ID: Hi, Thanks for the very quick replies! On Jan 22, 2012, at 10:59 AM, Henry Baker wrote: > > I still think that this is a worthwhile goal, but it would require a substantial amount of work to produce what Gerd wants. > > At 07:22 AM 1/22/2012, Richard Fateman wrote: >> Solve generally ignores declarations, except insofar as it might call some other program like simplification, that uses them. >> >> You will have to filter out the real solutions some other way. Please excuse my ignorance of advanced MAXIMA syntax. Here's what I really need to achieve: see if an equation that a student inputs is equivalent to an equation given by the instructor. Here's a snippet of internal LON-CAPA code; LON-CAPA is mostly written in Perl, the &cas()-subroutine passes expressions to MAXIMA for evaluation. sub compareequations { my ($var,$value,$equation)=@_; # var is the variable given # value is the expected value of $var, $var=$value # equation is the equation to be tested $expressiona='trigsimp(trigreduce(['.$var.'='.$value.']))'; $expressionb='trigsimp(trigreduce(solve('.$equation.','.$var.')))'; $reply=&cas('maxima','is(equal('.$expressiona.','.$expressionb.'))'); if ($reply=~/^Error\:/) { return $reply; } if ($reply=~/true/) { return 'true'; } return 'false'; } So, my current algorithm is: * instructor gives a single variable on the lefthand side and the expected righthand side (e.g., "x" and "2*y+b" for "x=2*y+b") * the student answer (e.g., "y=(x-b)/2") is solved for that variable (in this example, "x"), simplified, and compared to the simplified instructor answer The above problem occurs in a (minimal) example when the instructor answer is x=5, and the student inputs x^3=125 - in the real realm, that would be awkward but correct. Is there any better way to compare two equations (that LON-CAPA does not "know" the first thing about) inside MAXIMA, and if not, how could I begin to address the issue? Thanks! - Gerd. From fateman at eecs.berkeley.edu Sun Jan 22 13:56:54 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 22 Jan 2012 11:56:54 -0800 Subject: [Maxima] Declarations - how to compare two equations? In-Reply-To: References: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> <4F1C29A1.7070400@eecs.berkeley.edu> Message-ID: <4F1C6A06.50705@eecs.berkeley.edu> On 1/22/2012 11:22 AM, Gerd Kortemeyer wrote: .... > . Is there any better way to compare two equations (that LON-CAPA does > not "know" the first thing about) inside MAXIMA, and if not, how could > I begin to address the issue? Thanks! - Gerd. say that you want to tell if A=B and C=D express the same truth. let e1 = A-B and e2= C-D. let X=[x1,x2,...,xn] be the set of variables that occur in e1 and e2. Choose n random floating point numbers for x1, ..., xn, and evaluate e1 and e2. If the results are the same, approximately, then you say "yes". This can also be done with values chosen from a finite field, followed by evaluation using modular arithmetic. This is called hash-coding of expressions. The results would be identical. Details to consider: how many times to repeat the test. what to do with overflow, underflow, divide by zero. how close is equal. These ideas are not original with me, but (especially) the floating point evaluation has been proposed and maybe used in student test grading. From woollett at charter.net Sun Jan 22 14:44:57 2012 From: woollett at charter.net (Edwin Woollett) Date: Sun, 22 Jan 2012 12:44:57 -0800 Subject: [Maxima] quad_qagp behavior Message-ID: <1E77B74B786D4EE99ABC057CF47E1F4A@edwinc367e16bd> On Jan. 21, 2012, Raymond Toy wrote --------------------------- >You didn't take enough samples. I plotted r1(x) - r2(x) for x from %pi >to 5. and the plot is not zero. It is zero for x from 1 to %pi. --------------------------------------------------------------- You are right, I did not sample far enough. The two expressions agree up to %pi, and r2(x) is undefined for x > %pi (while r1(x) = 0 for x > %pi). ----------------------------------------------------------- (%i1) r1(x):= realpart(1/sqrt(sin(x)))$ (%i2) r2(x) := 1/realpart(sqrt(sin(x)))$ (%i3) r1(5); (%o3) 0 (%i4) r2(5); expt: undefined: 0 to a negative exponent. #0: r2(x=5) -- an error. To debug this try: debugmode(true); (%i5) r1(u); (%o5) cos(atan2(0,sin(u))/2)/sqrt(abs(sin(u))) (%i6) r2(u); (%o6) 1/(cos(atan2(0,sin(u))/2)*sqrt(abs(sin(u)))) (%i7) r1(3); (%o7) 1/sqrt(sin(3)) (%i8) r2(3); (%o8) 1/sqrt(sin(3)) ------------------------- >So I guess realpart is buggy in this case, although ratsimp(r1(x)-r2(x)) >is zero. ---------------------------------- realpart looks unreliable here, but how do you get ratsimp to give zero? ------------------------------------------------ (%i9) ratsimp(r1(u) - r2(u)); (%o9) (cos(atan2(0,sin(u))/2)^2-1)/(cos(atan2(0,sin(u))/2)*sqrt(abs(sin(u)))) ------------------------------------------ Ted From vi5u0-maxima at yahoo.co.uk Sun Jan 22 15:13:33 2012 From: vi5u0-maxima at yahoo.co.uk (Dan) Date: Sun, 22 Jan 2012 21:13:33 +0000 (GMT) Subject: [Maxima] Integrating a Gaussian wrt its width Message-ID: Dear All, I'm interested in integrals of the form: declare(N,integer) ; assume(N > 0) ; assume(N > 1) ; marginal : 'integrate((1/t-C)^(N-1)*exp(A-B/t^2),t,0,1/C) ; Inspired by Jeffreys (1961, _Theory of Probability_, Oxford University Press, p. 139), I thought a nice way forward would be to reduce this to a finite series of incomplete Gamma functions, using the substitution changevar(marginal,u+B/t^2,u,t) ; but all I get when I issue this changevar command is the error sign: sign of infinity is undefined. -- an error. To debug this try: debugmode(true); Any ideas, please? -- Thanks, Dan From willisb at unk.edu Sun Jan 22 16:11:19 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 22 Jan 2012 16:11:19 -0600 Subject: [Maxima] Integrating a Gaussian wrt its width In-Reply-To: References: Message-ID: Your change of variable converts the lower limit of integration to either -infinity for infinity (depending on the sign of B). The function changevar doesn't handle such things correctly, I think. You could try changing the lower limit to a new symbol---I wasn't able to push this any further. For integer N, one thing that might work: (%i1) assume(C>0, B>0); (%o1) [C>0,B>0] (%i2) marginal : integrate((1/t-C)^(N-1)*exp(A-B/t^2),t,0,1/C); (%o2) integrate(%e^(A-B/t^2)*(1/t-C)^(N-1),t,0,1/C) (%i3) makelist(ev(marginal, N : k, integrate),k,1,3); (%o3) [(gamma_incomplete(-1/2,B*C^2)*%e^A*sqrt(B))/2,-(gamma_incomplete(-1/2,B*C^2)*%e^A*sqrt(B)*C-gamma_incomplete(0,B*C^2)*%e^A)/2,-(-gamma_incomplete(-1/2,B*C^2)*%e^A*B*C^2+2*gamma_incomplete(0,B*C^2)*%e^A*sqrt(B)*C-gamma_incomplete(1/2,B*C^2)*%e^A)/(2*sqrt(B))] --Barton -----maxima-bounces at math.utexas.edu wrote: ----- To: Maxima mailing list From: Dan Sent by: maxima-bounces at math.utexas.edu Date: 01/22/2012 03:08PM Subject: [Maxima] Integrating a Gaussian wrt its width Dear All, I'm interested in integrals of the form: declare(N,integer) ; assume(N > 0) ; assume(N > 1) ; marginal : 'integrate((1/t-C)^(N-1)*exp(A-B/t^2),t,0,1/C) ; Inspired by Jeffreys (1961, _Theory of Probability_, Oxford University Press, p. 139), I thought a nice way forward would be to reduce this to a finite series of incomplete Gamma functions, using the substitution changevar(marginal,u+B/t^2,u,t) ; but all I get when I issue this changevar command is the error sign: sign of infinity is undefined. ??-- an error. To debug this try: debugmode(true); Any ideas, please? -- Thanks, Dan _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From ferriste at gmail.com Mon Jan 23 03:00:15 2012 From: ferriste at gmail.com (Stefano Ferri) Date: Mon, 23 Jan 2012 10:00:15 +0100 Subject: [Maxima] [Gcl-devel] maxima for windows with modern gcc/gcl In-Reply-To: References: <4F14E754.2070100@gmail.com> <87lip6w8d7.fsf@maguirefamily.org> Message-ID: 2012/1/19 Donald Winiecki > Stefano (or anyone!), > > The attached 7zip file contains documentation and other files to guide the > creation of a Win32 installer for GCL. The scripts work in `Inno Setup', > available from http://www.jrsoftware.org/isinfo.php > > Let me know if you run into any bumps. > > Best, > > _don > > Thank you for that, I will try to follow your suggestions as soon as I can (now I have no access to a win32 machine). Same thing for a new install.win32, as soon as I have time I will write what I have learned. Stefano > > On Thu, Jan 19, 2012 at 2:13 AM, Stefano Ferri wrote: > >> Thanks David and Camm. I've succesfully built gcl with the latest >> Mingw/Msys without pain. A simple checkout and a configure worked fine. >> Yes, I've noticed too that the option to disable xdr was broken, I didn't >> mention this fact in my previous email. >> Now I will try to finish the build process and the creation of the >> installer (just to learn how to do it). >> >> I think we should update the information given by install.win32, they are >> obsolete in some points and now the procedure is easier, at least for the >> gcl-related part. >> >> Stefano >> >> >> >> >> 2012/1/17 Camm Maguire >> >>> Greetings! Great to hear of your progress. BTW, I build frequently >>> under latest wine/mingw packages in Debian, together with >>> maxima/acl2/axiom, without issue. Had a native windows box too recently >>> and got things working. >>> >>> axiom needs xdr. Latest glibc moves the functions, and my configure fix >>> was too stringent. How about this: >>> >>> --- configure.in 16 Jan 2012 20:08:03 -0000 >>> 1.112.4.1.2.2.2.47.2.3.2.1.4.2.4.2.4.70 >>> +++ configure.in 17 Jan 2012 17:21:56 -0000 >>> @@ -66,7 +66,7 @@ >>> [try_japi=$enableval],[try_japi="no"]) >>> >>> AC_ARG_ENABLE(xdr,[ --enable-xdr=yes will compile in support for XDR], >>> -[try_xdr=$enableval],[try_xdr="no"]) >>> +[enable_xdr=$enableval],[enable_xdr="yes"]) >>> >>> AC_ARG_ENABLE(xgcl,[ --enable-xgcl=yes will compile in support for >>> XGCL], >>> [enable_xgcl=$enableval],[enable_xgcl="yes"]) >>> @@ -1046,8 +1046,12 @@ >>> fi >>> >>> >>> -AC_CHECK_FUNC(xdr_double,, >>> - AC_CHECK_LIB(tirpc,xdr_double,TLIBS="$TLIBS >>> -ltirpc",AC_MSG_ERROR([Need xdr_double]))) >>> +if test "$enable_xdr" = "yes" ; then >>> + AC_CHECK_FUNC(xdr_double,AC_DEFINE(HAVE_XDR), >>> + AC_CHECK_LIB(tirpc,xdr_double,AC_DEFINE(HAVE_XDR) >>> TLIBS="$TLIBS -ltirpc", >>> + AC_CHECK_LIB(rpc,xdr_double,AC_DEFINE(HAVE_XDR) TLIBS="$TLIBS >>> -lrpc", >>> + AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR) >>> TLIBS="$TLIBS -loncrpc")))) >>> +fi >>> >>> AC_MSG_CHECKING(__builtin___clear_cache) >>> AC_TRY_COMPILE([], >>> @@ -1373,17 +1377,17 @@ >>> EXTRA_LOBJS="${EXTRA_LOBJS} gcl_japi.o" >>> LIBS="${LIBS} -ljapi -lwsock32"] ) >>> fi >>> -if test "$use" = "mingw" ; then >>> - if test "$try_xdr" = "yes" ; then >>> - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >>> - LIBS="${LIBS} -loncrpc"] ) >>> - fi >>> -else >>> - if test "$try_xdr" = "yes" ; then >>> - AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >>> - LIBS="${LIBS} -lrpc"] ) >>> - fi >>> -fi >>> +dnl if test "$use" = "mingw" ; then >>> +dnl if test "$try_xdr" = "yes" ; then >>> +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >>> +dnl LIBS="${LIBS} -loncrpc"] ) >>> +dnl fi >>> +dnl else >>> +dnl if test "$try_xdr" = "yes" ; then >>> +dnl AC_CHECK_HEADERS(rpc/rpc.h,[AC_DEFINE(HAVE_XDR) >>> +dnl LIBS="${LIBS} -lrpc"] ) >>> +dnl fi >>> +dnl fi >>> >>> # Should really find a way to check for prototypes, but this >>> # basically works for now. CM >>> >>> David Billinghurst writes: >>> >>> > A couple of days ago I posted a windows installer for maxima-5.26.0 at >>> > >>> > http://billinghurst.customer.netspace.net.au/maxima-5.26.0.exe >>> > >>> > See http://www.math.utexas.edu/pipermail/maxima/2012/027451.html >>> > >>> > Having set up the build system, I decided to try it on a current >>> mingw/msys installation. As some of you know, it is a tricky build as gcl on >>> > windows is touchy. The last version of gcc that could be used to >>> build gcl was gcc-3.3.1 from August 2003, and you need to have an ancient >>> mingw/ >>> > msys install. See the INSTALL.win32 file in maxima cvs for the >>> details. There has been some progress with gcl. One can now build gcl >>> with the >>> > latest mingw32/msys using gcc-4.6.2 and successfully build a working >>> maxima. While the build works on 32-bit WinXP, I haven't managed to >>> reproduce >>> > it (yet) on a 64-bit Windows 7 machine. >>> > >>> > Anyway, I have uploaded a test installer of maxima cvs 2012-01-16 >>> using gcc-4.6.2 to >>> > >>> > http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe >>> > >>> > This is still work in progress, and some documentation is required, >>> but I'd welcome feedback. >>> > >>> > David >>> > >>> > _______________________________________________ >>> > Maxima mailing list >>> > Maxima at math.utexas.edu >>> > http://www.math.utexas.edu/mailman/listinfo/maxima >>> >>> -- >>> Camm Maguire >>> camm at maguirefamily.org >>> >>> ========================================================================== >>> "The earth is but one country, and mankind its citizens." -- >>> Baha'u'llah >>> _______________________________________________ >>> Maxima mailing list >>> Maxima at math.utexas.edu >>> http://www.math.utexas.edu/mailman/listinfo/maxima >>> >> >> >> _______________________________________________ >> Gcl-devel mailing list >> Gcl-devel at gnu.org >> https://lists.gnu.org/mailman/listinfo/gcl-devel >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Sun Jan 22 13:08:48 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sun, 22 Jan 2012 21:08:48 +0200 Subject: [Maxima] Declarations Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2012/027525.html *Gerd Kortemeyer: * Hi, We have been using MAXIMA successfully inside of LON-CAPA for homework problems for several years now - it's a great tool, thanks everybody!!! While authoring a new kind of homework, I am struggling with "declare" - why does the following (sample) code not give the expected results? (%i4) declare(x,real); (%o4) done (%i5) solve(x^3=125,x); 5 sqrt(3) %i - 5 5 sqrt(3) %i + 5 (%o5) [x = ----------------, x = - ----------------, x = 5] 2 2 (%i6) facts(); (%o6) [kind(x, real)] Is there another way to tell "solve" to stay in the real realm? Thanks! - Gerd. *********************************************************************************** How to get only real solutions of polynomial equation? I know these methods: a) (%i1) sol:solve(x^3=125,x); (%o1) [x=(5*sqrt(3)*%i-5)/2,x=-(5*sqrt(3)*%i+5)/2,x=5] (%i2) sublist(sol,lambda([e],freeof(%i,e))); (%o2) [x=5] b) (%i3) realonly:true$ realroots(x^3=125); (%o4) [x=5] c) (%i5) realonly:true$ algsys([x^3=125],[x]); (%o6) [[x=5]] d) (%i7) realonly:true$ to_poly_solve([x^3=125], [x]); Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $ (%o8) %union([x=5]) (%i9) first(%); (%o9) [x=5] Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Mon Jan 23 11:14:03 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 23 Jan 2012 09:14:03 -0800 Subject: [Maxima] quad_qagp behavior In-Reply-To: <1E77B74B786D4EE99ABC057CF47E1F4A@edwinc367e16bd> References: <1E77B74B786D4EE99ABC057CF47E1F4A@edwinc367e16bd> Message-ID: On Sun, Jan 22, 2012 at 12:44 PM, Edwin Woollett wrote: > On Jan. 21, 2012, Raymond Toy wrote > --------------------------- > > You didn't take enough samples. I plotted r1(x) - r2(x) for x from %pi >> to 5. and the plot is not zero. It is zero for x from 1 to %pi. >> > ------------------------------**------------------------------**--- > You are right, I did not sample far enough. The two > expressions agree up to %pi, and r2(x) is undefined > for x > %pi (while r1(x) = 0 for x > %pi). > ------------------------------**----------------------------- > (%i1) r1(x):= realpart(1/sqrt(sin(x)))$ > (%i2) r2(x) := 1/realpart(sqrt(sin(x)))$ > > (%i3) r1(5); > (%o3) 0 > > (%i4) r2(5); > expt: undefined: 0 to a negative exponent. > #0: r2(x=5) > -- an error. To debug this try: debugmode(true); > > (%i5) r1(u); > (%o5) cos(atan2(0,sin(u))/2)/sqrt(**abs(sin(u))) > > (%i6) r2(u); > (%o6) 1/(cos(atan2(0,sin(u))/2)***sqrt(abs(sin(u)))) > > (%i7) r1(3); > (%o7) 1/sqrt(sin(3)) > > (%i8) r2(3); > (%o8) 1/sqrt(sin(3)) > ------------------------- > > So I guess realpart is buggy in this case, although ratsimp(r1(x)-r2(x)) >> is zero. >> > ------------------------------**---- > realpart looks unreliable here, but how do you get ratsimp to > give zero? > Sorry, I clearly made a mistake. Unfortunately, I don't know what because that session is gone. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Mon Jan 23 11:41:47 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 23 Jan 2012 12:41:47 -0500 Subject: [Maxima] Declarations - how to compare two equations? In-Reply-To: <4F1C6A06.50705@eecs.berkeley.edu> References: <515989B4-0A9B-455B-8BCB-9CBF00CDB91C@lite.msu.edu> <4F1C29A1.7070400@eecs.berkeley.edu> <4F1C6A06.50705@eecs.berkeley.edu> Message-ID: Though this is a good approach for equivalence of *expressions*, I don't think it works well for equations, even for simple cases. The equations* a*= 1, 200* *a *= 200, *a* + 37 = 38, and (a-1)^201 = 0 all have the same solution set, but LHS-RHS and LHS/RHS are different for all *a* <> 1. Even if you happen to test the a=1 case, you still don't know that the solution sets are the same. Of course, it is much worse in the multivariate case. -s On Sun, Jan 22, 2012 at 14:56, Richard Fateman wrote: > On 1/22/2012 11:22 AM, Gerd Kortemeyer wrote: > .... > >> . Is there any better way to compare two equations (that LON-CAPA does >> not "know" the first thing about) inside MAXIMA, and if not, how could I >> begin to address the issue? Thanks! - Gerd. >> > > say that you want to tell if A=B and C=D express the same truth. > > let e1 = A-B and e2= C-D. > let X=[x1,x2,...,xn] be the set of variables that occur in e1 and e2. > > Choose n random floating point numbers for x1, ..., xn, and evaluate e1 > and e2. > > If the results are the same, approximately, then you say "yes". > > This can also be done with values chosen from a finite field, followed by > evaluation using modular arithmetic. This is called hash-coding of > expressions. > The results would be identical. > > Details to consider: > how many times to repeat the test. > what to do with overflow, underflow, divide by zero. > how close is equal. > > These ideas are not original with me, but (especially) the floating point > evaluation > has been proposed and maybe used in student test grading. > > > > > > > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulumbelu at googlemail.com Mon Jan 23 13:27:03 2012 From: ulumbelu at googlemail.com (Ralf Jung) Date: Mon, 23 Jan 2012 20:27:03 +0100 Subject: [Maxima] How to prevent the immediaetly evaluation after substitute a variable Message-ID: Dear maxima list members, here a example what's happend (%i1) x : 2*sqrt(h) (%o1) 2sqrt(h) (%i2) subst([h=0.3], x) (%o2) 1.095445115010332 But I want this outcome (%o2) 2sqrt(0.3) is it possible to stop the immediaetly evaluation after subst, so I can see first my expression with all the variables changed? ralf From lorenzo.isella at gmail.com Mon Jan 23 13:57:20 2012 From: lorenzo.isella at gmail.com (Lorenzo Isella) Date: Mon, 23 Jan 2012 20:57:20 +0100 Subject: [Maxima] Constructing a Function with a given Singularity Message-ID: <4F1DBBA0.5000809@gmail.com> Dear All, I hope this is not too off topic. I do not know if maxima can help me at all, but I would like to give it a try. I need to build a function of a power-law of x with the following asymptotic behavior for large x f(x^alpha)--> 0, if alpha=1, f(x^alpha)--> constant, if alpha in (1,1/3] Does anybody have any idea about how to do this in maxima? I repeat that I need a function of x^alpha; I cannot e.g. express f(x^alpha)=alpha*g(x^alpha), as alpha can appear only in the expression x^alpha. Does anybody have any idea about how to achieve that? Many thanks Lorenzo From willisb at unk.edu Mon Jan 23 14:27:58 2012 From: willisb at unk.edu (Barton Willis) Date: Mon, 23 Jan 2012 14:27:58 -0600 Subject: [Maxima] How to prevent the immediaetly evaluation after substitute a variable In-Reply-To: References: Message-ID: Try using box: (%i67) 2 * sqrt(box(h)); (%o67) 2*sqrt(h) (%i68) subst(h=0.3,%); (%o68) 2*sqrt(0.3) (%i69) rembox(%); (%o69) 1.095445115010332 To read the documentation for box, input ? box. There might be limitations on this method that I have not thought about.It might be possible to extend rembox to remove boxes bottom up one layer at a time. --Barton maxima-bounces at math.utexas.edu wrote on 01/23/2012 01:27:03 PM: > From: Ralf Jung > To: Maxima at math.utexas.edu > Date: 01/23/2012 01:26 PM > Subject: [Maxima] How to prevent the immediaetly evaluation after > substitute a variable > Sent by: maxima-bounces at math.utexas.edu > > Dear maxima list members, > > here a example what's happend > > (%i1) x : 2*sqrt(h) > > (%o1) 2sqrt(h) > > (%i2) subst([h=0.3], x) > > (%o2) 1.095445115010332 > > But I want this outcome > > (%o2) 2sqrt(0.3) > > is it possible to stop the immediaetly evaluation after subst, so I > can see first my expression with all the variables changed? > > ralf > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Mon Jan 23 15:36:17 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 23 Jan 2012 16:36:17 -0500 Subject: [Maxima] How to prevent the immediaetly evaluation after substitute a variable In-Reply-To: References: Message-ID: Ralf, Let me just add to Barton's suggestion that the issue here isn't (in Maxima terminology) "evaluation" (i.e. the substitution of variable values and functions) but "simplification". The expression (2+3) is *simplified* to 5, just as (2*x+3*x) is *simplified* to 5*x. -s On Mon, Jan 23, 2012 at 15:27, Barton Willis wrote: > Try using box: > > (%i67) 2 * sqrt(box(h)); > (%o67) 2*sqrt(h) > > (%i68) subst(h=0.3,%); > (%o68) 2*sqrt(0.3) > > (%i69) rembox(%); > (%o69) 1.095445115010332 > > To read the documentation for box, input ? box. There might be limitations > on > this method that I have not thought about.It might be possible to extend > rembox > to remove boxes bottom up one layer at a time. > > --Barton > > maxima-bounces at math.utexas.edu wrote on 01/23/2012 01:27:03 PM: > > > From: Ralf Jung > > To: Maxima at math.utexas.edu > > Date: 01/23/2012 01:26 PM > > Subject: [Maxima] How to prevent the immediaetly evaluation after > > substitute a variable > > Sent by: maxima-bounces at math.utexas.edu > > > > Dear maxima list members, > > > > here a example what's happend > > > > (%i1) x : 2*sqrt(h) > > > > (%o1) 2sqrt(h) > > > > (%i2) subst([h=0.3], x) > > > > (%o2) 1.095445115010332 > > > > But I want this outcome > > > > (%o2) 2sqrt(0.3) > > > > is it possible to stop the immediaetly evaluation after subst, so I > > can see first my expression with all the variables changed? > > > > ralf > > _______________________________________________ > > 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: From jrredford at yahoo.com Mon Jan 23 20:21:34 2012 From: jrredford at yahoo.com (James Redford) Date: Mon, 23 Jan 2012 18:21:34 -0800 (PST) Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite Message-ID: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> I downloaded the following binary: http://iweb.dl.sourceforge.net/project/maxima/Maxima-Windows/5.26.0-Windows/maxima-5.26.0.exe 30,364,448 bytes MD5: 2b9342ec1130ab56189dd08c71f1be26 After running the command "run_testsuite(display_all=true, display_known_bugs=true);", the following is the result: Error summary: Errors found in C:/program1/maxima/share/maxima/5.26.0/tests/rtest16.mac, problems: (185 186) 2 tests failed out of 9,121 total tests. real time : 425.570 secs run-gbc time : 393.620 secs child run time : 0.000 secs gbc time : 31.950 secs (%o0) done (%i1) Below is the build information: Maxima version: 5.26.0 Maxima build date: 22:48 1/15/2012 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 ---------- I also submitted the above as a bug-report at http://sourceforge.net/tracker/?group_id=4933&atid=104933 . From dbmaxima at gmail.com Mon Jan 23 20:54:33 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Tue, 24 Jan 2012 13:54:33 +1100 Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite In-Reply-To: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> References: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> Message-ID: <4F1E1D69.7090008@gmail.com> On 24/01/2012 1:21 PM, James Redford wrote: > I downloaded the following binary: > > http://iweb.dl.sourceforge.net/project/maxima/Maxima-Windows/5.26.0-Windows/maxima-5.26.0.exe > > 30,364,448 bytes > MD5: 2b9342ec1130ab56189dd08c71f1be26 > > > After running the command "run_testsuite(display_all=true, display_known_bugs=true);", the following is the result: > > > Error summary: > Errors found in C:/program1/maxima/share/maxima/5.26.0/tests/rtest16.mac, problems: > (185 186) > 2 tests failed out of 9,121 total tests. > real time : 425.570 secs > run-gbc time : 393.620 secs > child run time : 0.000 secs > gbc time : 31.950 secs > (%o0) done > (%i1) > > > Below is the build information: > > > Maxima version: 5.26.0 > Maxima build date: 22:48 1/15/2012 > Host type: i686-pc-mingw32 > Lisp implementation type: GNU Common Lisp (GCL) > Lisp implementation version: GCL 2.6.8 > > > ---------- > > > I also submitted the above as a bug-report at http://sourceforge.net/tracker/?group_id=4933&atid=104933 . > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima Thnaks for the report. That would be these tests below. They are a known problem with gcl under windows. Unfortunately the testsuite doesn't allow us to make known errors conditional on platform and lisp. Interestingly, I don't see them with my experimental windows build of CVS maxima using gcl/gcc-4.6.2. (http://www.math.utexas.edu/pipermail/maxima/2012/027475.html) Another reason to test this new build. Running tests in rtest16: ********************** Problem 185 *************** Input: 60 2 - 1 float(-------) - 1 60 2 Result: - 1.1102230246251565E-16 This differed from the expected result: 0.0 ********************** Problem 186 *************** Input: 1000 2 - 1 float(---------) - 1 1000 2 Result: - 1.1102230246251565E-16 This differed from the expected result: 0.0 From pbowyer at olynet.com Tue Jan 24 14:41:52 2012 From: pbowyer at olynet.com (Paul Bowyer) Date: Tue, 24 Jan 2012 12:41:52 -0800 Subject: [Maxima] Make check failures Message-ID: <4F1F1790.5040603@olynet.com> I downloaded the maxima source yesterday using: git clone git://maxima.git.sourceforge.net/gitroot/maxima/maxima I used the following configuration incantation today to build maxima: export GCL_ANSI=y CFLAGS="-O2 -g -march=i386 -mcpu=i686 -fno-fast-math" CXXFLAGS="-O2 -g -march=i386 -mcpu=i686 -fno-fast-math" && ./configure --prefix=$HOME/MaximaTest --enable-sbcl --enable-cmucl --enable-ccl --enable-gcl --with-sbcl=/usr/local/bin/sbcl --with-cmucl=/opt/cmucl-20c/bin/lisp --with-ccl=/usr/local/bin/ccl --with-gcl=/usr/bin/gcl followed by: make make check make install build_info (); Maxima version: 5.26.0_22_g91b6c40 Maxima build date: 10:20 1/24/2012 Host type: i686-pc-linux-gnu Lisp implementation type: CMU Common Lisp Lisp implementation version: Snapshot 2011-02 (20B Unicode) make check completed without unknown failures. build_info (); Maxima version: 5.26.0_22_g91b6c40 Maxima build date: 10:28 1/24/2012 Host type: i686-pc-linux-gnu Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 make check completed without unknown failures. build_info (); Maxima version: 5.26.0_22_g91b6c40 Maxima build date: 10:22 1/24/2012 Host type: i686-pc-linux-gnu Lisp implementation type: SBCL Lisp implementation version: 1.0.53 make check failures are tests (393, 394) build_info (); Maxima version: 5.26.0_22_g91b6c40 Maxima build date: 10:30 1/24/2012 Host type: i686-pc-linux-gnu Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.6-r14468M (LinuxX8632) make check failures are tests (37, 193, 197) I ran the test suite from within xmaxima for sbcl and ccl and sbcl fails on rtest16 ********************** Problem 393 *************** Input: closeto(zeta(%i + 3) - (1.10721440843141 - .1482908671781754 %i), 1.e-15) Result: 3.3157171161039706e-9 This differed from the expected result: true ********************** Problem 394 *************** Input: ! 1 ! closeto(!zeta(0.5 %i + -)! - 1.06534921249378, 1.e-14) ! 2 ! Result: 3.1194385963217997e-8 This differed from the expected result: true ccl fails on rtest15 ********************** Problem 37 *************** Input: 2 2 - %pi sin (3 a) sin (----- + a + b) 3 (----------------------------- 2 %pi sin (a - ---) 3 - %pi 2 sin(a) sin(3 a) cos(b) sin(----- + a + b) sin(3 a + 3 b) 3 - ---------------------------------------------------------- %pi sin(a - ---) sin(a + b) 3 2 2 sin (a) sin (3 a + 3 b) + -----------------------, result : trigrat(%%), 2 sin (a + b) expected : (- (- 9 + 10 cos(2 a) - 2 sqrt(3) sin(2 a) - cos(4 a) + sqrt(3) sin(4 a) + 10 cos(2 b) - 2 sqrt(3) sin(2 b) - cos(4 b) + sqrt(3) sin(4 b) - 4 cos(2 b - 2 a) - 8 cos(2 a + 2 b) + 4 sqrt(3) sin(2 a + 2 b) + 2 cos(4 a + 2 b) - 2 sqrt(3) sin(4 a + 2 b) + 2 cos(2 a + 4 b) - 2 sqrt(3) sin(2 a + 4 b) - cos(4 a + 4 b) + sqrt(3) sin(4 a + 4 b)))/4, ratsimp(result - expected)) Result: Polynomial quotient is not exact error-catch This differed from the expected result: 0 ********************** Problem 193 *************** Input: 2 t log(t) integrate(-----------------, t, 0, 1) 2 4 (t - 1) (1 + t ) Result: 2 (sqrt(2) - 2) %pi - ------------------ 32 This differed from the expected result: 2 (sqrt(2) - 1) %pi ------------------ 9/2 2 ********************** Problem 196 *************** Input: 1 factor(expand(sqrtdenest(integrate(------------, x, 0, 1)))) 1 4 - + (x - 3) 2 3/4 9/4 73 + sqrt(2) + 2 - 3 2 - factor((- (- log(----------------------------) 33 3/4 9/4 3/4 5/2 13/4 73 + sqrt(2) - 2 + 3 2 - 2 + 2 - 2 + log(----------------------------) + 2 atan(---------------------) 33 3/4 13/4 98 + 2 - 2 3/4 5/2 13/4 2 + 2 + 2 7/4 + 2 atan(-------------------)))/2 ) 3/4 13/4 - 98 + 2 - 2 Result: 13/4 5/2 3/4 13/4 5/2 3/4 2 + 2 + 2 - 2 + 2 - 2 (2 atan(-------------------) + 2 atan(---------------------) 13/4 3/4 13/4 3/4 - 2 + 2 - 98 - 2 + 2 + 98 9/4 3/4 9/4 3/4 3 2 - 2 + sqrt(2) + 73 - 3 2 + 2 + sqrt(2) + 73 + log(----------------------------) - log(------------------------------)) 33 33 9/4 3/4 7/4 3 2 - 2 + sqrt(2) + 73 /2 - (log(----------------------------) 33 9/4 3/4 - 3 2 + 2 + sqrt(2) + 73 - log(------------------------------) - 2 33 3/4 1/4 79 2 + 365 sqrt(2) + 877 2 + 5 atan(------------------------------------) 10657 3/4 1/4 - 79 2 + 365 sqrt(2) - 877 2 + 5 7/4 + 2 atan(--------------------------------------))/2 10657 This differed from the expected result: 0 My copies of cmucl, sbcl, and ccl may not be the latest available if that makes any difference to the test suite. I hope this information is useful in making maxima better, Paul Bowyer From toy.raymond at gmail.com Tue Jan 24 15:03:30 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 24 Jan 2012 13:03:30 -0800 Subject: [Maxima] Make check failures In-Reply-To: <4F1F1790.5040603@olynet.com> References: <4F1F1790.5040603@olynet.com> Message-ID: On Tue, Jan 24, 2012 at 12:41 PM, Paul Bowyer wrote: > > I ran the test suite from within xmaxima for sbcl and ccl and > sbcl fails on rtest16 > ********************** Problem 393 *************** > Input: > closeto(zeta(%i + 3) - (1.10721440843141 - .1482908671781754 %i), 1.e-15) > > > Result: > 3.3157171161039706e-9 > > This differed from the expected result: > true > > ********************** Problem 394 *************** > Input: > ! 1 ! > closeto(!zeta(0.5 %i + -)! - 1.06534921249378, 1.e-14) > ! 2 ! > > > Result: > 3.1194385963217997e-8 > I'm pretty sure this is the known issue with sbcl about how it computes (cl:expt ). A bug has been filed, I think, and I have verbal confirmation that it will be fixed someday. (Ccl used to have the same problem, but it was fixed a while ago.) Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Tue Jan 24 15:16:15 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 24 Jan 2012 14:16:15 -0700 Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite In-Reply-To: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> References: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> Message-ID: On 1/23/12, James Redford wrote: > I downloaded the following binary: > > http://iweb.dl.sourceforge.net/project/maxima/Maxima-Windows/5.26.0-Windows/maxima-5.26.0.exe Well, this is really crazy. The link above works (I tried it) but the file browser (http://sourceforge.net/projects/maxima/files/Maxima-Windows/5.26.0-Windows) shows nothing (but it still reports "1 item, 30.4 MB"). If anybody has some idea of what to do now, I'm all ears. best Robert Dodier From pbowyer at olynet.com Tue Jan 24 16:54:51 2012 From: pbowyer at olynet.com (Paul Bowyer) Date: Tue, 24 Jan 2012 14:54:51 -0800 Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite In-Reply-To: References: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> Message-ID: <4F1F36BB.7000005@olynet.com> On 01/24/2012 01:16 PM, Robert Dodier wrote: > On 1/23/12, James Redford wrote: > >> I downloaded the following binary: >> >> http://iweb.dl.sourceforge.net/project/maxima/Maxima-Windows/5.26.0-Windows/maxima-5.26.0.exe > Well, this is really crazy. The link above works (I tried it) but the > file browser > (http://sourceforge.net/projects/maxima/files/Maxima-Windows/5.26.0-Windows) > shows nothing (but it still reports "1 item, 30.4 MB"). > > If anybody has some idea of what to do now, I'm all ears. > > best > > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > You might try renaming the file with a ".ex1" extension to see if that shows properly. Downloaders would have to rename it to run it. Or wrap it in a zip archive possibly. From robert.dodier at gmail.com Tue Jan 24 17:07:02 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 24 Jan 2012 16:07:02 -0700 Subject: [Maxima] Make check failures In-Reply-To: <4F1F1790.5040603@olynet.com> References: <4F1F1790.5040603@olynet.com> Message-ID: Paul, thanks for taking the time to build & test Maxima. If you are interested, please consider trying to figure out why the results differ, and, if you can, supply a patch. You can post patches to the mailing list, or better still, I can enable svn write permission for you so you can commit patches directly. Thanks for your interest in Maxima, Robert Dodier From pbowyer at olynet.com Tue Jan 24 17:26:07 2012 From: pbowyer at olynet.com (Paul Bowyer) Date: Tue, 24 Jan 2012 15:26:07 -0800 Subject: [Maxima] Make check failures In-Reply-To: References: <4F1F1790.5040603@olynet.com> Message-ID: <4F1F3E0F.2040002@olynet.com> On 01/24/2012 03:07 PM, Robert Dodier wrote: > Paul, > > thanks for taking the time to build& test Maxima. > If you are interested, please consider trying to figure out > why the results differ, and, if you can, supply a patch. > You can post patches to the mailing list, or better still, > I can enable svn write permission for you so you can > commit patches directly. > > Thanks for your interest in Maxima, > > Robert Dodier > I doubt my math skills and my grasp of lisp are sufficient to track down errors in maxima, but it would be interesting and possibly educational to try. So far my lisp programming is to the point where I can write simple programs around CLX, but I haven't tried anything as advanced as maxima. I think it would be well beyond my abilities. If I discover anything in my stumblings with maxima, I'll post them, but don't hold your breath waiting... Paul Bowyer From korte at lite.msu.edu Tue Jan 24 20:33:16 2012 From: korte at lite.msu.edu (Gerd Kortemeyer) Date: Tue, 24 Jan 2012 21:33:16 -0500 Subject: [Maxima] Declarations In-Reply-To: References: Message-ID: <1BD52C74-0EB2-4103-BDD7-3647FE493AAD@lite.msu.edu> Hi, I just wanted to thank the folks on this list for their help and input. It turned out that loading additional packages took too long, which ruled out the otherwise perfect package "solvereal" by Mikael S?rensen, and also solution (d) below - LON-CAPA gets hit very hard during homework crunch time. Since we need to do a kill(all) between transactions, we would have needed to reload packages every time. I ended up coding something along the lines of solution (a) below, only that the loop was implemented on the Perl-side. A sample problem is at http://source.lon-capa.org/cgi-bin/cvsweb.cgi/loncom/homework/templates/custom_equation.problem?rev=1.1;content-type=text%2Fplain for anybody who might be interested. Eventually, we might turn this into a real homework type, like http://www.lon-capa.org/cas.html Thanks again, and thanks for Maxima, - Gerd. On Jan 22, 2012, at 2:08 PM, Aleksas Domarkas wrote: > from http://www.math.utexas.edu/pipermail/maxima/2012/027525.html > Gerd Kortemeyer: > Hi, > > We have been using MAXIMA successfully inside of LON-CAPA for homework problems for several years now - it's a great tool, thanks everybody!!! > > While authoring a new kind of homework, I am struggling with "declare" - why does the following (sample) code not give the expected results? > > (%i4) declare(x,real); > (%o4) done > (%i5) solve(x^3=125,x); > 5 sqrt(3) %i - 5 5 sqrt(3) %i + 5 > (%o5) [x = ----------------, x = - ----------------, x = 5] > 2 2 > (%i6) facts(); > (%o6) [kind(x, real)] > > Is there another way to tell "solve" to stay in the real realm? > > Thanks! > > - Gerd. > > *********************************************************************************** > > How to get only real solutions of polynomial equation? > I know these methods: > a) > (%i1) sol:solve(x^3=125,x); > > (%o1) [x=(5*sqrt(3)*%i-5)/2,x=-(5*sqrt(3)*%i+5)/2,x=5] > > (%i2) sublist(sol,lambda([e],freeof(%i,e))); > (%o2) [x=5] > > b) > (%i3) realonly:true$ > realroots(x^3=125); > (%o4) [x=5] > > c) > (%i5) realonly:true$ > > algsys([x^3=125],[x]); > > (%o6) [[x=5]] > > d) > (%i7) realonly:true$ > to_poly_solve([x^3=125], [x]); > Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $ > (%o8) %union([x=5]) > (%i9) first(%); > > (%o9) [x=5] > > > Aleksas D > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From robert.dodier at gmail.com Tue Jan 24 22:23:15 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 24 Jan 2012 21:23:15 -0700 Subject: [Maxima] Declarations In-Reply-To: <1BD52C74-0EB2-4103-BDD7-3647FE493AAD@lite.msu.edu> References: <1BD52C74-0EB2-4103-BDD7-3647FE493AAD@lite.msu.edu> Message-ID: On 1/24/12, Gerd Kortemeyer wrote: > It turned out that loading additional packages took too long, which ruled > out the otherwise perfect package "solvereal" by Mikael S?rensen, and also > solution (d) below - LON-CAPA gets hit very hard during homework crunch > time. Since we need to do a kill(all) between transactions, we would have > needed to reload packages every time. Gerd, I know you have a working system so maybe you're not interested in reworking stuff, but for the record: (1) to obviate the need to reload packages, you can load them once into a clean Maxima session and then dump an image (using a Lisp function -- it varies from one Lisp to another). Then all the stuff that's in that image is preserved. (2) another idea -- use share/contrib/maxima-server.lisp (works only w/ SBCL, sorry) to implement an ordinary *nixish server, in which clients connect via sockets and the server forks so each client has a clean session. Anything loaded before forking is available to all clients. Thanks for your interest in Maxima, Robert Dodier From dbmaxima at gmail.com Wed Jan 25 00:00:08 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Wed, 25 Jan 2012 17:00:08 +1100 Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite In-Reply-To: <4F1E1D69.7090008@gmail.com> References: <1327371694.82933.YahooMailClassic@web121806.mail.ne1.yahoo.com> <4F1E1D69.7090008@gmail.com> Message-ID: <4F1F9A68.10707@gmail.com> On 24/01/2012 1:54 PM, David Billinghurst wrote: > On 24/01/2012 1:21 PM, James Redford wrote: >> I downloaded the following binary: >> >> http://iweb.dl.sourceforge.net/project/maxima/Maxima-Windows/5.26.0-Windows/maxima-5.26.0.exe >> >> >> 30,364,448 bytes >> MD5: 2b9342ec1130ab56189dd08c71f1be26 >> >> After running the command "run_testsuite(display_all=true, >> display_known_bugs=true);", the following is the result: >> >> Error summary: >> Errors found in >> C:/program1/maxima/share/maxima/5.26.0/tests/rtest16.mac, problems: >> (185 186) >> >> >> > Thanks for the report. That would be these tests below. They are a > known problem > with gcl under windows. Unfortunately the testsuite doesn't allow us > to make > known errors conditional on platform and lisp. > > Interestingly, I don't see them with my experimental windows build of > CVS maxima > using gcl/gcc-4.6.2. > (http://www.math.utexas.edu/pipermail/maxima/2012/027475.html) > Another reason to test this new build. > I have confirmed that these failures do not occur in a maxima-5.26.0 built with gcl/gcc-4.6.2 From aleksasd873 at gmail.com Tue Jan 24 01:39:29 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Tue, 24 Jan 2012 09:39:29 +0200 Subject: [Maxima] How to prevent the immediaetly evaluation after substitute a variable Message-ID: from http://www.math.utexas.edu/pipermail/maxima/2012/027547.html Ralf, Let me just add to Barton's suggestion that the issue here isn't (in Maxima terminology) "evaluation" (i.e. the substitution of variable values and functions) but "simplification". The expression (2+3) is *simplified* to 5, just as (2*x+3*x) is *simplified* to 5*x. -s On Mon, Jan 23, 2012 at 15:27, Barton Willis > wrote: >* Try using box:*>**>* (%i67) 2 * sqrt(box(h));*>* (%o67) 2*sqrt(h)*>**>* (%i68) subst(h=0.3,%);*>* (%o68) 2*sqrt(0.3)*>**>* (%i69) rembox(%);*>* (%o69) 1.095445115010332*>**>* To read the documentation for box, input ? box. There might be limitations*>* on*>* this method that I have not thought about.It might be possible to extend*>* rembox*>* to remove boxes bottom up one layer at a time.*>**>* --Barton*>**>* maxima-bounces at math.utexas.edu wrote on 01/23/2012 01:27:03 PM:*>**>* > From: Ralf Jung >*>* > To: Maxima at math.utexas.edu *>* > Date: 01/23/2012 01:26 PM*>* > Subject: [Maxima] How to prevent the immediaetly evaluation after*>* > substitute a variable*>* > Sent by: maxima-bounces at math.utexas.edu *>* >*>* > Dear maxima list members,*>* >*>* > here a example what's happend*>* >*>* > (%i1) x : 2*sqrt(h)*>* >*>* > (%o1) 2sqrt(h)*>* >*>* > (%i2) subst([h=0.3], x)*>* >*>* > (%o2) 1.095445115010332*>* >*>* > But I want this outcome*>* >*>* > (%o2) 2sqrt(0.3)*>* >*>* > is it possible to stop the immediaetly evaluation after subst, so I*>* > can see first my expression with all the variables changed?*>* >*>* > ralf*>* > ____________________* *************************************************************** (%i1) "2*sqrt(0.3)"; (%o1) "2*sqrt(0.3)" (%i2) eval_string(%); (%o2) 1.095445115010332 Other method: (%i3) simp:false$ (%i4) 2*sqrt(0.3); (%o4) 2*sqrt(0.3) (%i5) %,simp=true; (%o5) 1.095445115010332 (%i6) 3+2; (%o6) 3+2 (%i7) simp:true$ (%i8) 3+2; (%o8) 5 yet another method: (%i9) define(Sqrt(x),sqrt(x))$ (%i10) define(f(x),2*'Sqrt(x))$ (%i11) f(0.3); (%o11) 2*Sqrt(0.3) (%i12) ev(%,nouns); (%o12) 1.095445115010332 Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.frigerio at iit.it Tue Jan 24 04:00:06 2012 From: marco.frigerio at iit.it (Marco Frigerio) Date: Tue, 24 Jan 2012 11:00:06 +0100 Subject: [Maxima] common factor reduction Message-ID: <4F1E8126.8030707@iit.it> Hi all, consider this (%i..) trigreduce( -A*cos(q1)*sin(q2) + A*sin(q1)*cos(q2) ); (%o..) - sin(q2 - q1) A Why I cannot do the same thing if instead of a variable like 'A' I have a numerical constant? (%i..) trigreduce( -4*cos(q1)*sin(q2) + 4*sin(q1)*cos(q2) ); sin(q2 + q1) sin(q2 - q1) sin(q2 + q1) sin(q2 - q1) (%o..) 4 (------------ - ------------) - 4 (------------ + ------------) 2 2 2 2 I would really like to see - sin(q2 - q1) 4 How can I achieve this? Thanks a lot Regards, MF From alserkli at inbox.ru Wed Jan 25 04:46:47 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Wed, 25 Jan 2012 12:46:47 +0200 Subject: [Maxima] common factor reduction In-Reply-To: <4F1E8126.8030707@iit.it> References: <4F1E8126.8030707@iit.it> Message-ID: On Tue, 24 Jan 2012, Marco Frigerio wrote: > (%i..) trigreduce( -4*cos(q1)*sin(q2) + 4*sin(q1)*cos(q2) ); > > sin(q2 + q1) sin(q2 - q1) sin(q2 + q1) sin(q2 - q1) > (%o..) 4 (------------ - ------------) - 4 (------------ + ------------) > 2 2 2 2 > > I would really like to see > - sin(q2 - q1) 4 > > How can I achieve this? %,ratsimp; -- Regards, ASK From vi5u0-maxima at yahoo.co.uk Wed Jan 25 05:00:13 2012 From: vi5u0-maxima at yahoo.co.uk (Dan) Date: Wed, 25 Jan 2012 11:00:13 +0000 (GMT) Subject: [Maxima] Integrating a Gaussian wrt its width In-Reply-To: References: Message-ID: On Sun, 22 Jan 2012, Barton Willis wrote: > Your change of variable converts the lower limit of integration to > either -infinity for infinity (depending on the sign of B). The > function changevar doesn't handle such things correctly, I think. > You could try changing the lower limit to a new symbol---I wasn't > able to push this any further. > For integer N, one thing that might work: > (%i1) assume(C>0, B>0); > (%o1) [C>0,B>0] > (%i2) marginal : integrate((1/t-C)^(N-1)*exp(A-B/t^2),t,0,1/C); > (%o2) integrate(%e^(A-B/t^2)*(1/t-C)^(N-1),t,0,1/C) > (%i3) makelist(ev(marginal, N : k, integrate),k,1,3); > (%o3) [(gamma_incomplete(-1/2,B*C^2)*%e^A*sqrt(B))/2,-(gamma_incomplete(-1/2,B*C^2)*%e^A*sqrt(B)*C-gamma_incomplete(0,B*C^2)*%e^A)/2,-(-gamma_incomplete(-1/2,B*C^2)*%e^A*B*C^2+2*gamma_incomplete(0,B*C^2)*%e^A*sqrt(B)*C-gamma_incomplete(1/2,B*C^2)*%e^A)/(2*sqrt(B))] Thanks Barton. In the end, I did the binomial expansion by hand, and the substitution piecemeal, like this: declare(N,integer) ; assume(N > 0) ; assume(N > 1) ; assume(B > 0) ; marginalshouldbe : 'integrate((1/t-C)^(N-1)*exp(A-B/t^2),t,0,1/C) ; theintegrand : (1/t-C)^(N-1)*exp(A-B/t^2) ; theintegrandexpanded : (1/t)^(N-1)*sum(gamma(N)*(-C)^j/(gamma(j+1)*gamma(N-j)*t^(N-j-1)),j,0,N-1)*exp(A-B/t^2) ; theintegrandtermj : (1/t)^(N-1)*gamma(N)*(-C)^j/(gamma(j+1)*gamma(N-j)*t^(N-j-1))*exp(A-B/t^2) ; subst(t = B^(1/2)/u^(1/2), theintegrandtermj) ; %*diff(B^(1/2)/u^(1/2),u) ; integrate(%,u,inf,B*C^2) ; marginal : sum(%,j,0,N-1) ; -- Dan From macrakis at alum.mit.edu Wed Jan 25 06:27:12 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 25 Jan 2012 07:27:12 -0500 Subject: [Maxima] common factor reduction In-Reply-To: <4F1E8126.8030707@iit.it> References: <4F1E8126.8030707@iit.it> Message-ID: ratsimp(trigreduce(...)) On Tue, Jan 24, 2012 at 05:00, Marco Frigerio wrote: > Hi all, > > consider this > > (%i..) trigreduce( -A*cos(q1)*sin(q2) + A*sin(q1)*cos(q2) ); > (%o..) - sin(q2 - q1) A > > Why I cannot do the same thing if instead of a variable like 'A' I have a > numerical constant? > > (%i..) trigreduce( -4*cos(q1)*sin(q2) + 4*sin(q1)*cos(q2) ); > > sin(q2 + q1) sin(q2 - q1) sin(q2 + q1) sin(q2 - q1) > (%o..) 4 (------------ - ------------) - 4 (------------ + ------------) > 2 2 2 2 > > I would really like to see > - sin(q2 - q1) 4 > > How can I achieve this? > > Thanks a lot > Regards, > MF > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.frigerio at iit.it Wed Jan 25 09:36:05 2012 From: marco.frigerio at iit.it (Marco Frigerio) Date: Wed, 25 Jan 2012 16:36:05 +0100 Subject: [Maxima] common factor reduction In-Reply-To: References: <4F1E8126.8030707@iit.it> Message-ID: <4F202165.50601@iit.it> Thank you. But look at this: (%i92) foo; (%o92) 0.35 sin(q1) cos(q2) - 0.35 cos(q1) sin(q2) (%i93) ratsimp(trigreduce(foo)); rat: replaced 0.35 by 7/20 = 0.35 rat: replaced -0.35 by -7/20 = -0.35 7 sin(q2 - q1) (%o93) - -------------- 20 There is still an awful denominator there (yes I know I could use float to get rid of it. But sometimes I would also need an additional 'expand') The point is why I cannot simply have the common factor to be written once (sorry I'm not sure how to say this in english..) 0.35 ( sin(q1) cos(q2) - cos(q1) sin(q2)) which is really independent of the fact that I have trigonometric functions. 'factor' somehow does that, but it introduces denominators as well: (%i125) factor(foo); rat: replaced 0.35 by 7/20 = 0.35 rat: replaced -0.35 by -7/20 = -0.35 7 (cos(q1) sin(q2) - sin(q1) cos(q2)) (%o125) - ------------------------------------- 20 Can I maybe avoid that 'rat' replaces 0.35? thanks again M On 01/25/2012 11:46 AM, Alexander Klimov wrote: > On Tue, 24 Jan 2012, Marco Frigerio wrote: >> (%i..) trigreduce( -4*cos(q1)*sin(q2) + 4*sin(q1)*cos(q2) ); >> >> sin(q2 + q1) sin(q2 - q1) sin(q2 + q1) sin(q2 - q1) >> (%o..) 4 (------------ - ------------) - 4 (------------ + ------------) >> 2 2 2 2 >> >> I would really like to see >> - sin(q2 - q1) 4 >> >> How can I achieve this? > > %,ratsimp; > From fateman at eecs.berkeley.edu Wed Jan 25 11:34:31 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 25 Jan 2012 09:34:31 -0800 Subject: [Maxima] common factor reduction In-Reply-To: <4F202165.50601@iit.it> References: <4F1E8126.8030707@iit.it> <4F202165.50601@iit.it> Message-ID: <4F203D27.9070201@eecs.berkeley.edu> On 1/25/2012 7:36 AM, Marco Frigerio wrote: You could start by not using 0.35, but some symbol like A35. Or you could do this: keepfloat:true. From sangwinc at for.mat.bham.ac.uk Wed Jan 25 13:02:02 2012 From: sangwinc at for.mat.bham.ac.uk (Chris Sangwin) Date: Wed, 25 Jan 2012 19:02:02 +0000 (GMT) Subject: [Maxima] gcd and simp:false; In-Reply-To: References: <4D8E0A85.4090602@uni-bonn.de> <4D8E8DBD.2080708@uni-bonn.de> Message-ID: I'm confused why the gcd function does not respect simp:false. (%i1) simp:false$ (%i2) gcd(x,y); (%o2) 1 Any suggestions? Chris From fateman at eecs.berkeley.edu Wed Jan 25 12:55:05 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 25 Jan 2012 10:55:05 -0800 Subject: [Maxima] gcd and simp:false; In-Reply-To: References: <4D8E0A85.4090602@uni-bonn.de> <4D8E8DBD.2080708@uni-bonn.de> Message-ID: <4F205009.702@eecs.berkeley.edu> On 1/25/2012 11:02 AM, Chris Sangwin wrote: > > I'm confused why the gcd function does not respect simp:false. > > (%i1) simp:false$ > (%i2) gcd(x,y); > (%o2) 1 > > Any suggestions? > Chris > The gcd function is being evaluated, not simplified. If you turn off evaluation also, you have converted your maxima system into a brick. In particular you could never turn evaluation back on without evaluating something. I think we've discussed this before, but simp:false is almost always a bad idea. If you don't want simplification, maybe you should be using a different program. RJF From dlakelan at street-artists.org Wed Jan 25 13:48:43 2012 From: dlakelan at street-artists.org (dlakelan) Date: Wed, 25 Jan 2012 11:48:43 -0800 Subject: [Maxima] defrule for altering sum expressions? Message-ID: <4F205C9B.7090609@street-artists.org> I'd like to define the following rule and have it convert a sum into a "nearest neighbor sum" so that the sum is from i-1 to i+1 no matter what the original bounds are. Any ideas why it doesn't work? numorsym(a) := numberp(a) or symbolp(a); defmatch(A,true, [low,high],numorsym); defrule(nearestneighborsum,sum(A,j,low,high),sum(A,j,i-1,i+1)); but it doesn't work: (%i71) numorsym(x) := numberp(x) or symbolp(x); (%o71) numorsym(x) := numberp(x) or symbolp(x) (%i72) matchdeclare(A,true,[low,high],numorsym); (%o72) done (%i73) defrule(nearestneighborsum,sum(A,j,low,high),sum(A,j,i-1,i+1)); (%o73) nearestneighborsum : sum(A, j, low, high) -> sum(A, j, i - 1, i + 1) (%i74) nearestneighborsum(sum(foobar[j],j,1,N)); (%o74) false From willisb at unk.edu Wed Jan 25 14:40:09 2012 From: willisb at unk.edu (Barton Willis) Date: Wed, 25 Jan 2012 14:40:09 -0600 Subject: [Maxima] defrule for altering sum expressions? In-Reply-To: <4F205C9B.7090609@street-artists.org> References: <4F205C9B.7090609@street-artists.org> Message-ID: Maybe this is a sum noun / verb thing? My favorite way to do such transformations is to substitute a lambda form for the function (notice the nounify('sum)). (%i156) change_sum_limits(e,lo,hi) := subst(nounify('sum) = lambda([q,k,a,b], sum(q,k,lo,hi)),e)$ (%i157) change_sum_limits(42 + sum(f(k),k,a,b),i-1,i+1); (%o157) f(i+1)+f(i)+f(i-1)+42 --Barton maxima-bounces at math.utexas.edu wrote on 01/25/2012 01:48:43 PM: > From: dlakelan > To: Maxima Mailing List > Date: 01/25/2012 01:47 PM > Subject: [Maxima] defrule for altering sum expressions? > Sent by: maxima-bounces at math.utexas.edu > > I'd like to define the following rule and have it convert a sum into a > "nearest neighbor sum" so that the sum is from i-1 to i+1 no matter what > the original bounds are. Any ideas why it doesn't work? > > numorsym(a) := numberp(a) or symbolp(a); > > defmatch(A,true, [low,high],numorsym); > > defrule(nearestneighborsum,sum(A,j,low,high),sum(A,j,i-1,i+1)); > > but it doesn't work: > > (%i71) numorsym(x) := numberp(x) or symbolp(x); > (%o71) numorsym(x) := numberp(x) or symbolp(x) > (%i72) matchdeclare(A,true,[low,high],numorsym); > (%o72) done > (%i73) defrule(nearestneighborsum,sum(A,j,low,high),sum(A,j,i-1,i+1)); > (%o73) nearestneighborsum : sum(A, j, low, high) -> sum(A, j, i - 1, i + 1) > (%i74) nearestneighborsum(sum(foobar[j],j,1,N)); > (%o74) false > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From dlakelan at street-artists.org Wed Jan 25 16:02:11 2012 From: dlakelan at street-artists.org (dlakelan) Date: Wed, 25 Jan 2012 14:02:11 -0800 Subject: [Maxima] defrule for altering sum expressions? In-Reply-To: References: <4F205C9B.7090609@street-artists.org> Message-ID: <4F207BE3.9000608@street-artists.org> On 01/25/2012 12:40 PM, Barton Willis wrote: > Maybe this is a sum noun / verb thing? > > My favorite way to do such transformations is to substitute a lambda form > for the function (notice the nounify('sum)). > > (%i156) change_sum_limits(e,lo,hi) := subst(nounify('sum) = > lambda([q,k,a,b], sum(q,k,lo,hi)),e)$ > > (%i157) change_sum_limits(42 + sum(f(k),k,a,b),i-1,i+1); > (%o157) f(i+1)+f(i)+f(i-1)+42 > > --Barton yes, this is the solution I recently came upon myself. Actually I named the function I was using, but a lambda form would make sense too. From macrakis at alum.mit.edu Wed Jan 25 17:30:24 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 25 Jan 2012 18:30:24 -0500 Subject: [Maxima] gcd and simp:false; In-Reply-To: References: <4D8E0A85.4090602@uni-bonn.de> <4D8E8DBD.2080708@uni-bonn.de> Message-ID: Maxima has two kinds of functions which share the same syntax: routines (evaluated or programming functions) and simplifying (mathematical) functions. gcd(...) is a routine which returns a value, not a mathematical function. In particular, gcd(...) is the *polynomial GCD* of its arguments* .* Turning simp off does not affect routines, only simplifications. It sounds as though you'd like a simplifying rational gcd (as opposed to polynomial gcd), which is a reasonable idea, but one that (as far as I know) has not been implemented in Maxima. Presumably you'd want any simplifications to be true for all values of all variables. You might think, for example, that while gcd(x,y)=gcd(y,x) and gcd(x,x+2)=gcd(x+3,x+1) can't be simplified, you'd still have gcd(x,x^2) = x. But this is not true: gcd(1/2,1/4) = 1/4 -- at least by the definition Maxima uses. If you can come up with a consistent, useful definition of a simplifying gcd, it shouldn't be that difficult to program -- just don't call it "gcd"! -s On Wed, Jan 25, 2012 at 14:02, Chris Sangwin wrote: > > I'm confused why the gcd function does not respect simp:false. > > (%i1) simp:false$ > (%i2) gcd(x,y); > (%o2) 1 > > Any suggestions? > Chris > > > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrredford at yahoo.com Wed Jan 25 20:47:09 2012 From: jrredford at yahoo.com (James Redford) Date: Wed, 25 Jan 2012 18:47:09 -0800 (PST) Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite Message-ID: <1327546029.87394.YahooMailClassic@web121806.mail.ne1.yahoo.com> Hi, Mr. Billinghurst. When you said "I have confirmed that these failures do not occur in a maxima-5.26.0 built with gcl/gcc-4.6.2", I assume you mean built from the standard Maxima 5.26.0 source code release, as opposed to a CVS snapshot. If that is correct, then I figure this is how the official Windows Maxima 5.26.0 binary ought to be built. Again, if that assumption is correct, then will you please post a download link to this Windows binary built from the official Maxima 5.26.0 source code release? I tested the below binary, which you stated is built from "maxima cvs 2012-01-16 using gcc-4.6.2" ( http://www.math.utexas.edu/pipermail/maxima/2012/027475.html ): http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe 33,114,409 bytes MD5: 598835f2e8210664f192dd58d3a1fc84 Below is the build information: Maxima version: 5.26.0 Maxima build date: 10:0 1/17/2012 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 Below is the result I obtained from running the command run_testsuite(); : No unexpected errors found out of 9,128 tests. real time : 338.510 secs run-gbc time : 309.220 secs child run time : 0.000 secs gbc time : 29.290 secs (%o0) done (%i1) ######################################## [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite David Billinghurst dbmaxima at gmail.com Wed Jan 25 00:00:08 CST 2012 On 24/01/2012 1:54 PM, David Billinghurst wrote: > On 24/01/2012 1:21 PM, James Redford wrote: >> I downloaded the following binary: >> >> http://iweb.dl.sourceforge.net/project/maxima/Maxima-Windows/5.26.0-Windows/maxima-5.26.0.exe >> >> >> 30,364,448 bytes >> MD5: 2b9342ec1130ab56189dd08c71f1be26 >> >> After running the command "run_testsuite(display_all=true, >> display_known_bugs=true);", the following is the result: >> >> Error summary: >> Errors found in >> C:/program1/maxima/share/maxima/5.26.0/tests/rtest16.mac, problems: >> (185 186) >> >> >> > Thanks for the report. That would be these tests below. They are a > known problem > with gcl under windows. Unfortunately the testsuite doesn't allow us > to make > known errors conditional on platform and lisp. > > Interestingly, I don't see them with my experimental windows build of > CVS maxima > using gcl/gcc-4.6.2. > (http://www.math.utexas.edu/pipermail/maxima/2012/027475.html) > Another reason to test this new build. > I have confirmed that these failures do not occur in a maxima-5.26.0 built with gcl/gcc-4.6.2 From c.j.sangwin at bham.ac.uk Wed Jan 25 13:05:59 2012 From: c.j.sangwin at bham.ac.uk (Christopher Sangwin) Date: Wed, 25 Jan 2012 19:05:59 +0000 Subject: [Maxima] gcd and simp:false; In-Reply-To: <4F205009.702@eecs.berkeley.edu> References: <4D8E0A85.4090602@uni-bonn.de> <4D8E8DBD.2080708@uni-bonn.de> , <4F205009.702@eecs.berkeley.edu> Message-ID: <4CBBDBC075F4FA42A00426E1246A1D8330F8F8E91D@EPSEXC1.adf.bham.ac.uk> Richard, Yes, we have talked about this, and despite my best efforts I still struggle to understand when something is "evaluated" and when something else is "simplified" in Maxima. (%i1) simp:false$ (%i2) gcd(x,y); (%o2) 1 (%i3) 1+1; (%o3) 1+1 Of course everything has to be evaluated! It just isn't clear to me when the simplifier is used and when it isn't. I know the view "if you want simp:false then use something else" has been expressed before. I can't argue with this. But, we could replace this with "for all , if you want then use something else" which would also be true, but I'm not usually that nihilistic! :-) C ________________________________________ From: Richard Fateman [fateman at eecs.berkeley.edu] Sent: 25 January 2012 18:55 To: Chris Sangwin Cc: maxima at math.utexas.edu Subject: Re: [Maxima] gcd and simp:false; On 1/25/2012 11:02 AM, Chris Sangwin wrote: > > I'm confused why the gcd function does not respect simp:false. > > (%i1) simp:false$ > (%i2) gcd(x,y); > (%o2) 1 > > Any suggestions? > Chris > The gcd function is being evaluated, not simplified. If you turn off evaluation also, you have converted your maxima system into a brick. In particular you could never turn evaluation back on without evaluating something. I think we've discussed this before, but simp:false is almost always a bad idea. If you don't want simplification, maybe you should be using a different program. RJF From wilhelm.haager at htlstp.ac.at Thu Jan 26 02:38:10 2012 From: wilhelm.haager at htlstp.ac.at (Wilhelm Haager) Date: Thu, 26 Jan 2012 09:38:10 +0100 Subject: [Maxima] Function returning the version number Message-ID: Hi, is the a possibility to get the version of Maxima within a Maxima session, i.e. a function which returns the version number (NOT within the command line like "maxima --version")? I have not found any possibility yet. That would be very useful for conditionals like "if version < 5.25 then ... else...;" Thanks in advance Wilhelm Haager From filonenko.mikhail at gmail.com Thu Jan 26 02:45:14 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Thu, 26 Jan 2012 10:45:14 +0200 Subject: [Maxima] Function returning the version number In-Reply-To: References: Message-ID: You can get value of common lisp variable *maxima-version* in maxima environment: ?\*maxima\-version\* 2012/1/26 Wilhelm Haager : > Hi, > > is the a possibility to get the version of Maxima within a Maxima session, > i.e. a function which returns the version number (NOT within the command > line > like "maxima --version")? > > I have not found any possibility yet. > > That would be very useful for conditionals like > "if version < 5.25 then ... else...;" > > Thanks in advance > Wilhelm Haager > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- With best regards, Michael Filonenko From dbmaxima at gmail.com Thu Jan 26 03:28:48 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Thu, 26 Jan 2012 20:28:48 +1100 Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite In-Reply-To: <1327546029.87394.YahooMailClassic@web121806.mail.ne1.yahoo.com> References: <1327546029.87394.YahooMailClassic@web121806.mail.ne1.yahoo.com> Message-ID: <4F211CD0.7080007@gmail.com> On 26/01/2012 1:47 PM, James Redford wrote: > Hi, Mr. Billinghurst. When you said "I have confirmed that these failures do not occur in a maxima-5.26.0 built with gcl/gcc-4.6.2", I assume you mean built from the standard Maxima 5.26.0 source code release, as opposed to a CVS snapshot. If that is correct, then I figure this is how the official Windows Maxima 5.26.0 binary ought to be built. Again, if that assumption is correct, then will you please post a download link to this Windows binary built from the official Maxima 5.26.0 source code release? > > I tested the below binary, which you stated is built from "maxima cvs 2012-01-16 using gcc-4.6.2" ( http://www.math.utexas.edu/pipermail/maxima/2012/027475.html ): > > http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe James, Thanks for the feedback. You are correct. I built the maxima from the 5.26.0 release tarball and ran the testsuite without error. It is a bit more work to generate a release but I will give it a go over the weekend. I'd like to see some more testing before we make the change, as I can't build gcl or maxima under windows 7 - only winXP. It seems to work OK, but I haven't tested much. David From rswarbrick at gmail.com Thu Jan 26 03:54:51 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Thu, 26 Jan 2012 09:54:51 +0000 Subject: [Maxima] gcd and simp:false; References: <4D8E0A85.4090602@uni-bonn.de> <4D8E8DBD.2080708@uni-bonn.de> <4F205009.702@eecs.berkeley.edu> <4CBBDBC075F4FA42A00426E1246A1D8330F8F8E91D@EPSEXC1.adf.bham.ac.uk> Message-ID: Christopher Sangwin writes: > Richard, > > Yes, we have talked about this, and despite my best efforts I still > struggle to understand when something is "evaluated" and when > something else is "simplified" in Maxima. > > (%i1) simp:false$ > (%i2) gcd(x,y); > (%o2) 1 > > (%i3) 1+1; > (%o3) 1+1 > > Of course everything has to be evaluated! It just isn't clear to me > when the simplifier is used and when it isn't. I know the view "if One way to think of it is as a (very important!) implementation detail. In Maxima, something like "gcd(x,y)" is represented as applying the operator GCD to two arguments, X and Y. Similarly, "x+y" is applying the operator + to the two arguments X and Y. Now, there are three things that can happen (1) Maybe there's a function called gcd. In which case, it will be run with the given arguments and its result will replace what you started with. This is what's happening here. (2) If no change, maybe there's a rule for how to simplify gcd(x,y) An example is something like sin(x^2)+cos(x^2). The toplevel operator of the expression is "+", and spotting that this is 1 isn't really to do with "+" per se. Rules that spot this sort of thing are called simplification rules. Classes of these rules can be turned on and off using variables like trigsign, algebraic and many many others. More dramatically, you can turn them all off with simp: false. (3) Finally, if Maxima has no idea what to do with an expression, it just returns it, in the hope that some day in the future you can tell it something else helpful. I hope this makes the simplification/function distinction make a bit more sense. I've ignored some details like simplification of arguments and simplifying the result of simplifications and and and, but what I've wrote is sort of true. Rupert PS. Before anyone points it out, yes I do know about the lisp/Maxima $naming scheme. But that's irrelevant to the question above. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From rswarbrick at gmail.com Thu Jan 26 05:25:55 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Thu, 26 Jan 2012 11:25:55 +0000 Subject: [Maxima] defrule bug 1204711 Message-ID: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> Hi, I noticed this bug[1] the other day and spent a while thinking about it. The way that simplification rules for operators currently works is a property on the symbol called (confusingly) 'operators. To declare a simplification rule, you define a function and set (get 'myoperator 'operators) to that function. To chain rules in tellsimp and tellsimpafter, there is a complicated system, where the new rules call previously defined rules in the start/end of their function bodies. This is rather brittle and, since the interiors of the functions can't be changed after the fact, causes bugs like this one. I wrote a different implementation, where 'operators is kept (for backwards compatibility), but just holds one rule, with no chaining. tellsimp and tellsimpafter push functions onto a list stored at a different property, which get called in order. Current status: It works, but I haven't implemented some of the tidying up that removerule did, so there's a bit of work to do yet. I was worried about the performance: surely such a brittle system as the old one had to be done for performance reasons! So I ran the testsuite for timing, and it actually came in faster (30 seconds faster on about 10 minutes total), but this might have been down to noise. There are no new failed tests. My question is the following: Should I spend a few more hours making a tidied up patchset and testing it as thoroughly as possible? Would such a change be merged? I don't particularly fancy spending hours on something that will be rejected out of hand just because it touches src/simp.lisp... Rupert Footnotes: [1] http://sourceforge.net/tracker/?func=detail&aid=1204711&group_id=4933&atid=104933 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From laoluomoks at gmail.com Thu Jan 26 07:45:38 2012 From: laoluomoks at gmail.com (Olaoluwa Omokanwaiye) Date: Thu, 26 Jan 2012 14:45:38 +0100 Subject: [Maxima] Maxima on Mac OS X Message-ID: Hi there, Hope this mail meets all well. I have wxMaxima (Maxima 5.25.1) installed on my Mac OS X (version 10.6.8) I have not found a manual to help guide through, is there anyone with a complete and easy guide to use and maximize this powerful tool? Is there anyone that uses something similar on a Mac system. Kind regards Ola From alexanderk.hansen at gmail.com Thu Jan 26 07:55:58 2012 From: alexanderk.hansen at gmail.com (Alexander Hansen) Date: Thu, 26 Jan 2012 08:55:58 -0500 Subject: [Maxima] Maxima on Mac OS X In-Reply-To: References: Message-ID: <4F215B6E.3@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 1/26/12 8:45 AM, Olaoluwa Omokanwaiye wrote: > Hi there, > > Hope this mail meets all well. I have wxMaxima (Maxima 5.25.1) > installed on my Mac OS X (version 10.6.8) I have not found a > manual to help guide through, is there anyone with a complete and > easy guide to use and maximize this powerful tool? Is there anyone > that uses something similar on a Mac system. > > Kind regards Ola I would be surprised if your Maxima installation didn't include its extensive manual. If you select Help -> Maxima Help from the wxMaxima applications menu, does that manual not show up? - -- Alexander Hansen, Ph.D. Fink User Liaison http://finkakh.wordpress.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8hW24ACgkQB8UpO3rKjQ+QOQCfTrUvosae/h3nkUAFB61/ZskJ 8EkAoJkOF2E5EZiwlm/nVx8RBHWBAXqT =fSfr -----END PGP SIGNATURE----- From laoluomoks at gmail.com Thu Jan 26 08:17:22 2012 From: laoluomoks at gmail.com (Olaoluwa Omokanwaiye) Date: Thu, 26 Jan 2012 15:17:22 +0100 Subject: [Maxima] Maxima on Mac OS X In-Reply-To: <4F215B6E.3@gmail.com> References: <4F215B6E.3@gmail.com> Message-ID: Thanks kind sir, I see a blue question mark icon meaning "show maxima help" kind regards Ola On 1/26/12, Alexander Hansen wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 1/26/12 8:45 AM, Olaoluwa Omokanwaiye wrote: >> Hi there, >> >> Hope this mail meets all well. I have wxMaxima (Maxima 5.25.1) >> installed on my Mac OS X (version 10.6.8) I have not found a >> manual to help guide through, is there anyone with a complete and >> easy guide to use and maximize this powerful tool? Is there anyone >> that uses something similar on a Mac system. >> >> Kind regards Ola > > I would be surprised if your Maxima installation didn't include its > extensive manual. > > If you select Help -> Maxima Help from the wxMaxima applications menu, > does that manual not show up? > > - -- > Alexander Hansen, Ph.D. > Fink User Liaison > http://finkakh.wordpress.com/ > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (Darwin) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAk8hW24ACgkQB8UpO3rKjQ+QOQCfTrUvosae/h3nkUAFB61/ZskJ > 8EkAoJkOF2E5EZiwlm/nVx8RBHWBAXqT > =fSfr > -----END PGP SIGNATURE----- > -- laolu omokanwaiye From dbmaxima at gmail.com Thu Jan 26 08:40:55 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Fri, 27 Jan 2012 01:40:55 +1100 Subject: [Maxima] Errors in Windows Maxima 5.26.0 run_testsuite In-Reply-To: <4F211CD0.7080007@gmail.com> References: <1327546029.87394.YahooMailClassic@web121806.mail.ne1.yahoo.com> <4F211CD0.7080007@gmail.com> Message-ID: <4F2165F7.6080508@gmail.com> On 26/01/2012 8:28 PM, David Billinghurst wrote: > On 26/01/2012 1:47 PM, James Redford wrote: >> Hi, Mr. Billinghurst. When you said "I have confirmed that these >> failures do not occur in a maxima-5.26.0 built with gcl/gcc-4.6.2", I >> assume you mean built from the standard Maxima 5.26.0 source code >> release, as opposed to a CVS snapshot. If that is correct, then I >> figure this is how the official Windows Maxima 5.26.0 binary ought to >> be built. Again, if that assumption is correct, then will you please >> post a download link to this Windows binary built from the official >> Maxima 5.26.0 source code release? >> >> I tested the below binary, which you stated is built from "maxima cvs >> 2012-01-16 using gcc-4.6.2" ( >> http://www.math.utexas.edu/pipermail/maxima/2012/027475.html ): >> >> http://billinghurst.customer.netspace.net.au/maxima-5.26.0-test.exe > James, > > Thanks for the feedback. You are correct. I built the maxima from the > 5.26.0 release tarball and ran the testsuite without error. It is a > bit more work to generate a release but I will give it a go over the > weekend. > > I'd like to see some more testing before we make the change, as I > can't build gcl or maxima under windows 7 - only winXP. It seems to > work OK, but I haven't tested much. > > David See if you can break http://billinghurst.customer.netspace.net.au/maxima-5.26.0_gcl_gcc-4.6.2.exe From alexanderk.hansen at gmail.com Thu Jan 26 08:55:17 2012 From: alexanderk.hansen at gmail.com (Alexander Hansen) Date: Thu, 26 Jan 2012 09:55:17 -0500 Subject: [Maxima] Maxima on Mac OS X In-Reply-To: References: <4F215B6E.3@gmail.com> Message-ID: <4F216955.3090705@gmail.com> On 1/26/12 9:17 AM, Olaoluwa Omokanwaiye wrote: > Thanks kind sir, I see a blue question mark icon meaning "show maxima help" > > kind regards > Ola > > I have that on my own wxMaxima. When I push it, I get a window that displays the manual. From robert.dodier at gmail.com Thu Jan 26 15:22:14 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 26 Jan 2012 14:22:14 -0700 Subject: [Maxima] 5.26 installer for Windows now apparently visible in file manager Message-ID: Hi, I uploaded maxima-5.26.0.exe to the SF file manager again and now it seems to be visible. Can someone confirm? See if you can find it this way: go to http://sourceforge.net/projects/maxima and then follow Files >> Maxima-Windows >> 5.26.0-Windows best Robert Dodier From macrakis at alum.mit.edu Thu Jan 26 15:29:12 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 26 Jan 2012 16:29:12 -0500 Subject: [Maxima] cf documentation Message-ID: The 'cf' (continued fraction) documentation should mention that cf expansions are exact for rational numbers, but are cut off at ratepsilon (for floats) and 10^-fpprec (for bigfloats). -s -------------- next part -------------- An HTML attachment was scrubbed... URL: From erich.neuwirth at univie.ac.at Thu Jan 26 15:45:10 2012 From: erich.neuwirth at univie.ac.at (Erich Neuwirth) Date: Thu, 26 Jan 2012 22:45:10 +0100 Subject: [Maxima] 5.26 installer for Windows now apparently visible in file manager In-Reply-To: References: Message-ID: <4F21C966.4020700@univie.ac.at> It is visible here, http://sourceforge.net/projects/maxima/files/Maxima-Windows/5.26.0-Windows/ But the download button on http://sourceforge.net/projects/maxima/ still says maxix-5.25.1-gcl.exe On 1/26/2012 10:22 PM, Robert Dodier wrote: > Hi, > > I uploaded maxima-5.26.0.exe to the SF file manager again > and now it seems to be visible. Can someone confirm? > See if you can find it this way: go to http://sourceforge.net/projects/maxima > and then follow Files >> Maxima-Windows >> 5.26.0-Windows > > best > > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From ferriste at gmail.com Thu Jan 26 15:59:12 2012 From: ferriste at gmail.com (Stefano Ferri) Date: Thu, 26 Jan 2012 22:59:12 +0100 Subject: [Maxima] 5.26 installer for Windows now apparently visible in file manager In-Reply-To: <4F21C966.4020700@univie.ac.at> References: <4F21C966.4020700@univie.ac.at> Message-ID: It is working now. Anyway, I'm pretty sure this was a syncronization problem of sourceforge servers, it takes some hours to complete. I already noticed that some months ago when the executable built with ccl was substituted by the gcl build. Stefano 2012/1/26 Erich Neuwirth > It is visible here, > > http://sourceforge.net/projects/fofor mer > memaxima/files/Maxima-Windows/5.26.0-Windows/ > > But the download button on > http://sourceforge.net/projects/maxima/ > still says maxix-5.25.1-gcl.exe > > On 1/26/2012 10:22 PM, Robert Dodier wrote: > > Hi, > > > > I uploaded maxima-5.26.0.exe to the SF file manager again > > and now it seems to be visible. Can someone confirm? > > See if you can find it this way: go to > http://sourceforge.net/projects/maxima > > and then follow Files >> Maxima-Windows >> 5.26.0-Windows > > > > best > > > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Fri Jan 27 00:07:22 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 26 Jan 2012 23:07:22 -0700 Subject: [Maxima] announcement: Maxima 5.26 Message-ID: Please distribute this message as you see fit. Announcing Maxima 5.26 Maxima is a GPL'd branch of Macsyma, the venerable symbolic computation system. Maxima 5.26 is a bug fix and feature enhancement release. The current version is 5.26.0. Maxima has functions to work with polynomials, matrices, finite sets, integrals, derivatives and differential equations, linear algebra, plotting, floating point and arbitrary-precision arithmetic, etc. Maxima can run on MS Windows and various flavors of Unix, including MacOS X. There is a precompiled executable installer for Windows, RPM's for Linux, and source code tar.gz. Maxima is implemented in Common Lisp; several Lisps can compile and run Maxima, including CMUCL, SBCL, Clisp, GCL, and ECL. The Maxima project welcomes new participants. You can contribute in several ways: reporting bugs, fixing bugs, writing new add-on packages, revising core functions, user interfaces, documentation, etc. Why not see what's happening on the mailing list and consider how you might contribute to the project. Thanks to everyone who contributed to the 5.26 release. Regards, Robert Dodier Maxima developer and 5.26 release manager Project page: http://sourceforge.net/projects/maxima Documentation: http://maxima.sourceforge.net/documentation.html Bug reports. You must create a Sourceforge login before filing a bug report (anonymous reports no longer allowed). http://sourceforge.net/tracker/?group_id=4933&atid=104933 Mailing list. Please sign up before posting a message. http://maxima.sourceforge.net/maximalist.html Download page: http://sourceforge.net/projects/maxima/files Ports page: http://apps.sourceforge.net/mediawiki/maxima/index.php?title=Maxima_ports Project home page: http://maxima.sourceforge.net Change log: New items in core: * quadpack function quad_qagp (QAGP algorithm) * quadpack function quad_control (control error messages) New items in share: * package draw: option draw_realpart, object wired_surface * package lapack: function zgeev Other changes: * reference manual: reorganization, editing, translations * package ezunits: bug fixes, minor extensions, more tests Bug fixes: 3439895 makeset can't deal with sets of sets 3437268 expand doesn't fully expand 3426847 float hypergeometric error | fix 3410704 limit gives the wrong answer 3404854 default for logexapand 3398066 radcan generates floats? 3398047 trigrat() causes an error 3396631 equal terms produce different results 3390551 Error break in rtest2 with display_all=true 3389830 Error break in rtest15 with linear display 3388801 integrate error 3377347 log(1/(1+%i)) gives error 3376603 sign of declared imaginary 3358420 nfloat bug 3354672 Maxima hangs when assigning modulus:-3 3276461 Inaccurate Limit Evaluation 3213380 "-"(a,b) with simp:false prints incorrectly 3207833 Option variable lognumer has no effect 3185855 radcan warns about float-convert 3151302 Wrong plotting of functions based on spherical harmonics 2995695 Documentation for resultant is confusing unnumbered: bessel_y integrals (mailing list circa 2011-10-22) unnumbered: f90 output format (mailing list circa 2011-09-22) unnumbered: Problem with save (mailing list 2011-09-10) unnumbered: error function lsquares (mailing list 2011-08-25) From robert.dodier at gmail.com Fri Jan 27 00:29:03 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 26 Jan 2012 23:29:03 -0700 Subject: [Maxima] defrule bug 1204711 In-Reply-To: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> Message-ID: On 1/26/12, Rupert Swarbrick wrote: > http://sourceforge.net/tracker/?func=detail&aid=1204711&group_id=4933&atid=104933 Well, I suspect it would require fewer changes to preserve the existing chaining scheme, but if so, then we'll have to work out a way to fix up the chain when one rule is removed. I can't think of a way right now. Maybe you ought to go ahead and work on this other approach. best, Robert Dodier From tomdean at speakeasy.org Fri Jan 27 00:34:14 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Thu, 26 Jan 2012 22:34:14 -0800 Subject: [Maxima] maxima 5.26.0 Build Failure on FreeBSD Message-ID: <4F224566.5020908@speakeasy.org> uname -a FreeBSD P9X79.tddhome 9.0-STABLE FreeBSD 9.0-STABLE #0: Wed Jan 4 14:16:41 PST 2012 tomdean at P9X79.tddhome:/usr/src/sys/GENERIC amd64 # ./configure --with-clisp ... # make ... Making all in info pattern=`printf "\r$"` ; bad_files=`find . -name '*.texi' -print | xargs /usr/bin/grep -E -l -e "$pattern"` ; [ -z "$bad_files" ] || ( echo "WARNING: The following files have DOS-style EOLs: $bad_files" ; echo "Run /doc/info/fix_crlf to fix the problem." ) *** Error code 1 Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0/doc/info. *** Error code 1 Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0/doc/info. *** Error code 1 Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0/doc. *** Error code 1 Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0. Tom Dean From fateman at eecs.berkeley.edu Fri Jan 27 00:36:01 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Thu, 26 Jan 2012 22:36:01 -0800 Subject: [Maxima] defrule bug 1204711 In-Reply-To: References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> Message-ID: <4F2245D1.9090405@eecs.berkeley.edu> On 1/26/2012 10:29 PM, Robert Dodier wrote: > On 1/26/12, Rupert Swarbrick wrote: > >> http://sourceforge.net/tracker/?func=detail&aid=1204711&group_id=4933&atid=104933 > Well, I suspect it would require fewer changes to preserve > the existing chaining scheme, but if so, then we'll have to > work out a way to fix up the chain when one rule is removed. > I can't think of a way right now. Maybe you ought to go ahead > and work on this other approach. > > best, > > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima If you want to retract a particular simp rule among a whole bunch, I suggest you keep a list of your rules and assert via tellsimp, etc. when you want them to operate. When you want to remove one, kill them all. Then edit the list of rules, and re-assert them. That way you don't have to change any of the system code. It is unlikely that you are going to be faster than the current method, though you might be insignificantly slower. At least if your computation is in fact the same one. Which it might not be. RJF From piminusmeson at bk.ru Fri Jan 27 00:42:54 2012 From: piminusmeson at bk.ru (Dmitry Shkirmanov) Date: Fri, 27 Jan 2012 10:42:54 +0400 Subject: [Maxima] integrate(sin(x)^2/x,x,minf,inf); In-Reply-To: References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> Message-ID: <4F22476E.4030602@bk.ru> (%i1) integrate(sin(x)^2/x,x,minf,inf); Principal Value log(- 1) (%o1) - -------- 2 (%i2) integrate(sin(x)^2/x,x,10000000000,10000000000); (%o2) 0 (%i3) Function sin(x)^2/x is odd function, so it seems that integrate(sin(x)^2/x,x,minf,inf) must return 0. Am i wrong? From robert.dodier at gmail.com Fri Jan 27 00:59:28 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 26 Jan 2012 23:59:28 -0700 Subject: [Maxima] maxima 5.26.0 Build Failure on FreeBSD In-Reply-To: <4F224566.5020908@speakeasy.org> References: <4F224566.5020908@speakeasy.org> Message-ID: On 1/26/12, Thomas D. Dean wrote: > pattern=`printf "\r$"` ; bad_files=`find . -name '*.texi' -print | > xargs /usr/bin/grep -E -l -e "$pattern"` ; [ -z "$bad_files" ] || ( > echo "WARNING: The following files have DOS-style EOLs: $bad_files" ; > echo "Run /doc/info/fix_crlf to fix the problem." ) > *** Error code 1 I guess this means the shell interpreter didn't like that command. Is grep not in /usr/bin? does it not take -E -l -e as arguments? or the conditional expression is not recognized? Just guessing. best Robert Dodier From tomdean at speakeasy.org Fri Jan 27 01:22:36 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Thu, 26 Jan 2012 23:22:36 -0800 Subject: [Maxima] maxima 5.26.0 Build Failure on FreeBSD In-Reply-To: References: <4F224566.5020908@speakeasy.org> Message-ID: <4F2250BC.1000504@speakeasy.org> On 01/26/12 22:59, Robert Dodier wrote: > On 1/26/12, Thomas D. Dean wrote: > >> pattern=`printf "\r$"` ; bad_files=`find . -name '*.texi' -print | >> xargs /usr/bin/grep -E -l -e "$pattern"` ; [ -z "$bad_files" ] || ( >> echo "WARNING: The following files have DOS-style EOLs: $bad_files" ; >> echo "Run /doc/info/fix_crlf to fix the problem." ) >> *** Error code 1 > > I guess this means the shell interpreter didn't like that command. > Is grep not in /usr/bin? does it not take -E -l -e as arguments? > or the conditional expression is not recognized? Just guessing. > I used sh # cd doc/info # pattern=`printf "\r$"` # bad_files=`find . -name '*.texi' -print | xargs /usr/bin/grep -E -l -e "$pattern"` # echo $bad_files bad_files is empty # which grep /usr/bin/grep # grep --version grep (GNU grep) 2.5.1-FreeBSD Which allows -E -l -e I started fresh. No problem. Maybe something strange in unpacking/configure/code-rot? make check passed, with the exception of known errors. Thanks, Tom Dean From tomdean at speakeasy.org Fri Jan 27 01:51:59 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Thu, 26 Jan 2012 23:51:59 -0800 Subject: [Maxima] integrate(sin(x)^2/x,x,minf,inf); In-Reply-To: <4F22476E.4030602@bk.ru> References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F22476E.4030602@bk.ru> Message-ID: <4F22579F.9010103@speakeasy.org> On 01/26/12 22:42, Dmitry Shkirmanov wrote: > (%i1) integrate(sin(x)^2/x,x,minf,inf); > Principal Value > log(- 1) > (%o1) - -------- > 2 > (%i2) integrate(sin(x)^2/x,x,10000000000,10000000000); > (%o2) 0 > (%i3) > Maple 15 can be torqued to returning 0.*I. > integrate(sin(x)^2/x,x=-inf..inf); -1/2 ln(-inf) + 1/2 Ci(-2 inf) + 1/2 ln(inf) - 1/2 Ci(2 inf) > evalc(%); (-1/2 (1/2 + 1/2 signum(inf)) Pi + 1/4 Pi (1 + signum(inf)) + 1/2 (1/2 - 1/2 signum(inf)) Pi - 1/4 Pi (1 - signum(inf))) I > evalf(%); 0. I From talon at lpthe.jussieu.fr Fri Jan 27 03:47:32 2012 From: talon at lpthe.jussieu.fr (Michel Talon) Date: Fri, 27 Jan 2012 09:47:32 +0000 (UTC) Subject: [Maxima] maxima 5.26.0 Build Failure on FreeBSD References: <4F224566.5020908@speakeasy.org> Message-ID: Thomas D. Dean wrote: > uname -a > FreeBSD P9X79.tddhome 9.0-STABLE FreeBSD 9.0-STABLE #0: Wed Jan 4 > 14:16:41 PST 2012 tomdean at P9X79.tddhome:/usr/src/sys/GENERIC amd64 > > # ./configure --with-clisp > ... > > # make > ... > Making all in info > pattern=`printf "\r$"` ; bad_files=`find . -name '*.texi' -print | > xargs /usr/bin/grep -E -l -e "$pattern"` ; [ -z "$bad_files" ] || ( > echo "WARNING: The following files have DOS-style EOLs: $bad_files" ; > echo "Run /doc/info/fix_crlf to fix the problem." ) > *** Error code 1 > > Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0/doc/info. > *** Error code 1 > > Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0/doc/info. > *** Error code 1 > > Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0/doc. > *** Error code 1 > > Stop in /usr/home/tomdean/Math/Maxima/maxima-5.26.0. > > Tom Dean This is a well-known error which has been present since ages and is basically harmless. You can do make -i install and you will get a working system. Perhaps some slight problems in the documentation. The main cause of the problem is that the scripts which build the documentation have been tuned for gnu sed, and don't work with freebsd sed. I have mailed about that the FreeBSD maintainer (who provided a working patch for the sed rules) and Robert Dodier. I don't remember having seen an answer from RD, i thought the problem was solved. If necessary i can try to recover the patch and post it here. -- Michel Talon From macrakis at alum.mit.edu Fri Jan 27 08:50:21 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 27 Jan 2012 09:50:21 -0500 Subject: [Maxima] integrate(sin(x)^2/x,x,minf,inf); In-Reply-To: <4F22476E.4030602@bk.ru> References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F22476E.4030602@bk.ru> Message-ID: What version of Maxima are you running? In Maxima 5.25.1 GCL 2.6.8, I get: (%i1) integrate(sin(x)^2/x,x,minf,inf); Principal Value (%o1) 0 On Fri, Jan 27, 2012 at 01:42, Dmitry Shkirmanov wrote: > (%i1) integrate(sin(x)^2/x,x,minf,**inf); > Principal Value > log(- 1) > (%o1) - -------- > 2 > (%i2) integrate(sin(x)^2/x,x,**10000000000,10000000000); > (%o2) 0 > (%i3) > > Function sin(x)^2/x is odd function, so it seems that > integrate(sin(x)^2/x,x,minf,**inf) must return 0. Am i wrong? > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From piminusmeson at bk.ru Fri Jan 27 09:15:06 2012 From: piminusmeson at bk.ru (Dmitry Shkirmanov) Date: Fri, 27 Jan 2012 19:15:06 +0400 Subject: [Maxima] integrate(sin(x)^2/x,x,minf,inf); In-Reply-To: References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F22476E.4030602@bk.ru> Message-ID: <4F22BF7A.2030905@bk.ru> > What version of Maxima are you running? ya at debian:~$ maxima --version Maxima 5.26.0 > > (%i1) integrate(sin(x)^2/x,x,minf,inf); > Principal Value > (%o1) 0 > > > On Fri, Jan 27, 2012 at 01:42, Dmitry Shkirmanov > wrote: > > (%i1) integrate(sin(x)^2/x,x,minf,inf); > Principal Value > log(- 1) > (%o1) - -------- > 2 > (%i2) integrate(sin(x)^2/x,x,10000000000,10000000000); > (%o2) 0 > (%i3) > > Function sin(x)^2/x is odd function, so it seems that > integrate(sin(x)^2/x,x,minf,inf) must return 0. Am i wrong? > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rswarbrick at gmail.com Fri Jan 27 10:16:55 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Fri, 27 Jan 2012 16:16:55 +0000 Subject: [Maxima] defrule bug 1204711 In-Reply-To: <4F2245D1.9090405@eecs.berkeley.edu> (Richard Fateman's message of "Thu, 26 Jan 2012 22:36:01 -0800") References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F2245D1.9090405@eecs.berkeley.edu> Message-ID: <87boppqfwo.fsf@hake.rswarbrick.dnsalias.com> Richard Fateman writes: > On 1/26/2012 10:29 PM, Robert Dodier wrote: >> On 1/26/12, Rupert Swarbrick wrote: >> >>> http://sourceforge.net/tracker/?func=detail&aid=1204711&group_id=4933&atid=104933 > > If you want to retract a particular simp rule among a whole bunch, I > suggest you keep a list of your rules and assert via tellsimp, > etc. when you want them to operate. When you want to remove one, kill > them all. Then edit the list of rules, and re-assert them. > > That way you don't have to change any of the system code. > It is unlikely that you are going to be faster than the current > method, though you might be insignificantly slower. At least > if your computation is in fact the same one. Which it might not > be. > > RJF Right. I'm not sure if you've actually read my message? Or maybe I wasn't clear. At the moment, tellsimp/tellsimpafter and remrule interact weirdly. The reason for this is (I presume) a performance hack. My first try to fix this works by removing the hacky method and replacing it with something sane. It appears to work at least as fast, or faster. I'm aware that I can work around bugs, but that's an... unusual approach. Are you saying that I should not expect Maxima to have sane semantics with defrule and friends? Or do you think that I was trying to write this to improve performance? Or have I misunderstood you? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From rswarbrick at gmail.com Fri Jan 27 10:17:32 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Fri, 27 Jan 2012 16:17:32 +0000 Subject: [Maxima] defrule bug 1204711 In-Reply-To: (Robert Dodier's message of "Thu, 26 Jan 2012 23:29:03 -0700") References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> Message-ID: <877h0dqfvn.fsf@hake.rswarbrick.dnsalias.com> Robert Dodier writes: > On 1/26/12, Rupert Swarbrick wrote: > >> http://sourceforge.net/tracker/?func=detail&aid=1204711&group_id=4933&atid=104933 > > Well, I suspect it would require fewer changes to preserve > the existing chaining scheme, but if so, then we'll have to > work out a way to fix up the chain when one rule is removed. > I can't think of a way right now. Maybe you ought to go ahead > and work on this other approach. Cool. I'll sort out a clean patch and should be able to post it sometime next week. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From robert.dodier at gmail.com Fri Jan 27 10:21:16 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 27 Jan 2012 09:21:16 -0700 Subject: [Maxima] Fwd: Problems with the maxima documentation In-Reply-To: <4857E09C-5837-46F6-826C-F03AD4747D5C@lpthe.jussieu.fr> References: <4857E09C-5837-46F6-826C-F03AD4747D5C@lpthe.jussieu.fr> Message-ID: Michel, I found the patch you sent. I've applied it & committed it & pushed the commit. I didn't try to run make yet. I mean this in the best way possible -- please don't send patches to me personally, please post them on the mailing list or bug tracker or some other public communication. It is not guaranteed that they will get applied, but it does increase the chances of it. best, Robert Dodier ---------- Forwarded message ---------- From: Michel Talon Date: Sun, 18 Dec 2011 15:20:20 +0100 Subject: Problems with the maxima documentation To: Robert Dodier Hello some time ago i mentioned there are problems building the maxima documentation on BSD and Mac OS X and it turned out that using gnu sed was able to fix most or all of the problems. I mentioned this problem on FreeBSD mailing list, and a developer, Brendan Fabeny, looked at the sed differenced between gnu sed and bsd sed, and came with a patch which indeeds solves most of the errors and also sent me explanations on the patch. The culprits are extract_categories.sh and extract_categories1.sed in doc/info, and here are the patches: niobe% cat patch-doc__info__extract_categories.sh --- doc/info/extract_categories.sh.orig 2011-08-01 00:39:51.000000000 -0400 +++ doc/info/extract_categories.sh 2011-12-16 09:05:05.000000000 -0500 @@ -17,9 +17,10 @@ if [ $f = "maxima.texi" ] then echo SKIP OVER $f else - sed 's/^@def\(fn\|vr\) *{[^}]*} *\([^[:blank:]]*\).*/@anchor{Item: \2}\ -\0/; s/^@node *\([^,]*\).*/@anchor{Item: \1}\ -\0/' "$f" > tmp.texi + sed 's/^@deffn *{[^}]*} *\([^[:blank:]]*\).*/@anchor{Item: \1}\ +&/; s/^@defvr *{[^}]*} *\([^[:blank:]]*\).*/@anchor{Item: \1}\ +&/; s/^@node *\([^,]*\).*/@anchor{Item: \1}\ +&/' "$f" > tmp.texi mv tmp.texi "$f" fi done niobe% cat patch-doc__info__extract_categories1.sed --- doc/info/extract_categories1.sed.orig 2011-08-01 00:39:51.000000000 -0400 +++ doc/info/extract_categories1.sed 2011-12-16 08:12:32.000000000 -0500 @@ -1,6 +1,9 @@ -s/^@def\(fn\|vr\) *{[^}]*} *\([^[:blank:]]*\).*/items = ["\2"]/ -s/^@def\(fn\|vr\)x *{[^}]*} *\([^[:blank:]]*\).*/if not "\2" in items: items.append ("\2")/ -s/^@end def\(fn\|vr\)/items = []/ +s/^@deffn *{[^}]*} *\([^[:blank:]]*\).*/items = ["\1"]/ +s/^@defvr *{[^}]*} *\([^[:blank:]]*\).*/items = ["\1"]/ +s/^@deffnx *{[^}]*} *\([^[:blank:]]*\).*/if not "\1" in items: items.append ("\1")/ +s/^@defvrx *{[^}]*} *\([^[:blank:]]*\).*/if not "\1" in items: items.append ("\1")/ +s/^@end deffn/items = []/ +s/^@end defvr/items = []/ s/^@node *\([^,]*\).*/items = ["\1"] # extracted from node/ s/@opencatbox// s/@closecatbox// and here are the explanations: The explanations for the changes in my patch are: -- In conformance with the Open Group specs, "|" is only a special character indicating alternation when extended regular expressions (EREs) are used, and FreeBSD sed(1) only uses EREs when invoked with the "-E" or "-r" options. -- a "\0" backreference, as nearly as I can tell from a few tests, is a non-standard GNU extension that seems to be equivalent to "&". In accordance with the Open Group specs, FreeBSD sed(1) interprets "\0" as "0". As far as i can see there is also replacement of \2 by \1, which i don't know the rationale for. Anyways, after applying these patches i still have some smaller problems, as i mention in a mail to B.F. that i also CC to you. -- Michel Talon talon at lpthe.jussieu.fr From toy.raymond at gmail.com Fri Jan 27 10:40:22 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 27 Jan 2012 08:40:22 -0800 Subject: [Maxima] Function returning the version number In-Reply-To: References: Message-ID: On Thu, Jan 26, 2012 at 12:45 AM, Michael Filonenko < filonenko.mikhail at gmail.com> wrote: > You can get value of common lisp variable *maxima-version* in maxima > environment: > > ?\*maxima\-version\* > > Does that actually work for you? That variable doesn't exist for me. Instead, I use ?\*autoconf\-version\* which currently returns 5.26.0_22_g91b6c40_dirty in my current tree. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From filonenko.mikhail at gmail.com Fri Jan 27 10:49:05 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Fri, 27 Jan 2012 18:49:05 +0200 Subject: [Maxima] Function returning the version number In-Reply-To: References: Message-ID: I was wrong. When I worked with my branch of maxima sources I renamed some variables, and forgot that it is only in my sources. 2012/1/27 Raymond Toy : > > > On Thu, Jan 26, 2012 at 12:45 AM, Michael Filonenko > wrote: >> >> You can get value of common lisp variable *maxima-version* in maxima >> environment: >> >> ?\*maxima\-version\* >> > > Does that actually work for you? That variable doesn't exist for me. > > Instead, I use > > ?\*autoconf\-version\* > > which currently returns 5.26.0_22_g91b6c40_dirty in my current tree. > > Ray > -- With best regards, Michael Filonenko From fateman at eecs.berkeley.edu Fri Jan 27 11:07:53 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Fri, 27 Jan 2012 09:07:53 -0800 Subject: [Maxima] defrule bug 1204711 In-Reply-To: <87boppqfwo.fsf@hake.rswarbrick.dnsalias.com> References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F2245D1.9090405@eecs.berkeley.edu> <87boppqfwo.fsf@hake.rswarbrick.dnsalias.com> Message-ID: <4F22D9E9.5020700@eecs.berkeley.edu> On 1/27/2012 8:16 AM, Rupert Swarbrick wrote: > > Right. I'm not sure if you've actually read my message? Or maybe I > wasn't clear. I didn't read your earlier bug report previously, but I just read it. It seems to me that remrule doesn't do what the documentation says. I haven't tested it much, but I suspect that it either works if you remove ALL the rules, or if you remove the most recently defined rule. In fact, it is kind of unlikely that the author of this code (initially me, in about 1969), tried it in the circumstance that you have come up with. That is, defining rules with the simplifier OFF does not usually make sense. After all, if you are defining a rule F(A) --> B, and then try to define another rule F(A) --> C, the simplifier will change that latter rule to B-->C. If you didn't mean that, then what did you mean? The only time turning the simplifier off makes sense is if you are trying to over-ride a built in simplification. e.g. if you would like to do tellsimp(0^0,undefined). I suspect that one fix would be to change the documentation to say that remrule will only remove (a) all the rules on an operator or (b) the last rule on an operator. I am sure that there are lots of anomalies that could be uncovered in Maxima by turning off the simplifier and expecting Maxima to do whatever a user imagines that it should do in such a circumstance. > > At the moment, tellsimp/tellsimpafter and remrule interact weirdly. The > reason for this is (I presume) a performance hack. My first try to fix > this works by removing the hacky method and replacing it with something > sane. It appears to work at least as fast, or faster. > > I'm aware that I can work around bugs, but that's an... unusual > approach. Well, it depends on the circumstance. I agree that remrule doesn't do what the documentation seems to indicate it should do, but don't you think you are doing something pretty odd? After all, you are saying that the system should simplify the same exact expression, foo(1) into two different results, and doing so by temporarily disabling the simplifier. Can you think of no other way to accomplish your goal? I think that tellsimpafter(foo(1),a) tellsimpafer(foo(1),b) is a user error, and if you hadn't turned off the simplifier, you would have gotten an error message. if you had said tellsimpafter(foo(1),bar(1)); tellsimpafter(foo(1), b); you would have been informed that the second rule was placed on bar, not on foo. While I don't want to exactly correlate it with your situation, I would dispute that your statement about working around bugs is unusual. It is probably the most frequent approach. It happens like this: a bug is reported. The person in charge of resolving bugs decides that it is not a bug, but a "user error" or PICNIC. "Problem in Chair, Not in Computer". The advice is to change the user program. User does so and continues until the next bug... From the user perspective it appears he/she is being told how to work around a bug. Statistically speaking, user error constitute a vast majority of reported bugs in programs. > Are you saying that I should not expect Maxima to have sane > semantics with defrule and friends? If the documentation of remrule is changed, does that make it sane? Maybe one should also add that any bugs that occur only when simp:false, are user errors. > Or do you think that I was trying to > write this to improve performance? Nope. The difference in performance for tellsimp/tellsimpafter should be negligible. The initial implementation was complicated by the notion that after a bunch of tellsimps etc one would end up with a single subroutine that could be compiled into machine code. This would be harder to do with a separable list of rules. In practice, no one compiles the subroutine. RJF > Or have I misunderstood you? > > Rupert From tomdean at speakeasy.org Fri Jan 27 11:51:15 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Fri, 27 Jan 2012 09:51:15 -0800 Subject: [Maxima] maxima 5.26.0 Build Failure on FreeBSD In-Reply-To: References: <4F224566.5020908@speakeasy.org> Message-ID: <4F22E413.7060705@speakeasy.org> On 01/27/12 01:47, Michel Talon wrote: > Thomas D. Dean wrote: > The main cause of the problem is that the scripts which build the > documentation have been tuned for gnu sed, and don't work with freebsd > sed. I have mailed about that the FreeBSD maintainer (who provided a > working patch for the sed rules) and Robert Dodier. I don't remember > having seen an answer from RD, i thought the problem was solved. If necessary > i can try to recover the patch and post it here. > > I zapped the build directory, started fresh, using gnu make and it completed successfully. Even with the original error, as you said, make check was successful. Thanks, Tom Dean From tomdean at speakeasy.org Fri Jan 27 11:55:47 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Fri, 27 Jan 2012 09:55:47 -0800 Subject: [Maxima] integrate(sin(x)^2/x,x,minf,inf); In-Reply-To: References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F22476E.4030602@bk.ru> Message-ID: <4F22E523.4000504@speakeasy.org> On 01/27/12 06:50, Stavros Macrakis wrote: > What version of Maxima are you running? In Maxima 5.25.1 GCL 2.6.8, I get: > # maxima Maxima 5.26.0 http://maxima.sourceforge.net using Lisp CLISP 2.49 (2010-07-07) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) integrate(sin(x)^2/x,x,minf,inf); Principal Value log(- 1) (%o1) - -------- 2 Tom Dean From rswarbrick at gmail.com Fri Jan 27 11:51:00 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Fri, 27 Jan 2012 17:51:00 +0000 Subject: [Maxima] defrule bug 1204711 References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F2245D1.9090405@eecs.berkeley.edu> <87boppqfwo.fsf@hake.rswarbrick.dnsalias.com> <4F22D9E9.5020700@eecs.berkeley.edu> Message-ID: <8p4bv8xavk.ln2@hake.rswarbrick.dnsalias.com> Richard Fateman writes: > The only time turning the simplifier off makes sense is if you are > trying to over-ride a built in simplification. e.g. if you would like > to do tellsimp(0^0,undefined). > > I suspect that one fix would be to change the documentation to say > that remrule will only remove (a) all the rules on an operator or (b) > the last rule on an operator. > > I am sure that there are lots of anomalies that could be uncovered in > Maxima by turning off the simplifier and expecting Maxima to do > whatever a user imagines that it should do in such a circumstance. Hmm. It hadn't occurred to me that it might be impossible to trigger this without the simplifier temporarily turned off. That's a good point. > While I don't want to exactly correlate it with your situation, I > would dispute that your statement about working around bugs is > unusual. It is probably the most frequent approach. > > It happens like this: a bug is reported. The person in charge of > resolving bugs decides that it is not a bug, but a "user error" or > PICNIC. "Problem in Chair, Not in Computer". The advice is to change > the user program. User does so and continues until the next bug... > > From the user perspective it appears he/she is being told how to work > around a bug. Another possibility is that, from a user perspective, the program author appears arrogant and unpleasant. I'm not convinced that it's ever a great idea to reply with PICNIC, RTFM or other acronyms that show how terribly clever the author is. > Statistically speaking, user error constitute a vast majority of > reported bugs in programs. In some cases, programs can be designed to make it obvious to the user that they're doing something weird. HAL's new line: "I'm sorry, Dave. I'm afraid I can't do that. And why on Earth do you want me to?" Maybe this is more difficult with something like Maxima, where there is a whole programming language with which a user can shoot themselves in the foot. >> Are you saying that I should not expect Maxima to have sane >> semantics with defrule and friends? > If the documentation of remrule is changed, does that make it sane? > Maybe one should also add that any bugs that occur only when > simp:false, are user errors. Maybe. But arguing that "Maxima's behaviour when you set simp:false is undefined" implies that simp shouldn't be a variable a user can get to without diving into lisp... >> Or do you think that I was trying to write this to improve >> performance? > Nope. The difference in performance for tellsimp/tellsimpafter should > be negligible. The initial implementation was complicated by the > notion that after a bunch of tellsimps etc one would end up with a > single subroutine that could be compiled into machine code. This > would be harder to do with a separable list of rules. In practice, no > one compiles the subroutine. If I've understood this paragraph correctly, it doesn't quite describe how the current code works. Each simplifying subroutine may recurse to a previously defined one if one exists. As such, each would be compiled into separate functions. I would expect to get identical performance with one function calling each simplifying routine in turn (and not descend so far into the stack!). With implementations like SBCL, of course, everything gets compiled, so the compile/don't compile thing is sort of moot. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From fateman at eecs.berkeley.edu Fri Jan 27 13:42:32 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Fri, 27 Jan 2012 11:42:32 -0800 Subject: [Maxima] defrule bug 1204711 In-Reply-To: <8p4bv8xavk.ln2@hake.rswarbrick.dnsalias.com> References: <87fwf2ln7g.fsf@hake.rswarbrick.dnsalias.com> <4F2245D1.9090405@eecs.berkeley.edu> <87boppqfwo.fsf@hake.rswarbrick.dnsalias.com> <4F22D9E9.5020700@eecs.berkeley.edu> <8p4bv8xavk.ln2@hake.rswarbrick.dnsalias.com> Message-ID: <4F22FE28.7060905@eecs.berkeley.edu> On 1/27/2012 9:51 AM, Rupert Swarbrick wrote: > > Another possibility is that, from a user perspective, the program author > appears arrogant and unpleasant. Having sat on both sides of this perspective, I entirely agree. > I'm not convinced that it's ever a > great idea to reply with PICNIC, RTFM or other acronyms that show how > terribly clever the author is. look up "user error" on wikipedia.. >> Statistically speaking, user error constitute a vast majority of >> reported bugs in programs. > In some cases, programs can be designed to make it obvious to the user > that they're doing something weird. HAL's new line: "I'm sorry, > Dave. I'm afraid I can't do that. And why on Earth do you want me to?" > > Maybe this is more difficult with something like Maxima, where there is > a whole programming language with which a user can shoot themselves in > the foot. and the goal is to do "all of mathematics"... > >>> Are you saying that I should not expect Maxima to have sane >>> semantics with defrule and friends? >> If the documentation of remrule is changed, does that make it sane? >> Maybe one should also add that any bugs that occur only when >> simp:false, are user errors. > Maybe. But arguing that "Maxima's behaviour when you set simp:false is > undefined" implies that simp shouldn't be a variable a user can get to > without diving into lisp... That's pretty much my view. But in Maxima you can set any variable in lisp by doing something like ?secret_name: 1234, also. So we cannot really make a water-tight system without other changes. > >>> Or do you think that I was trying to write this to improve >>> performance? >> Nope. The difference in performance for tellsimp/tellsimpafter should >> be negligible. The initial implementation was complicated by the >> notion that after a bunch of tellsimps etc one would end up with a >> single subroutine that could be compiled into machine code. This >> would be harder to do with a separable list of rules. In practice, no >> one compiles the subroutine. > If I've understood this paragraph correctly, it doesn't quite describe > how the current code works. Each simplifying subroutine may recurse to > a previously defined one if one exists. Yes, it calls that function. Alternatively it could get the function name from a list and then call it. I don't know if the difference in execution time could be measured. > As such, each would be compiled > into separate functions. Yes > I would expect to get identical performance > with one function calling each simplifying routine in turn (and not > descend so far into the stack!). With implementations like SBCL, of > course, everything gets compiled, so the compile/don't compile thing is > sort of moot. I don't know what is compiled. If just "defun" forms are compiled, or if the forms produced by the pattern match compiler (used by tellsimp etc) also get compiled. Still, looking up functions in a list vs directly calling them would distinguish your suggestion from what is done now, right? RJF From tomdean at speakeasy.org Sat Jan 28 02:35:15 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Sat, 28 Jan 2012 00:35:15 -0800 Subject: [Maxima] Working with Inequalities Message-ID: <4F23B343.4090408@speakeasy.org> How do I solve this? x^2 + 2*x=3 and 7*x+2<-x-3 I found solve_rat_ineq. That handles the inequality OK. (%i1) solve(x^2 + 2*x=3,x); (%o1) [x = - 3, x = 1] (%i2) solve_rat_ineq(7*x+2<-x-3); 5 (%o2) [[x < - -]] 8 The solution is x = -3 Tom Dean From willisb at unk.edu Sat Jan 28 08:12:22 2012 From: willisb at unk.edu (Barton Willis) Date: Sat, 28 Jan 2012 08:12:22 -0600 Subject: [Maxima] Working with Inequalities In-Reply-To: <4F23B343.4090408@speakeasy.org> References: <4F23B343.4090408@speakeasy.org> Message-ID: The optional package 'to_poly_solver' has a (very) limited ability to solve inequations. When to_poly_solver is able to transform the inequations into a linear system, the solver applies the Fourier elimination method. (%i2) load(to_poly_solver)$ Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $ (%i3) %solve([x^2 + 2*x=3, 7*x+2<-x-3],[x]); (%o3) %union([x=-3]) To attempt conversion to a linear form, %solve doesn't introduce radicals: (%i6) %solve([x^2 + 9*x=3, 7*x+2<-x-3],[x]); (%o6) %union([x<-5/8,x^2+9*x-3=0]) So %solve handles x^2 + 2*x=3, 7*x+2<-x-3 OK, but don't expect great things from %solve. --Barton (author of to_poly_solver). -----maxima-bounces at math.utexas.edu wrote: ----- To: maxima at math.utexas.edu From: "Thomas D. Dean" Sent by: maxima-bounces at math.utexas.edu Date: 01/28/2012 02:35AM Subject: [Maxima] Working with Inequalities How do I solve this? ?? x^2 + 2*x=3 and 7*x+2<-x-3 I found solve_rat_ineq. ?That handles the inequality OK. (%i1) solve(x^2 + 2*x=3,x); (%o1) [x = - 3, x = 1] (%i2) solve_rat_ineq(7*x+2<-x-3); ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?5 (%o2) ? ? ? ? ? ? ? ? ? ? ? ? ? ?[[x < - -]] ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?8 The solution is x = -3 Tom Dean _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From adammaj1 at o2.pl Sat Jan 28 03:30:10 2012 From: adammaj1 at o2.pl (Adam Majewski) Date: Sat, 28 Jan 2012 10:30:10 +0100 Subject: [Maxima] RE : string to identifier In-Reply-To: References: <4D0C218C381046D9A51EAB30B6AA95BA@PASSERELLE> Message-ID: On 22.01.2012 10:14, Adam Majewski wrote: > On 22.01.2012 01:39, laurent couraud wrote: >> You can also use eval_string from the package stringproc. >> >> Laurent. > > > Thx. It : > * removes upper/lower case switching > * removes one language from code ( older code have used 3 languages : > Maxima, Lisp and gnuplot. New code uses 2 languages : Maxima and gnuplot. ) > Below is new code. > > I think about making scene ( scene1, scene2 ....) in similar way to make > code shorter ( I hope not obfuscated) and then use : > draw(scene1, scene2) > > Old code and image is here : > http://commons.wikimedia.org/wiki/File:Parabolic_critical_orbits.png > more description : > http://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/parabolic > > > Please look also at : > > Category:Images with Maxima CAS source code > http://commons.wikimedia.org/wiki/Category:Images_with_Maxima_CAS_source_code > > > Category:Created with Maxima (software) > http://commons.wikimedia.org/wiki/Category:Created_with_Maxima_%28software%29 > > > Thx > > Adam > > > > > ============== newest code ============== > > kill(all); > > > > /* ---------- functions ---------------------- */ > > /* conformal map from circle to cardioid ( boundary > of period 1 component of Mandelbrot set */ > F(w):=w/2-w*w/4; > > > /* > circle D={w:abs(w)=1 } where w=ToCircle(t,r) > t is angle in turns ; 1 turn = 360 degree = 2*Pi radians > r is a radius > */ > ToCircle(t,r):=r*%e^(%i*t*2*%pi); > > > > > /* > > http://en.wikipedia.org/wiki/Complex_quadratic_polynomial > */ > f(z,c):=z*z+c $ > > GiveCriticalOrbit(c,iMax):= > /* > computes (without escape test) > critical orbit (forward orbit of critical point ) > and saves it to the list for draw package */ > block( > [z,orbit,temp], > z:0, /* first point = critical point z:0+0*%i */ > orbit:[[realpart(z),imagpart(z)]], > for i:1 thru iMax step 1 do > ( z:expand(f(z,c)), > orbit:endcons([realpart(z),imagpart(z)],orbit)), > > return(orbit) > )$ > > > /* find fixed point alfa , returns a list */ > GiveFixed(c):= > ( > [z], > z:float(rectform((1-sqrt(1-4*c))/2)), > [[realpart(z),imagpart(z)]] > )$ > > > > GiveC(angle,radius):= > ( > [w], > /* point of unit circle w:l(internalAngle,internalRadius); */ > w:ToCircle(angle,radius), /* point of circle */ > float(rectform(F(w))) /* point on boundary of period 1 component of > Mandelbrot set */ > )$ > > > > compile(all)$ > > > > /* ---------- constant ---------------------------*/ > Numerator :1; > DenominatorMax :10; > InternalRadius:1; > iMax:500; > > > /* -------------- main ----------------- */ > > > > for Denominator:1 thru DenominatorMax step 1 do > ( > InternalAngle: Numerator/Denominator, > c: GiveC(InternalAngle,InternalRadius), > /* */ > eval_string(concat("z",string(Denominator)))::GiveFixed(c), > /* */ > > eval_string(concat("orbit",string(Denominator)))::GiveCriticalOrbit(c,iMax) > ); > > > > > /*-----------------------------------------------------------------------*/ > load(draw); /* ( interface to gnuplot ) by Mario Rodriguez Riotorto > http://www.telefonica.net/web2/biomates */ > > draw( > > terminal = screen, > columns =5, > file_name = "b", > pic_width = 1000, /* Since Maxima 5.23, pic_width and pic_height are > deprecated. */ > pic_height = 500, /* See option dimensions. To get the same effect, > write dimensions=[800,600] */ > > gr2d( > title= "1/1 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit1), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z1), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= " 1/2 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* criitical orbit */ > color =red, > points(orbit2), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z2), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= " 1/3 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit3), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z3), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= " 1/4 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit4), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z4), > /* criitical point */ > color =blue, > points([0],[0]) > ), > gr2d( > title= " 1/5 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit5), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z5), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= "1/6 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit6), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z6), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= " 1/7 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* criitical orbit */ > color =red, > points(orbit7), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z7), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= " 1/8 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit8), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z8), > /* criitical point */ > color =blue, > points([0],[0]) > ), > > gr2d( > title= " 1/9 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit9), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z9), > /* criitical point */ > color =blue, > points([0],[0]) > ), > gr2d( > title= " 1/10 ", > user_preamble = "set border 0;set nokey;set size square;set noxtics ;set > noytics;", > point_type = filled_circle, > points_joined = false, > point_size = 0.7, > /* critical orbit */ > color =red, > points(orbit10), > /* parabolic fixed point */ > color =black, > point_size = 1.4, > points(z10), > /* criitical point */ > color =blue, > points([0],[0]) > ) > > > > ); With help of Mario Rodriguez Riotorto I have change the program. It does not uses strings but lists of scenes and is much shorter. Thx Adam ===========code========== kill(all); /* ---------- functions ---------------------- */ /* conformal map from circle to cardioid ( boundary of period 1 component of Mandelbrot set */ F(w):=w/2-w*w/4; /* circle D={w:abs(w)=1 } where w=l(t,r) t is angle in turns ; 1 turn = 360 degree = 2*Pi radians r is a radius */ ToCircle(t,r):=r*%e^(%i*t*2*%pi); /* http://en.wikipedia.org/wiki/Complex_quadratic_polynomial */ f(z,c):=z*z+c $ GiveCriticalOrbit(c,iMax):= /* computes (without escape test) critical orbit (forward orbit of critical point ) and saves it to the list for draw package */ block( [z,orbit,temp], z:0, /* first point = critical point z:0+0*%i */ orbit:[[realpart(z),imagpart(z)]], for i:1 thru iMax step 1 do ( z:expand(f(z,c)), orbit:endcons([realpart(z),imagpart(z)],orbit)), return(orbit) )$ /* find fixed point alfa , returns a list */ GiveFixed(c):= ( [z], z:float(rectform((1-sqrt(1-4*c))/2)), [[realpart(z),imagpart(z)]] )$ GiveC(angle,radius):= ( [w], /* point of unit circle w:l(internalAngle,internalRadius); */ w:ToCircle(angle,radius), /* point of circle */ float(rectform(F(w))) /* point on boundary of period 1 component of Mandelbrot set */ )$ GiveScene(sTitle, zn, orbitn):= gr2d(title= sTitle, user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;", point_type = filled_circle, points_joined = false, point_size = 0.7, /* critical orbit */ color =red, points(orbitn), /* parabolic fixed point */ color =black, point_size = 1.4, points(zn), /* criitical point */ color =blue, points([0],[0]) )$ compile(all)$ /* ---------- constant ---------------------------*/ Numerator :1; DenominatorMax :10; InternalRadius:1; iMax:500; /* -------------- main ----------------- */ scenes:[]; for Denominator:1 thru DenominatorMax step 1 do ( InternalAngle: Numerator/Denominator, c: GiveC(InternalAngle,InternalRadius), scene:GiveScene(string(InternalAngle), GiveFixed(c), GiveCriticalOrbit(c,iMax)), scenes:cons(scene,scenes))$ /*-----------------------------------------------------------------------*/ load(draw); /* ( interface to gnuplot ) by Mario Rodriguez Riotorto http://www.telefonica.net/web2/biomates */ draw( terminal = screen, columns =5, file_name = "b", pic_width = 1000, /* Since Maxima 5.23, pic_width and pic_height are deprecated. */ pic_height = 500, /* See option dimensions. To get the same effect, write dimensions=[800,600] */ scenes ); From macrakis at alum.mit.edu Sat Jan 28 13:32:43 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sat, 28 Jan 2012 14:32:43 -0500 Subject: [Maxima] string to identifier In-Reply-To: <4F1B27BB.2070800@eecs.berkeley.edu> References: <4F1B27BB.2070800@eecs.berkeley.edu> Message-ID: Actually, concat with a Maxima symbol returns a Maxima symbol (interned): concat('list,123) => list123 But usually when users as for functionality like this, they would be better off using named arrays or simply lists. -s On Sat, Jan 21, 2012 at 16:01, Richard Fateman wrote: > On 1/21/2012 12:51 PM, Adam Majewski wrote: > >> How can I convert string to identifier ? >> >> I would like to make a few list for draw package : >> list1, list2 ... >> >> for Denominator:1 thru DenominatorMax step 1 do >> ( >> name:concat("list",string(**Denominator)), >> /* here I should convert string name to identier */ >> name:Givelist /* my function */ >> ); >> >> try > ?intern(concat("list", 123)); > > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Sat Jan 28 14:05:01 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 28 Jan 2012 13:05:01 -0700 Subject: [Maxima] Function returning the version number In-Reply-To: References: Message-ID: I think that making a program dependent on the Maxima version number generally indicates that something has gone wrong; I would avoid it if possible. That said, I have a patch laying around to rework build_info so that it returns a Maxima structure (as defined by defstruct) which makes it easy to extract the bits of the build info. With this patch I get: (%i2) x : build_info (); (%o2) Maxima version: 5.26.0_16_gb72c64c_dirty Maxima build date: 2012-01-11 00:01:25 Host type: i686-pc-linux-gnu Lisp implementation type: CMU Common Lisp Lisp implementation version: CVS release-19a 19a-release-20040728 + minimal debian patches (%i3) x at version; (%o3) 5.26.0_16_gb72c64c_dirty (%i4) x at timestamp; (%o4) 2012-01-11 00:01:25 (%i5) x at host; (%o5) i686-pc-linux-gnu (%i6) x at lisp_name; (%o6) CMU Common Lisp (%i7) x at lisp_version; (%o7) CVS release-19a 19a-release-20040728 + minimal debian patches Note that the patch includes a display function so that the return value of build_info is displayed just as build_info now displays the build info. I'll commit this unless someone thinks it's a bad idea. best Robert Dodier From robert.dodier at gmail.com Sat Jan 28 14:08:12 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 28 Jan 2012 13:08:12 -0700 Subject: [Maxima] Function returning the version number In-Reply-To: References: Message-ID: Oh, sorry -- I forgot to include the patch. Here it is. best Robert Dodier PS. Index: src/macsys.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/macsys.lisp,v retrieving revision 1.83 diff -u -r1.83 macsys.lisp --- src/macsys.lisp 6 Sep 2010 22:18:16 -0000 1.83 +++ src/macsys.lisp 20 Mar 2011 20:10:05 -0000 @@ -359,23 +359,57 @@ (format t (intl:gettext "Submit bug reports by following the 'Add new' link on that page.~%")) (format t (intl:gettext "Please include the following information with your bug report:~%")) (format t "-------------------------------------------------------------~%") - ($build_info) + (displa ($build_info)) (format t "-------------------------------------------------------------~%") (format t (intl:gettext "The above information is also reported by the function 'build_info'.~%~%")) "") +(defstruct1 '((%build_info) $version $timestamp $host $lisp_name $lisp_version)) + +(defvar *maxima-build-info* nil) + (defmfun $build_info () - (format t (intl:gettext "~%Maxima version: ~a~%") *autoconf-version*) - (format t (intl:gettext "Maxima build date: ~a:~a ~a/~a/~a~%") - (third cl-user:*maxima-build-time*) - (second cl-user:*maxima-build-time*) - (fifth cl-user:*maxima-build-time*) - (fourth cl-user:*maxima-build-time*) - (sixth cl-user:*maxima-build-time*)) - (format t (intl:gettext "Host type: ~a~%") *autoconf-host*) - (format t (intl:gettext "Lisp implementation type: ~a~%") (lisp-implementation-type)) - (format t (intl:gettext "Lisp implementation version: ~a~%~%") (lisp-implementation-version)) - "") + (or + *maxima-build-info* + (setq + *maxima-build-info* + (let + ((year (sixth cl-user:*maxima-build-time*)) + (month (fifth cl-user:*maxima-build-time*)) + (day (fourth cl-user:*maxima-build-time*)) + (hour (third cl-user:*maxima-build-time*)) + (minute (second cl-user:*maxima-build-time*)) + (seconds (first cl-user:*maxima-build-time*))) + (mfuncall + '$new + `((%build_info) + ,*autoconf-version* + ,(format nil "~4,'0d-~2,'0d-~2,'0d ~2,'0d:~2,'0d:~2,'0d" year month day hour minute seconds) + ,*autoconf-host* + ,(lisp-implementation-type) + ,(lisp-implementation-version))))))) + +(defun dimension-build-info (form result) + (declare (special bkptht bkptdp lines break)) + (let + ((version-string (format nil (intl:gettext "Maxima version: ~a") (mfuncall '$@ form '$version))) + (timestamp-string (format nil (intl:gettext "Maxima build date: ~a") (mfuncall '$@ form '$timestamp))) + (host-string (format nil (intl:gettext "Host type: ~a") (mfuncall '$@ form '$host))) + (lisp-name-string (format nil (intl:gettext "Lisp implementation type: ~a") (mfuncall '$@ form '$lisp_name))) + (lisp-version-string (format nil (intl:gettext "Lisp implementation version: ~a") (mfuncall '$@ form '$lisp_version))) + (bkptht 1) + (bkptdp 1) + (lines 0) + (break 0)) + (forcebreak result 0) + (forcebreak (reverse (coerce version-string 'list)) 0) + (forcebreak (reverse (coerce timestamp-string 'list)) 0) + (forcebreak (reverse (coerce host-string 'list)) 0) + (forcebreak (reverse (coerce lisp-name-string 'list)) 0) + (forcebreak (reverse (coerce lisp-version-string 'list)) 0)) + nil) + +(setf (get '%build_info 'dimension) 'dimension-build-info) (defvar *maxima-started* nil) From fateman at eecs.berkeley.edu Sat Jan 28 16:29:44 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sat, 28 Jan 2012 14:29:44 -0800 Subject: [Maxima] putting defstruct into the Maxima manual In-Reply-To: <4ACCA6E6.90100@cs.berkeley.edu> References: <4ACCA6E6.90100@cs.berkeley.edu> Message-ID: <4F2476D8.3040408@eecs.berkeley.edu> A few years later.... Since build_info uses it .... how about .... On 10/7/2009 7:34 AM, Richard Fateman wrote: Could someone find a place for this and put it into the manual and online info? Thanks. RJF .................. Maxima includes a technique to establish records or structures with named fields. It uses the following functions: defstruct and new. It uses the operator @ . Here's an example. defstruct(f(x,y,z)); /* declare f to be a record with 3 fields, x,y,z */ myrecord: new(f); /* myrecord is an instance of f */ myrecord at y:45; /* change myrecord as seen below. */ myrecord; ==> f(x,45,z) accessing is done this way... myrecord at y ==> 45. Initializers also possible defstruct(f(x,y=3.14159, z)); ff:new(f) ==> f(x,3.14159,z) ff at y:2.71828 ==> ff is f(x,2.71828,z). It is generally better to use more descriptive field names, ones that are not likely to be assigned values. If you use x as field name there is a danger that you would assign it a value, like x:10. But then ff at x means ff at 10. From robert.dodier at gmail.com Sun Jan 29 01:49:04 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 29 Jan 2012 00:49:04 -0700 Subject: [Maxima] putting defstruct into the Maxima manual In-Reply-To: <4F2476D8.3040408@eecs.berkeley.edu> References: <4ACCA6E6.90100@cs.berkeley.edu> <4F2476D8.3040408@eecs.berkeley.edu> Message-ID: On 1/28/12, Richard Fateman wrote: > A few years later.... Oh, documentation for defstruct & friends was added to ref manual a few releases ago. Better late than never, slow & steady wins the race, etc. best Robert Dodier From sen1 at math.msu.edu Sun Jan 29 10:06:57 2012 From: sen1 at math.msu.edu (Sheldon Newhouse) Date: Sun, 29 Jan 2012 16:06:57 +0000 Subject: [Maxima] problem with draw and windows 7 Message-ID: Hello all, I have a student who has windows 7 Home Premium on her laptop. She has tried both Maxima-5.25.0 and 5.26.0 and can't see the plot with draw2d. Other students with the same OS (I think) have no difficulty with draw and I don't in my Win 7 Professional laptop. She has no trouble with plot2d. The gnuplot window opens up just fine. With draw2d, (in either Xmaxima or WxMaxima), she gets a graphics output like [gr2d(explicit)]at that looks as if the gnuplot window should open, but it doesn't. I looked everywhere on the destop and it is not there. any ideas? -TIA. ------------------------------------------------------------------------------------------- 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 | ------------------------------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From fateman at eecs.berkeley.edu Sun Jan 29 10:29:33 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 29 Jan 2012 08:29:33 -0800 Subject: [Maxima] bigfloat eigenvalues Message-ID: <4F2573ED.8080601@eecs.berkeley.edu> I re-worked the program from lapack/ eispack "bisect" which computes eigenvalues of a symmetric tridiagonal matrix (STM) so that it runs in bigfloat arithmetic. it is in http://www.cs.berkeley.edu/~fateman/lisp/bfbisect.lisp and appears to be happy in GCL. testing it in your favorite version of maxima would require loading that file (optionally compiling), and running ?test(); Bisect is possibly the program of choice for STM if you need only a set number n of eigenvalues in an interval, rather than all of them. Thanks to f2cl for producing a first cut. I also have a version that runs using MPFR (a c-coded bigfloat library). I loaded MPFR into Allegro Common Lisp for this version; loading MPFR into other lisps requires special attention and knowledge that I don't have. (I gather that GCL is particularly deficient in loading foreign function libraries). Comments, improvements, welcome. RJF From mohamedabouzied at yahoo.co.uk Sat Jan 28 04:07:53 2012 From: mohamedabouzied at yahoo.co.uk (MOHAMMED ABOU ZIED) Date: Sat, 28 Jan 2012 10:07:53 +0000 (GMT) Subject: [Maxima] bug report Message-ID: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> Dear All, I want to report two bugs, when I use algsys() function, the output list is recognized as a 1 element list (which is worng). This don't happen for the linsolve() function as the attachments reveal. Another bug, after I took the outputs of linsolve() function "i don't know if this also at algsysy() or not", i used denom() function, but it returned 1 and when i take num() function, it return both numerator divided by the denominator. Yours, Mohamed Abouzied -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bug.png Type: image/png Size: 171275 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: no_bug.png Type: image/png Size: 167164 bytes Desc: not available URL: From aleksasd873 at gmail.com Sat Jan 28 07:22:53 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sat, 28 Jan 2012 15:22:53 +0200 Subject: [Maxima] Working with Inequalities Message-ID: *Thomas D. Dean* tomdean at speakeasy.org *Sat Jan 28 02:35:15 CST 2012 *wrote: How do I solve this? x^2 + 2*x=3 and 7*x+2<-x-3 I found solve_rat_ineq. That handles the inequality OK. (%i1) solve(x^2 + 2*x=3,x); (%o1) [x = - 3, x = 1] (%i2) solve_rat_ineq(7*x+2<-x-3); 5 (%o2) [[x < - -]] 8 The solution is x = -3 Tom Dean ******************************************* first method: (%i1) eq:x^2 + 2*x=3$ (%i2) ineq:7*x+2<-x-3$ (%i3) sol:solve(eq); (%o3) [x=-3,x=1] (%i4) sublist(sol,lambda([e],ev(ineq,e))); (%o4) [x=-3] second method: (%i5) to_poly_solve([eq,ineq], [x]); Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $ (%o5) %union([x=-3]) (%i6) first(%); (%o6) [x=-3] Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From sigoldberg1 at gmail.com Sat Jan 28 16:50:45 2012 From: sigoldberg1 at gmail.com (Seth Goldberg) Date: Sat, 28 Jan 2012 17:50:45 -0500 Subject: [Maxima] porting Maxima 5.26.0 to mac issue? My error? Message-ID: porting issue/?bug/?my error > I downloaded Maxima 5.26.0, opened the dmg, dragged the Maxina icon to to the applications folder, then opened the applications folder and doubleclicked the Maxima icon. A vare window opens and I get see: "Last login: Fri Jan 27 22:27:07 on ttys000 exec '/Applications/Maxima.app/Contents/Resourc/maxima.sh' seth-goldbergs-computer:~ sigoldberg1$ exec '/Applications/Maxima.app/ Contents/Resources/maxima.sh' /Applications/Maxima.app/Contents/Resources/maxima//bin/maxima: line 178: /Applications/Maxima.app/Contents/Resources/maxima//bin/sbcl: Bad CPU type in executable /Applications/Maxima.app/Contents/Resources/maxima//bin/maxima: line 178: /Applications/Maxima.app/Contents/Resources/maxima//bin/sbcl: Unknown error: 0 [Process completed]" > Ideas? Please forward to porting people. > > Thanks, > Seth Goldberg > > > > My system - Mac OS X Vers. 10.6.5 > Hardware and software Overview: all plain vanilla - off the shelf > > Model Name: MacBook Pro > Model Identifier: MacBookPro1,1 > Processor Name: Intel Core Duo > Processor Speed: 2 GHz > Number Of Processors: 1 > Total Number Of Cores: 2 > L2 Cache: 2 MB > Memory: 2 GB > Bus Speed: 667 MHz > Boot ROM Version: MBP11.0055.B08 > SMC Version (system): 1.2f10 > Serial Number (system): W86240QUWBH > Hardware UUID: 00000000-0000-1000-8000- 0016CB8F7F83 > Sudden Motion Sensor: > State: Enabled > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andre.maute at gmx.de Sun Jan 29 11:14:06 2012 From: andre.maute at gmx.de (andre maute) Date: Sun, 29 Jan 2012 18:14:06 +0100 Subject: [Maxima] bug report In-Reply-To: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> References: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> Message-ID: <4F257E5E.30909@gmx.de> On 01/28/2012 11:07 AM, MOHAMMED ABOU ZIED wrote: > Dear All, > I want to report two bugs, > when I use algsys() function, the output list is recognized as a 1 element list (which is worng). > This don't happen for the linsolve() function as the attachments reveal. But there are algebraic equations with more than one solution! See the documentation, this is documented behavior. Andre From rswarbrick at gmail.com Sun Jan 29 11:28:24 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Sun, 29 Jan 2012 17:28:24 +0000 Subject: [Maxima] bug report References: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> Message-ID: MOHAMMED ABOU ZIED writes: > Dear All, > I want to report two bugs, > when I use algsys() function, the output list is recognized as a 1 element list (which is worng). > This don't happen for the linsolve() function as the attachments reveal. Solve returns a list of the solutions. Here it has found one solution (thus the list has length one). This solution has two variables, i and I (so the only element in the top-level list has two elements). > Another bug, after I took the outputs of linsolve() function "i don't > know if this also at algsysy() or not", i used denom() function, but > it returned 1 and when i take num() function, it return both numerator > divided by the denominator. Can you include a transcript? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From glneolistmail at gmail.com Sun Jan 29 11:34:44 2012 From: glneolistmail at gmail.com (Andrew Davis) Date: Sun, 29 Jan 2012 12:34:44 -0500 Subject: [Maxima] Floating point problems Message-ID: Hello all, While doing some homework, maxima return some incorrect limits. I traced the problem back to the number -8.14. It is evaluated to -8.140000000001, you can test this yourself by taking the limit of (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This happens on all clisp's and even on http://calc.matthen.com/ , (evaluate -8.14). At first I thought it was just rounding error on display and not internal stored like that, but take a limit that uses -8.14 and you will have undefined results where it should have a real limit ( because -8.14 can be factored in my problem but -8.14000001 could not ). This is the only number I found that does that, but I suspect more. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Sun Jan 29 11:47:10 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 09:47:10 -0800 Subject: [Maxima] Floating point problems In-Reply-To: References: Message-ID: <4F25861E.40602@gmail.com> On 1/29/12 9:34 AM, Andrew Davis wrote: > Hello all, > > While doing some homework, maxima return some incorrect limits. I traced > the problem back to the number -8.14. It is evaluated to > -8.140000000001, you can test this yourself by taking the limit of > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This > happens on all clisp's and even on http://calc.matthen.com/ , (evaluate > -8.14). At first I thought it was just rounding error on display and > not internal stored like that, but take a limit that uses -8.14 and you > will have undefined results where it should have a real limit > ( because -8.14 can be factored in my problem but -8.14000001 could not > ). This is the only number I found that does that, but I suspect more. This, and questions like it, are becoming a FAQ. If you want exact numbers, use exact numbers instead of floating-point. So use 814/100 instead. 8.14 cannot be represented exactly as (binary) floating-point number. In fact 8.14 differs from 814/100 by 1/1759218604441600. Also read "What Every Computer Scientist Should Know About Floating-Point Arithmetic", by David Goldberg. Google will find suitable versions. Ray From toy.raymond at gmail.com Sun Jan 29 11:47:10 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 09:47:10 -0800 Subject: [Maxima] Floating point problems In-Reply-To: References: Message-ID: <4F25861E.40602@gmail.com> On 1/29/12 9:34 AM, Andrew Davis wrote: > Hello all, > > While doing some homework, maxima return some incorrect limits. I traced > the problem back to the number -8.14. It is evaluated to > -8.140000000001, you can test this yourself by taking the limit of > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This > happens on all clisp's and even on http://calc.matthen.com/ , (evaluate > -8.14). At first I thought it was just rounding error on display and > not internal stored like that, but take a limit that uses -8.14 and you > will have undefined results where it should have a real limit > ( because -8.14 can be factored in my problem but -8.14000001 could not > ). This is the only number I found that does that, but I suspect more. This, and questions like it, are becoming a FAQ. If you want exact numbers, use exact numbers instead of floating-point. So use 814/100 instead. 8.14 cannot be represented exactly as (binary) floating-point number. In fact 8.14 differs from 814/100 by 1/1759218604441600. Also read "What Every Computer Scientist Should Know About Floating-Point Arithmetic", by David Goldberg. Google will find suitable versions. Ray From fateman at eecs.berkeley.edu Sun Jan 29 12:51:34 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 29 Jan 2012 10:51:34 -0800 Subject: [Maxima] bug report In-Reply-To: References: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> Message-ID: <4F259536.10705@eecs.berkeley.edu> On 1/29/2012 9:28 AM, Rupert Swarbrick wrote: > MOHAMMED ABOU ZIED writes: >> Dear All, >> I want to report two bugs, I suspect that the previous two responses may not be specific enough for you. These are not bugs. It would also be helpful in the future if you had a more informative subject line, and did not attach images, but text. Also, you should simplify your report to the simplest example that demonstrates the phenomenon. (Also, there is another place to send bugs, should you find them in the future.) The Maxima bug database is available at http://sourceforge.net/tracker/?atid=104933&group_id=4933&func=browse Submit bug reports by following the 'Add new' link on that page. Good luck, and enjoy Maxima! RJF From andrej.vodopivec at gmail.com Sun Jan 29 13:31:33 2012 From: andrej.vodopivec at gmail.com (Andrej Vodopivec) Date: Sun, 29 Jan 2012 20:31:33 +0100 Subject: [Maxima] porting Maxima 5.26.0 to mac issue? My error? In-Reply-To: References: Message-ID: Unfortunately the binary only supports 64 bit macs. Core Duo is 32 bit. Andrej On Sat, Jan 28, 2012 at 11:50 PM, Seth Goldberg wrote: > porting issue/?bug/?my error > >> I downloaded Maxima 5.26.0, opened the dmg, dragged the Maxina icon to to >> the applications folder, then opened the applications folder and >> doubleclicked the Maxima icon.? A vare window opens and I get see: > > ? "Last login: Fri Jan 27 22:27:07 on ttys000 > ? exec '/Applications/Maxima.app/Contents/Resourc/maxima.sh' > ? seth-goldbergs-computer:~ sigoldberg1$ exec '/Applications/Maxima.app/ > ? Contents/Resources/maxima.sh' > ? /Applications/Maxima.app/Contents/Resources/maxima//bin/maxima: line > ? 178: /Applications/Maxima.app/Contents/Resources/maxima//bin/sbcl: Bad > ? CPU type in executable > ? /Applications/Maxima.app/Contents/Resources/maxima//bin/maxima: line > ? 178: /Applications/Maxima.app/Contents/Resources/maxima//bin/sbcl: > ? Unknown error: 0 > > ? [Process completed]" > >> Ideas? ?Please forward to porting people. >> >> Thanks, >> Seth Goldberg >> >> > >> >> My system - Mac OS X ?Vers. 10.6.5 >> Hardware and software Overview: all plain vanilla -? off the shelf >> >> ? Model Name: MacBook Pro >> ? Model Identifier: ? MacBookPro1,1 >> ? Processor Name: ? ? Intel Core Duo >> ? Processor Speed: ? ?2 GHz >> ? Number Of Processors: ? ? ? 1 >> ? Total Number Of Cores: ? ? ?2 >> ? L2 Cache: ? 2 MB >> ? Memory: ? ? 2 GB >> ? Bus Speed: ?667 MHz >> ? Boot ROM Version: ? MBP11.0055.B08 >> ? SMC Version (system): ? ? ? 1.2f10 >> ? Serial Number (system): ? ? W86240QUWBH >> ? Hardware UUID: ? ? ?00000000-0000-1000-8000- > 0016CB8F7F83 >> ? Sudden Motion Sensor: >> ? State: ? ? ?Enabled >> > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > From pbowyer at olynet.com Sun Jan 29 14:11:39 2012 From: pbowyer at olynet.com (Paul Bowyer) Date: Sun, 29 Jan 2012 12:11:39 -0800 Subject: [Maxima] Make check failures In-Reply-To: References: <4F1F1790.5040603@olynet.com> Message-ID: <4F25A7FB.6050302@olynet.com> On 01/24/2012 01:03 PM, Raymond Toy wrote: > > > On Tue, Jan 24, 2012 at 12:41 PM, Paul Bowyer > wrote: > > > I ran the test suite from within xmaxima for sbcl and ccl and > sbcl fails on rtest16 > ********************** Problem 393 *************** > Input: > closeto(zeta(%i + 3) - (1.10721440843141 - .1482908671781754 %i), > 1.e-15) > > > Result: > 3.3157171161039706e-9 > > This differed from the expected result: > true > > ********************** Problem 394 *************** > Input: > ! 1 ! > closeto(!zeta(0.5 %i + -)! - 1.06534921249378, 1.e-14) > ! 2 ! > > > Result: > 3.1194385963217997e-8 > > > I'm pretty sure this is the known issue with sbcl about how it > computes (cl:expt ). A bug has been filed, I > think, and I have verbal confirmation that it will be fixed someday. > (Ccl used to have the same problem, but it was fixed a while ago.) > > Ray > Ray: I installed sbcl 1.0.55 and rebuilt maxima from source using a fresh download yesterday and now the testsuite using the sbcl runtime completes without unknown errors. Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Sun Jan 29 14:44:06 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 12:44:06 -0800 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: <4F25AF96.1010409@gmail.com> On 1/29/12 11:50 AM, Andrew Davis wrote: > I understand all that it is not exact > > At first I thought it was just rounding error on display > > but why is it not held in memory symbolically so that it can be > factored and manipulated correctly. > +maxima-list Because you told maxima you wanted a floating-point number by writing 8.14. And it is being manipulated correctly (barring bugs) according to floating-point arithmetic rules. Ray From macrakis at alum.mit.edu Sun Jan 29 14:44:31 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 29 Jan 2012 15:44:31 -0500 Subject: [Maxima] bug report In-Reply-To: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> References: <1327745273.46551.YahooMailNeo@web26503.mail.ukl.yahoo.com> Message-ID: Please send compact, reproducible bug reports. From what you've said, I see no evidence of a bug. Have you tried ? algsys and ? linsolve to see what these functions are *supposed* to do? In particular: ...`algsys' returns a *list* of solutions... The easiest way to show us what you did in a reproducible way is to turn display2d:true and then cut and paste the input/output stream, as below. Be sure to include all inputs. I've included some guesses about what confused you: (%i1) display2d:false; (%o1) false (%i2) algsys([x^2+1=y,x=y],[x,y]); (%o2) [[x = -(sqrt(3)*%i-1)/2,y = -(sqrt(3)*%i-1)/2], << note that this is a LIST of solutions [x = (sqrt(3)*%i+1)/2,y = (sqrt(3)*%i+1)/2]] << in general, non-linear equations have multiple solutions (%i3) part(%o2,1); (%o3) [x = -(sqrt(3)*%i-1)/2,y = -(sqrt(3)*%i-1)/2] (%i4) part(%,1); (%o4) x = -(sqrt(3)*%i-1)/2 (%i5) part(%,2); (%o5) -(sqrt(3)*%i-1)/2 (%i6) denom(%o5); (%o6) 2 << this is probably what you were looking for (%i7) num(%o5); (%o7) 1-sqrt(3)*%i (%i8) denom(%o4); << %o4 is an EQUATION, not an EXPRESSION (%o8) 1 << equations don't have denominators (arguably this could give an error message) -s On Sat, Jan 28, 2012 at 05:07, MOHAMMED ABOU ZIED < mohamedabouzied at yahoo.co.uk> wrote: > Dear All, > I want to report two bugs, > when I use algsys() function, the output list is recognized as a 1 element > list (which is worng). > This don't happen for the linsolve() function as the attachments reveal. > Another bug, after I took the outputs of linsolve() function "i don't know > if this also at algsysy() or not", i used denom() function, but it returned > 1 and when i take num() function, it return both numerator divided by the > denominator. > Yours, > Mohamed Abouzied > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Sun Jan 29 14:48:18 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 29 Jan 2012 15:48:18 -0500 Subject: [Maxima] Floating point problems In-Reply-To: References: Message-ID: I doubt this has anything to do with limits. Please try harder to produce *minimal reproducible* problem reports. As for factoring, it doesn't make sense to factor approximate numbers like 8.14, which cannot be represented exactly in binary floating-point. But if you insist, the factorization is: factor(rationalize(8.14)) => 5*6113*18740440949/2^46 -s On Sun, Jan 29, 2012 at 12:34, Andrew Davis wrote: > Hello all, > > While doing some homework, maxima return some incorrect limits. I traced > the problem back to the number -8.14. It is evaluated to -8.140000000001, > you can test this yourself by taking the limit of (-8.14+1) as x approaches > any number, or just evaluate 1-8.14. This happens on all clisp's and even > on http://calc.matthen.com/ , (evaluate -8.14). At first I thought it was > just rounding error on display and not internal stored like that, but take > a limit that uses -8.14 and you will have undefined results where it should > have a real limit ( because -8.14 can be factored in my problem but > -8.14000001 could not ). This is the only number I found that does that, > but I suspect more. > > Thank you. > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Sun Jan 29 15:34:56 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 29 Jan 2012 14:34:56 -0700 Subject: [Maxima] [patch] 3D curve parametric plot In-Reply-To: References: Message-ID: I have committed & pushed this patch. Alexander, thanks for your help. Robert Dodier On 1/22/12, Alexander Klimov wrote: > Hi. > > It used to be possible to do 3D parametric curve plots with > > plot3d([sin(t), cos(t), t], [t,-5,5], [y,-5,5], [grid,100,2], > [gnuplot_pm3d,false])$ > > but in the current version it gives > > plot3d: wrong number of variables: [t]. There should be two > > The problem can be fixed with the attached patch. It would be nice if > it were committed to the mainline. It is also a good idea to document > the grid trick in plot3d documentation. > > -- > Regards, > ASK From robert.dodier at gmail.com Sun Jan 29 16:05:04 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sun, 29 Jan 2012 15:05:04 -0700 Subject: [Maxima] cf documentation In-Reply-To: References: Message-ID: On 1/26/12, Stavros Macrakis wrote: > The 'cf' (continued fraction) documentation should mention that cf > expansions are exact for rational numbers, but are cut off at ratepsilon > (for floats) and 10^-fpprec (for bigfloats). I;ve revised the cf documentation to take that into account. What do you think? best Robert Dodier PS. -- Function: cf () Computes a continued fraction approximation. is an expression comprising continued fractions, square roots of integers, and literal real numbers (integers, rational numbers, ordinary floats, and bigfloats). `cf' computes exact expansions for rational numbers, but expansions are truncated at `ratepsilon' for ordinary floats and `10^(-fpprec)' for bigfloats. etc etc. (same as before) From glneolistmail at gmail.com Sun Jan 29 13:51:21 2012 From: glneolistmail at gmail.com (Andrew Davis) Date: Sun, 29 Jan 2012 14:51:21 -0500 Subject: [Maxima] Floating point problems In-Reply-To: <4F25861E.40602@gmail.com> References: <4F25861E.40602@gmail.com> Message-ID: I understand all that it is not exact > At first I thought it was just rounding error on display but why is it not held in memory symbolically so that it can be factored and manipulated correctly. Thank you. On Sun, Jan 29, 2012 at 12:47 PM, Raymond Toy wrote: > On 1/29/12 9:34 AM, Andrew Davis wrote: > > Hello all, > > > > While doing some homework, maxima return some incorrect limits. I traced > > the problem back to the number -8.14. It is evaluated to > > -8.140000000001, you can test this yourself by taking the limit of > > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This > > happens on all clisp's and even on http://calc.matthen.com/ , (evaluate > > -8.14). At first I thought it was just rounding error on display and > > not internal stored like that, but take a limit that uses -8.14 and you > > will have undefined results where it should have a real limit > > ( because -8.14 can be factored in my problem but -8.14000001 could not > > ). This is the only number I found that does that, but I suspect more. > > This, and questions like it, are becoming a FAQ. If you want exact > numbers, use exact numbers instead of floating-point. So use 814/100 > instead. 8.14 cannot be represented exactly as (binary) floating-point > number. In fact 8.14 differs from 814/100 by 1/1759218604441600. > > Also read "What Every Computer Scientist Should Know About > Floating-Point Arithmetic", by David Goldberg. Google will find > suitable versions. > > Ray > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Sun Jan 29 16:22:30 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 29 Jan 2012 17:22:30 -0500 Subject: [Maxima] cf documentation In-Reply-To: References: Message-ID: Revisions look good, thanks. -s On Sun, Jan 29, 2012 at 17:05, Robert Dodier wrote: > On 1/26/12, Stavros Macrakis wrote: > > > The 'cf' (continued fraction) documentation should mention that cf > > expansions are exact for rational numbers, but are cut off at ratepsilon > > (for floats) and 10^-fpprec (for bigfloats). > > I;ve revised the cf documentation to take that into account. > What do you think? > > best > > Robert Dodier > > PS. > > -- Function: cf () > Computes a continued fraction approximation. is an > expression comprising continued fractions, square roots of > integers, and literal real numbers (integers, rational numbers, > ordinary floats, and bigfloats). `cf' computes exact expansions > for rational numbers, but expansions are truncated at `ratepsilon' > for ordinary floats and `10^(-fpprec)' for bigfloats. > > etc etc. (same as before) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Sun Jan 29 16:26:54 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 29 Jan 2012 17:26:54 -0500 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: The Maxima convention (which is followed by most systems I know) is that numbers expressed with a decimal point are interpreted as floating-point numbers. It would of course be possible to change that decision, but the next question then would be what the output form of such objects is: if 0.8 is interpreted as 8/10 (= 4/5), should it be output as 0.8? 8/10? or 4/5? What is the output form of 0.8 + 1/10? How about 0.8 + 1/3? And how about 0.8 + 1/3 - 11/15? -s On Sun, Jan 29, 2012 at 14:51, Andrew Davis wrote: > I understand all that it is not exact > > At first I thought it was just rounding error on display > > but why is it not held in memory symbolically so that it can be > factored and manipulated correctly. > > Thank you. > > On Sun, Jan 29, 2012 at 12:47 PM, Raymond Toy wrote: > >> On 1/29/12 9:34 AM, Andrew Davis wrote: >> > Hello all, >> > >> > While doing some homework, maxima return some incorrect limits. I traced >> > the problem back to the number -8.14. It is evaluated to >> > -8.140000000001, you can test this yourself by taking the limit of >> > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This >> > happens on all clisp's and even on http://calc.matthen.com/ , (evaluate >> > -8.14). At first I thought it was just rounding error on display and >> > not internal stored like that, but take a limit that uses -8.14 and you >> > will have undefined results where it should have a real limit >> > ( because -8.14 can be factored in my problem but -8.14000001 could not >> > ). This is the only number I found that does that, but I suspect more. >> >> This, and questions like it, are becoming a FAQ. If you want exact >> numbers, use exact numbers instead of floating-point. So use 814/100 >> instead. 8.14 cannot be represented exactly as (binary) floating-point >> number. In fact 8.14 differs from 814/100 by 1/1759218604441600. >> >> Also read "What Every Computer Scientist Should Know About >> Floating-Point Arithmetic", by David Goldberg. Google will find >> suitable versions. >> >> Ray >> >> > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fateman at eecs.berkeley.edu Sun Jan 29 16:46:52 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sun, 29 Jan 2012 14:46:52 -0800 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: <4F25CC5C.9000407@eecs.berkeley.edu> The simplest (but somewhat rude) answer to your question is that your idea of what is correct and what can be factored does not correspond to the generally accepted and more useful notions of what is correct and what can be factored. Factorization requires a unique factorization domain. Floating point numbers are not a UFD. Conventionally, typing 8.14 means you wish to use the internal (binary) floating-point representation. It is not possible to represent exactly 814/100 in binary. The number that is represented is exactly 572801577606185/70368744177664 which is what Stavros got from rationalize(8.14); and this can be interpreted as an element in a UFD and admits of factoring into (5*6113*18740440949)/2^46 exactly. I also recommend you read Goldberg's paper. Good luck. RJF On 1/29/2012 2:26 PM, Stavros Macrakis wrote: > The Maxima convention (which is followed by most systems I know) is > that numbers expressed with a decimal point are interpreted as > floating-point numbers. It would of course be possible to change that > decision, but the next question then would be what the output form of > such objects is: if 0.8 is interpreted as 8/10 (= 4/5), should it be > output as 0.8? 8/10? or 4/5? What is the output form of 0.8 + 1/10? > How about 0.8 + 1/3? And how about 0.8 + 1/3 - 11/15? > > -s > > > On Sun, Jan 29, 2012 at 14:51, Andrew Davis > wrote: > > I understand all that it is not exact > > At first I thought it was just rounding error on display > > but why is it not held in memory symbolically so that it can be > factored and manipulated correctly. > > Thank you. > > On Sun, Jan 29, 2012 at 12:47 PM, Raymond Toy > > wrote: > > On 1/29/12 9:34 AM, Andrew Davis wrote: > > Hello all, > > > > While doing some homework, maxima return some incorrect > limits. I traced > > the problem back to the number -8.14. It is evaluated to > > -8.140000000001, you can test this yourself by taking the > limit of > > (-8.14+1) as x approaches any number, or just evaluate > 1-8.14. This > > happens on all clisp's and even on http://calc.matthen.com/ > , (evaluate > > -8.14). At first I thought it was just rounding error on > display and > > not internal stored like that, but take a limit that uses > -8.14 and you > > will have undefined results where it should have a real limit > > ( because -8.14 can be factored in my problem but > -8.14000001 could not > > ). This is the only number I found that does that, but I > suspect more. > > This, and questions like it, are becoming a FAQ. If you want > exact > numbers, use exact numbers instead of floating-point. So use > 814/100 > instead. 8.14 cannot be represented exactly as (binary) > floating-point > number. In fact 8.14 differs from 814/100 by 1/1759218604441600. > > Also read "What Every Computer Scientist Should Know About > Floating-Point Arithmetic", by David Goldberg. Google will find > suitable versions. > > Ray > > > > _______________________________________________ > 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: From pbowyer at olynet.com Sun Jan 29 19:19:20 2012 From: pbowyer at olynet.com (Paul Bowyer) Date: Sun, 29 Jan 2012 17:19:20 -0800 Subject: [Maxima] Make check failures In-Reply-To: References: <4F1F1790.5040603@olynet.com> <4F1F3E0F.2040002@olynet.com> Message-ID: <4F25F018.8030903@olynet.com> On 01/24/2012 05:17 PM, Robert Dodier wrote: > On 1/24/12, Paul Bowyer wrote: > >> So far my lisp programming is to the point where I can write simple >> programs around CLX, but I haven't tried anything as advanced as maxima. >> I think it would be well beyond my abilities. >> >> If I discover anything in my stumblings with maxima, I'll post them, but >> don't hold your breath waiting... > OK, well, Maxima is a big, messy program but in some ways it is not > too terribly sophisticated. I think it's likely that you can readily > learn enough about Lisp& Maxima to make useful contributions. > > best, > > Robert Dodier > Robert: I tried updating CCL and rebuilding maxima, but it made no difference with the testsuite errors. The CCL maxima runtime still fails rtest15, problems 37, 193, and 196. build_info (); Maxima version: 5.26.0_26_gc4216e7 Maxima build date: 18:32 1/28/2012 Host type: i686-pc-linux-gnu Lisp implementation type: Clozure Common Lisp Lisp implementation version: Version 1.7-r15188M (LinuxX8632) (%i2) run_testsuite (display_all = true, tests=[rtest15]); ********************** Problem 37 *************** Input: 2 2 - %pi sin (3 a) sin (----- + a + b) 3 (----------------------------- 2 %pi sin (a - ---) 3 - %pi 2 sin(a) sin(3 a) cos(b) sin(----- + a + b) sin(3 a + 3 b) 3 - ---------------------------------------------------------- %pi sin(a - ---) sin(a + b) 3 2 2 sin (a) sin (3 a + 3 b) + -----------------------, result : trigrat(%%), 2 sin (a + b) expected : (- (- 9 + 10 cos(2 a) - 2 sqrt(3) sin(2 a) - cos(4 a) + sqrt(3) sin(4 a) + 10 cos(2 b) - 2 sqrt(3) sin(2 b) - cos(4 b) + sqrt(3) sin(4 b) - 4 cos(2 b - 2 a) - 8 cos(2 a + 2 b) + 4 sqrt(3) sin(2 a + 2 b) + 2 cos(4 a + 2 b) - 2 sqrt(3) sin(4 a + 2 b) + 2 cos(2 a + 4 b) - 2 sqrt(3) sin(2 a + 4 b) - cos(4 a + 4 b) + sqrt(3) sin(4 a + 4 b)))/4, ratsimp(result - expected)) Result: Polynomial quotient is not exact error-catch This differed from the expected result: 0 ********************** Problem 193 *************** Input: 2 t log(t) integrate(-----------------, t, 0, 1) 2 4 (t - 1) (1 + t ) Result: 2 (sqrt(2) - 2) %pi - ------------------ 32 This differed from the expected result: 2 (sqrt(2) - 1) %pi ------------------ 9/2 2 ********************** Problem 196 *************** Input: 1 factor(expand(sqrtdenest(integrate(------------, x, 0, 1)))) 1 4 - + (x - 3) 2 3/4 9/4 73 + sqrt(2) + 2 - 3 2 - factor((- (- log(----------------------------) 33 3/4 9/4 3/4 5/2 13/4 73 + sqrt(2) - 2 + 3 2 - 2 + 2 - 2 + log(----------------------------) + 2 atan(---------------------) 33 3/4 13/4 98 + 2 - 2 3/4 5/2 13/4 2 + 2 + 2 7/4 + 2 atan(-------------------)))/2 ) 3/4 13/4 - 98 + 2 - 2 Result: 13/4 5/2 3/4 13/4 5/2 3/4 2 + 2 + 2 - 2 + 2 - 2 (2 atan(-------------------) + 2 atan(---------------------) 13/4 3/4 13/4 3/4 - 2 + 2 - 98 - 2 + 2 + 98 9/4 3/4 9/4 3/4 3 2 - 2 + sqrt(2) + 73 - 3 2 + 2 + sqrt(2) + 73 + log(----------------------------) - log(------------------------------)) 33 33 9/4 3/4 7/4 3 2 - 2 + sqrt(2) + 73 /2 - (log(----------------------------) 33 9/4 3/4 - 3 2 + 2 + sqrt(2) + 73 - log(------------------------------) - 2 33 3/4 1/4 79 2 + 365 sqrt(2) + 877 2 + 5 atan(------------------------------------) 10657 3/4 1/4 - 79 2 + 365 sqrt(2) - 877 2 + 5 7/4 + 2 atan(--------------------------------------))/2 10657 This differed from the expected result: 0 I manually fed parts of problem 37 into xmaxima to see what happens: %i1) sin(a)^2*sin(3*b+3*a)^2/sin(b+a)^2 -2*sin(a)*sin(3*a)*cos(b)*sin(b+a-%pi/3)*sin(3*b+3*a) /(sin(a-%pi/3)*sin(b+a)) +sin(3*a)^2*sin(b+a-%pi/3)^2/sin(a-%pi/3)^2; and I got the following output: 2 2 sin (a) sin (3 b + 3 a) (%o1) ----------------------- 2 sin (b + a) %pi 2 sin(a) sin(3 a) cos(b) sin(b + a - ---) sin(3 b + 3 a) 3 - -------------------------------------------------------- %pi sin(a - ---) sin(b + a) 3 2 2 %pi sin (3 a) sin (b + a - ---) 3 + --------------------------- 2 %pi sin (a - ---) 3 (%i2) trace(ratexpand); (%o2) [ratexpand] (%i3) trigrat(%o1); 1 Enter ratexpand [%i b] 1 Exit ratexpand %i b 1 1 Enter ratexpand [-] 2 1 1 Exit ratexpand - 2 1 Enter ratexpand [%i a] 1 Exit ratexpand %i a <-- falls apart here Polynomial quotient is not exact I did the same for the cmucl runtime with xmaxima and it completed successfully: 1 Enter ratexpand [%i b] 1 Exit ratexpand %i b 1 1 Enter ratexpand [-] 2 1 1 Exit ratexpand - 2 1 Enter ratexpand [%i a] 1 Exit ratexpand %i a <-- completes successfully %i a 8 more output follows... I didn't go any further because I have difficulty following the lisp code in maxima. Maybe that will change as I spend more time trying to understand it. Paul Bowyer From toy.raymond at gmail.com Sun Jan 29 19:44:10 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 17:44:10 -0800 Subject: [Maxima] Make check failures In-Reply-To: <4F25F018.8030903@olynet.com> References: <4F1F1790.5040603@olynet.com> <4F1F3E0F.2040002@olynet.com> <4F25F018.8030903@olynet.com> Message-ID: <4F25F5EA.6070304@gmail.com> On 1/29/12 5:19 PM, Paul Bowyer wrote: > On 01/24/2012 05:17 PM, Robert Dodier wrote: >> On 1/24/12, Paul Bowyer wrote: >> >>> So far my lisp programming is to the point where I can write simple >>> programs around CLX, but I haven't tried anything as advanced as maxima. >>> I think it would be well beyond my abilities. >>> >>> If I discover anything in my stumblings with maxima, I'll post them, but >>> don't hold your breath waiting... >> OK, well, Maxima is a big, messy program but in some ways it is not >> too terribly sophisticated. I think it's likely that you can readily >> learn enough about Lisp& Maxima to make useful contributions. >> >> best, >> >> Robert Dodier >> > Robert: > > I tried updating CCL and rebuilding maxima, but it made no difference > with the testsuite errors. The CCL maxima runtime still fails rtest15, > problems 37, 193, and 196. > > build_info (); > Maxima version: 5.26.0_26_gc4216e7 > Maxima build date: 18:32 1/28/2012 > Host type: i686-pc-linux-gnu > Lisp implementation type: Clozure Common Lisp > Lisp implementation version: Version 1.7-r15188M (LinuxX8632) I think Barton mentioned a little while ago that the errors only occur with the 32-bit version of CCL. Everything works fine with the 64-bit version. > > > Result: > Polynomial quotient is not exact Ugh. Of all the bugs to start with, this is probably one of the most difficult but also one with far reaching consequences. No one has found a case that was simple enough to debug and no one has figured out exactly how it all works. (I think.) If you're new, maybe this is not the place to begin. On the other hand, maybe a newbie can learn enough and has the right point of view to figure it all out. :-) That would be fantastic! Ray From toy.raymond at gmail.com Sun Jan 29 19:44:10 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 17:44:10 -0800 Subject: [Maxima] Make check failures In-Reply-To: <4F25F018.8030903@olynet.com> References: <4F1F1790.5040603@olynet.com> <4F1F3E0F.2040002@olynet.com> <4F25F018.8030903@olynet.com> Message-ID: <4F25F5EA.6070304@gmail.com> On 1/29/12 5:19 PM, Paul Bowyer wrote: > On 01/24/2012 05:17 PM, Robert Dodier wrote: >> On 1/24/12, Paul Bowyer wrote: >> >>> So far my lisp programming is to the point where I can write simple >>> programs around CLX, but I haven't tried anything as advanced as maxima. >>> I think it would be well beyond my abilities. >>> >>> If I discover anything in my stumblings with maxima, I'll post them, but >>> don't hold your breath waiting... >> OK, well, Maxima is a big, messy program but in some ways it is not >> too terribly sophisticated. I think it's likely that you can readily >> learn enough about Lisp& Maxima to make useful contributions. >> >> best, >> >> Robert Dodier >> > Robert: > > I tried updating CCL and rebuilding maxima, but it made no difference > with the testsuite errors. The CCL maxima runtime still fails rtest15, > problems 37, 193, and 196. > > build_info (); > Maxima version: 5.26.0_26_gc4216e7 > Maxima build date: 18:32 1/28/2012 > Host type: i686-pc-linux-gnu > Lisp implementation type: Clozure Common Lisp > Lisp implementation version: Version 1.7-r15188M (LinuxX8632) I think Barton mentioned a little while ago that the errors only occur with the 32-bit version of CCL. Everything works fine with the 64-bit version. > > > Result: > Polynomial quotient is not exact Ugh. Of all the bugs to start with, this is probably one of the most difficult but also one with far reaching consequences. No one has found a case that was simple enough to debug and no one has figured out exactly how it all works. (I think.) If you're new, maybe this is not the place to begin. On the other hand, maybe a newbie can learn enough and has the right point of view to figure it all out. :-) That would be fantastic! Ray From macrakis at alum.mit.edu Sun Jan 29 20:19:07 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 29 Jan 2012 21:19:07 -0500 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: Just to continue on this theme, if you treat 0.8 as the exact number 4/5, then sin(0.8) can't be simplified or evaluated to an approximate result (0.717...), which seems to be what most users want.... -s On Sun, Jan 29, 2012 at 17:26, Stavros Macrakis wrote: > The Maxima convention (which is followed by most systems I know) is that > numbers expressed with a decimal point are interpreted as floating-point > numbers. It would of course be possible to change that decision, but the > next question then would be what the output form of such objects is: if 0.8 > is interpreted as 8/10 (= 4/5), should it be output as 0.8? 8/10? or 4/5? > What is the output form of 0.8 + 1/10? How about 0.8 + 1/3? And how > about 0.8 + 1/3 - 11/15? > > -s > > > On Sun, Jan 29, 2012 at 14:51, Andrew Davis wrote: > >> I understand all that it is not exact >> > At first I thought it was just rounding error on display >> >> but why is it not held in memory symbolically so that it can be >> factored and manipulated correctly. >> >> Thank you. >> >> On Sun, Jan 29, 2012 at 12:47 PM, Raymond Toy wrote: >> >>> On 1/29/12 9:34 AM, Andrew Davis wrote: >>> > Hello all, >>> > >>> > While doing some homework, maxima return some incorrect limits. I >>> traced >>> > the problem back to the number -8.14. It is evaluated to >>> > -8.140000000001, you can test this yourself by taking the limit of >>> > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This >>> > happens on all clisp's and even on http://calc.matthen.com/ , >>> (evaluate >>> > -8.14). At first I thought it was just rounding error on display and >>> > not internal stored like that, but take a limit that uses -8.14 and you >>> > will have undefined results where it should have a real limit >>> > ( because -8.14 can be factored in my problem but -8.14000001 could not >>> > ). This is the only number I found that does that, but I suspect more. >>> >>> This, and questions like it, are becoming a FAQ. If you want exact >>> numbers, use exact numbers instead of floating-point. So use 814/100 >>> instead. 8.14 cannot be represented exactly as (binary) floating-point >>> number. In fact 8.14 differs from 814/100 by 1/1759218604441600. >>> >>> Also read "What Every Computer Scientist Should Know About >>> Floating-Point Arithmetic", by David Goldberg. Google will find >>> suitable versions. >>> >>> Ray >>> >>> >> >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Sun Jan 29 21:02:31 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 29 Jan 2012 22:02:31 -0500 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: float(4/5) => .8 rat(.8) => 4/5 (within ratepsilon accuracy -- ratepsilon should be something like 2e-15) rationalize(.8) => 3602879701896397/4503599627370496 (2^n fraction) On Sun, Jan 29, 2012 at 21:45, Andrew Davis wrote: > Is there a standard way to convert between the two forms in memory then? > .8 <-> 4/5 , -8.14 <-> -814/100? > > > On Sun, Jan 29, 2012 at 9:19 PM, Stavros Macrakis wrote: > >> Just to continue on this theme, if you treat 0.8 as the exact number 4/5, >> then sin(0.8) can't be simplified or evaluated to an approximate result >> (0.717...), which seems to be what most users want.... >> >> -s >> >> On Sun, Jan 29, 2012 at 17:26, Stavros Macrakis wrote: >> >>> The Maxima convention (which is followed by most systems I know) is that >>> numbers expressed with a decimal point are interpreted as floating-point >>> numbers. It would of course be possible to change that decision, but the >>> next question then would be what the output form of such objects is: if 0.8 >>> is interpreted as 8/10 (= 4/5), should it be output as 0.8? 8/10? or 4/5? >>> What is the output form of 0.8 + 1/10? How about 0.8 + 1/3? And how >>> about 0.8 + 1/3 - 11/15? >>> >>> -s >>> >>> >>> On Sun, Jan 29, 2012 at 14:51, Andrew Davis wrote: >>> >>>> I understand all that it is not exact >>>> > At first I thought it was just rounding error on display >>>> >>>> but why is it not held in memory symbolically so that it can be >>>> factored and manipulated correctly. >>>> >>>> Thank you. >>>> >>>> On Sun, Jan 29, 2012 at 12:47 PM, Raymond Toy wrote: >>>> >>>>> On 1/29/12 9:34 AM, Andrew Davis wrote: >>>>> > Hello all, >>>>> > >>>>> > While doing some homework, maxima return some incorrect limits. I >>>>> traced >>>>> > the problem back to the number -8.14. It is evaluated to >>>>> > -8.140000000001, you can test this yourself by taking the limit of >>>>> > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This >>>>> > happens on all clisp's and even on http://calc.matthen.com/ , >>>>> (evaluate >>>>> > -8.14). At first I thought it was just rounding error on display and >>>>> > not internal stored like that, but take a limit that uses -8.14 and >>>>> you >>>>> > will have undefined results where it should have a real limit >>>>> > ( because -8.14 can be factored in my problem but -8.14000001 could >>>>> not >>>>> > ). This is the only number I found that does that, but I suspect >>>>> more. >>>>> >>>>> This, and questions like it, are becoming a FAQ. If you want exact >>>>> numbers, use exact numbers instead of floating-point. So use 814/100 >>>>> instead. 8.14 cannot be represented exactly as (binary) floating-point >>>>> number. In fact 8.14 differs from 814/100 by 1/1759218604441600. >>>>> >>>>> Also read "What Every Computer Scientist Should Know About >>>>> Floating-Point Arithmetic", by David Goldberg. Google will find >>>>> suitable versions. >>>>> >>>>> Ray >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Maxima mailing list >>>> Maxima at math.utexas.edu >>>> http://www.math.utexas.edu/mailman/listinfo/maxima >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From subiono2008 at matematika.its.ac.id Sun Jan 29 20:33:08 2012 From: subiono2008 at matematika.its.ac.id (subiono2008 at matematika.its.ac.id) Date: Mon, 30 Jan 2012 09:33:08 +0700 (WIT) Subject: [Maxima] How to calculate of a matrix p(A) In-Reply-To: References: Message-ID: <1664.10.112.250.187.1327890788.squirrel@webmail.its.ac.id> Dear all, I have a problem to calcute a matrix p(A) with p(x) is a polynomial of degree n with real koefficient and A is a matrix of size n time n. For an example: p(x)=x^2 +3x + 2 and then p(A)=A^2+3A+2I, with I is identity matrix of size 2 time 2. Thank you in advanced Subiono -- http://www.its.ac.id From willisb at unk.edu Sun Jan 29 21:46:12 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 29 Jan 2012 21:46:12 -0600 Subject: [Maxima] Make check failures In-Reply-To: <4F25F5EA.6070304@gmail.com> References: <4F25F5EA.6070304@gmail.com>, <4F1F1790.5040603@olynet.com> <4F1F3E0F.2040002@olynet.com> <4F25F018.8030903@olynet.com> Message-ID: -----maxima-bounces at math.utexas.edu wrote: ----- >I think Barton mentioned a little while ago that the errors only occur >with the 32-bit version of CCL. ?Everything works fine with the 64-bit >version. Yes, I just re-checked this: no errors with 64 bit CCL (Version 1.7-r14925M), and with 32 bit CCL, rtest15.mac, problems (37 193 196) fail. And #37 is the pesky Polynomial quotient is not exact error. --Barton From willisb at unk.edu Sun Jan 29 21:52:37 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 29 Jan 2012 21:52:37 -0600 Subject: [Maxima] How to calculate of a matrix p(A) In-Reply-To: <1664.10.112.250.187.1327890788.squirrel@webmail.its.ac.id> References: <1664.10.112.250.187.1327890788.squirrel@webmail.its.ac.id>, Message-ID: Method I: (%i1) load(linearalgebra)$ (%i2) M : matrix([1,2],[3,4])$ (%i3) matrixfun(lambda([x], x^2+3*x+2),M); (%o3) matrix([12,16],[24,36]) Method II: (%i4) M.M+3*M+2*ident(2); (%o4) matrix([12,16],[24,36]) --Barton -----maxima-bounces at math.utexas.edu wrote: ----- To: maxima at math.utexas.edu From: subiono2008 at matematika.its.ac.id Sent by: maxima-bounces at math.utexas.edu Date: 01/29/2012 09:15PM Subject: [Maxima] How to calculate of a matrix p(A) Dear all, I have a problem to calcute a matrix p(A) with p(x) is a polynomial of degree n with real koefficient and A is a matrix of size n time n. For ?an example: p(x)=x^2 +3x + 2 and then p(A)=A^2+3A+2I, with I is identity matrix of size 2 time 2. Thank you in advanced Subiono -- http://www.its.ac.id? _______________________________________________ Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From willisb at unk.edu Sun Jan 29 22:18:26 2012 From: willisb at unk.edu (Barton Willis) Date: Sun, 29 Jan 2012 22:18:26 -0600 Subject: [Maxima] Make check failures In-Reply-To: References: , <4F25F5EA.6070304@gmail.com>, <4F1F1790.5040603@olynet.com> <4F1F3E0F.2040002@olynet.com> <4F25F018.8030903@olynet.com> Message-ID: The trigrat function locally sets gcd to subres. Changing to spmod at least eliminates the "polynomial not...." error in 32 bit CCL. --bw ----maxima-bounces at math.utexas.edu wrote: ----- From toy.raymond at gmail.com Sun Jan 29 23:19:18 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 21:19:18 -0800 Subject: [Maxima] bigfloat eigenvalues In-Reply-To: <4F2573ED.8080601@eecs.berkeley.edu> References: <4F2573ED.8080601@eecs.berkeley.edu> Message-ID: <4F262856.70004@gmail.com> On 1/29/12 8:29 AM, Richard Fateman wrote: > I re-worked the program from lapack/ eispack "bisect" which > computes eigenvalues of a symmetric tridiagonal matrix (STM) so that > it runs in bigfloat arithmetic. it is in > http://www.cs.berkeley.edu/~fateman/lisp/bfbisect.lisp > and appears to be happy in GCL. testing it in your favorite version of > maxima > would require loading that file (optionally compiling), and running > ?test(); Here is another version using maxima bigfloat class. Probably slower than what Richard has done, but it's a bit simpler, and also closer to the original f2cl version. Needs some work to be nice with maxima, but the simple test appears to work. Just load (or compile and load) this into maxima. Ray -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: bisect.lisp URL: From toy.raymond at gmail.com Sun Jan 29 23:19:18 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sun, 29 Jan 2012 21:19:18 -0800 Subject: [Maxima] bigfloat eigenvalues In-Reply-To: <4F2573ED.8080601@eecs.berkeley.edu> References: <4F2573ED.8080601@eecs.berkeley.edu> Message-ID: <4F262856.70004@gmail.com> On 1/29/12 8:29 AM, Richard Fateman wrote: > I re-worked the program from lapack/ eispack "bisect" which > computes eigenvalues of a symmetric tridiagonal matrix (STM) so that > it runs in bigfloat arithmetic. it is in > http://www.cs.berkeley.edu/~fateman/lisp/bfbisect.lisp > and appears to be happy in GCL. testing it in your favorite version of > maxima > would require loading that file (optionally compiling), and running > ?test(); Here is another version using maxima bigfloat class. Probably slower than what Richard has done, but it's a bit simpler, and also closer to the original f2cl version. Needs some work to be nice with maxima, but the simple test appears to work. Just load (or compile and load) this into maxima. Ray -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: bisect.lisp URL: From villate at fe.up.pt Mon Jan 30 04:02:09 2012 From: villate at fe.up.pt (Jaime Villate) Date: Mon, 30 Jan 2012 10:02:09 +0000 Subject: [Maxima] How to calculate of a matrix p(A) In-Reply-To: <1664.10.112.250.187.1327890788.squirrel@webmail.its.ac.id> References: <1664.10.112.250.187.1327890788.squirrel@webmail.its.ac.id> Message-ID: <4F266AA1.8020402@fe.up.pt> On 01/30/2012 02:33 AM, subiono2008 at matematika.its.ac.id wrote: > I have a problem to calcute a matrix p(A) with > p(x) is a polynomial of degree n with real koefficient > and A is a matrix of size n time n. For an example: > p(x)=x^2 +3x + 2 and then > p(A)=A^2+3A+2I, with I is identity matrix of size 2 time 2. 3A should be written as 3*A and for matrices A? must be written as A^^2 Regards, Jaime -------------- next part -------------- An HTML attachment was scrubbed... URL: From glneolistmail at gmail.com Sun Jan 29 20:45:29 2012 From: glneolistmail at gmail.com (Andrew Davis) Date: Sun, 29 Jan 2012 21:45:29 -0500 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: Is there a standard way to convert between the two forms in memory then? .8 <-> 4/5 , -8.14 <-> -814/100? On Sun, Jan 29, 2012 at 9:19 PM, Stavros Macrakis wrote: > Just to continue on this theme, if you treat 0.8 as the exact number 4/5, > then sin(0.8) can't be simplified or evaluated to an approximate result > (0.717...), which seems to be what most users want.... > > -s > > On Sun, Jan 29, 2012 at 17:26, Stavros Macrakis wrote: > >> The Maxima convention (which is followed by most systems I know) is that >> numbers expressed with a decimal point are interpreted as floating-point >> numbers. It would of course be possible to change that decision, but the >> next question then would be what the output form of such objects is: if 0.8 >> is interpreted as 8/10 (= 4/5), should it be output as 0.8? 8/10? or 4/5? >> What is the output form of 0.8 + 1/10? How about 0.8 + 1/3? And how >> about 0.8 + 1/3 - 11/15? >> >> -s >> >> >> On Sun, Jan 29, 2012 at 14:51, Andrew Davis wrote: >> >>> I understand all that it is not exact >>> > At first I thought it was just rounding error on display >>> >>> but why is it not held in memory symbolically so that it can be >>> factored and manipulated correctly. >>> >>> Thank you. >>> >>> On Sun, Jan 29, 2012 at 12:47 PM, Raymond Toy wrote: >>> >>>> On 1/29/12 9:34 AM, Andrew Davis wrote: >>>> > Hello all, >>>> > >>>> > While doing some homework, maxima return some incorrect limits. I >>>> traced >>>> > the problem back to the number -8.14. It is evaluated to >>>> > -8.140000000001, you can test this yourself by taking the limit of >>>> > (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This >>>> > happens on all clisp's and even on http://calc.matthen.com/ , >>>> (evaluate >>>> > -8.14). At first I thought it was just rounding error on display and >>>> > not internal stored like that, but take a limit that uses -8.14 and >>>> you >>>> > will have undefined results where it should have a real limit >>>> > ( because -8.14 can be factored in my problem but -8.14000001 could >>>> not >>>> > ). This is the only number I found that does that, but I suspect more. >>>> >>>> This, and questions like it, are becoming a FAQ. If you want exact >>>> numbers, use exact numbers instead of floating-point. So use 814/100 >>>> instead. 8.14 cannot be represented exactly as (binary) floating-point >>>> number. In fact 8.14 differs from 814/100 by 1/1759218604441600. >>>> >>>> Also read "What Every Computer Scientist Should Know About >>>> Floating-Point Arithmetic", by David Goldberg. Google will find >>>> suitable versions. >>>> >>>> Ray >>>> >>>> >>> >>> _______________________________________________ >>> Maxima mailing list >>> Maxima at math.utexas.edu >>> http://www.math.utexas.edu/mailman/listinfo/maxima >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From duke at eml.cc Mon Jan 30 08:22:47 2012 From: duke at eml.cc (marmaduke) Date: Mon, 30 Jan 2012 15:22:47 +0100 Subject: [Maxima] integration limit swap? Message-ID: <1327933367.19342.140661029779825@webmail.messagingengine.com> Hi I was trying to compute the integral integrate(f, x, a, b) where a is greater than b, and the result was wrong until I manually switch the limits and changed the change of the integral, so my question is, does Maxima automatically swap the limits of integration if the lower limit is greater than the positive limit? details of the integral: f: w*cos(p)/2 - 1; integrate(1/f, p, %pi, phi); Thanks, Marmaduke From fateman at eecs.berkeley.edu Mon Jan 30 09:08:15 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Mon, 30 Jan 2012 07:08:15 -0800 Subject: [Maxima] Floating point problems In-Reply-To: References: <4F25861E.40602@gmail.com> Message-ID: <4F26B25F.2010005@eecs.berkeley.edu> On 1/29/2012 6:45 PM, Andrew Davis wrote: > Is there a standard way to convert between the two forms in memory > then? .8 <-> 4/5 , -8.14 <-> -814/100? rationalize(x) gets the EXACT rational equivalent. ratdisrep(rat(x)) gets an approximation, depending on ratepsilon. Read the manual. From wilhelm.haager at htlstp.ac.at Mon Jan 30 09:55:15 2012 From: wilhelm.haager at htlstp.ac.at (Wilhelm Haager) Date: Mon, 30 Jan 2012 16:55:15 +0100 Subject: [Maxima] Function returning the version number In-Reply-To: References: Message-ID: <775d3aa288cec7e6741d67094362584d@localhost> On Sat, 28 Jan 2012 13:05:01 -0700, Robert Dodier wrote: > I think that making a program dependent on the Maxima version > number generally indicates that something has gone wrong; > I would avoid it if possible. > > That said, I have a patch laying around to rework build_info > so that it returns a Maxima structure (as defined by defstruct) > which makes it easy to extract the bits of the build info. > > With this patch I get: > > (%i2) x : build_info (); > (%o2) > Maxima version: 5.26.0_16_gb72c64c_dirty > Maxima build date: 2012-01-11 00:01:25 > Host type: i686-pc-linux-gnu > Lisp implementation type: CMU Common Lisp > Lisp implementation version: CVS release-19a 19a-release-20040728 + > minimal debian patches > (%i3) x at version; > (%o3) 5.26.0_16_gb72c64c_dirty > (%i4) x at timestamp; > (%o4) 2012-01-11 00:01:25 > (%i5) x at host; > (%o5) i686-pc-linux-gnu > (%i6) x at lisp_name; > (%o6) CMU Common Lisp > (%i7) x at lisp_version; > (%o7) CVS release-19a 19a-release-20040728 + minimal debian patches > > > Note that the patch includes a display function so that the > return value of build_info is displayed just as build_info now > displays the build info. > > I'll commit this unless someone thinks it's a bad idea. > > best > > Robert Dodier Thank you very much for your answer. On principle, it is favourable to avoid version-dependencies in programs. But some optional parameters of the package "draw" have changed recently (I think from the Maxima version 5.22 to 5.23), eg. the options "pic_width" and "pic_height" have changed to "dimensions". When a package makes use of those options (as the control engineering package COMA does), the version dependent treatment seems useful. The actual Maxima version included in Ubuntu is still version 5.20, in Windows we have 5.25; it's convenient to maintain only one package for all versions. Best regards Wilhelm Haager From biomates at telefonica.net Mon Jan 30 11:08:49 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Mon, 30 Jan 2012 18:08:49 +0100 Subject: [Maxima] Function returning the version number In-Reply-To: <775d3aa288cec7e6741d67094362584d@localhost> References: <775d3aa288cec7e6741d67094362584d@localhost> Message-ID: <1327943329.1897.10.camel@pc> > But some optional parameters of the package "draw" have changed > recently (I think from the > Maxima version 5.22 to 5.23), eg. the options "pic_width" and > "pic_height" have changed to "dimensions". > When a package makes use of those options (as the control engineering > package COMA does), > the version dependent treatment seems useful. When these changes were made, the version number of draw changed to '2'. (%i1) load(draw)$ (%i2) get(draw, version); (%o2) 2 With older Maxima versions, 'get' gives 1. Perhaps you can make use of this fact. -- Mario From toy.raymond at gmail.com Mon Jan 30 11:24:26 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Mon, 30 Jan 2012 09:24:26 -0800 Subject: [Maxima] integration limit swap? In-Reply-To: <1327933367.19342.140661029779825@webmail.messagingengine.com> References: <1327933367.19342.140661029779825@webmail.messagingengine.com> Message-ID: On Mon, Jan 30, 2012 at 6:22 AM, marmaduke wrote: > Hi > > I was trying to compute the integral > > integrate(f, x, a, b) > > where a is greater than b, and the result was wrong until I manually > switch the limits and changed the change of the integral, so my question > is, does Maxima automatically swap the limits of integration if the lower > limit is greater than the positive limit? > No, maxima doesn't swap limits: integrate(1,x,5,0) -> -5 > > details of the integral: > > f: w*cos(p)/2 - 1; > integrate(1/f, p, %pi, phi); > > > Maxima asks me a few questions. How did you answer them? What result did you get and what were you expecting? Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Mon Jan 30 14:12:43 2012 From: woollett at charter.net (Edwin Woollett) Date: Mon, 30 Jan 2012 12:12:43 -0800 Subject: [Maxima] applying a set of conditions for first order ord. diff. eqn. References: <4F240F1A.8090105@orange.fr> Message-ID: <22424BE52EE9480F92047C215433C652@edwinc367e16bd> Hi Jerome, Thanks for the kind comments. I don't think you can use ic2 for this type of first order ordinary differential equation, as you suggest in your pdf file description of this problem. Instead you can use ic1 to evaluate something unknown in your equation, and then use solve to satisfy the rest of the conditions. =================== Your differential equation can be written as du/dz - a u + b = 0, where the three conditions are: u = 0 when z = +/- 1, and integrate(u,z,-1,1) = 2, (a global condition rather than local) and a and b are constants. We can simplify this differential equation by dividing by a and letting r = b/a and x = a z, so u = 0 when x = +/- a. (I use r rather than c because ic1 uses %c as a constant of integration, and one can get confused.) We then have to solve du/dx - u + r = 0, subject first to u = 0 at x = +/- a. After applying these two conditions, to find a and r, we can replace x --> a z and apply the integral condition as written above. -------------------------------- Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) display2d:false$ (%i2) de : 'diff (u,x) - u + r = 0; (%o2) 'diff (u,x,1) - u + r = 0 (%i3) gsoln : ode2 (de, u, x); (%o3) u = (r*%e^-x+%c)*%e^x (%i4) psoln : ic1(gsoln, x = -a, u = 0); (%o4) u = r - r*%e^(x + a) (%i5) us : rhs (psoln); (%o5) r - r*%e^(x + a) (%i6) solve (subst (x = a, us), a); (%o6) [a = log (-1), a = 0] /* We don't want a = 0, so I looked at the float of log(-1) to guess what it can be replaced by */ (%i7) map ('float, [log (-1), %i*%pi]); (%o7) [3.141592653589793*%i, 3.141592653589793*%i] (%i8) us : subst (a = %i*%pi, us); (%o8) r*%e^x + r (%i9) us : subst (x = %i*%pi*z, us); (%o9) r*%e^(%i*%pi*z) + r (%i10) solve (integrate (us, z, -1, 1) = 2, r); (%o10) [r = 1] (%i11) us : subst (r = 1, us); (%o11) %e^(%i*%pi*z) + 1 ------------------------------ Hope this approach is helpful as a start. Ted Woollett ====================== ----- Original Message ----- From: Laboratoire.Vulcain To: woollett at charter.net Sent: Saturday, January 28, 2012 7:07 AM Subject: maxima feedback from Mr Jerome Huck Dear Professor, this email to thank you for your Maxima by Example. I am a seniro aerospace engineer and scientist. I used more supercomputers to make calculations in the CFD area. I am reading one old book on MHD and I tried to use Maxima to find analytical solutions. I read the documentation and your Maxima by Example. I have some troubles with hyperbolic functions or the simplification of those functions. I attached my example. I will enjoy to have your point of view on my questions. Thanks in advance. Best regards. Jerome Huck. From woollett at charter.net Mon Jan 30 14:28:27 2012 From: woollett at charter.net (Edwin Woollett) Date: Mon, 30 Jan 2012 12:28:27 -0800 Subject: [Maxima] applying a set of conditions for first order ord. diff. eqn. Message-ID: <58C0DD26253B4340B3A4B652A8238CE2@edwinc367e16bd> On Jan. 30, 2012, I wrote: ------------------- >After applying these two conditions, to >find a and r, we can >replace x --> a z and apply the integral >condition as written above. ------------------------------ should have been : " to find two of the three constants, a, r, and %c returned by ic1, we can replace...." Ted From robert.dodier at gmail.com Tue Jan 31 10:17:48 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 31 Jan 2012 09:17:48 -0700 Subject: [Maxima] Extending assignment Was: Functions with any number of arguments In-Reply-To: References: Message-ID: On 1/19/12, Alexander Klimov wrote: > On Sun, 15 Jan 2012, Aleksas Domarkas wrote: >> How in Maxima define functions with any number of arguments ? >> >> For example, i need function MIN(arg1,arg2, ...) >> MIN(2) => 2 >> MIN(3,4) =>3 >> MIN(2/3,1/2,sqrt(2)/2) => 1/2 > > MIN([args]) := block([m:first(args)], > for i in rest(args) do m:min(m,i), > m); >> Other example. How define G with following properties: >> G(n) => gamma(n) >> G(5) => 24 >> G(a, x) => gamma_incomplete (a, x) >> G(a, z1, z2) => gamma_incomplete_generalized (a, z1, z2) > > Use "length(args)" and "if then elseif ..." Another approach is to use the simplification system. A rule is defined for each case of interest. Creating new rules doesn't require touching existing ones. e.g. matchdeclare ([aa, xx, yy], all); tellsimp (G (xx), gamma (xx)); tellsimp (G (aa, xx), gamma_incomplete (aa, xx)); tellsimp (G (aa, xx, yy), gamma_incomplete_generalized (aa, xx, yy)); G (5); => 24 G (u, 5); => gamma_incomplete(u, 5) G (u, %e, %pi + 1); => gamma_incomplete_generalized(u, %e, %pi + 1) For better or worse that approach doesn't really work for functions with arbitrary numbers of arguments. User-defined rules can only be applied to functions with a stated number of arguments (except for "+" and "*"). So you would have to make up rules for MIN(xx), MIN(xx, yy), MIN(xx, yy, zz), etc etc. I have often thought about extending the rule system to handle general n-ary functions but never got around to it. One of these days! best Robert Dodier From renzodelfabbro at alice.it Tue Jan 31 10:56:40 2012 From: renzodelfabbro at alice.it (Renzo Del Fabbro) Date: Tue, 31 Jan 2012 16:56:40 +0000 (UTC) Subject: [Maxima] wxplot2d Message-ID: I'm trying to plot a function from t=0 to 8 microsecond wxplot2d([rhs(s[1])],[t,0,8e-6],[legend,"v(t)","i(t)"], [gnuplot_preamble,"set grid"],[xlabel,"t / us"]); How can I plot a microsecond x scale to avoid x.-e006 exponential format? Thanks Renzo From villate at fe.up.pt Tue Jan 31 11:15:07 2012 From: villate at fe.up.pt (Jaime Villate) Date: Tue, 31 Jan 2012 17:15:07 +0000 Subject: [Maxima] wxplot2d In-Reply-To: References: Message-ID: <4F28219B.6020302@fe.up.pt> On 01/31/2012 04:56 PM, Renzo Del Fabbro wrote: > wxplot2d([rhs(s[1])],[t,0,8e-6],[legend,"v(t)","i(t)"], > [gnuplot_preamble,"set grid"],[xlabel,"t / us"]); > > How can I plot a microsecond x scale to avoid x.-e006 exponential format? Hi, without knowing how s[1] was defined it's hard to answer, but I'd guess you should replace any ocurrences of t by t*1e-6 and then use the interval [t, 0, 8] instead of [t, 0, 8e-6]. Regards, Jaime From renzodelfabbro at alice.it Tue Jan 31 11:46:52 2012 From: renzodelfabbro at alice.it (Renzo Del Fabbro) Date: Tue, 31 Jan 2012 17:46:52 +0000 (UTC) Subject: [Maxima] wxplot2d References: <4F28219B.6020302@fe.up.pt> Message-ID: Jaime Villate fe.up.pt> writes: > without knowing how s[1] was defined it's hard to answer, but I'd guess > you should replace any ocurrences of t by t*1e-6 and then use the interval > [t, 0, 8] instead of [t, 0, 8e-6]. Thanks Jaime, my inputs are -------------------------------------- eq_1:'diff(v(t),t)=-i(t)/C-v(t)/(R*C)$ eq_2:'diff(i(t),t)=-i(t)*R/L+v(t)/L$ [R,L,C,v0,i0]:[2,1e-6,1e-6,20,10] $ atvalue(v(t),t=0,v0) $ atvalue(i(t),t=0,i0) $ s:desolve([eq_1,eq_2],[v(t),i(t)]),expand,numer; wxplot2d([rhs(s[1])],[t,0,8e-6],[legend,"v(t)","i(t)"], [gnuplot_preamble,"set grid"],[xlabel,"t / us"]); -------------------------------------- and I'd like to know if there was a way to modify just wxplot2d parameters. Regards Renzo From villate at fe.up.pt Tue Jan 31 13:58:43 2012 From: villate at fe.up.pt (Jaime Villate) Date: Tue, 31 Jan 2012 19:58:43 +0000 Subject: [Maxima] wxplot2d In-Reply-To: References: <4F28219B.6020302@fe.up.pt> Message-ID: <4F2847F3.9070304@fe.up.pt> On 01/31/2012 05:46 PM, Renzo Del Fabbro wrote: > my inputs are > -------------------------------------- > > eq_1:'diff(v(t),t)=-i(t)/C-v(t)/(R*C)$ > eq_2:'diff(i(t),t)=-i(t)*R/L+v(t)/L$ > [R,L,C,v0,i0]:[2,1e-6,1e-6,20,10] $ > atvalue(v(t),t=0,v0) $ > atvalue(i(t),t=0,i0) $ > s:desolve([eq_1,eq_2],[v(t),i(t)]),expand,numer; > > wxplot2d([rhs(s[1])],[t,0,8e-6],[legend,"v(t)","i(t)"], > [gnuplot_preamble,"set grid"],[xlabel,"t / us"]); > > -------------------------------------- > > and I'd like to know if there was a way to modify just wxplot2d parameters. OK, I do not how to make gnuplot change the values displayed in the axes but I still think that it is a more elegant solution to work with ?s from the begining: eq_1:'diff(v(t),t)=-i(t)/C-v(t)/(R*C)$ eq_2:'diff(i(t),t)=-i(t)*R/L+v(t)/L$ [R,L,C, v0,i0]:[2,1,1,20,10] $ atvalue(v(t),t=0,v0) $ atvalue(i(t),t=0,i0) $ s:desolve([eq_1,eq_2],[v(t),i(t)]),expand,numer; plot2d([rhs(s[1])],[t,0,8],[legend,"v(t)","i(t)"], [gnuplot_preamble,"set grid"],[xlabel,"t / us"]); Since RC and L/R both have units of time, if you measure capacitance in ?F, inductances in ?H and resistances in Ohms, the unit that will be implicitly used for time is ?s. Regards, Jaime From gwpublic at wp.pl Tue Jan 31 15:58:49 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Tue, 31 Jan 2012 22:58:49 +0100 Subject: [Maxima] references to methods, algorithms behind lsquares Message-ID: Hello, I'd like to reference to works related with : * lsquares * fmin_cobyla while in Manual fmin_cobyla is well referenced: http://maxima.sourceforge.net/docs/manual/de/maxima_37.html For lsquares there are no such nice references: http://maxima.sourceforge.net/docs/manual/en/maxima_65.html#SEC304 I'd like to cite in my thesis to works behind lsquares, as I use it (to be more specific: lsquares_estimates , lsquares_mse ). One more issue : What's are best terms for lsquares ? I'd like to call it somehow, I am curious about recommendations for "terms" describing lqaures, like : Optimization Search Routine ? Optimisation in Symbolic Mathematics ? Data fitting of parametrised symbolic mathematics ? Best regards, Grzegorz Wierzowiecki From renzodelfabbro at alice.it Tue Jan 31 16:19:03 2012 From: renzodelfabbro at alice.it (Renzo Del Fabbro) Date: Tue, 31 Jan 2012 22:19:03 +0000 (UTC) Subject: [Maxima] wxplot2d References: <4F28219B.6020302@fe.up.pt> <4F2847F3.9070304@fe.up.pt> Message-ID: Jaime Villate fe.up.pt> writes: > Since RC and L/R both have units of time, if you measure capacitance in > ?F, inductances > in ?H and resistances in Ohms, the unit that will be implicitly used for > time is ?s. > Thank you very much Jaime. Ciao from Italy Renzo From willisb at unk.edu Tue Jan 31 19:12:08 2012 From: willisb at unk.edu (Barton Willis) Date: Tue, 31 Jan 2012 19:12:08 -0600 Subject: [Maxima] sqrt(1-x^2)/(2-2*x^2) --/--> 1/(2*sqrt(1-x^2)) In-Reply-To: References: , <4F28219B.6020302@fe.up.pt> <4F2847F3.9070304@fe.up.pt> Message-ID: The general simplifier does sqrt(1-x^2)/(1-x^2) --> 1/sqrt(1-x^2), but it doesn't simplify sqrt(1-x^2)/(2-2*x^2) to 1/(2*sqrt(1-x^2)). Ratsimp, radcan, and rootscontract don't do this simplification either. --Barton From macrakis at alum.mit.edu Tue Jan 31 19:37:56 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 31 Jan 2012 20:37:56 -0500 Subject: [Maxima] sqrt(1-x^2)/(2-2*x^2) --/--> 1/(2*sqrt(1-x^2)) In-Reply-To: References: <4F28219B.6020302@fe.up.pt> <4F2847F3.9070304@fe.up.pt> Message-ID: That's annoying. A workaround (not a solution) is 1/gfactor(1/expr). On Tue, Jan 31, 2012 at 20:12, Barton Willis wrote: > sqrt(1-x^2)/(2-2*x^2) -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Tue Jan 31 21:09:52 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 31 Jan 2012 22:09:52 -0500 Subject: [Maxima] sqrt(1-x^2)/(2-2*x^2) --/--> 1/(2*sqrt(1-x^2)) In-Reply-To: References: <4F28219B.6020302@fe.up.pt> <4F2847F3.9070304@fe.up.pt> Message-ID: An even simpler related problem: How do I get sqrt(1-x^2) to be expressed as sqrt(1-x)*sqrt(x+1) or even %i*sqrt(x-1)*sqrt(x+1)? All three are simplified according to the general simplifier, but I can't seem to find some combination of factor, gfactor, scanmap, etc. that will get me from the first version to the others.... -s On Tue, Jan 31, 2012 at 20:37, Stavros Macrakis wrote: > That's annoying. A workaround (not a solution) is 1/gfactor(1/expr). > > On Tue, Jan 31, 2012 at 20:12, Barton Willis wrote: > >> sqrt(1-x^2)/(2-2*x^2) > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Wed Feb 1 00:54:50 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Tue, 31 Jan 2012 23:54:50 -0700 Subject: [Maxima] references to methods, algorithms behind lsquares In-Reply-To: References: Message-ID: On 1/31/12, gwpublic at wp.pl wrote: > For lsquares there are no such nice references: > http://maxima.sourceforge.net/docs/manual/en/maxima_65.html#SEC304 > > I'd like to cite in my thesis to works behind lsquares, as I use it > (to be more specific: lsquares_estimates , lsquares_mse ). Well, lsquares_estimates tries to find an exact minimum of the mean square error, via the Maxima function "solve". If solve cannot find a solution, then lsquares_estimates tries to find an approximate minimum, via the function "lbfgs", which is an implementation of the LBFGS algorithm, which is a limited-memory BFGS (quasi-Newton) algorithm. "?? lbfgs" finds some info in the reference manual. > One more issue : What's are best terms for lsquares ? > > I'd like to call it somehow, I am curious about recommendations for > "terms" describing lqaures, like : > Optimization Search Routine ? > Optimisation in Symbolic Mathematics ? > Data fitting of parametrised symbolic mathematics ? I think it's what's commonly called "estimation" or more specifically "least squares estimation". best, Robert Dodier From aleksasd873 at gmail.com Wed Feb 1 02:36:29 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Wed, 1 Feb 2012 10:36:29 +0200 Subject: [Maxima] sqrt(1-x^2)/(2-2*x^2) --/--> 1/(2*sqrt(1-x^2)) Message-ID: Barton Willis willisb at unk.edu Tue Jan 31 19:12:08 CST 2012 The general simplifier does sqrt(1-x^2)/(1-x^2) --> 1/sqrt(1-x^2), but it doesn't simplify sqrt(1-x^2)/(2-2*x^2) to 1/(2*sqrt(1-x^2)). Ratsimp, radcan, and rootscontract don't do this simplification either. --Barton ***************************************************************************************** (%i1) S:sqrt(1-x^2)/(2-2*x^2)$ (%i2) subst(2-2*x^2=2*(1-x^2),S); (%o2) 1/(2*sqrt(1-x^2)) Aleksas -------------- next part -------------- An HTML attachment was scrubbed... URL: From willisb at unk.edu Wed Feb 1 04:40:28 2012 From: willisb at unk.edu (Barton Willis) Date: Wed, 1 Feb 2012 04:40:28 -0600 Subject: [Maxima] sqrt(1-x^2)/(2-2*x^2) --/--> 1/(2*sqrt(1-x^2)) In-Reply-To: References: , <4F28219B.6020302@fe.up.pt> <4F2847F3.9070304@fe.up.pt> Message-ID: Maxima calls inte to do integrate((sqrt(1-x^2)*(x^2+1))/(2-2*x^2),x,0,1). If I recall, inte is one of the last functions integrate tries. Some other method (not sure which one) handles integrate((x^2+1)/(2*sqrt(1-x^2)),x,0,1). integrate((sqrt(1-x^2)*(x^2+1))/(2-2*x^2),x,0,1) is in the testsuite. --Barton From aleksasd873 at gmail.com Wed Feb 1 06:04:33 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Wed, 1 Feb 2012 14:04:33 +0200 Subject: [Maxima] integrate bug Message-ID: Integrate bug: (%i1) integrate(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2); (%o1) -%pi/4 (%i2) float(%), numer; (%o2) -0.78539816339745 (%i3) quad_qags(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2); (%o3) [0.9161228399914,1.0171006703434392*10^-14,21,0] Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From rswarbrick at gmail.com Wed Feb 1 06:48:48 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 01 Feb 2012 12:48:48 +0000 Subject: [Maxima] Please sign up to the mailing list References: Message-ID: Dear Aleksas, I sent a private message to you a month or so ago. At the moment, your emails are getting held in the moderation queue until someone approves them. I'm sure you'd like your emails to get through in a timely fashion. I'm also sure that I'd rather not approve them quite so often. The solution to both problems is to sign up to the mailing list. If you don't want mail delivery (because you use GMane or the like), you can turn it off. Also, words and sentences in emails are always nice. But that's a different problem. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From villate at fe.up.pt Wed Feb 1 07:05:49 2012 From: villate at fe.up.pt (Jaime Villate) Date: Wed, 01 Feb 2012 13:05:49 +0000 Subject: [Maxima] integrate bug In-Reply-To: References: Message-ID: <4F2938AD.8040504@fe.up.pt> On 02/01/2012 12:04 PM, Aleksas Domarkas wrote: > Integrate bug: > > (%i1) integrate(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2); > (%o1) -%pi/4 > (%i2) float(%), numer; > (%o2) -0.78539816339745 > > (%i3) quad_qags(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2); > (%o3) [0.9161228399914,1.0171006703434392*10^-14,21,0] And: (%i2) integrate (acos ((x-1/2)/sqrt (1-x^2)), x); (%o2) -%pi*x/2 which is obviously wrong. Jaime From renekaelin at gmx.ch Wed Feb 1 07:14:14 2012 From: renekaelin at gmx.ch (rene kaelin) Date: Wed, 1 Feb 2012 14:14:14 +0100 Subject: [Maxima] simplification problem Message-ID: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> Dear Maxima users 3^0.5/(2-3^0.5) - (2*3^0.5+3)/(4-3) is simplified to -2.664535259100376e-15 How can I simplify it to 0? From dbmaxima at gmail.com Wed Feb 1 07:29:40 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Thu, 02 Feb 2012 00:29:40 +1100 Subject: [Maxima] simplification problem In-Reply-To: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> References: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> Message-ID: <4F293E44.70900@gmail.com> On 2/02/2012 12:14 AM, rene kaelin wrote: > Dear Maxima users > > 3^0.5/(2-3^0.5) - (2*3^0.5+3)/(4-3) > > is simplified to > > -2.664535259100376e-15 > > How can I simplify it to 0? Use rational numbers, rather than floating point numbers: (%i1) 3^(1/2)/(2-3^(1/2))-(2*3^(1/2)+3)/(4-3); (%o1) sqrt(3)/(2-sqrt(3))-2*sqrt(3)-3 (%i2) radcan(%); (%o2) 0 From macrakis at alum.mit.edu Wed Feb 1 07:29:59 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 1 Feb 2012 08:29:59 -0500 Subject: [Maxima] simplification problem In-Reply-To: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> References: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> Message-ID: In Maxima, using a decimal point in a number indicates you want to calculate with floating-point (approximate) numbers, so the result will often not be exact. For exact calculations, use fractions, e.g. 3^(1/2)/(2-3^(1/2)) - (2*3^(1/2)+3)/(4-3) or sqrt(3)/(2-sqrt(3)) - (2*sqrt(3)+3)/(4-3) Then you can use any one of Maxima's functions to reorganize/simplify the expression. In this case, ratsimp gives 0; in other cases, you may want to try radcan, expand, factor, etc. -s On Wed, Feb 1, 2012 at 08:14, rene kaelin wrote: > Dear Maxima users > > 3^0.5/(2-3^0.5) - (2*3^0.5+3)/(4-3) > > is simplified to > > -2.664535259100376e-15 > > How can I simplify it to 0? > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From villate at fe.up.pt Wed Feb 1 08:23:16 2012 From: villate at fe.up.pt (Jaime Villate) Date: Wed, 01 Feb 2012 14:23:16 +0000 Subject: [Maxima] simplification problem In-Reply-To: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> References: <11F35F17-2CB6-4645-ABD5-0734B1BC4D84@gmx.ch> Message-ID: <4F294AD4.6020808@fe.up.pt> On 02/01/2012 01:14 PM, rene kaelin wrote: > 3^0.5/(2-3^0.5) - (2*3^0.5+3)/(4-3) ratsimp (3^(1/2)/(2-3^(1/2)) - (2*3^(1/2)+3)/(4-3)) -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.mueller at math.uni-dortmund.de Wed Feb 1 11:34:32 2012 From: jan.mueller at math.uni-dortmund.de (=?ISO-8859-15?Q?Jan_Hendrik_M=FCller?=) Date: Wed, 01 Feb 2012 18:34:32 +0100 Subject: [Maxima] plot of plsquares polynom Message-ID: <4F2977A8.9020806@math.uni-dortmund.de> Hi all, two questions: - how can z be plotted? plsquares works fine but the plot doesn't work load("plsquares")$ plsquares(matrix([1,2,0],[3,5,4],[4,7,9],[5,8,10],[1,3,4],[2,5,7],[1,6,9],[3,1,4],[1,1,1],[4,3,6],[6,7,8]),[x,y,z],z,3,3)$ plot3d(z, [x,0,9], [y,0,9]); - the rows of the matrix (only as an example) have to be substituted by the lines of the .txt file attached. Any idea how to realise that is welcome Jan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Transportkosten3.txt URL: From aleksasd873 at gmail.com Wed Feb 1 11:49:10 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Wed, 1 Feb 2012 19:49:10 +0200 Subject: [Maxima] integrate bug Message-ID: On 02/01/2012 12:04 PM, Aleksas Domarkas wrote: > Integrate bug: > > (%i1) integrate(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2); > (%o1) -%pi/4 > (%i2) float(%), numer; > (%o2) -0.78539816339745 > > (%i3) quad_qags(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2); > (%o3) [0.9161228399914,1.0171006703434392*10^-14,21,0] And: (%i2) integrate (acos ((x-1/2)/sqrt (1-x^2)), x); (%o2) -%pi*x/2 which is obviously wrong. Jaime ***************************************************************************************************************** Let (%i1) f:acos((x-1/2)/sqrt(1-x^2))$ We prove that (%i2) 'integrate(f,x,0,1/2)=asin(1/sqrt(7))/sqrt(2)-asin((752*sqrt(3))/2401)/4+%pi/4; (%o2) integrate(acos((x-1/2)/sqrt(1-x^2)),x,0,1/2)=asin(1/sqrt(7))/sqrt(2)-asin((752*sqrt(3))/2401)/4+%pi/4 proof: (%i3) load(bypart)$ (%i4) assume(abs(x)<1)$ (%i5) byparts(f,x,f,1),factor$ (%i6) F:ev(%, nouns),factor; (%o6) (2^(3/2)*x*acos((2*x-1)/(2*sqrt(1-x^2)))-sqrt(2)*asin((10*x+1)/(2*sqrt(7)*(x+1)))-sqrt(2)*asin((6*x-5)/(2*sqrt(7)*(x-1)))+asin((4*x-1)/sqrt(7)))/2^(3/2) Solution: (%i7) sol:ev(F,x=1/2)-ev(F,x=0),expand; (%o7) asin(5/(2*sqrt(7)))/2-asin(2/sqrt(7))+asin(1/sqrt(7))/sqrt(2)+asin(1/(2*sqrt(7)))/2+%pi/4 Next we simplify (%i8) ratsimp(sol*sqrt(2))/sqrt(2); (%o8) (2*asin(5/(2*sqrt(7)))-4*asin(2/sqrt(7))+2^(3/2)*asin(1/sqrt(7))+2*asin(1/(2*sqrt(7)))+%pi)/4 We contract terms (%i9) f1:2*asin(5/(2*sqrt(7)))-4*asin(2/sqrt(7))+2*asin(1/(2*sqrt(7)))$ (%i10) sin(f1)$ (%i11) trigexpand(%)$ (%i12) trigexpand(%)$ (%i13) radcan(%); (%o13) -(752*sqrt(3))/2401 Therefore, it is true equality (%i14) T:f1=asin(%); (%o14) 2*asin(5/(2*sqrt(7)))-4*asin(2/sqrt(7))+2*asin(1/(2*sqrt(7)))=-asin((752*sqrt(3))/2401) (%i15) ratsubst(rhs(T),lhs(T),sol); (%o15) (4*asin(1/sqrt(7))-sqrt(2)*asin((752*sqrt(3))/2401)+sqrt(2)*%pi)/2^(5/2) (%i16) solution:expand(%); (%o16) asin(1/sqrt(7))/sqrt(2)-asin((752*sqrt(3))/2401)/4+%pi/4 q.e.d. Test: (%i17) float(solution), numer; (%o17) 0.9161228399914 (%i18) quad_qags(f, x, 0, 1/2); (%o18) [0.9161228399914,1.0171006703434392*10^-14,21,0] Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Wed Feb 1 12:50:52 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 1 Feb 2012 10:50:52 -0800 Subject: [Maxima] plot of plsquares polynom In-Reply-To: <4F2977A8.9020806@math.uni-dortmund.de> References: <4F2977A8.9020806@math.uni-dortmund.de> Message-ID: Looks like the return value of plsquares is an equation z = .... Try something like foo : plsquares (...); plot3d (rhs (foo), [x, ...], [y, ...]); HTH Robert Dodier On 2/1/12, Jan Hendrik M?ller wrote: > Hi all, > two questions: > - how can z be plotted? plsquares works fine but the plot doesn't work > load("plsquares")$ > > plsquares(matrix([1,2,0],[3,5,4],[4,7,9],[5,8,10],[1,3,4],[2,5,7],[1,6,9],[3,1,4],[1,1,1],[4,3,6],[6,7,8]),[x,y,z],z,3,3)$ > plot3d(z, [x,0,9], [y,0,9]); > - the rows of the matrix (only as an example) have to be substituted by > the lines of the .txt file attached. Any idea how to realise that is welcome > Jan > From woollett at charter.net Wed Feb 1 14:14:10 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 1 Feb 2012 12:14:10 -0800 Subject: [Maxima] ver. 5.26.0 display bug Message-ID: version 5.26.0 (windows gcl) inserts (false) in front of the usual display command output. (only checked console mode and xmaxima interfaces) ------------------------------------- Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) a; (%o1) a (%i2) display(a)$ (false) a = a (%i3) a:3$ (%i4) display(a)$ (false) a = 3 (%i5) build_info()$ Maxima version: 5.26.0 Maxima build date: 22:48 1/15/2012 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 ----------------------------- This behavior does not occur in 5.25.1 Ted Woollett From woollett at charter.net Wed Feb 1 14:26:43 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 1 Feb 2012 12:26:43 -0800 Subject: [Maxima] ver. 5.26.0 display bug Message-ID: On Feb. 1, 2012, I wrote: ------------------ >version 5.26.0 (windows gcl) inserts >(false) in front of the usual display >command output. ------------------------- I should have mentioned that the display mode was display2d = false. If I set desplay2d to true, the (false) goes away: ----------------------------- (%i6) display2d:true$ (%i7) display(a); a = 3 (%o7) done (%i8) display2d:false$ (%i9) display(a); (false) a = 3 (%o9) done ----------------------------- Ted Woollett From tomdean at speakeasy.org Wed Feb 1 14:57:33 2012 From: tomdean at speakeasy.org (Thomas D. Dean) Date: Wed, 01 Feb 2012 12:57:33 -0800 Subject: [Maxima] ver. 5.26.0 display bug In-Reply-To: References: Message-ID: <4F29A73D.9090101@speakeasy.org> On 02/01/12 12:26, Edwin Woollett wrote: > display2d = false. > maxima Maxima 5.26.0 http://maxima.sourceforge.net using Lisp CLISP 2.49 (2010-07-07) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i9) display2d:false$ (%i10) display(a)$ (false) a = 3 (%i11) display2d:true$ (%i12) display(a)$ a = 3 Tom Dean From macrakis at alum.mit.edu Wed Feb 1 17:23:04 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 1 Feb 2012 18:23:04 -0500 Subject: [Maxima] sqrt(1-x^2)/(2-2*x^2) --/--> 1/(2*sqrt(1-x^2)) In-Reply-To: References: <4F28219B.6020302@fe.up.pt> <4F2847F3.9070304@fe.up.pt> Message-ID: Hmm... I'd forgotten about radexpand. expr: sqrt(1-x^2)/(2-2*x^2) $ scanmap(factor,expr),radexpand:all; gets you -%i/(2*sqrt(x-1)*sqrt(x+1)) The %i might be a bit inconvenient, but is nonetheless correct.... I wonder if we have any code that will "notice" that the result is real iff -1 wrote: > Maxima calls inte to do integrate((sqrt(1-x^2)*(x^2+1))/(2-2*x^2),x,0,1). > If I recall, > inte is one of the last functions integrate tries. Some other method (not > sure which one) > handles integrate((x^2+1)/(2*sqrt(1-x^2)),x,0,1). > > integrate((sqrt(1-x^2)*(x^2+1))/(2-2*x^2),x,0,1) is in the testsuite. > > --Barton > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From subiono2008 at matematika.its.ac.id Wed Feb 1 22:33:12 2012 From: subiono2008 at matematika.its.ac.id (subiono2008 at matematika.its.ac.id) Date: Thu, 2 Feb 2012 11:33:12 +0700 (WIT) Subject: [Maxima] Inverse z-transform and ploting In-Reply-To: References: Message-ID: <3289.10.112.250.187.1328157192.squirrel@webmail.its.ac.id> Dear all, Let be X(z) a z-transform of a sequence x[n] How do we calculate invers z-transform of X(z) and plot x[n]. Subiono -- http://www.its.ac.id From villate at fe.up.pt Thu Feb 2 03:24:09 2012 From: villate at fe.up.pt (Jaime Villate) Date: Thu, 02 Feb 2012 09:24:09 +0000 Subject: [Maxima] Inverse z-transform and ploting In-Reply-To: <3289.10.112.250.187.1328157192.squirrel@webmail.its.ac.id> References: <3289.10.112.250.187.1328157192.squirrel@webmail.its.ac.id> Message-ID: <4F2A5639.5070709@fe.up.pt> On 02/02/2012 04:33 AM, subiono2008 at matematika.its.ac.id wrote: > Let be X(z) a z-transform of a sequence x[n] > How do we calculate invers z-transform of X(z) and > plot x[n]. > Here is an example: (%i2) X: z/(z-2)$ (%i3) f[0]: ratsimp (ev(X, z=1/y))$ (%i4) f[n] := ratsimp (diff (f[n-1], y)/n)$ (%i5) f[5]; (%o5) 32/(64*y^6-192*y^5+240*y^4-160*y^3+60*y^2-12*y+1) (%i6) x[5]: ev (f[5], y=0); (%o6) 32 (%i7) plot2d ( [discrete, makelist(i,i,0,5), makelist(ev(f[i],y=0), i, 0, 5)], [style, points]); In this example you can easily see that x[n] can be written as 2^n, but in a general case it might not be possible to write x[n] as a function of n. Also, notice that (%i5) was necessary in order to calculte al functions f[1]...f[5], before ev(f[i], y=0) can be used. Otherwise, if you attempt to use ev on a function f[n] which has not been computed yet, you will get an error because the substitution y=0 will be done before the derivative. The use of ratsimp is also necessary to avoid terms with 1/y which would lead to a division by zero error. I hope this helps you. Regards, Jaime From gwpublic at wp.pl Thu Feb 2 05:16:48 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Thu, 2 Feb 2012 12:16:48 +0100 Subject: [Maxima] References to papers about Maxima Message-ID: Hello, I'd like to use Maxima in my Thesis. (To be more specific: lquares method). Could you recommend some references (papers, books) I might like reference to? Best, Greg (gwpl) From villate at fe.up.pt Thu Feb 2 05:24:46 2012 From: villate at fe.up.pt (Jaime Villate) Date: Thu, 02 Feb 2012 11:24:46 +0000 Subject: [Maxima] References to papers about Maxima In-Reply-To: References: Message-ID: <4F2A727E.1020107@fe.up.pt> On 02/02/2012 11:16 AM, gwpublic at wp.pl wrote: > Hello, > > I'd like to use Maxima in my Thesis. (To be more specific: lquares method). > > Could you recommend some references (papers, books) I might like reference to? > > Best, > Greg (gwpl) > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima The answer is in the Maxima FAQ: http://maxima-project.org/wiki/index.php?title=Maxima_FAQ#What_is_the_appropriate_way_to_cite_maxima_in_an_academic_context.3F Regards, Jaime From toy.raymond at gmail.com Thu Feb 2 11:19:18 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Thu, 2 Feb 2012 09:19:18 -0800 Subject: [Maxima] Inverse z-transform and ploting In-Reply-To: <3289.10.112.250.187.1328157192.squirrel@webmail.its.ac.id> References: <3289.10.112.250.187.1328157192.squirrel@webmail.its.ac.id> Message-ID: On Wed, Feb 1, 2012 at 8:33 PM, wrote: > Dear all, > > Let be X(z) a z-transform of a sequence x[n] > How do we calculate invers z-transform of X(z) and > plot x[n]. > > > Jaime has given one technique. Another technique is to use the inversion formula x(n) = 1/(2*%pi*%i)*contour(X(z)*z^(n-1),z) where contour is the the contour integral over any closed curve containing all of the poles of X(z). Using complex number theory, this can be reduced to x(n) = sum(residue(X(z)*z^(n-1),z, p)) where the sum is over all of the poles, p, of X(z). As an example, let X(z) = z/(z-1/2). X(z) has one pole at z=1/2 so, using maxima: (%o1) xn : residue(z/(z-1/2)*z^(n-1),z,1/2); (%i1) 1/2^n (%o2) plot2d([discrete, makelist(k,k,0,10),makelist(subst(n=k,xn),k,0,10)],[style, points]); Another way is to note that to find the inverse transform, we want to express X(z) in a Laurent series. Maxima can do that to: (%o1) powerseries(z/(z-1/2), z, inf); (%i1) 2*sum(2^(-i1-1)/z^(i1), i1, 0, inf) I leave it as an exercise for the reader to figure out how to extract the coefficient of each power of z^(-n) to get x(n). :-) A google search will give you several other techniques that can be used to find the inverse transform. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwpublic at wp.pl Thu Feb 2 11:39:15 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Thu, 2 Feb 2012 18:39:15 +0100 Subject: [Maxima] references to methods, algorithms behind lsquares In-Reply-To: References: Message-ID: On Wed, Feb 1, 2012 at 7:54 AM, Robert Dodier wrote: > On 1/31/12, gwpublic at wp.pl wrote: > >> For lsquares there are no such nice references: >> http://maxima.sourceforge.net/docs/manual/en/maxima_65.html#SEC304 >> >> I'd like to cite in my thesis to works behind lsquares, as I use it >> (to be more specific: lsquares_estimates , lsquares_mse ). > > Well, lsquares_estimates tries to find an exact minimum of the > mean square error, via the Maxima function "solve". > If solve cannot find a solution, then lsquares_estimates tries > to find an approximate minimum, via the function "lbfgs", > which is an implementation of the LBFGS algorithm, which > is a limited-memory BFGS (quasi-Newton) algorithm. > "?? lbfgs" finds some info in the reference manual. Great Thanks Robert Dodier, this explanation about lsquare_estimates internals and references ("?? lbfgs") are exactly what I needed :). Best Grzegorz Wierzowiecki From gwpublic at wp.pl Thu Feb 2 11:53:41 2012 From: gwpublic at wp.pl (gwpublic at wp.pl) Date: Thu, 2 Feb 2012 18:53:41 +0100 Subject: [Maxima] References to papers about Maxima In-Reply-To: <4F2A727E.1020107@fe.up.pt> References: <4F2A727E.1020107@fe.up.pt> Message-ID: > The answer is in the Maxima FAQ: > http://maxima-project.org/wiki/index.php?title=Maxima_FAQ#What_is_the_appropriate_way_to_cite_maxima_in_an_academic_context.3F Thankas Jaime Villate, I've overlooked it, Some projects have theirs "Research Papers", "Papers" or even "Books" page, I haven't found about checking FAQ. All Best Greg From woollett at charter.net Thu Feb 2 15:02:27 2012 From: woollett at charter.net (Edwin Woollett) Date: Thu, 2 Feb 2012 13:02:27 -0800 Subject: [Maxima] get name of variable as string in function? Message-ID: I would like to define mprint(var) such that mprint(a) would give a = (value of a) so far I have tried: -------------------------------- (%i1) a:2; (%o1) 2 (%i2) mprint(zz) := print(sconcat(string(zz)," = "),zz)$ (%i3) mprint(a); 2 = 2 (%o3) 2 (%i4) mprint(zz) := print(sconcat(string('zz)," = "),zz)$ (%i5) mprint(a); zz = 2 (%o5) 2 ------------------- Ted Woollett From macrakis at alum.mit.edu Thu Feb 2 15:08:00 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 2 Feb 2012 16:08:00 -0500 Subject: [Maxima] get name of variable as string in function? In-Reply-To: References: Message-ID: mprint(zz) := print(sconcat(zz," = ",ev(zz)))$ and then mprint('a). You could also define mprint as a macro (using ::=), but why complicate things? Note that mprint('zz) will not work properly (because of the "ev"), so you should probably use a more obscure name mprint(zz234) := print(sconcat(zz234," = ",ev(zz234)))$ -s On Thu, Feb 2, 2012 at 16:02, Edwin Woollett wrote: > I would like to define mprint(var) such that > mprint(a) would give > a = (value of a) > so far I have tried: > ------------------------------**-- > > (%i1) a:2; > (%o1) 2 > > (%i2) mprint(zz) := print(sconcat(string(zz)," = "),zz)$ > > (%i3) mprint(a); > 2 = 2 (%o3) 2 > > (%i4) mprint(zz) := print(sconcat(string('zz)," = "),zz)$ > > (%i5) mprint(a); > zz = 2 (%o5) 2 > ------------------- > > Ted Woollett > > > > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Thu Feb 2 15:36:02 2012 From: woollett at charter.net (Edwin Woollett) Date: Thu, 2 Feb 2012 13:36:02 -0800 Subject: [Maxima] get name of variable as string in function? References: Message-ID: On Feb. 2, 2012, Stavros Macrakis wrote: --------------------- > mprint(zz) := print(sconcat(zz," = ",ev(zz)))$ > and then mprint('a). ------------------------ This works. Now I want to define mdisplay(a) or mdisplay(a,b), etc to apply this def. to each arg in succession. But my tries so far fail: --------------------------------------------------- (%i1) [a,b] : [2,3]; (%o1) [2,3] (%i2) mprint(zz234) := print(sconcat(" ",zz234," = "),ev(zz234))$ (%i3) mprint('a); a = 2 (%o3) 2 (%i4) map('mprint,'[a,b]); a = 2 b = 3 (%o4) [2,3] (%i5) mdisplay([vv]) := map('mprint,'vv)$ (%i6) mdisplay(a,b); map: improper argument: vv #0: mdisplay(vv=[2,3]) -- an error. To debug this try: debugmode(true); (%i7) mdisplay([vv]) := (print(vv),map('mprint,'vv))$ (%i8) mdisplay(a,b); [2,3] map: improper argument: vv #0: mdisplay(vv=[2,3]) -- an error. To debug this try: debugmode(true); ----------------------------------- Ted From macrakis at alum.mit.edu Thu Feb 2 16:13:43 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 2 Feb 2012 17:13:43 -0500 Subject: [Maxima] get name of variable as string in function? In-Reply-To: References: Message-ID: I suggest you keep things simple and modular: /* The worker function */ mprintx(name,val) := print(sconcat(" ",name," = "),val)$ mprint('a,a)$ /* Print 1 variable */ mprint(zz23) := mprintx(zz23,ev(zz23))$ mprint('a)$ /* Print many variables in a list */ mprintl(ll23) := map(mprintx,ll23,map(ev,ll23))$ mprintl('[a,b])$ /* Print many variables as multiple arguments */ mprintll([mm23]) ::= subst(mm23,'mm23,'(mprintl('mm23)))$ mprintll(a,b)$ -s mprintll(a,b); On Thu, Feb 2, 2012 at 16:36, Edwin Woollett wrote: > > On Feb. 2, 2012, Stavros Macrakis wrote: > --------------------- > > mprint(zz) := print(sconcat(zz," = ",ev(zz)))$ and then mprint('a). >> > ------------------------ > This works. Now I want to define mdisplay(a) > or mdisplay(a,b), etc to apply this def. to each > arg in succession. But my tries so far fail: > ------------------------------**--------------------- > (%i1) [a,b] : [2,3]; > (%o1) [2,3] > > (%i2) mprint(zz234) := print(sconcat(" ",zz234," = "),ev(zz234))$ > > (%i3) mprint('a); > > a = 2 (%o3) 2 > > (%i4) map('mprint,'[a,b]); > a = 2 b = 3 (%o4) [2,3] > > (%i5) mdisplay([vv]) := map('mprint,'vv)$ > > (%i6) mdisplay(a,b); > map: improper argument: vv > #0: mdisplay(vv=[2,3]) > -- an error. To debug this try: debugmode(true); > > (%i7) mdisplay([vv]) := (print(vv),map('mprint,'vv))$ > > (%i8) mdisplay(a,b); > [2,3] map: improper argument: vv > #0: mdisplay(vv=[2,3]) > -- an error. To debug this try: debugmode(true); > > ------------------------------**----- > Ted > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From villate at fe.up.pt Thu Feb 2 16:58:05 2012 From: villate at fe.up.pt (Jaime Villate) Date: Thu, 02 Feb 2012 22:58:05 +0000 Subject: [Maxima] get name of variable as string in function? In-Reply-To: References: Message-ID: <4F2B14FD.3030505@fe.up.pt> or you could also use something like this: (%i1) mprint(z) := if listp(z) then map(mprint, z) else printf(true, "~a = ~a~%", z, ev(z))$ (%i2) a: 2$ (%i3) [b,c]: [%pi, 2/5]$ (%4) mprint('a); a = 2 (%o4) false (%i5) mprint(['a,'b,'c]); a = 2 b = %pi c = 2/5 (%o5) [false, false, false] On 02/02/2012 10:13 PM, Stavros Macrakis wrote: > I suggest you keep things simple and modular: > > /* The worker function */ > mprintx(name,val) := print(sconcat(" ",name," = "),val)$ > > mprint('a,a)$ > > /* Print 1 variable */ > mprint(zz23) := mprintx(zz23,ev(zz23))$ > > mprint('a)$ > > /* Print many variables in a list */ > mprintl(ll23) := map(mprintx,ll23,map(ev,ll23))$ > > mprintl('[a,b])$ > > /* Print many variables as multiple arguments */ > mprintll([mm23]) ::= subst(mm23,'mm23,'(mprintl('mm23)))$ > > mprintll(a,b)$ > > -s > > mprintll(a,b); > > > On Thu, Feb 2, 2012 at 16:36, Edwin Woollett > wrote: > > > On Feb. 2, 2012, Stavros Macrakis wrote: > --------------------- > > mprint(zz) := print(sconcat(zz," = ",ev(zz)))$ and then > mprint('a). > > ------------------------ > This works. Now I want to define mdisplay(a) > or mdisplay(a,b), etc to apply this def. to each > arg in succession. But my tries so far fail: > --------------------------------------------------- > (%i1) [a,b] : [2,3]; > (%o1) [2,3] > > (%i2) mprint(zz234) := print(sconcat(" ",zz234," = "),ev(zz234))$ > > (%i3) mprint('a); > > a = 2 (%o3) 2 > > (%i4) map('mprint,'[a,b]); > a = 2 b = 3 (%o4) [2,3] > > (%i5) mdisplay([vv]) := map('mprint,'vv)$ > > (%i6) mdisplay(a,b); > map: improper argument: vv > #0: mdisplay(vv=[2,3]) > -- an error. To debug this try: debugmode(true); > > (%i7) mdisplay([vv]) := (print(vv),map('mprint,'vv))$ > > (%i8) mdisplay(a,b); > [2,3] map: improper argument: vv > #0: mdisplay(vv=[2,3]) > -- an error. To debug this try: debugmode(true); > > ----------------------------------- > Ted > > > > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From pier_carla at yahoo.it Fri Feb 3 05:47:44 2012 From: pier_carla at yahoo.it (Pierpaolo Garofalo) Date: Fri, 3 Feb 2012 11:47:44 +0000 (GMT) Subject: [Maxima] plot array of functions Message-ID: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> Hi everybody in the list, I am a new maxima user so if my question has been already answered elsewhere, please bear with me. I would be grateful if someone could provide a link to some explanation...? I googled around for hours before posting here. I am trying to plot a star of lines and for this purpose I am trying to rely on a vector of functions. So far I have made my way to this point: array(Y,9); for i:0 thru 9 do block(Y[i](x):=i*x, display(Y[i])); plot2d([Y(x)],[x,-5,5]); plot2d: expression evaluates to non-numeric value everywhere in plotting range. plot2d: nothing to plot. (%o103) false I have tried to alter in quite a few different way the Y expression in the plot2d string but with no success. Any hint would be greatly appreciated, Pier From eric.reyssat at unicaen.fr Fri Feb 3 06:08:41 2012 From: eric.reyssat at unicaen.fr (Eric Reyssat) Date: Fri, 03 Feb 2012 13:08:41 +0100 Subject: [Maxima] plot array of functions In-Reply-To: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> Message-ID: <4F2BCE49.8090309@unicaen.fr> Hi Pierpaolo, Maybe you could adapt this to your needs : Y:makelist(i*x,i,0,9); plot2d(Y,[x,-5,5]); Here Y[i] is not a function but an expression. Eric Le 03/02/2012 12:47, Pierpaolo Garofalo a ?crit : > array(Y,9); > > for i:0 thru 9 do block(Y[i](x):=i*x, display(Y[i])); > > plot2d([Y(x)],[x,-5,5]); From pier at unirc.eu Fri Feb 3 06:51:35 2012 From: pier at unirc.eu (Pier) Date: Fri, 3 Feb 2012 13:51:35 +0100 Subject: [Maxima] plot array of functions In-Reply-To: <4F2BCE49.8090309@unicaen.fr> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2BCE49.8090309@unicaen.fr> Message-ID: <20120203124858.M90907@unirc.eu> Eric, thank you very much! That's what I was looking for! Greetings, Pier On Fri, 03 Feb 2012 13:08:41 +0100, Eric Reyssat wrote > Hi Pierpaolo, > > Maybe you could adapt this to your needs : > > Y:makelist(i*x,i,0,9); plot2d(Y,[x,-5,5]); > > Here Y[i] is not a function but an expression. > > Eric > > Le 03/02/2012 12:47, Pierpaolo Garofalo a ?crit : > > array(Y,9); > > > > for i:0 thru 9 do block(Y[i](x):=i*x, display(Y[i])); > > > > plot2d([Y(x)],[x,-5,5]); > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima --------------------------------------------------------------------------------------------------------------------------------------------- ....../\ /\ ......0 0 .....=O= < Pierp > --------------------------------------------------------------------------------------------------------------------------------------------- Linux Gentoo Ker. 2.6.37/Ker. 2.6.19.2 RTAI Vulcano Web: http://pier.unirc.eu skype: pier_carla irc: irc.unirc.eu #linux icq: 325474062 -------------------- From villate at fe.up.pt Fri Feb 3 09:55:48 2012 From: villate at fe.up.pt (Jaime Villate) Date: Fri, 03 Feb 2012 15:55:48 +0000 Subject: [Maxima] plot array of functions In-Reply-To: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> Message-ID: <4F2C0384.7000106@fe.up.pt> On 02/03/2012 11:47 AM, Pierpaolo Garofalo wrote: > I am a new maxima user so if my question has been already answered elsewhere, please bear with me. I would be grateful if someone could provide > > a link to some explanation... I googled around for hours before posting here. > > > I am trying to plot a star of lines and for this purpose I am trying to rely on a vector of functions. So far I have made my way to this point: > > array(Y,9); > > for i:0 thru 9 do block(Y[i](x):=i*x, display(Y[i])); > > plot2d([Y(x)],[x,-5,5]); > > plot2d: expression evaluates to non-numeric value everywhere in plotting range. > plot2d: nothing to plot. > (%o103) false Hi, welcome to this group. Feel free to ask whenever you get stuck. Eric has already told you the answer, but since you are new user I'd like to point out why your attempt failed. First of all, you should avoid using arrays, at least until you're more familiar with Maxima. You could have created a list rather than an array by simply writing the "for" command right away: for i:0 thru 9 do (Y[i](x) := i*x, display (Y[i])); notice also that you do not need block in this case, since you are not defining any local variables. After you have defined those 10 functions, Y(x) will not refer to the list of those 10 functions but rather to another different function which you have not defined yet. That's why plot2d complaints that Y(x) evaluates to a non-numeric value, because in fact it cannot be evaluated since it has not been defined. To get a list with the ten functions you defined, you would have to write: [Y[0](x), Y[1](x), Y[2](x), Y[3](x), Y[4](x), Y[5](x), Y[6](x), Y[7](x), Y[8](x), Y[9](x)] or simply, makelist (Y[i](x), i, 0, 9) which will give you the same result. But in Maxima it makes life easier to represent mathematical functions by expressions rather than defining procedures with an input variable. Namely, get used to: f: x^2 + 2; at (f, x=5); instead of: f(x) := x^2 + 2; f(5); Regards, Jaime From villate at fe.up.pt Fri Feb 3 11:14:44 2012 From: villate at fe.up.pt (Jaime Villate) Date: Fri, 03 Feb 2012 17:14:44 +0000 Subject: [Maxima] plot array of functions In-Reply-To: <4F2C0384.7000106@fe.up.pt> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2C0384.7000106@fe.up.pt> Message-ID: <4F2C1604.3000109@fe.up.pt> On 02/03/2012 03:55 PM, Jaime Villate wrote: > You could have created a list rather than an array by simply writing > the "for" command > right away: > for i:0 thru 9 do (Y[i](x) := i*x, display (Y[i])); > > After you have defined those 10 functions,... Let me correct myself. The above command did not just define 10 functions 0, x, 2*x, ..., 9*x, but it really defined a function of two variables, Y[y](x) ---> y*x Thus, the above command would be equivalent to: for i:0 thru 9 do (Y[y](x) := y*x, display (Y[i])); which shows that the function Y[y](x) is being superfluously defined 10 times and an even simpler form of the above command would be: Y[y](x) := y*x; for i:0 thru 9 do display (Y[i]); If one really wants to define just an array of 10 functions, one should use define() instead of := for i:0 thru 9 do (define (Y[i](x), i*x), display(Y[i](x))); This is one more good reason to advise users not to use "Maxima functions" to represent the kind of functions they are used to in mathematics. Cheers, Jaime From pier at unirc.eu Fri Feb 3 12:39:13 2012 From: pier at unirc.eu (Pier) Date: Fri, 3 Feb 2012 19:39:13 +0100 Subject: [Maxima] plot array of functions In-Reply-To: <4F2C1604.3000109@fe.up.pt> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2C0384.7000106@fe.up.pt> <4F2C1604.3000109@fe.up.pt> Message-ID: <20120203183642.M4125@unirc.eu> Jamie, thank you very much for the explanation. I'll study what you wrote carefully. Pier On Fri, 03 Feb 2012 17:14:44 +0000, Jaime Villate wrote > On 02/03/2012 03:55 PM, Jaime Villate wrote: > > You could have created a list rather than an array by simply writing > > the "for" command > > right away: > > for i:0 thru 9 do (Y[i](x) := i*x, display (Y[i])); > > > > After you have defined those 10 functions,... > > Let me correct myself. The above command did not just define 10 functions > 0, x, 2*x, ..., 9*x, but it really defined a function of two > variables, Y[y](x) ---> y*x Thus, the above command would be > equivalent to: for i:0 thru 9 do (Y[y](x) := y*x, display (Y[i])); > > which shows that the function Y[y](x) is being superfluously defined > 10 times and an even simpler form of the above command would be: > Y[y](x) := y*x; for i:0 thru 9 do display (Y[i]); > > If one really wants to define just an array of 10 functions, one > should use define() instead of := for i:0 thru 9 do (define > (Y[i](x), i*x), display(Y[i](x))); > > This is one more good reason to advise users not to use "Maxima > functions" to > represent the kind of functions they are used to in mathematics. > > Cheers, > Jaime > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima From pier at unirc.eu Fri Feb 3 14:48:06 2012 From: pier at unirc.eu (Pier) Date: Fri, 3 Feb 2012 21:48:06 +0100 Subject: [Maxima] plot array of functions In-Reply-To: <4F2C1604.3000109@fe.up.pt> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2C0384.7000106@fe.up.pt> <4F2C1604.3000109@fe.up.pt> Message-ID: <20120203204625.M29639@unirc.eu> Thanks everybody for the useful prompt replies. Just to point out what I was aiming at, here follows the list of instructions I intended to suggest to my pupils in order to show them the influence of the parameter K when linearly combining two lines r and s into a star (ex:r+K*s). Namely, varying K from 0 to a possibly high value, the expression ex approaches nearer and nearer the line s. (%i6) a:1; (%i7) b:1; (%i8) c:1; (%i9) e:1; (%i10) f:0.5; (%i11) g:1; (%i12) r:a*x+b*y+c; (%i13) s:e*x+f*y+g; (%i14) P:linsolve([r,s],[x,y]); centre point of the star (%i15) ex:r+K*s; (%i16) solve(ex,y); copy and paste the rhs of the output as rhs of %i17 (%i17) Z(x,K):=-((2*x+2)*K+2*x+2)/(K+2); (%i18) F:makelist(Z(x,K),K,0,10); (%i19) plot2d(F,[x,-5,5]); One thing I haven't been able to do is to avoiding copying-pasting the rhs output of %i16 y=-((2*x+2)*K+2*x+2)/(K+2) as the rhs in %i17. I tried with: Z(ex,K):=solve(ex,y); but that didn't work. Thanks, Pier From toy.raymond at gmail.com Fri Feb 3 14:56:19 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 3 Feb 2012 12:56:19 -0800 Subject: [Maxima] plot array of functions In-Reply-To: <20120203204625.M29639@unirc.eu> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2C0384.7000106@fe.up.pt> <4F2C1604.3000109@fe.up.pt> <20120203204625.M29639@unirc.eu> Message-ID: On Fri, Feb 3, 2012 at 12:48 PM, Pier wrote: > Thanks everybody for the useful prompt replies. > > Just to point out what I was aiming at, here follows the list of > instructions > I intended to suggest to my pupils in order to show them the influence of > the > parameter K when linearly combining two lines r and s into a star > (ex:r+K*s). > Namely, varying K from 0 to a possibly high value, the expression ex > approaches nearer and nearer the line s. > > (%i6) a:1; > (%i7) b:1; > (%i8) c:1; > (%i9) e:1; > (%i10) f:0.5; > (%i11) g:1; > (%i12) r:a*x+b*y+c; > (%i13) s:e*x+f*y+g; > (%i14) P:linsolve([r,s],[x,y]); centre point of the star > (%i15) ex:r+K*s; > (%i16) solve(ex,y); copy and paste the rhs of the output as rhs of %i17 > (%i17) Z(x,K):=-((2*x+2)*K+2*x+2)/(K+2); > (%i18) F:makelist(Z(x,K),K,0,10); > (%i19) plot2d(F,[x,-5,5]); > > One thing I haven't been able to do is to avoiding copying-pasting the rhs > output of %i16 > > y=-((2*x+2)*K+2*x+2)/(K+2) > > If you want the rhs of something, use the rhs function rhs(%o16). But the output of solve is a list, so you probably want to do rhs(%o16[1]) instead. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From villate at fe.up.pt Sat Feb 4 07:34:17 2012 From: villate at fe.up.pt (Jaime Villate) Date: Sat, 04 Feb 2012 13:34:17 +0000 Subject: [Maxima] plot array of functions In-Reply-To: <20120203204625.M29639@unirc.eu> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2C0384.7000106@fe.up.pt> <4F2C1604.3000109@fe.up.pt> <20120203204625.M29639@unirc.eu> Message-ID: <4F2D33D9.6080706@fe.up.pt> On 02/03/2012 08:48 PM, Pier wrote: > (%i6) a:1; > (%i7) b:1; > (%i8) c:1; > (%i9) e:1; > (%i10) f:0.5; > (%i11) g:1; > (%i12) r:a*x+b*y+c; > (%i13) s:e*x+f*y+g; > (%i14) P:linsolve([r,s],[x,y]); centre point of the star > (%i15) ex:r+K*s; > (%i16) solve(ex,y); copy and paste the rhs of the output as rhs of %i17 > (%i17) Z(x,K):=-((2*x+2)*K+2*x+2)/(K+2); > (%i18) F:makelist(Z(x,K),K,0,10); > (%i19) plot2d(F,[x,-5,5]); > > One thing I haven't been able to do is to avoiding copying-pasting the rhs > output of %i16 > > y=-((2*x+2)*K+2*x+2)/(K+2) > > as the rhs in %i17. I tried with: > > Z(ex,K):=solve(ex,y); > > but that didn't work. I guess you meant "Z(x,K) := solve(ex,y)", but that will fail by two reasons. The first reason, already pointed out by Ray, is that solve will give you a list of equations, even if there is only one solution. You want just the right hand side of the first equation in the list returned by solve: rhs(first(solve(ex, y))) (or use [1] instead of first). The second reason is that := will not evaluate its arguments. That means that in the command "Z(x,K) := rhs (first (solve (ex, y)))" ex will not be solved to find y, but that step will be delayed until you try to evaluate Z(x,k) at some later time; that might work but it might also give you unintended results; for instance: (%i15) Z(x,K) := rhs ( first(solve(ex,y))); (%o15) Z(x, K) := rhs(first(solve(ex, y))) (%i16) y:3; (%o16) 3 (%i17) Z(2,4); solve: all variables must not be numbers. #0: Z(x=2,k=4) -- an error. To debug this try: debugmode(true) by the time Z tried to use solve, y was no longer an undefined variable so it failed. As I pointed out in my previous message you should better use expressions: Z: rhs ( first(solve(ex,y))); but if you insist on using functions, then use define() instead of := define (Z(x,K), rhs ( first(solve(ex,y)))); the difference between f(x):=exp and define(f(x),exp) is that define will first evaluate its arguments before defining the function. In the case above, solve, first and rhs will be executed before Z(x,K) is defined. I also use Maxima extensively in my Physics lectures; I'm interested to know what courses you are teaching. Cheers, Jaime From zhaxiaolei at gmail.com Sat Feb 4 09:41:11 2012 From: zhaxiaolei at gmail.com (zxl) Date: Sat, 4 Feb 2012 23:41:11 +0800 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) Message-ID: hello: I hope expand (a+b sqrt(5))^n to the form A+B sqrt(5), but expand ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert 5^(3/2) to 5 5^(1/2) ? thanks z.x.l -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.reyssat at unicaen.fr Sat Feb 4 10:21:10 2012 From: eric.reyssat at unicaen.fr (Eric Reyssat) Date: Sat, 04 Feb 2012 17:21:10 +0100 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) In-Reply-To: References: Message-ID: <4F2D5AF6.1090602@unicaen.fr> Hello z.x.l, radcan (expression); is usually a good way to simplify radicals. Eric Le 04/02/2012 16:41, zxl a ?crit : > hello: > > I hope expand (a+b sqrt(5))^n to the form A+B sqrt(5), but expand > ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert > 5^(3/2) to 5 5^(1/2) ? > > thanks > > z.x.l > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Sat Feb 4 13:55:11 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 4 Feb 2012 11:55:11 -0800 Subject: [Maxima] get name of variable as string in function? In-Reply-To: References: Message-ID: On 2/2/12, Edwin Woollett wrote: > I would like to define mprint(var) such that > mprint(a) would give > a = (value of a) Isn't that exactly what display(a) does? best, Robert Dodier From pier at unirc.eu Sat Feb 4 14:04:08 2012 From: pier at unirc.eu (Pier) Date: Sat, 4 Feb 2012 21:04:08 +0100 Subject: [Maxima] plot array of functions In-Reply-To: <4F2D33D9.6080706@fe.up.pt> References: <1328269664.98345.YahooMailNeo@web26208.mail.ukl.yahoo.com> <4F2C0384.7000106@fe.up.pt> <4F2C1604.3000109@fe.up.pt> <20120203204625.M29639@unirc.eu> <4F2D33D9.6080706@fe.up.pt> Message-ID: <20120204194642.M83461@unirc.eu> Jaime, thank you very much for your hints. At last I got what I wanted. Here are the working lines: (%i1) a:1; (%i2) b:1; (%i3) c:1; (%i4) e:1; (%i5) f:0.5; (%i6) g:1; (%i7) r:a*x+b*y+c; (%i8) s:e*x+f*y+g; (%i9) P:linsolve([r,s],[x,y]); (%i10) ex:r+K*s; (%i20) define (Z(x,K), rhs ( (solve(ex,y)[1]))); (%i21) F:makelist(Z(x,K),K,0,10); (%i22) plot2d(F,[x,-5,5]); It is not that I insist on using functions... I tried both: Z: rhs ( first(solve(ex,y))); and define (Z(x,K), rhs ( (solve(ex,y)[1]))); but only the latter worked. For sure I must get hold of a good book on Maxima. Pier On Sat, 04 Feb 2012 13:34:17 +0000, Jaime Villate wrote > On 02/03/2012 08:48 PM, Pier wrote: > > (%i6) a:1; > > (%i7) b:1; > > (%i8) c:1; > > (%i9) e:1; > > (%i10) f:0.5; > > (%i11) g:1; > > (%i12) r:a*x+b*y+c; > > (%i13) s:e*x+f*y+g; > > (%i14) P:linsolve([r,s],[x,y]); centre point of the star > > (%i15) ex:r+K*s; > > (%i16) solve(ex,y); copy and paste the rhs of the output as rhs of %i17 > > (%i17) Z(x,K):=-((2*x+2)*K+2*x+2)/(K+2); > > (%i18) F:makelist(Z(x,K),K,0,10); > > (%i19) plot2d(F,[x,-5,5]); > > > > One thing I haven't been able to do is to avoiding copying-pasting the rhs > > output of %i16 > > > > y=-((2*x+2)*K+2*x+2)/(K+2) > > > > as the rhs in %i17. I tried with: > > > > Z(ex,K):=solve(ex,y); > > > > but that didn't work. > I guess you meant "Z(x,K) := solve(ex,y)", but that will fail by two > reasons. The first reason, > already pointed out by Ray, is that solve will give you a list of > equations, even if there is > only one solution. You want just the right hand side of the first > equation in the list returned > by solve: rhs(first(solve(ex, y))) > (or use [1] instead of first). > > The second reason is that := will not evaluate its arguments. That > means that in the command "Z(x,K) := rhs (first (solve (ex, y)))" ex > will not be solved to find y, but that step will be delayed until > you try to evaluate Z(x,k) at some later time; that might work but > it might also give you unintended results; for instance: > > (%i15) Z(x,K) := rhs ( first(solve(ex,y))); > (%o15) Z(x, K) := rhs(first(solve(ex, y))) > (%i16) y:3; > (%o16) 3 > (%i17) Z(2,4); > > solve: all variables must not be numbers. > #0: Z(x=2,k=4) > -- an error. To debug this try: debugmode(true) > > by the time Z tried to use solve, y was no longer an undefined > variable so it failed. > > As I pointed out in my previous message you should better use expressions: > > Z: rhs ( first(solve(ex,y))); > > but if you insist on using functions, then use define() instead of := > > define (Z(x,K), rhs ( first(solve(ex,y)))); > > the difference between f(x):=exp and define(f(x),exp) is that define > will first evaluate its arguments > before defining the function. In the case above, solve, first and > rhs will be executed before Z(x,K) is defined. > > I also use Maxima extensively in my Physics lectures; I'm interested > to know what courses you are teaching. > > Cheers, > Jaime > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima --------------------------------------------------------------------------------------------------------------------------------------------- ....../\ /\ ......0 0 .....=O= < Pierp > --------------------------------------------------------------------------------------------------------------------------------------------- Linux Gentoo Ker. 2.6.37/Ker. 2.6.19.2 RTAI Vulcano Web: http://pier.unirc.eu skype: pier_carla irc: irc.unirc.eu #linux icq: 325474062 -------------------- From amca01 at gmail.com Sat Feb 4 22:08:58 2012 From: amca01 at gmail.com (Alasdair McAndrew) Date: Sun, 5 Feb 2012 15:08:58 +1100 Subject: [Maxima] A series question Message-ID: What is the canonical Maxima way of obtaining the series form f(x) + hf'(x) + h^2f''(x)/2 + h^3f'''(x)/6 + ... for f(x+h)? Thanks, Alasdair -- Blog: http://amca01.wordpress.com Web: http://sites.google.com/site/amca01/ Facebook: http://www.facebook.com/alasdair.mcandrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.reyssat at unicaen.fr Sun Feb 5 01:01:18 2012 From: eric.reyssat at unicaen.fr (Eric Reyssat) Date: Sun, 05 Feb 2012 08:01:18 +0100 Subject: [Maxima] A series question In-Reply-To: References: Message-ID: <4F2E293E.6040407@unicaen.fr> Hello Alasdair, I'm not expert in canonical Maxima but (%i13) subst(u-x=h,taylor(f(u),u,x,3)); (%o13) f(x)+h^3*('at('diff(f(u),u,3),u = x))/6 +h^2*('at('diff(f(u),u,2),u = x))/2+h*('at('diff(f(u),u,1),u = x)) (%i14) subst(u-x=h,taylor(sin(u),u,x,3)); (%o14) -h^2*sin(x)/2+sin(x)-h^3*cos(x)/6+h*cos(x) is quite simple, and gives reasonable results for explicit as well as litteral functions. I don't know if maxima knows of a simpler way of writing f^(5)(x) (fifth derivative at x) than ('at('diff(f(u),u,5),u = x)) Eric Le 05/02/2012 05:08, Alasdair McAndrew a ?crit : > What is the canonical Maxima way of obtaining the series form > > f(x) + hf'(x) + h^2f''(x)/2 + h^3f'''(x)/6 + ... > > for f(x+h)? > > Thanks, > Alasdair > -- > Blog: http://amca01.wordpress.com > Web: http://sites.google.com/site/amca01/ > Facebook: http://www.facebook.com/alasdair.mcandrew > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From biomates at telefonica.net Sun Feb 5 05:06:30 2012 From: biomates at telefonica.net (Mario Rodriguez) Date: Sun, 05 Feb 2012 12:06:30 +0100 Subject: [Maxima] draw package, multiple plots with different sizes? In-Reply-To: <4F18754A.20309@street-artists.org> References: <4F171FD5.20108@street-artists.org> <1326984114.1569.17.camel@pc> <1326997893.1684.18.camel@pc> <4F18754A.20309@street-artists.org> Message-ID: <1328439990.1531.8.camel@pc> El jue, 19-01-2012 a las 11:55 -0800, dlakelan escribi?: > > Thank you very much for the helpful examples! If you are considering > additional features to add to draw, you might consider a standardized > (non preamble based) way to do this. It is often nice to do multi-plots > where some plots are more prominent or have different aspect ratios than > others, and inset-plots are also quite nice. Hello, I have commited to the git repository some changes in the draw package (files draw.lisp, grcommon.lisp and vtk.lisp) on multiplots (both Gnuplot and VTK). Info on new option 'allocation': With option @code{allocation} it is possible to place a scene in the output window at will; this is of interest in multiplots. When @code{false}, the scene is placed automatically, depending on the value assigned to option @code{columns}. In any other case, @code{allocation} must be set to a list of two pairs of numbers; the first corresponds to the position of the lower left corner of the scene, and the second pair gives the width and height of the plot. All quantities must be given in relative coordinates, between 0 and 1. Gnuplot examples: http://riotorto.users.sourceforge.net/gnuplot/multiplots/index.html#allocation VTK examples: http://riotorto.users.sourceforge.net/vtk/multiplot -- Mario From lapeyre.math122a at gmail.com Sun Feb 5 11:28:14 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Sun, 05 Feb 2012 18:28:14 +0100 Subject: [Maxima] experiments with maxima Message-ID: <4F2EBC2E.1020605@gmail.com> Greetings, Here are some experiments that may be interesting. The code is at: https://sourceforge.net/projects/ribot/files/ These are the same thing: maxima-expt.zip maxima-expt.tar.gz This is a 3.2MB data file for one function prime_pi_tables.lisp 1) Documentation: Modified the command-line interface to the maxima manual to allow other documents to be displayed with ? and ?? and to allow other systems to make queries. The documentation system is divided into three parts: a) databases. b) querying and organizing component. c) front ends. Databases are registered with the querying component by sending a struct. The original describe command line interface calls the querying component. Not much was done here, just separating the code. There are four examples of databases: a) the maxima info database. b) simple-doc. This is available immediately. (I later saw this is similar to L. Butler's code.) (%i3) simple_doc_add("new_function", "The new description."); (%o3) "new_function" (%i4) ? new_function The new description. (%o4) true c) max-doc, a more capable documentation database than simple-doc, but not coherent. It would be nice if there were a lisp parser of gnu texinfo code. The idea is to make it easy to convert to normal maxima doc. d) developer or internal documentation. Eg, there is a macro ddefun that expands to defun but also captures the doc string to a database along with the name of the source file, and lambda list. This is then also available via ? and ??. There is a variable controlling sending the output to a pager, as well, that only works with some lisp/platfrom combinations. 2) Options or keyword arguments to maxima functions: One could use a new infix notation, or just pass a form: func(x, a -> b) or func(x, opt(a=b)) I am using the former. 3) defmfun1 macro for writing maxima functions: (no support now for writing directly in maxima language). The syntax tries to follow defun as much as possible with &optional, &aux, &rest, with some additions. a) There is a new parameter type &opt rather than &key for the keyword args, mentioned above. b) Directives for argument checking and preprocessing of args. c) Automatic entry in the max-doc database. Actually, we require a directive :doc to create a documentation entry. An example: (defmfun1 $f (x) x). Another example (that still does not use &opt) (defmfun1 ($f4 :doc) ( (x :string) (y :non-neg-int) &optional (z :string "dog") ) "f4 ignores the string and integer arguments and returns 'dog' by default." z) then .... (%i2) ? f4 -- Function: f4: f4(, :optional ) Section: Example functions f4 ignores the string and integer arguments and returns 'dog' by default. f4 requires either two or three arguments. The first argument must be a string. The second argument must be a non-negative integer. The third argument must be a string. (%i3) f4(); f4: f4 called with no arguments; either two or three arguments are expected. (%i4) f4(1); f4: Argument '1' is not a string in f4(1). (%i5) f4("cat",1); (%o5) "dog" Some other examples of definitions: (defmfun1 $f8 (x &rest (m :list) ) ...) ; Each of the &rest arguments must be a maxima list. (defmfun1 $f9 ( (x (:int-range 1 10) )) ...) ; eg f9(5) (defmfun1 $f10 ( x &opt ($y (:int-range 1 3))) ; eg f10(1, y->2) 4) array representation of expressions. Instead of a list, represent an expression by a struct with a list for the op and a lisp array for the arguments. This allows more efficient random access of elements in the expression. These cannot be used universally, of course. Some of the functions to manipulate them are. a) aex(e), lex(e) shallow conversion between array and list representation. b) faex(e), flex(e), raex(e,i,j...) convert at all levels or levels given by a specification. c) e falls through aex(e) if e is a symbol, number, bigfloat, string, etc. d) ipart(e,...). Like inpart but expression can be mixed list and array representation at different levels. ipart_set(e,v,....) destructive assignment. Some other modifications are done, eg. the alike function understands array expressions. In general, the idea is to allow algorithms that are not efficient for singly-linked lists. What output representation to choose if none is specificied is problematic. Display of aex is badly hacked via msize at the moment. It looks slightly better in 5.25.1 than 5.26.0 I don't understand the maxima display code. Many functions take the option ot. ot->ar means output array representation ot->ml means output lisp list representation. 5) A number of functions, mostly using the above. Eg. a) lrange (called lrange because 'range' is already taken) lrange(3) => [1,2,3] lrange(3,ot->ar) => ~[1,2,3] (ask for array representation output, marked by '~') lrange(x,x+4,2) => [x,x+2,x+4] For generating a single list large enough to measure the time, lrange is a few hundred times faster than the more general 'makelist', and about 3 times faster than Z. Lenaric's, also more general, table. Here is an example. defmfun-ae is a macro that writes some array expression options into the lambda list. This example could also be done simply by copying to a lisp array. (defmfun-ae $ae_random_permutation (a) "Return expression a with random permutation of arguments." (let* ( (a1 ($aex_cp a)) ; shallow copy to array expression from list or array expression (n ($length a1)) ) (dotimes (i n) (let ( (j (+ i ($random (- n i)))) (tmp ($aex_get a1 i)) ) (declare (fixnum j)) ($aex_set a1 i ($aex_get a1 j)) ;; these are pretty fast ($aex_set a1 j tmp))) (defmfun-final-to-ae a1))) ;; convert to the representation specified in the call. ae_random_permutation([1,2,3]); => ~[3,1,2] (list input , array output) ae_random_permutation( aex( [1,2,3]) ); => ~[3,1,2] (array input and output) ae_random_permutation( aex( [1,2,3] ), ot->ml ); [1,2,3] (array input, list output) The following (compiled) is almost as fast on large lists of numbers (10^5 or 10^6) rand_perm(a) := block([a1,n,j,tmp], modedeclare([j,n],fixnum), a1 : aex_cp(a), n : length(a1), for i from 0 thru n-1 do ( j : i + random(n-i), tmp : aex_get(a1,i), aex_set(a1,i,aex_get(a1,j)), aex_set(a1,j,tmp)), a1); 6) cffi example: prime_pi prime counting function. The table is big so it is packaged separately. This may not be easily buildable on some systems. I made an interface to a fast c++ prime sieve implementation (Walisch) and some tables (Oliveira). The library is multithreaded. This works with sbcl and ccl on linux. The trial allegro system would not link the 64 bit library. It is probably not difficult to get it work with MS Win, but I stopped when I got linking errors because mingw does not have openmp. Also, poking around the web and the gcl source I could not find how to do ffi for gcl. Example: The spacing of entries in the table for 10^12 is greater than 10^8 (Denser tables are available). So 10^8 values must be sieved: (%i28) prime_pi(10^12 + 10^8, threads->2); Evaluation took 0.0940 seconds (0.0940 elapsed) using 0 bytes. (%o28) 37611530300 Here, 10^9 values sieved. Note real time is half the total processor time. (%i29) prime_pi(10^15 + 10^9, threads->2); Evaluation took 1.6610 seconds (0.8610 elapsed) using 0 bytes. (%o29) 29844599369090 From macrakis at alum.mit.edu Sun Feb 5 13:07:53 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 5 Feb 2012 14:07:53 -0500 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) In-Reply-To: References: Message-ID: 5^(3/2) is Maxima's standard way of expressing sqrt(5)^3 = 5*sqrt(5). It is important in Maxima to have standard ways of expressing such things, otherwise it risks not simplifying e.g. 5*sqrt(5) - 5^(3/2). Since Maxima is programmable, you can of course generate whatever form you want -- though you shouldn't use the standard sqrt function, since Maxima "knows" about it and will simplify it. Here is one simple trick: (%i1) display2d:false$ (%i2) 5^(3/2); (%o2) 5^(3/2) (%i3) ratsubst(sqr(5),sqrt(5),%o2); (%o3) sqr(5)^3 (%i4) ratsubst(5,sqr(5)^2,%o3); (%o4) 5*sqr(5) Of course, subsequent calculations won't know that sqr(5)^2 = 5. You could also do something like this: separate_roots(ex):= if mapatom(ex) then ex elseif inpart(ex,0)="^" then block([b:inpart(ex,1),e:inpart(ex,2)], if numberp(b) and numberp(e) then b^truncate(e)*box(b^(e-truncate(e))) <<< box "protects" from simplification else ex) else ex$ This produces ugly results (with box), especially for negative powers, but you should be able to customize this to something more of your liking. -s On Sat, Feb 4, 2012 at 10:41, zxl wrote: > hello: > > I hope expand (a+b sqrt(5))^n to the form A+B sqrt(5), but expand > ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert 5^(3/2) to > 5 5^(1/2) ? > > thanks > > z.x.l > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Sun Feb 5 13:09:03 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sun, 5 Feb 2012 14:09:03 -0500 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) In-Reply-To: References: Message-ID: PS And if you want to recurse down the whole expression, you can either use scanmap(separate_roots, ...) or separate_roots(ex):= if mapatom(ex) then ex elseif inpart(ex,0)="^" then block([b:inpart(ex,1),e:inpart(ex,2)], if numberp(b) and numberp(e) then b^truncate(e)*box(b^(e-truncate(e))) else map('separate_roots,ex)) else map('separate_roots,ex)$ -s On Sun, Feb 5, 2012 at 14:07, Stavros Macrakis wrote: > 5^(3/2) is Maxima's standard way of expressing sqrt(5)^3 = 5*sqrt(5). It > is important in Maxima to have standard ways of expressing such things, > otherwise it risks not simplifying e.g. 5*sqrt(5) - 5^(3/2). > > Since Maxima is programmable, you can of course generate whatever form you > want -- though you shouldn't use the standard sqrt function, since Maxima > "knows" about it and will simplify it. > > Here is one simple trick: > > (%i1) display2d:false$ > (%i2) 5^(3/2); > (%o2) 5^(3/2) > (%i3) ratsubst(sqr(5),sqrt(5),%o2); > (%o3) sqr(5)^3 > (%i4) ratsubst(5,sqr(5)^2,%o3); > (%o4) 5*sqr(5) > > Of course, subsequent calculations won't know that sqr(5)^2 = 5. > > You could also do something like this: > > separate_roots(ex):= > if mapatom(ex) > then ex > elseif inpart(ex,0)="^" > then block([b:inpart(ex,1),e:inpart(ex,2)], > if numberp(b) and numberp(e) > then b^truncate(e)*box(b^(e-truncate(e))) <<< box "protects" from > simplification > else ex) > else ex$ > > This produces ugly results (with box), especially for negative powers, but > you should be able to customize this to something more of your liking. > > -s > > On Sat, Feb 4, 2012 at 10:41, zxl wrote: > >> hello: >> >> I hope expand (a+b sqrt(5))^n to the form A+B sqrt(5), but expand >> ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert 5^(3/2) to >> 5 5^(1/2) ? >> >> thanks >> >> z.x.l >> >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Sun Feb 5 13:33:12 2012 From: woollett at charter.net (Edwin Woollett) Date: Sun, 5 Feb 2012 11:33:12 -0800 Subject: [Maxima] get name of variable as string in function? Message-ID: On Feb. 4, 2012, Robert Dodier wrote: ---------------------------------- >> I would like to define mprint(var) such that >> mprint(a) would give >> a = (value of a) >> >Isn't that exactly what display(a) does? --------------------------------------------- See bug item #3484414 and recent mailing list about display. You are correct that this is what display used to do, but with ver. 5.26.0, (false) precedes the display output if display2d is set to false. Thanks for your interest, Ted From zhaxiaolei at gmail.com Mon Feb 6 09:42:58 2012 From: zhaxiaolei at gmail.com (zxl) Date: Mon, 6 Feb 2012 23:42:58 +0800 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) In-Reply-To: References: Message-ID: thanks ?Eric Reyssat and?Stavros Macrakis. Now I know that 1?5^(3/2) is somewhat "atom" in maxima; 2?radcan can expand (a+b sqrt(5))^n to A+B (5)^(1/2) or A+B (5)^(3/2). thanks On Sat, Feb 4, 2012 at 11:41 PM, zxl wrote: > > hello: > > I hope expand (a+b sqrt(5))^n ?to the form ?A+B sqrt(5), but expand ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert 5^(3/2) to 5 5^(1/2) ? > > thanks > > z.x.l From zhaxiaolei at gmail.com Mon Feb 6 09:59:46 2012 From: zhaxiaolei at gmail.com (zxl) Date: Mon, 6 Feb 2012 23:59:46 +0800 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) In-Reply-To: References: Message-ID: some fix. 1?if B=5^k C, where 5 not divide C, then B 5^(1/2) will be represented as C 5^(k+1/2); 2?radcan can expand (a+b sqrt(5))^n to A+B 5^m where 5 not divide B. On Mon, Feb 6, 2012 at 11:42 PM, zxl wrote: > thanks ?Eric Reyssat and?Stavros Macrakis. Now I know that > > 1?5^(3/2) is somewhat "atom" in maxima; > > 2?radcan can expand (a+b sqrt(5))^n to A+B (5)^(1/2) ?or A+B (5)^(3/2). > > thanks > > On Sat, Feb 4, 2012 at 11:41 PM, zxl wrote: >> >> hello: >> >> I hope expand (a+b sqrt(5))^n ?to the form ?A+B sqrt(5), but expand ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert 5^(3/2) to 5 5^(1/2) ? >> >> thanks >> >> z.x.l From macrakis at alum.mit.edu Mon Feb 6 10:36:09 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 6 Feb 2012 11:36:09 -0500 Subject: [Maxima] How can I convert 5^(3/2) to 5* 5^(1/2) In-Reply-To: References: Message-ID: Just to be clear, none of this is specific to radcan. You'll get the same results with ratsimp or expand. -s On Mon, Feb 6, 2012 at 10:59, zxl wrote: > some fix. > > 1?if B=5^k C, where 5 not divide C, then B 5^(1/2) will be represented > as C 5^(k+1/2); > > 2?radcan can expand (a+b sqrt(5))^n to A+B 5^m where 5 not divide B. > > On Mon, Feb 6, 2012 at 11:42 PM, zxl wrote: > > thanks Eric Reyssat and Stavros Macrakis. Now I know that > > > > 1?5^(3/2) is somewhat "atom" in maxima; > > > > 2?radcan can expand (a+b sqrt(5))^n to A+B (5)^(1/2) or A+B (5)^(3/2). > > > > thanks > > > > On Sat, Feb 4, 2012 at 11:41 PM, zxl wrote: > >> > >> hello: > >> > >> I hope expand (a+b sqrt(5))^n to the form A+B sqrt(5), but expand > ((1+sqrt(5))) give me 5^(3/2)+ 3 sqrt(5) + 16. How can I convert 5^(3/2) to > 5 5^(1/2) ? > >> > >> thanks > >> > >> z.x.l > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Mon Feb 6 14:17:15 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Mon, 6 Feb 2012 12:17:15 -0800 Subject: [Maxima] display patch, was: get name of variable as string in function? Message-ID: On 2/5/12, Edwin Woollett wrote: > On Feb. 4, 2012, Robert Dodier wrote: > ---------------------------------- >>> I would like to define mprint(var) such that >>> mprint(a) would give >>> a = (value of a) >>> >>Isn't that exactly what display(a) does? > --------------------------------------------- > See bug item #3484414 and recent mailing list about display. > You are correct that this is what display used to do, but > with ver. 5.26.0, (false) precedes the display output > if display2d is set to false. Well, OK. No need to invent a work-around, it's easier to fix the bug. Here is a patch. Can someone commit this? My git sandbox is messed up (OH WONDERS OF GIT WILL YOU NEVER CEASE) and I can't take the time to straighten it out right now. best Robert Dodier PS. diff --git a/src/comm.lisp b/src/comm.lisp index 1282784..94c3823 100644 --- a/src/comm.lisp +++ b/src/comm.lisp @@ -753,7 +753,9 @@ (setq ans (list '(mequal simp) (disp2 l) ans))) (if lablist (nconc lablist (cons (elabel ans) nil))) (setq tim (get-internal-run-time)) - (displa (list '(mlable) (if lablist linelable) ans)) + (let ((*display-labels-p* nil)) + (declare (special *display-labels-p*)) + (displa (list '(mlable) (if lablist linelable) ans))) (mterpri) (timeorg tim))) From not0read0765 at yopmail.com Tue Feb 7 02:17:06 2012 From: not0read0765 at yopmail.com (Olive) Date: Tue, 7 Feb 2012 09:17:06 +0100 Subject: [Maxima] numeric approximation Message-ID: <20120207091706.0f12eeef@yopmail.com> My experiment: (%i1) f(t):=''(integrate(1/(sin(x)^2+log(x)),x,1,t)); t / [ 1 (%o1) f(t) := I ---------------- dx ] 2 / sin (x) + log(x) 1 (%i2) f(5), numer; 5 / [ 1 (%o2) I ---------------- dx ] 2 / sin (x) + log(x) 1 It seems that (%i1) correctly define a function f(t) and maxima is indeed able to derive it. Why (%o2) does not give a numeric approximation of f(5)? What I have to do to get it? How can I plot f? Olive From not0read0765 at yopmail.com Tue Feb 7 02:32:13 2012 From: not0read0765 at yopmail.com (Olive) Date: Tue, 7 Feb 2012 09:32:13 +0100 Subject: [Maxima] numeric approximation References: <20120207091706.0f12eeef@yopmail.com> Message-ID: <20120207093213.4380d923@yopmail.com> On Tue, 7 Feb 2012 09:17:06 +0100 Olive wrote: > My experiment: > > (%i1) f(t):=''(integrate(1/(sin(x)^2+log(x)),x,1,t)); > t > / > [ 1 > (%o1) f(t) := I ---------------- dx > ] 2 > / sin (x) + log(x) > 1 > (%i2) f(5), numer; > 5 > / > [ 1 > (%o2) I ---------------- dx > ] 2 > / sin (x) + log(x) > 1 > It seems that (%i1) correctly define a function f(t) and maxima is > indeed able to derive it. Why (%o2) does not give a numeric > approximation of f(5)? What I have to do to get it? How can I plot f? By reading the documentation, I can define: f_numer(t):=quad_qag(1/(sin(x)^2+log(x)),x,1,t,1)[1]; and f_numer give a numeric approximation of f. But is it possible to connect f(t) and f_numer(t)? Both represent intrinsically the same function (f(t) is the symbolic representation of f_numer(t)). Olive From dbmaxima at gmail.com Tue Feb 7 04:56:16 2012 From: dbmaxima at gmail.com (David Billinghurst) Date: Tue, 07 Feb 2012 21:56:16 +1100 Subject: [Maxima] display patch, was: get name of variable as string in function? In-Reply-To: References: Message-ID: <4F310350.5070503@gmail.com> On 7/02/2012 7:17 AM, Robert Dodier wrote: > On 2/5/12, Edwin Woollett wrote: >> On Feb. 4, 2012, Robert Dodier wrote: >> ---------------------------------- >>>> I would like to define mprint(var) such that >>>> mprint(a) would give >>>> a = (value of a) >>>> >>> Isn't that exactly what display(a) does? >> --------------------------------------------- >> See bug item #3484414 and recent mailing list about display. >> You are correct that this is what display used to do, but >> with ver. 5.26.0, (false) precedes the display output >> if display2d is set to false. > Well, OK. No need to invent a work-around, it's easier to fix the bug. > Here is a patch. Can someone commit this? My git sandbox > is messed up (OH WONDERS OF GIT WILL YOU NEVER CEASE) > and I can't take the time to straighten it out right now. > > best > > Robert Dodier Done. From rswarbrick at gmail.com Tue Feb 7 05:07:13 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Tue, 07 Feb 2012 11:07:13 +0000 Subject: [Maxima] numeric approximation References: <20120207091706.0f12eeef@yopmail.com> <20120207093213.4380d923@yopmail.com> Message-ID: <28d709xlah.ln2@hake.rswarbrick.dnsalias.com> Olive writes: >> >> (%i1) f(t):=''(integrate(1/(sin(x)^2+log(x)),x,1,t)); > > By reading the documentation, I can define: > > f_numer(t):=quad_qag(1/(sin(x)^2+log(x)),x,1,t,1)[1]; > > and f_numer give a numeric approximation of f. But is it possible to > connect f(t) and f_numer(t)? Both represent intrinsically the same > function (f(t) is the symbolic representation of f_numer(t)). > > Olive I don't know what the answer *should* be, but what's going on is that maxima doesn't know of a relationship between "integrate" and "quad_qag". So g(x) := 1/(sin(x)^2+log(x)); f(t) := integrate (g(x), x, 1, t); f_numer(t) := quad_qag(g(x),x,1,t,1)[1]; is reasonable enough (not tested!), but maxima doesn't have a way to say f(t), gimme_a_number; Notice that there are several numerical integration routines and that (as far as I know) clever numerical analyst types haven't found a way to automatically determine which one is most appropriate, so it's not clear how one would implement the "gimme_a_number" flag. Also, numerical routines also return a guess at their error, which you're throwing away in your code above. How should that be treated by the "gimme_a_number" flag? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From jan.mueller at math.uni-dortmund.de Tue Feb 7 09:23:07 2012 From: jan.mueller at math.uni-dortmund.de (=?ISO-8859-1?Q?Jan_Hendrik_M=FCller?=) Date: Tue, 07 Feb 2012 16:23:07 +0100 Subject: [Maxima] plot of plsquares polynom In-Reply-To: References: <4F2977A8.9020806@math.uni-dortmund.de> Message-ID: <4F3141DB.7070403@math.uni-dortmund.de> To whom may be interested, this works fine: load(numericalio)$ M:read_matrix("...root.../Transportkosten3.txt")$ load("plsquares")$ gl:plsquares(M,[x,y,z],z,2)$ fpprintprec:4$ float(gl); load("draw")$ draw3d( title = "kleinste Quadrate Fl?che", xlabel = "Entfernung", ylabel = "Gewicht", zlabel = "Transportkosten", point_size=2, color=black, points(M), grid=true, explicit(rhs(gl), x,0,350, y,0,100)); Thanks to Robert and Mario (por los informationes sobre draw3d) Jan Robert Dodier schrieb: > Looks like the return value of plsquares is an equation z = .... > Try something like > > foo : plsquares (...); > plot3d (rhs (foo), [x, ...], [y, ...]); > > HTH > > Robert Dodier > > > On 2/1/12, Jan Hendrik M?ller wrote: >> Hi all, >> two questions: >> - how can z be plotted? plsquares works fine but the plot doesn't work >> load("plsquares")$ >> >> plsquares(matrix([1,2,0],[3,5,4],[4,7,9],[5,8,10],[1,3,4],[2,5,7],[1,6,9],[3,1,4],[1,1,1],[4,3,6],[6,7,8]),[x,y,z],z,3,3)$ >> plot3d(z, [x,0,9], [y,0,9]); >> - the rows of the matrix (only as an example) have to be substituted by >> the lines of the .txt file attached. Any idea how to realise that is welcome >> Jan >> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Transportkosten3.txt URL: From vext01 at gmail.com Tue Feb 7 10:25:58 2012 From: vext01 at gmail.com (Edd Barrett) Date: Tue, 7 Feb 2012 16:25:58 +0000 Subject: [Maxima] Checking equivilence of equalities Message-ID: <20120207162558.GF22183@edd-i386.kent.ac.uk> Hi, First of all, I am new on this list -- thanks for your CAS system, I use it a lot for my studies. I have a couple of questions regarding maxima that I will ask in separate threads to avoid confusion. Is there a way of checking equivalence of two equalities in maxima. Eg: a = 1 and a - 1 = 0 are equivalent. Looking at the manual, equal() looks like a goo bet, however: `is(equal(a=1, a-1=0)` is false. It looks like equal() deals only with expressions and not equalities? I could make the equalities of the form `0 = ` and then perform `equal(rhs(e), rhs(e2))` ? Cheers -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From vext01 at gmail.com Tue Feb 7 10:38:05 2012 From: vext01 at gmail.com (Edd Barrett) Date: Tue, 7 Feb 2012 16:38:05 +0000 Subject: [Maxima] "guarded" fetch from hashed array Message-ID: <20120207163805.GG22183@edd-i386.kent.ac.uk> Hi again, I wish to use a hash table to store a mapping from a variable name to a list of coefficients. This is accomplished easily enough in maxima, however, is there a way of throwing an error if the key accessed is not a key in the hash table? Why? Because if the key does not exist, the expression is interpreted as a symbolic expression, eg: hash[a] : "aaa"$ So, `hash[a]` would return "aaa", but `hash[b]` is a non-existing key and thus the expression evaluates symbolically to "hash_{b}" (subscript b). The question arises, "Did the hash[b] map to hash_{b} or was the key non-existent"? My current solution is silly: pget(x, hash) := ( info : arrayinfo(hash), /* strip non-keys */ for i:1 thru 2 do ( info : delete(first(info), info, 1) ), if member(x, info) then hash[x] else ( error("ERROR: Unknown variable", x), false ) )$ This makes my hash table lookup linear :\ What is the correct way? -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From villate at fe.up.pt Tue Feb 7 11:52:49 2012 From: villate at fe.up.pt (Jaime Villate) Date: Tue, 07 Feb 2012 17:52:49 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120207163805.GG22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> Message-ID: <4F3164F1.5010808@fe.up.pt> On 02/07/2012 04:38 PM, Edd Barrett wrote: > I wish to use a hash table to store a mapping from a variable name to a > list of coefficients. This is accomplished easily enough in maxima, > however, is there a way of throwing an error if the key accessed is not > a key in the hash table? Have you tried with atom? (%i2) hash[a]: "aaa"$ (%i3) atom(hash[a]); (%o3) true (%i4) atom(hash[b]); (%o4) false Regards, Jaime From vext01 at gmail.com Tue Feb 7 12:29:32 2012 From: vext01 at gmail.com (Edd Barrett) Date: Tue, 7 Feb 2012 18:29:32 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <4F3164F1.5010808@fe.up.pt> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F3164F1.5010808@fe.up.pt> Message-ID: <20120207182932.GK22183@edd-i386.kent.ac.uk> On Tue, Feb 07, 2012 at 05:52:49PM +0000, Jaime Villate wrote: > On 02/07/2012 04:38 PM, Edd Barrett wrote: > >I wish to use a hash table to store a mapping from a variable name to a > >list of coefficients. This is accomplished easily enough in maxima, > >however, is there a way of throwing an error if the key accessed is not > >a key in the hash table? > Have you tried with atom? > > (%i2) hash[a]: "aaa"$ > (%i3) atom(hash[a]); > (%o3) true > (%i4) atom(hash[b]); > (%o4) false Great. Actually, my hash contains lists, so I can use listp() similarly. I bet there is a better way still... -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From woollett at charter.net Tue Feb 7 12:55:11 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 07 Feb 2012 18:55:11 -0000 Subject: [Maxima] numeric approximation Message-ID: <9A6E6641BF664E3EA8831C1ECBB61945@edwinc367e16bd> On Feb. 7, 2012, Rupert Swarbrick wrote: ----------------------------- >Notice that there are several numerical integration routines and that >(as far as I know) clever numerical analyst types haven't found a way to >automatically determine which one is most appropriate, so it's not clear >how one would implement the "gimme_a_number" flag. Also, numerical >routines also return a guess at their error, which you're throwing away >in your code above. How should that be treated by the "gimme_a_number" >flag? ----------------------------------- A "wrapper" for the quadpack routines is something I have been diligently working on, as part of a software package for an updated version of Ch. 8, Numerical Integration, (Maxima by Example). The one-dimensional quadrature code is basically done, and I am now trying to integrate two dimensional code into the package. This code first tries integrate to get an exact symbolic answer (if possible). Due to some bugs in the special functions area, there are automatic filters to bypass integrate and go directly to quadpack (this also includes multiple valued functions case). The code then chooses between the quadpack routines using a variety of methods and option flags. If quadpack returns a serious error code, the function nint will return 'false' together with a plain English error message. The one and two dimensional versions of nint are tested with all the demonstration numerical integrals posted by Mathematica, together with a variety of integrals that need to be checked because of various Maxima peculiarities. The particular example Olive has submitted can then be handled as follows: ----------------------------------------------------- Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) load(nint); (%o1) "c:/work2/nint.mac" (%i2) g : 1/(sin(x)^2 + log(x))$ (%i3) f(t) := nint(g,x,1,t)$ (%i4) f(5); (%o4) 2.729767710374242 (%i5) goutL; (%o5) [[qag,2.729767710374242,3.3769724748722686E-12,93,0]] -------------------------------------- Ted Woollett http://www.csulb.edu/~woollett/ From willisb at unk.edu Tue Feb 7 13:35:10 2012 From: willisb at unk.edu (Barton Willis) Date: Tue, 7 Feb 2012 13:35:10 -0600 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120207182932.GK22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F3164F1.5010808@fe.up.pt> <20120207182932.GK22183@edd-i386.kent.ac.uk> Message-ID: Also, The assoc function (enter ? assoc) might be useful. --Barton maxima-bounces at math.utexas.edu wrote on 02/07/2012 12:29:32 PM: > From: Edd Barrett > To: Jaime Villate > Cc: maxima at math.utexas.edu > Date: 02/07/2012 12:25 PM > Subject: Re: [Maxima] "guarded" fetch from hashed array > Sent by: maxima-bounces at math.utexas.edu > > On Tue, Feb 07, 2012 at 05:52:49PM +0000, Jaime Villate wrote: > > On 02/07/2012 04:38 PM, Edd Barrett wrote: > > >I wish to use a hash table to store a mapping from a variable name to a > > >list of coefficients. This is accomplished easily enough in maxima, > > >however, is there a way of throwing an error if the key accessed is not > > >a key in the hash table? > > Have you tried with atom? > > > > (%i2) hash[a]: "aaa"$ > > (%i3) atom(hash[a]); > > (%o3) true > > (%i4) atom(hash[b]); > > (%o4) false > > Great. > > Actually, my hash contains lists, so I can use listp() similarly. > > I bet there is a better way still... > > -- > Best Regards > Edd Barrett > > http://www.theunixzoo.co.uk > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Tue Feb 7 13:50:00 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 07 Feb 2012 19:50:00 -0000 Subject: [Maxima] numeric approximation Message-ID: <735ED2F1E5624EB9BF9AC7F66AA49A1C@edwinc367e16bd> On Feb. 7, 2012, I wrote: ------------------------------------ (%i1) load(nint); (%o1) "c:/work2/nint.mac" (%i2) g : 1/(sin(x)^2 + log(x))$ (%i3) f(t) := nint(g,x,1,t)$ (%i4) f(5); (%o4) 2.729767710374242 (%i5) goutL; (%o5) [[qag,2.729767710374242,3.3769724748722686E-12,93,0]] -------------------------------- then one can make a table, for example: (%i6) ntable (func, x0, dx, xf):= block([nL, fL, nfL, jj, ii], nL : makelist (zz, zz, x0, xf, dx), fL : map ('func, nL), nfL : makelist ( [" ", nL[jj], " ", fL[jj] ], jj, length(nL)), for ii thru length (nfL) do apply ('print, nfL[ii]))$ (%i7) ntable ( 'f, 2, 2, 10)$ 2 0.80395247146645 4 2.307860373006648 6 3.188145387618254 8 4.049252091167718 10 4.843537149824256 (%i8) time(%); (%o8) [1.64] ---------------------------- Ted Woollett From macrakis at alum.mit.edu Tue Feb 7 15:00:23 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Tue, 7 Feb 2012 16:00:23 -0500 Subject: [Maxima] Checking equivilence of equalities In-Reply-To: <20120207162558.GF22183@edd-i386.kent.ac.uk> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> Message-ID: You could certainly do something like is ( equal( lhs(eq1)-rhs(eq1) , lhs(eq2)-rhs(eq2) ) ) as you suggest, but that does NOT test that the truth-values of the equations are the same. After all, 2*x=0 and x=0 are equivalent equations, but 2*x is not equal to x. Logically, what you want is something like is ( equal( zerop(lhs(eq1)-rhs(eq1)) , zerop( lhs(eq2)-rhs(eq2) ) ) ) but Maxima doesn't support any such zerop function. You could define zerop(q) := signum(q)^2 , which is perfectly correct, but the system won't be able to do anything useful with that. -s -------------- next part -------------- An HTML attachment was scrubbed... URL: From fateman at eecs.berkeley.edu Tue Feb 7 15:34:58 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Tue, 07 Feb 2012 13:34:58 -0800 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120207163805.GG22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> Message-ID: <4F319902.3040202@eecs.berkeley.edu> Here is how you make all non-entries produce an error. hash[x]:= error("ERROR ", x); /* try it out */ hash[a]:aaa; hash[a]; hash[b]; From woollett at charter.net Tue Feb 7 15:51:20 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 07 Feb 2012 21:51:20 -0000 Subject: [Maxima] display patch, was: get name of variable as string in function? Message-ID: <991931A0F3EA4FD8AED3827D2FD0112F@edwinc367e16bd> On Feb. 6, 2012, Robert Dodier wrote: ------------------------ ....No need to invent a work-around, it's easier to fix the bug. Here is a patch..... ----------------------------- Thanks for the patch. Ted From vext01 at gmail.com Tue Feb 7 17:26:23 2012 From: vext01 at gmail.com (Edd Barrett) Date: Tue, 7 Feb 2012 23:26:23 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <4F319902.3040202@eecs.berkeley.edu> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> Message-ID: <20120207232623.GL22183@edd-i386.kent.ac.uk> On Tue, Feb 07, 2012 at 01:34:58PM -0800, Richard Fateman wrote: > Here is how you make all non-entries produce an error. > hash[x]:= error("ERROR ", x); Perfect! Many thanks -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From woollett at charter.net Tue Feb 7 17:27:28 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 07 Feb 2012 23:27:28 -0000 Subject: [Maxima] numeric approximation Message-ID: On Feb. 7, 2012, I wrote ----------------------------------------- >(%i1) load(nint); >(%o1) "c:/work2/nint.mac" >(%i2) g : 1/(sin(x)^2 + log(x))$ >(%i3) f(t) := nint(g,x,1,t)$ >(%i4) f(5); >(%o4) 2.729767710374242 >(%i5) goutL; >(%o5) [[qag,2.729767710374242,3.3769724748722686E-12,93,0]] >-------------------------------- >then one can make a table, for example: >(%i6) ntable (func, x0, dx, xf):= >block([nL, fL, nfL, jj, ii], > nL : makelist (zz, zz, x0, xf, dx), > fL : map ('func, nL), > nfL : makelist ( [" ", nL[jj], " ", fL[jj] ], jj, length(nL)), > for ii thru length (nfL) do apply ('print, nfL[ii]))$ >(%i7) ntable ( 'f, 2, 2, 10)$ > 2 0.80395247146645 > 4 2.307860373006648 > 6 3.188145387618254 > 8 4.049252091167718 > 10 4.843537149824256 >(%i8) time(%); >(%o8) [1.64] -------------------------------------- Of course it is much easier (but slightly slower) to use print with a do loop: ------------------------------------------ (%i20) for j:2 step 2 thru 10 do print(" ",j," ",f(j))$ 2 0.80395247146645 4 2.307860373006648 6 3.188145387618254 8 4.049252091167718 10 4.843537149824256 (%i21) time(%); (%o21) [2.11] --------------------------------- and much easier to define a table function in terms of the do loop: ---------------------------------------- (%i22) ftable(func,x0,xf,dx) := block([jj], for jj:x0 step dx thru xf do print(" ",jj," ",func(jj)))$ (%i23) ftable(f,2,10,2)$ 2 0.80395247146645 4 2.307860373006648 6 3.188145387618254 8 4.049252091167718 10 4.843537149824256 (%i24) time(%); (%o24) [2.71] -------------------------- Ted Woollett From vext01 at gmail.com Wed Feb 8 04:36:32 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 8 Feb 2012 10:36:32 +0000 Subject: [Maxima] Checking equivilence of equalities In-Reply-To: References: <20120207162558.GF22183@edd-i386.kent.ac.uk> Message-ID: <20120208103632.GP22183@edd-i386.kent.ac.uk> On Tue, Feb 07, 2012 at 04:00:23PM -0500, Stavros Macrakis wrote: > You could certainly do something like > > is ( equal( lhs(eq1)-rhs(eq1) , lhs(eq2)-rhs(eq2) ) ) > > as you suggest, but that does NOT test that the truth-values of the > equations are the same. > > After all, 2*x=0 and x=0 are equivalent equations, but 2*x is not equal to > x. Logically, what you want is something like > > is ( equal( zerop(lhs(eq1)-rhs(eq1)) , zerop( > lhs(eq2)-rhs(eq2) ) ) ) > > but Maxima doesn't support any such zerop function. > > You could define zerop(q) := signum(q)^2 , which is perfectly correct, but > the system won't be able to do anything useful with that. > > -s I am quite suprised that this functionality does not exist. I would have thought that equality equivilence would be a commonly used feature in a CAS system. I will raise a feature request and see what the developers say. Cheers -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From macrakis at alum.mit.edu Wed Feb 8 05:01:31 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 8 Feb 2012 06:01:31 -0500 Subject: [Maxima] Checking equivilence of equalities In-Reply-To: <20120208103632.GP22183@edd-i386.kent.ac.uk> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> Message-ID: Could you give some examples of non-trivial situations where this functionality is useful? That might help in thinking about approaches. Your current example is easily handled with 'solve' but of course that won't work when Maxima can't solve the equations. -s On Feb 8, 2012 5:32 AM, "Edd Barrett" wrote: > On Tue, Feb 07, 2012 at 04:00:23PM -0500, Stavros Macrakis wrote: > > You could certainly do something like > > > > is ( equal( lhs(eq1)-rhs(eq1) , lhs(eq2)-rhs(eq2) ) ) > > > > as you suggest, but that does NOT test that the truth-values of the > > equations are the same. > > > > After all, 2*x=0 and x=0 are equivalent equations, but 2*x is not equal > to > > x. Logically, what you want is something like > > > > is ( equal( zerop(lhs(eq1)-rhs(eq1)) , zerop( > > lhs(eq2)-rhs(eq2) ) ) ) > > > > but Maxima doesn't support any such zerop function. > > > > You could define zerop(q) := signum(q)^2 , which is perfectly correct, > but > > the system won't be able to do anything useful with that. > > > > -s > > I am quite suprised that this functionality does not exist. I would have > thought that equality equivilence would be a commonly used feature in a > CAS system. > > I will raise a feature request and see what the developers say. > > Cheers > > -- > Best Regards > Edd Barrett > > http://www.theunixzoo.co.uk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vext01 at gmail.com Wed Feb 8 05:06:42 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 8 Feb 2012 11:06:42 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <4F319902.3040202@eecs.berkeley.edu> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> Message-ID: <20120208110642.GQ22183@edd-i386.kent.ac.uk> On Tue, Feb 07, 2012 at 01:34:58PM -0800, Richard Fateman wrote: > Here is how you make all non-entries produce an error. > hash[x]:= error("ERROR ", x); > > /* try it out */ > > hash[a]:aaa; > > > > hash[a]; > > hash[b]; Whilst this works in the simple case, it did not work in the context I wish to use it -- contrived example follows: ---8<--- (%i0) kill(all)$ (%i1) new_hash() := ( hash : make_array(hashed), hash[x] := error("Error: ", x), /* populate */ hash[a] : 1, hash[b] : 2, hash[c] : 3, hash )$ (%i2) h : new_hash(); (%o2) HashTable (%i3) h[a]; (%o3) false ---8<--- It seems like the 'hash[x] := error(...)' declaration is syntactic, in that it will only match for hashes called 'hash'; the behavior is not associated with the hash itself. However, I would not have expected 'h[a]' to return false. That is a mystery. If you remove the 'hash[x] := error(...)' from new_hash(), 'h[a]' returns 1 as expected. A bug? -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From vext01 at gmail.com Wed Feb 8 05:10:17 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 8 Feb 2012 11:10:17 +0000 Subject: [Maxima] Checking equivilence of equalities In-Reply-To: References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> Message-ID: <20120208111017.GR22183@edd-i386.kent.ac.uk> On Wed, Feb 08, 2012 at 06:01:31AM -0500, Stavros Macrakis wrote: > Could you give some examples of non-trivial situations where this > functionality is useful? That might help in thinking about approaches. > Your current example is easily handled with 'solve' but of course that > won't work when Maxima can't solve the equations. I am writing regression tests for a maxima program that I have written. I will first decide test case inputs and then by hand determine the output I expect. When the tests are run, the actual result (as determined by my program( needs to be compared for equivilence to the expected result. Given that there are many ways to express the same equality, I either need to convert the equality into a canonical form and test for syntactic equality, or have maxima do this for me. I hope that explains this OK. -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From rswarbrick at gmail.com Wed Feb 8 05:27:38 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 08 Feb 2012 11:27:38 +0000 Subject: [Maxima] Checking equivilence of equalities References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> Message-ID: Edd Barrett writes: > On Tue, Feb 07, 2012 at 04:00:23PM -0500, Stavros Macrakis wrote: >> You could certainly do something like >> >> is ( equal( lhs(eq1)-rhs(eq1) , lhs(eq2)-rhs(eq2) ) ) >> >> as you suggest, but that does NOT test that the truth-values of the >> equations are the same. >> >> After all, 2*x=0 and x=0 are equivalent equations, but 2*x is not equal to >> x. Logically, what you want is something like >> >> is ( equal( zerop(lhs(eq1)-rhs(eq1)) , zerop( >> lhs(eq2)-rhs(eq2) ) ) ) >> >> but Maxima doesn't support any such zerop function. >> >> You could define zerop(q) := signum(q)^2 , which is perfectly correct, but >> the system won't be able to do anything useful with that. >> >> -s > > I am quite suprised that this functionality does not exist. I would have > thought that equality equivilence would be a commonly used feature in a > CAS system. > > I will raise a feature request and see what the developers say. Stavros is one of the core developers of Maxima. Also, look at the zeroequiv function, and maybe at past discussions of the topic. You might find this thread [1] interesting (it basically consists of people correctly telling me that I'm being very naive...). Less promising is [2]. Rupert [1] http://thread.gmane.org/gmane.comp.mathematics.maxima.general/25976/focus=25978 [2] http://article.gmane.org/gmane.comp.mathematics.maxima.general/10928 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From jan.mueller at math.uni-dortmund.de Wed Feb 8 06:07:13 2012 From: jan.mueller at math.uni-dortmund.de (Jan Mueller) Date: Wed, 8 Feb 2012 13:07:13 +0100 Subject: [Maxima] Checking equivilence of equalities In-Reply-To: References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> Message-ID: Hope the following is a non-trivial example: from my point of view wxMaxima is becoming more and more popular in German secondary schools. Is(equal()) is a very helpful command to further Independent learning in Algebra, because pupils could check on their own if some algebraic transformations they made on their own are equivalent or not. From this point of view it would be nescessary that isequal-commands could check polynomial-equations and terms (e.g. with a maximum power of 3?), elementary exponential- and trigonometric equations and terms. But its up to you to decide if didactical aspects should play a role in the decision which commands should be developed or not Am 08.02.2012 um 12:01 schrieb Stavros Macrakis : > Could you give some examples of non-trivial situations where this functionality is useful? That might help in thinking about approaches. Your current example is easily handled with 'solve' but of course that won't work when Maxima can't solve the equations. > > -s > On Feb 8, 2012 5:32 AM, "Edd Barrett" wrote: > On Tue, Feb 07, 2012 at 04:00:23PM -0500, Stavros Macrakis wrote: > > You could certainly do something like > > > > is ( equal( lhs(eq1)-rhs(eq1) , lhs(eq2)-rhs(eq2) ) ) > > > > as you suggest, but that does NOT test that the truth-values of the > > equations are the same. > > > > After all, 2*x=0 and x=0 are equivalent equations, but 2*x is not equal to > > x. Logically, what you want is something like > > > > is ( equal( zerop(lhs(eq1)-rhs(eq1)) , zerop( > > lhs(eq2)-rhs(eq2) ) ) ) > > > > but Maxima doesn't support any such zerop function. > > > > You could define zerop(q) := signum(q)^2 , which is perfectly correct, but > > the system won't be able to do anything useful with that. > > > > -s > > I am quite suprised that this functionality does not exist. I would have > thought that equality equivilence would be a commonly used feature in a > CAS system. > > I will raise a feature request and see what the developers say. > > Cheers > > -- > Best Regards > Edd Barrett > > http://www.theunixzoo.co.uk > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From rswarbrick at gmail.com Wed Feb 8 06:19:51 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Wed, 08 Feb 2012 12:19:51 +0000 Subject: [Maxima] Checking equivilence of equalities References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> Message-ID: Jan Mueller writes: > Hope the following is a non-trivial example: from my point of view > wxMaxima is becoming more and more popular in German secondary > schools. Is(equal()) is a very helpful command to further Independent > learning in Algebra, because pupils could check on their own if some > algebraic transformations they made on their own are equivalent or > not. From this point of view it would be nescessary that > isequal-commands could check polynomial-equations and terms (e.g. with > a maximum power of 3?), elementary exponential- and trigonometric > equations and terms. But its up to you to decide if didactical aspects > should play a role in the decision which commands should be developed > or not Could one could write an "easy_equal_p" function or the like? This could go in share or even in src maybe, but it makes sense to distinguish it From something trying to do something more general... Maybe there is a list of functions that would be useful in a general teaching/learning package. I suspect they'd be reasonably easy to write. Do you have any other suggestions for some that should appear? Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From villate at fe.up.pt Wed Feb 8 09:35:12 2012 From: villate at fe.up.pt (Jaime Villate) Date: Wed, 08 Feb 2012 15:35:12 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120208110642.GQ22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> Message-ID: <4F329630.4040607@fe.up.pt> On 02/08/2012 11:06 AM, Edd Barrett wrote: > It seems like the 'hash[x] := error(...)' declaration is syntactic, in > that it will only match for hashes called 'hash'; the behavior is not > associated with the hash itself. That statement defines a function named hash, with one input variable x. You are also defining an array with the same function as the function and when use ask for hash[something] in some cases Maxima will give you the value of the function and in other cases the value of the array. That is a hack which should be handled with care. Also, notice that hash[x] := defines a "memoizing function", which will store its value in memory and then return it. For instance: (%i4) hash[b]; ERROR b #0: lambda([x],error("ERROR ",x))(x=b) The value lambda([x],error("ERROR ",x))(x=b) was stored in memory and then its result shown. In other words, every time you try hash[key] with an undefined key, you are using up more memory. Regards, Jaime From fateman at eecs.berkeley.edu Wed Feb 8 09:42:20 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 08 Feb 2012 07:42:20 -0800 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120208110642.GQ22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> Message-ID: <4F3297DC.10007@eecs.berkeley.edu> On 2/8/2012 3:06 AM, Edd Barrett wrote: I think you have to decide if you want a function with an associated default value other than those explicit values stored in a hash table, hash[x]:= .... or just a hash table defined via make_array(hashtable). The latter, defined in Maxima sometime after version 5.23.2 appears to me to be much less useful, and in particular does not have the functionality of defining default values. You are defining one of each. Omit the make_array and your contrived function works just fine. however, hash[a] and h[a] are the same. This can be fixed, perhaps by passing the name e.g. new_hash(h), but may require some diddling around to make sure the argument is properly evaluated. RJF > From villate at fe.up.pt Wed Feb 8 09:50:01 2012 From: villate at fe.up.pt (Jaime Villate) Date: Wed, 08 Feb 2012 15:50:01 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <4F329630.4040607@fe.up.pt> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> <4F329630.4040607@fe.up.pt> Message-ID: <4F3299A9.3010809@fe.up.pt> On 02/08/2012 03:35 PM, Jaime Villate wrote: > On 02/08/2012 11:06 AM, Edd Barrett wrote: >> It seems like the 'hash[x] := error(...)' declaration is syntactic, in >> that it will only match for hashes called 'hash'; the behavior is not >> associated with the hash itself. > That statement defines a function named hash, with one input variable x. Please allow me to answer again, this time trying to be more clear: hash[x] := error(...) does not evaluate its arguments; "hash" and "x" will not be replaced with whatever values they might have within a loop or function body. Jaime From fateman at eecs.berkeley.edu Wed Feb 8 09:50:32 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 08 Feb 2012 07:50:32 -0800 Subject: [Maxima] Checking equivilence of equalities In-Reply-To: <20120208111017.GR22183@edd-i386.kent.ac.uk> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> Message-ID: <4F3299C8.1040906@eecs.berkeley.edu> On 2/8/2012 3:10 AM, Edd Barrett wrote: > On Wed, Feb 08, 2012 at 06:01:31AM -0500, Stavros Macrakis wrote: >> Could you give some examples of non-trivial situations where this >> functionality is useful? That might help in thinking about approaches. >> Your current example is easily handled with 'solve' but of course that >> won't work when Maxima can't solve the equations. > I am writing regression tests for a maxima program that I have written. > I will first decide test case inputs and then by hand determine the > output I expect. > > When the tests are run, the actual result (as determined by my program( > needs to be compared for equivilence to the expected result. > > Given that there are many ways to express the same equality, I either > need to convert the equality into a canonical form and test for > syntactic equality, or have maxima do this for me. > > I hope that explains this OK. > Not really. If you compare EXPRESSIONS, this makes sense. If you compare EQUALITIES, then all you need to test for is 3 values. true, false, and unknown. 2=2 is true 2=3 is false f(x)=g(y) is presumably unknown. In the world of equalities, 4=4 is also true, so equal_test(2=2,4=4) is true. Is that what you want? The reason that some stuff, e.g. "comparing equalities" is not in Maxima or in any other computer algebra system, is that you probably don't need it. Comparing expressions, e.g. sin(x+2*%pi) and sin(x) DOES make sense. From fateman at eecs.berkeley.edu Wed Feb 8 10:09:43 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 08 Feb 2012 08:09:43 -0800 Subject: [Maxima] Equivalences. Re: Checking equivilence of equalities In-Reply-To: <4F3299C8.1040906@eecs.berkeley.edu> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> <4F3299C8.1040906@eecs.berkeley.edu> Message-ID: <4F329E47.4000906@eecs.berkeley.edu> On 2/8/2012 7:50 AM, Richard Fateman wrote: > On 2/8/2012 3:10 AM, Edd Barrett wrote: >> On Wed, Feb 08, 2012 at 06:01:31AM -0500, Stavros Macrakis wrote: .... I think that what you want is this: for x being a single variable or a vector of variables... e1: A(x)=B(x) and e2: C(x)=D(x) are "equivalent" if for all values of x , A(x)=B(x) implies C(x)=D(x) AND C(x)=B(x) implies A(x)=B(x). As Stavros pointed out, if you solve(e1,x) and solve(e2,x) and the solutions are the same, then you are done, and Maxima has done the job. If you want another way of saying this, you could ask zeroequivalence of (C-D) subject to the relation A-B=0 and zeroequivalence of (A-B) subject to the relation C-D=0. A potentially useful goal that may have more general traction is finding an algorithm where you could reduce both e1 and e2 to a simpler form and then, even though you could not solve that, you could show they are the same. for example, e1: f(x)+4= g(x)+6 e2: f(x)-2 =g(x) could both be reduced to (say) f(x)=g(x)+2 For some classes of functions f and g this makes sense, e.g. finding minimal polynomials. RJF From villate at fe.up.pt Wed Feb 8 10:31:03 2012 From: villate at fe.up.pt (Jaime Villate) Date: Wed, 08 Feb 2012 16:31:03 +0000 Subject: [Maxima] Equivalences. Re: Checking equivilence of equalities In-Reply-To: <4F329E47.4000906@eecs.berkeley.edu> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> <4F3299C8.1040906@eecs.berkeley.edu> <4F329E47.4000906@eecs.berkeley.edu> Message-ID: <4F32A347.8020202@fe.up.pt> On 02/08/2012 04:09 PM, Richard Fateman wrote: > e1: A(x)=B(x) and e2: C(x)=D(x) are "equivalent" if > > for all values of x , A(x)=B(x) implies C(x)=D(x) AND > C(x)=B(x) implies A(x)=B(x). > > As Stavros pointed out, if you solve(e1,x) and solve(e2,x) and the > solutions are the same, > then you are done, and Maxima has done the job. > > If you want another way of saying this, you could ask > > zeroequivalence of (C-D) subject to the relation A-B=0 and > > zeroequivalence of (A-B) subject to the relation C-D=0. > > A potentially useful goal that may have more general traction is > finding an algorithm > where you could reduce both e1 and e2 to > a simpler form and then, even though you could not solve that, you > could show they > are the same. > > for example, > e1: f(x)+4= g(x)+6 > e2: f(x)-2 =g(x) > > could both be reduced to (say) > > f(x)=g(x)+2 In some sense in this second case you are also solving the equations and comparing them: (%i1) solve(f+4=g+6, f); (%o1) [f = g + 2] (%i2) solve(f-2=g, f); (%o2) [f = g + 2] And again, this second example worked because we were able to find the solution. Cheers, Jaime From korte at lite.msu.edu Wed Feb 8 10:37:10 2012 From: korte at lite.msu.edu (Gerd Kortemeyer) Date: Wed, 8 Feb 2012 11:37:10 -0500 Subject: [Maxima] Equivalences. Re: Checking equivilence of equalities In-Reply-To: <4F32A347.8020202@fe.up.pt> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> <4F3299C8.1040906@eecs.berkeley.edu> <4F329E47.4000906@eecs.berkeley.edu> <4F32A347.8020202@fe.up.pt> Message-ID: Hi, On Feb 8, 2012, at 11:31 AM, Jaime Villate wrote: > > In some sense in this second case you are also solving the equations and comparing them: > > (%i1) solve(f+4=g+6, f); > (%o1) [f = g + 2] > (%i2) solve(f-2=g, f); > (%o2) [f = g + 2] > > And again, this second example worked because we were able to find the solution. I agree. That's what I ended up doing for the LON-CAPA integration: http://www.math.utexas.edu/pipermail/maxima/2012/027556.html Works well, - Gerd. From vext01 at gmail.com Wed Feb 8 10:58:24 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 8 Feb 2012 16:58:24 +0000 Subject: [Maxima] Equivalences. Re: Checking equivilence of equalities In-Reply-To: References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> <4F3299C8.1040906@eecs.berkeley.edu> <4F329E47.4000906@eecs.berkeley.edu> <4F32A347.8020202@fe.up.pt> Message-ID: <20120208165824.GT22183@edd-i386.kent.ac.uk> On Wed, Feb 08, 2012 at 11:37:10AM -0500, Gerd Kortemeyer wrote: > Hi, > > On Feb 8, 2012, at 11:31 AM, Jaime Villate wrote: > > > > > In some sense in this second case you are also solving the equations and comparing them: > > > > (%i1) solve(f+4=g+6, f); > > (%o1) [f = g + 2] > > (%i2) solve(f-2=g, f); > > (%o2) [f = g + 2] > > > > And again, this second example worked because we were able to find the solution. > > I agree. That's what I ended up doing for the LON-CAPA integration: > > http://www.math.utexas.edu/pipermail/maxima/2012/027556.html > > Works well, Thanks for all of your replies. I think I can figure something out using solve() -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From villate at fe.up.pt Wed Feb 8 11:02:09 2012 From: villate at fe.up.pt (Jaime Villate) Date: Wed, 08 Feb 2012 17:02:09 +0000 Subject: [Maxima] Equivalences. Re: Checking equivilence of equalities In-Reply-To: References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> <4F3299C8.1040906@eecs.berkeley.edu> <4F329E47.4000906@eecs.berkeley.edu> <4F32A347.8020202@fe.up.pt> Message-ID: <4F32AA91.9090301@fe.up.pt> On 02/08/2012 04:37 PM, Gerd Kortemeyer wrote: > Hi, > > On Feb 8, 2012, at 11:31 AM, Jaime Villate wrote: > >> In some sense in this second case you are also solving the equations and comparing them: >> >> (%i1) solve(f+4=g+6, f); >> (%o1) [f = g + 2] >> (%i2) solve(f-2=g, f); >> (%o2) [f = g + 2] >> >> And again, this second example worked because we were able to find the solution. > I agree. That's what I ended up doing for the LON-CAPA integration: > > http://www.math.utexas.edu/pipermail/maxima/2012/027556.html > > Works well, > In e-learning systems, you can check that the equations you are expecting as an answer to your questions can be solved with solve() and then you can confidently use an implementation like the following (unless you have genius students who can come up with equivalent algebraic equations that solve cannot handle). (%i2) equivp(e,f):= is(equal(solve(e,first(listofvars(e))),solve(f,first(listofvars(f)))))$ (%i3) e1: x^2-3*x+2=0$ (%i4) e2: 6*x-2*x^2-4=0$ (%i5) equivp(e1,e2); (%o5) true (%i6) e3: x+y=1$ (%i7) e4: x=1-y$ (%i8) equivp(e3,e4); (%o8) true (%i9) e5: x^2=1+y^2-2*y$ (%i10) e6: 4*y+2*x^2=2*y^2+2$ (%i11) equivp(e5,e6); (%o11) true But keep in mind that x=2 is not equivalent to x^2=4. Regards, Jaime From vext01 at gmail.com Wed Feb 8 11:10:56 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 8 Feb 2012 17:10:56 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <4F3297DC.10007@eecs.berkeley.edu> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> <4F3297DC.10007@eecs.berkeley.edu> Message-ID: <20120208171056.GV22183@edd-i386.kent.ac.uk> On Wed, Feb 08, 2012 at 07:42:20AM -0800, Richard Fateman wrote: > however, hash[a] and h[a] are the same. I have also just realised that all variables are global in maxima unless explicitely marked local by block([], ...). This completely caught me off guard. -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From macrakis at alum.mit.edu Wed Feb 8 11:20:15 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 8 Feb 2012 12:20:15 -0500 Subject: [Maxima] Equivalences. Re: Checking equivilence of equalities In-Reply-To: <4F32AA91.9090301@fe.up.pt> References: <20120207162558.GF22183@edd-i386.kent.ac.uk> <20120208103632.GP22183@edd-i386.kent.ac.uk> <20120208111017.GR22183@edd-i386.kent.ac.uk> <4F3299C8.1040906@eecs.berkeley.edu> <4F329E47.4000906@eecs.berkeley.edu> <4F32A347.8020202@fe.up.pt> <4F32AA91.9090301@fe.up.pt> Message-ID: Careful! The given solution has some problematic cases: listofvars(a+b=1) => [a, b] listofvars(b=1-a) => [b, a] So first(listofvars(...)) is not going to work. You could look at solutions in *all* variables, and sort the variables: sort(listofvars(...))); or the solutions: sort(solve(...)). More robustly, you might want to perform the symmdifference of the solution sets. If there is a family of solutions, they are parameterized: solve(a+b=1,[a,b]) => [[a = 1 - %r3, b = %r3]] solve(a+b=1,[a,b]) => [[a = 1 - %r4, b = %r4]] <<< new free variable names You may need to play with %rnum_list to handle this. Another big problem is that solve doesn't solve a lot of cases, e.g. solve(sin(x)^2+cos(x)^2=0,x) should give the empty set, but in fact just returns the equations. Are you interested in real solutions only? Solve generally gives all solutions, including complex. Solve uses arc-trig functions. etc. On Wed, Feb 8, 2012 at 12:02, Jaime Villate wrote: > On 02/08/2012 04:37 PM, Gerd Kortemeyer wrote: > >> Hi, >> >> On Feb 8, 2012, at 11:31 AM, Jaime Villate wrote: >> >> In some sense in this second case you are also solving the equations and >>> comparing them: >>> >>> (%i1) solve(f+4=g+6, f); >>> (%o1) [f = g + 2] >>> (%i2) solve(f-2=g, f); >>> (%o2) [f = g + 2] >>> >>> And again, this second example worked because we were able to find the >>> solution. >>> >> I agree. That's what I ended up doing for the LON-CAPA integration: >> >> http://www.math.utexas.edu/**pipermail/maxima/2012/027556.**html >> >> Works well, >> >> In e-learning systems, you can check that the equations you are > expecting as an answer to > your questions can be solved with solve() and then you can confidently use > an implementation > like the following (unless you have genius students who can come up with > equivalent algebraic > equations that solve cannot handle). > > (%i2) equivp(e,f):= is(equal(solve(e,first(** > listofvars(e))),solve(f,first(**listofvars(f)))))$ > > (%i3) e1: x^2-3*x+2=0$ > (%i4) e2: 6*x-2*x^2-4=0$ > (%i5) equivp(e1,e2); > (%o5) true > > (%i6) e3: x+y=1$ > (%i7) e4: x=1-y$ > (%i8) equivp(e3,e4); > (%o8) true > > (%i9) e5: x^2=1+y^2-2*y$ > (%i10) e6: 4*y+2*x^2=2*y^2+2$ > (%i11) equivp(e5,e6); > (%o11) true > > But keep in mind that x=2 is not equivalent to x^2=4. > > Regards, > Jaime > > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Wed Feb 8 13:10:14 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 8 Feb 2012 14:10:14 -0500 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120208171056.GV22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> <4F3297DC.10007@eecs.berkeley.edu> <20120208171056.GV22183@edd-i386.kent.ac.uk> Message-ID: Dear Edd Barrett, I'm afraid you've come across one of the ugliest parts of Maxima. There are actually *two distinct kinds* of associative array in Maxima: "hashed" associative arrays (which you get without declarations), and "hash_table" associative arrays (which you get with make_array('hashed)). Bizarrely and inexcusably, the semantics of these two kinds of arrays are completely inconsistent. The "hash_table" style is problematic in various ways and I would recommend it be rethought and replaced. In the meantime, though, you can define the following: :lisp (defun $hash_table_defined (ar i) (multiple-value-bind (val ok) (marrayref-gensub ar i nil) ok)) Then hash_table_defined( <>, <> ) will return true or false. A simpler way to do this is just to make sure that FALSE is never a valid value. Since you are storing lists of variables, how can FALSE ever be valid? -s For example: *Hashed style* qq[3]: 5$ qq[3] => 5 OK qq[7] => qq[7] qq => qq << treated as an identifier, not as a first-class value kill(qq[3]) OK qq[3] => qq[3] restored to uninitialized state arrayinfo(qq) => [hashed,1,[3]] qq[5,5]: 999 => error -- must have consistent number of subscripts *Hash_table style* rr: make_array('hashed)$ rr[3]:5$ rr[3] => 5 OK rr[7] => false <<< inconsistent rr => {Lisp Array: #} << treated as a weird internal object kill(rr[3]) => error arrayinfo(rr) => [hash_table,1,3] << notice inconsistent conventions rr[5,5]: 999 => no error -- allows different numbers of subscripts arrayinfo(rr) => fatal error (implementation bug) -------------- next part -------------- An HTML attachment was scrubbed... URL: From vext01 at gmail.com Wed Feb 8 17:09:55 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 8 Feb 2012 23:09:55 +0000 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> <4F3297DC.10007@eecs.berkeley.edu> <20120208171056.GV22183@edd-i386.kent.ac.uk> Message-ID: <20120208230955.GW22183@edd-i386.kent.ac.uk> Thanks for geting back to me. On Wed, Feb 08, 2012 at 02:10:14PM -0500, Stavros Macrakis wrote: > The "hash_table" style is problematic in various ways and I would recommend > it be rethought and replaced. I would favor this. As a newcomer to maxima, I find these hashtables confusing. I guess I was looking for something like a Python dictionary... > In the meantime, though, you can define the following: > > :lisp (defun $hash_table_defined (ar i) (multiple-value-bind (val ok) > (marrayref-gensub ar i nil) ok)) I'll give it a go. Do you plan to implement something like this for real in maxima? -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From macrakis at alum.mit.edu Wed Feb 8 17:10:06 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 8 Feb 2012 18:10:06 -0500 Subject: [Maxima] "guarded" fetch from hashed array In-Reply-To: <20120208230955.GW22183@edd-i386.kent.ac.uk> References: <20120207163805.GG22183@edd-i386.kent.ac.uk> <4F319902.3040202@eecs.berkeley.edu> <20120208110642.GQ22183@edd-i386.kent.ac.uk> <4F3297DC.10007@eecs.berkeley.edu> <20120208171056.GV22183@edd-i386.kent.ac.uk> <20120208230955.GW22183@edd-i386.kent.ac.uk> Message-ID: On Wed, Feb 8, 2012 at 18:09, Edd Barrett wrote: > Do you plan to implement something like this for real in maxima? No immediate plans, sorry. -s -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Fri Feb 10 11:16:52 2012 From: woollett at charter.net (Edwin Woollett) Date: Fri, 10 Feb 2012 09:16:52 -0800 Subject: [Maxima] display patch, was: get name of variable as string in function? Message-ID: On Feb. 6, 2012, Robert Dodier wrote: ----------------------- >Well, OK. No need to invent a work-around, it's easier to fix the bug. >Here is a patch. Can someone commit this? My git sandbox >is messed up (OH WONDERS OF GIT WILL YOU NEVER CEASE) >and I can't take the time to straighten it out right now. [snip] >diff --git a/src/comm.lisp b/src/comm.lisp >index 1282784..94c3823 100644 >--- a/src/comm.lisp >+++ b/src/comm.lisp >@@ -753,7 +753,9 @@ > (setq ans (list '(mequal simp) (disp2 l) ans))) > (if lablist (nconc lablist (cons (elabel ans) nil))) > (setq tim (get-internal-run-time)) >- (displa (list '(mlable) (if lablist linelable) ans)) >+ (let ((*display-labels-p* nil)) >+ (declare (special *display-labels-p*)) >+ (displa (list '(mlable) (if lablist linelable) ans))) > (mterpri) > (timeorg tim))) ---------------------------------------- I am using the new version of comm.lisp downloaded from git, and find a peculiar interaction with integrate resulting in a lisp error: ------------------------------------ Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) integrate(-1/(x^2-x),x,-1/2,1/2); Principal Value (%o1) log(3) (%i2) load ("comm-new.lisp")$ (%i3) integrate(-1/(x^2-x),x,-1/2,1/2); Maxima encountered a Lisp error: Error in COND [or a callee]: The variable NUM is unbound. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. (%i4) build_info()$ Maxima version: 5.26.0 Maxima build date: 22:48 1/15/2012 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 ------------------------------------ Ted From toy.raymond at gmail.com Fri Feb 10 16:11:47 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Fri, 10 Feb 2012 14:11:47 -0800 Subject: [Maxima] display patch, was: get name of variable as string in function? In-Reply-To: References: Message-ID: On Fri, Feb 10, 2012 at 9:16 AM, Edwin Woollett wrote: > I am using the new version of comm.lisp downloaded from > git, and find a peculiar interaction with integrate > resulting in a lisp error: > > ------------------------------**------ > > Maxima 5.26.0 http://maxima.sourceforge.net > using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) > > > (%i1) integrate(-1/(x^2-x),x,-1/2,1/**2); > Principal Value > (%o1) log(3) > (%i2) load ("comm-new.lisp")$ > (%i3) integrate(-1/(x^2-x),x,-1/2,1/**2); > Maxima encountered a Lisp error: > > Error in COND [or a callee]: The variable NUM is unbound. > > I suspect this is not a problem with the new version. I'm guessing you will have the same problem if you load the original version of comm.lisp. With the current git version of maxima, I don't run into any problems (without loading com-new.lisp, separately). The output of integrate is different, though, but it is still correct. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Sat Feb 11 12:48:39 2012 From: woollett at charter.net (Edwin Woollett) Date: Sat, 11 Feb 2012 10:48:39 -0800 Subject: [Maxima] display patch, was: get name of variable as string in function? Message-ID: On Feb. 10, 2012, Raymond Toy wrote: ---------------------- >I suspect this is not a problem with the new version. I'm guessing you >will have the same problem if you load the original version of comm.lisp. > >With the current git version of maxima, I don't run into any problems... -------------------------------------------------------------------------- You are right - just loading in comm.lisp messes with integrate. ----------------------------------------------------------- (%i1) integrate(-1/(x^2-x),x,-1/2,1/2); Principal Value (%o1) log(3) (%i2) load ("comm-old.lisp")$ (%i3) integrate(-1/(x^2-x),x,-1/2,1/2); Maxima encountered a Lisp error: Error in COND [or a callee]: The variable NUM is unbound. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. ----------------------------------- Ted From toy.raymond at gmail.com Sat Feb 11 17:19:52 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Sat, 11 Feb 2012 15:19:52 -0800 Subject: [Maxima] display patch, was: get name of variable as string in function? In-Reply-To: References: Message-ID: On 2/11/12 10:48 AM, Edwin Woollett wrote: > On Feb. 10, 2012, Raymond Toy wrote: > ---------------------- >> I suspect this is not a problem with the new version. I'm guessing you >> will have the same problem if you load the original version of comm.lisp. >> >> With the current git version of maxima, I don't run into any problems... > -------------------------------------------------------------------------- > > You are right - just loading in comm.lisp messes with integrate. Not sure if it will make a difference, but you might want to compile and comm.lisp. Something like :lisp (load (compile-file "/comm.lisp")) Ray From woollett at charter.net Sun Feb 12 13:52:19 2012 From: woollett at charter.net (Edwin Woollett) Date: Sun, 12 Feb 2012 11:52:19 -0800 Subject: [Maxima] display patch, was: get name of variable as string in function? Message-ID: <7A87108A86304D8CBFD64F37B2AF7A23@edwinc367e16bd> On Feb. 11, 2012, Raymond Toy wrote: ------------------------------------------------ >Not sure if it will make a difference, but you might want to compile and >comm.lisp. Something like > > :lisp (load (compile-file "/comm.lisp")) --------------------------------------------------------------- This seems to work for me: (display2d:false set in my init file) ------------------------------------------ Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) a : 2$ (%i2) :lisp $_ ((MSETQ) $A 2) (%i2) :lisp (load (compile-file "c:/work2/comm-new.lisp")) Compiling c:/work2/comm-new.lisp. End of Pass 1. ;; Note: Tail-recursive call of SUBST1 was replaced by iteration. ;; Note: Tail-recursive call of SUBST2 was replaced by iteration. ;; Note: Tail-recursive call of $TRUNC was replaced by iteration. ;; Note: Tail-recursive call of DISP2 was replaced by iteration. ;; Note: Tail-recursive call of DISP2 was replaced by iteration. ;; Note: Tail-recursive call of FINDPOWERS1 was replaced by iteration. End of Pass 2. OPTIMIZE levels: Safety=2, Space=3, Speed=3 Finished compiling c:/work2/comm-new.lisp. 73680 (%i2) integrate(-1/(x^2-x),x,-1/2,1/2); Principal Value (%o2) log(3) (%i3) display(a)$ a = 2 --------------------------------- Thanks for the suggestion, Ted From p.blanchenay at lse.ac.uk Mon Feb 13 06:17:48 2012 From: p.blanchenay at lse.ac.uk (Patrick Blanchenay) Date: Mon, 13 Feb 2012 12:17:48 +0000 Subject: [Maxima] Graphing a function for several parameter values Message-ID: <4F38FF6C.2050104@lse.ac.uk> Dear list members, I am a somewhat beginner at Maxima, so please excuse me if my question is stupid. I would like to plot a function several times for different values of parameters. The function depends on a set of parameters, say paramOne and paramTwo. I would like to be able to specify several sets of those parameters, and for each set, get the function graphed. I do not want the number of parameter sets to be hard-coded, so I thought about using a for ... in ... do loop. This is what I tried, but it doesn't seem to work: parametersList: [ [paramOne=valueOne, paramTwo=valueTwo], [paramOne=valueThree, paramTwo=valueFour], ]$ for parameterSet in parametersList do block( i++, functionList[i] : ev(function(x,paramOne,paramTwo),parameterSet), return functionList ) wxplot2d(functionList,[x,0,1])$ Any suggestions? Thank you! Patrick PS: this was cross-posted on StackOverflow. From alserkli at inbox.ru Mon Feb 13 06:29:38 2012 From: alserkli at inbox.ru (Alexander Klimov) Date: Mon, 13 Feb 2012 14:29:38 +0200 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F38FF6C.2050104@lse.ac.uk> References: <4F38FF6C.2050104@lse.ac.uk> Message-ID: On Mon, 13 Feb 2012, Patrick Blanchenay wrote: > I would like to plot a function several times for different values of > parameters. > > The function depends on a set of parameters, say paramOne and paramTwo. > I would like to be able to specify several sets of those parameters, and > for each set, get the function graphed. function: x * paramOne + paramTwo; parametersList: [ [paramOne=1, paramTwo=1], [paramOne=-1, paramTwo=0] ]$ functionList: map(lambda([p],ev(function,p)),parametersList)$ plot2d(functionList,[x,0,1])$ -- Regards, ASK From villate at fe.up.pt Mon Feb 13 08:36:22 2012 From: villate at fe.up.pt (Jaime Villate) Date: Mon, 13 Feb 2012 14:36:22 +0000 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F38FF6C.2050104@lse.ac.uk> References: <4F38FF6C.2050104@lse.ac.uk> Message-ID: <4F391FE6.5040002@fe.up.pt> On 02/13/2012 12:17 PM, Patrick Blanchenay wrote: > I would like to plot a function several times for different values of > parameters. > > The function depends on a set of parameters, say paramOne and paramTwo. > I would like to be able to specify several sets of those parameters, and > for each set, get the function graphed. > > I do not want the number of parameter sets to be hard-coded, so I > thought about using a for ... in ... do loop. This is what I tried, but > it doesn't seem to work: > > parametersList: [ > [paramOne=valueOne, paramTwo=valueTwo], > [paramOne=valueThree, paramTwo=valueFour], > ]$ > for parameterSet in parametersList do > block( > i++, > functionList[i] : ev(function(x,paramOne,paramTwo),parameterSet), > return functionList > ) > wxplot2d(functionList,[x,0,1])$ Hi, welcome to the list. You have several errors. 1- The statement "functionList[i]: ..." will not create a list but an array. By the end of the loop, functionList will not refer to the whole array, but rather to another variable, different from the array you created, and thus undefined. In any case, the plot command expects a list of functions and not an array. 2- i++ does not work in Maxima (unless you defined the postfix operator ++); you should have used i:0 .... i: i+1 3- return functionList will also fail; perhaps return(functionList) but it will not work as you expect from other programming languages. For that type of for loop you do not need to return anything from the loop. I recommend that you use makelist() to create your list of functions. Something like this: (%i2) f (x,A,w):= A*sin(w*x)$ (%i3) plist: [ [p1=1, p2=2], [p1=3, p2=4] ]$ (%i4) flist: makelist ( ev(f(x,p1,p2), p), p, plist); (%o4) [sin(2*x),3*sin(4*x)] (%i5) plot2d ( flist, [x, 0, 7]); As a matter of personal taste, I find simpler to use expressions, even though in this case the result is the same: (%i2) f: A*sin(w*x)$ (%i3) plist: [ [A=1, w=2], [A=3, w=4] ]$ (%i4) flist: makelist (subst (p,f), p, plist); (%o4) [sin(2*x),3*sin(4*x)] (%i5) plot2d ( flist, [x, 0, 7]); Cheers, Jaime From p.blanchenay at lse.ac.uk Mon Feb 13 10:20:53 2012 From: p.blanchenay at lse.ac.uk (Patrick Blanchenay) Date: Mon, 13 Feb 2012 16:20:53 +0000 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F391FE6.5040002@fe.up.pt> References: <4F38FF6C.2050104@lse.ac.uk> <4F391FE6.5040002@fe.up.pt> Message-ID: <4F393865.6090208@lse.ac.uk> Je la 13/02/2012 14:36, Jaime Villate skribis: > I recommend that you use makelist() to create your list of functions. > Something like this: > > (%i2) f (x,A,w):= A*sin(w*x)$ > > (%i3) plist: [ [p1=1, p2=2], [p1=3, p2=4] ]$ > > (%i4) flist: makelist ( ev(f(x,p1,p2), p), p, plist); > > (%o4) [sin(2*x),3*sin(4*x)] > (%i5) plot2d ( flist, [x, 0, 7]); > Thank you very much Jaime, Do you know if I could apply the substitution of parameters to several functions? E.g. something like: flist: makelist ( concat(ev(f(x,p1,p2), p),",",ev(g(x,p1,p2), p)), p, plist); plot2d ( flist, [x, 0, 7]); I have no idea, but basically i'd like to plot two functions for several parameters values, so I need to have them like [f(under param_set1), g(under param_set1), f(under param_set2), g(under param_set2)] Is this still feasible with makelist? Thank you again! Patrick From villate at fe.up.pt Mon Feb 13 11:02:35 2012 From: villate at fe.up.pt (Jaime Villate) Date: Mon, 13 Feb 2012 17:02:35 +0000 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F393865.6090208@lse.ac.uk> References: <4F38FF6C.2050104@lse.ac.uk> <4F391FE6.5040002@fe.up.pt> <4F393865.6090208@lse.ac.uk> Message-ID: <4F39422B.6000009@fe.up.pt> On 02/13/2012 04:20 PM, Patrick Blanchenay wrote: > Do you know if I could apply the substitution of parameters to several > functions? > > E.g. something like: > > flist: makelist ( concat(ev(f(x,p1,p2), p),",",ev(g(x,p1,p2), p)), p, > plist); > plot2d ( flist, [x, 0, 7]); > > I have no idea, but basically i'd like to plot two functions for several > parameters values, so I need to have them like > [f(under param_set1), g(under param_set1), f(under param_set2), g(under > param_set2)] > > Is this still feasible with makelist? Sure, something such as: flist: makelist ( ev( [f(x,p1,p2), g(x,p1,p2)], p), p, plist)$ plot2d (flatten (flist), [x, 0, 7]); That makelist command will create a list of the type [[f1,g1], [f2,g2],...] flatten() will transform it into the list that plot2d needs: [f1, g1, f2, g2, ...] (concat will not work here because it will produce strings with a "," inside the strings, but not a list). Cheers, Jaime From p.blanchenay at lse.ac.uk Mon Feb 13 11:53:44 2012 From: p.blanchenay at lse.ac.uk (Patrick Blanchenay) Date: Mon, 13 Feb 2012 17:53:44 +0000 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F39422B.6000009@fe.up.pt> References: <4F38FF6C.2050104@lse.ac.uk> <4F391FE6.5040002@fe.up.pt> <4F393865.6090208@lse.ac.uk> <4F39422B.6000009@fe.up.pt> Message-ID: <4F394E28.1050900@lse.ac.uk> Je la 13/02/2012 17:02, Jaime Villate skribis: > On 02/13/2012 04:20 PM, Patrick Blanchenay wrote: >> Do you know if I could apply the substitution of parameters to several >> functions? >> >> E.g. something like: >> >> flist: makelist ( concat(ev(f(x,p1,p2), p),",",ev(g(x,p1,p2), p)), p, >> plist); >> plot2d ( flist, [x, 0, 7]); >> >> I have no idea, but basically i'd like to plot two functions for several >> parameters values, so I need to have them like >> [f(under param_set1), g(under param_set1), f(under param_set2), g(under >> param_set2)] >> >> Is this still feasible with makelist? > Sure, something such as: > > flist: makelist ( ev( [f(x,p1,p2), g(x,p1,p2)], p), p, plist)$ > plot2d (flatten (flist), [x, 0, 7]); > > That makelist command will create a list of the type [[f1,g1], [f2,g2],...] > flatten() will transform it into the list that plot2d needs: [f1, g1, > f2, g2, ...] > Ah, flatten is exactly what I needed. Thank you very much for your help! (And thank you Alexander as well!) From p.blanchenay at lse.ac.uk Mon Feb 13 12:10:09 2012 From: p.blanchenay at lse.ac.uk (Patrick Blanchenay) Date: Mon, 13 Feb 2012 18:10:09 +0000 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F394E28.1050900@lse.ac.uk> References: <4F38FF6C.2050104@lse.ac.uk> <4F391FE6.5040002@fe.up.pt> <4F393865.6090208@lse.ac.uk> <4F39422B.6000009@fe.up.pt> <4F394E28.1050900@lse.ac.uk> Message-ID: <4F395201.6030006@lse.ac.uk> Je la 13/02/2012 17:53, Patrick Blanchenay skribis: > Je la 13/02/2012 17:02, Jaime Villate skribis: >> On 02/13/2012 04:20 PM, Patrick Blanchenay wrote: >>> Do you know if I could apply the substitution of parameters to several >>> functions? >>> >>> E.g. something like: >>> >>> flist: makelist ( concat(ev(f(x,p1,p2), p),",",ev(g(x,p1,p2), p)), p, >>> plist); >>> plot2d ( flist, [x, 0, 7]); >>> >>> I have no idea, but basically i'd like to plot two functions for several >>> parameters values, so I need to have them like >>> [f(under param_set1), g(under param_set1), f(under param_set2), g(under >>> param_set2)] >>> >>> Is this still feasible with makelist? >> Sure, something such as: >> >> flist: makelist ( ev( [f(x,p1,p2), g(x,p1,p2)], p), p, plist)$ >> plot2d (flatten (flist), [x, 0, 7]); >> >> That makelist command will create a list of the type [[f1,g1], [f2,g2],...] >> flatten() will transform it into the list that plot2d needs: [f1, g1, >> f2, g2, ...] >> > > Ah, flatten is exactly what I needed. Thank you very much for your help! > (And thank you Alexander as well!) Actually I spoke too fast, the problem is that my functions are parametric, so each of them need to be in ['parametric, xOne(t),yOne(t),[t,0,1]]. In other words, not everything should be flatten. Is there any way to get "intermediate" flattening? What I get from the makelist() command, with for instance: plist: [ [p1=1, p2=2], [p1=3, p2=4] ] is: [ [ ['parametric, xOne(t,1,2),yOne(t,1,2),[t,0,1]], ['parametric, xTwo(t,1,2),yTwo(t,1,2),[t,0,1]] ], [ ['parametric, xOne(t,3,4),yOne(t,3,4),[t,0,1]], ['parametric, xTwo(t,3,4),yTwo(t,3,4),[t,0,1]] ] ] What I would like is to suppress the "intermediate" level of hierarchy, in order to get: [ ['parametric, xOne(t,1,2),yOne(t,1,2),[t,0,1]], ['parametric, xTwo(t,1,2),yTwo(t,1,2),[t,0,1]], ['parametric, xOne(t,3,4),yOne(t,3,4),[t,0,1]], ['parametric, xTwo(t,3,4),yTwo(t,3,4),[t,0,1]] ] whereas if I use flatten, I get: ['parametric, xOne(t,1,2),yOne(t,1,2),t,0,1, 'parametric, xTwo(t,1,2),yTwo(t,1,2),t,0,1, 'parametric, xOne(t,3,4),yOne(t,3,4),t,0,1, 'parametric, xTwo(t,3,4),yTwo(t,3,4),t,0,1] Any suggestions? From p.blanchenay at lse.ac.uk Mon Feb 13 13:39:41 2012 From: p.blanchenay at lse.ac.uk (Patrick Blanchenay) Date: Mon, 13 Feb 2012 19:39:41 +0000 Subject: [Maxima] Graphing a function for several parameter values In-Reply-To: <4F395201.6030006@lse.ac.uk> References: <4F38FF6C.2050104@lse.ac.uk> <4F391FE6.5040002@fe.up.pt> <4F393865.6090208@lse.ac.uk> <4F39422B.6000009@fe.up.pt> <4F394E28.1050900@lse.ac.uk> <4F395201.6030006@lse.ac.uk> Message-ID: <4F3966FD.1020104@lse.ac.uk> Je la 13/02/2012 18:10, Patrick Blanchenay skribis: > Je la 13/02/2012 17:53, Patrick Blanchenay skribis: >> Je la 13/02/2012 17:02, Jaime Villate skribis: >>> On 02/13/2012 04:20 PM, Patrick Blanchenay wrote: >>>> Do you know if I could apply the substitution of parameters to several >>>> functions? >>>> >>>> E.g. something like: >>>> >>>> flist: makelist ( concat(ev(f(x,p1,p2), p),",",ev(g(x,p1,p2), p)), p, >>>> plist); >>>> plot2d ( flist, [x, 0, 7]); >>>> >>>> I have no idea, but basically i'd like to plot two functions for several >>>> parameters values, so I need to have them like >>>> [f(under param_set1), g(under param_set1), f(under param_set2), g(under >>>> param_set2)] >>>> >>>> Is this still feasible with makelist? >>> Sure, something such as: >>> >>> flist: makelist ( ev( [f(x,p1,p2), g(x,p1,p2)], p), p, plist)$ >>> plot2d (flatten (flist), [x, 0, 7]); >>> >>> That makelist command will create a list of the type [[f1,g1], [f2,g2],...] >>> flatten() will transform it into the list that plot2d needs: [f1, g1, >>> f2, g2, ...] >>> >> >> Ah, flatten is exactly what I needed. Thank you very much for your help! >> (And thank you Alexander as well!) > > Actually I spoke too fast, the problem is that my functions are > parametric, so each of them need to be in ['parametric, > xOne(t),yOne(t),[t,0,1]]. In other words, not everything should be > flatten. Is there any way to get "intermediate" flattening? > > What I get from the makelist() command, with for instance: > plist: [ [p1=1, p2=2], [p1=3, p2=4] ] > is: > [ > [ > ['parametric, xOne(t,1,2),yOne(t,1,2),[t,0,1]], > ['parametric, xTwo(t,1,2),yTwo(t,1,2),[t,0,1]] > ], > [ > ['parametric, xOne(t,3,4),yOne(t,3,4),[t,0,1]], > ['parametric, xTwo(t,3,4),yTwo(t,3,4),[t,0,1]] > ] > ] > > What I would like is to suppress the "intermediate" level of hierarchy, > in order to get: > [ > ['parametric, xOne(t,1,2),yOne(t,1,2),[t,0,1]], > ['parametric, xTwo(t,1,2),yTwo(t,1,2),[t,0,1]], > ['parametric, xOne(t,3,4),yOne(t,3,4),[t,0,1]], > ['parametric, xTwo(t,3,4),yTwo(t,3,4),[t,0,1]] > ] > > whereas if I use flatten, I get: > ['parametric, xOne(t,1,2),yOne(t,1,2),t,0,1, > 'parametric, xTwo(t,1,2),yTwo(t,1,2),t,0,1, > 'parametric, xOne(t,3,4),yOne(t,3,4),t,0,1, > 'parametric, xTwo(t,3,4),yTwo(t,3,4),t,0,1] > > Any suggestions? I found how to do it using "append": f(x,A,w):= A*sin(w*x)$ g(x,B,w):= B*cos(w*x)$ parameterList: [ [p1=1, p2=2], [p1=3, p2=4] ]$ functionList: apply(append, makelist( ev( [['parametric, 2*t, f(t,p1,p2), [t, 0, 1], [nticks, 300]], ['parametric, g(t,p1,p2), 5*t+2, [t, 0, 1], [nticks, 300]]], p), p, paramaterList) ); plot2d(functionList, [x, 0, 7]); Sorry about the spam! From paweld2 at gmail.com Wed Feb 8 03:25:33 2012 From: paweld2 at gmail.com (=?ISO-8859-2?Q?Pawe=B3_Cesar_Sanjuan_Szklarz?=) Date: Wed, 8 Feb 2012 10:25:33 +0100 Subject: [Maxima] Generating octave functions from maxima Message-ID: Hello. Working on simulations for mechanical systems, I found really usefull to generate ODE equations on Maxima and then translate to octave to make simulations. I am using a simple function "generateOctaveFunction" at end of the mail to generate the octave functions as follow: load ("generateOctaveFunction.mac"); f(x,y) := sin(x) + cos(y) + t $ eq1 : -y + f(x,y); eq2 : x - f(x,y); testFunc : "generated"; generateOctaveFunction(testFunc,".",dq,[eq1,eq2],[x,y]); This generates file generated.maxgen with content: function dq =generated(q,t) dq(1,1) = t+cos(q(2))+sin(q(1))-q(2) dq(1,2) = -t-cos(q(2))-sin(q(1))+q(1) endfunction My question is: how to generate dq(i) in stand of dq(1,i)?? I am using f90mx inside generateOctaveFunction. Is there any more sofisticated way to pass Maxima equations to Octave?? Regards, Pawe? Cesar Sanjuan Szklarz. PD. generateOctaveFunction.mac /* Generate ODE function definition for octave Parameters functionName : Octave function name directoryName : target directory dq : matrix to save ODE equations EquationsList : equations [eq_1,eq_2,...] listVariables : state variables [x_1,x_2,...] Generated ODE function has form d(x_1)/dt = eq1; d(x_2)/dt = eq2; Variables [x_1,x_2,...] are replaced by [q[1],q[2],...] and generated is pseudo octave file "function dq =$funcName$(q,t) dq(1,i) = f90(eq_i) endfunction" Final equations should be repared to by q(1,i) = f90(eq_i) It can be done with command: sed -i -e 's/^d\(.\)(.\+,\(.\+\)) =\(.*\)$/d\1(\2)=\3;/g' TODO: fix to generate directly q(i). */ load (f90)$ generateOctaveFunction(functionName,directoryName,dq,EquationsList,listVariables) := block( /* x,y -> q_1,q_2 */ [q_eq : matrix( subst( map("=",listVariables,makelist(q[i],i,1,length(listVariables))), EquationsList )) ], FunHeader(funcName) := concat("function dq =",funcName,"(q,t)"), FunFileName(funcName,dir) := concat(dir,"/",funcName,".maxgen"), FunFooter : "endfunction", print (FunHeader(functionName)), f90mx(dq,q_eq), print (FunFooter), with_stdout (FunFileName(functionName,directoryName) , print (FunHeader(functionName)),f90mx(dq,q_eq),print (FunFooter)), dq:matrixEquation )$ From pchannell at lanl.gov Wed Feb 8 12:45:59 2012 From: pchannell at lanl.gov (Paul Channell) Date: Wed, 08 Feb 2012 11:45:59 -0700 Subject: [Maxima] numerical testing of identity Message-ID: <4F32C2E7.7040804@lanl.gov> In Maple there is a command, testeq, that checks a purported identity by numerically substituting random values for variables to establish falsehood with certainty or truth (with high probability). Is there an equivalent command in Maxima? Paul Channell From wissme at hotmail.com Wed Feb 8 13:44:18 2012 From: wissme at hotmail.com (WIZ Me) Date: Wed, 8 Feb 2012 19:44:18 +0000 Subject: [Maxima] Calling maxima from outside world Message-ID: Hello,Is there a document explaining in simple terms how to delegate computations to Maxima from another programming language ? Any *simple* example appreciated (it's ok to be able to send/get a Lisp expression as the result of a computation, it will be translated into another language, I don't know yet which one).Thanks a lot, it's for a student project... Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: From korte at lite.msu.edu Mon Feb 13 14:59:22 2012 From: korte at lite.msu.edu (Gerd Kortemeyer) Date: Mon, 13 Feb 2012 15:59:22 -0500 Subject: [Maxima] Calling maxima from outside world In-Reply-To: References: Message-ID: <46F09AC1-57DD-40B3-85CA-64DCC3B949A7@lite.msu.edu> Hi, On Feb 8, 2012, at 2:44 PM, WIZ Me wrote: > > Is there a document explaining in simple terms how to delegate computations to Maxima from another programming language ? As far as I know, there is no straightforward way to use MAXIMA as a kernel. Here's something that may be useful: http://www.lon-capa.org/maximaasserver.html The first program is a daemon that starts several instances of MAXIMA, keeps them alive, and let's you talk to them via a socket. From your other language, call the socket when you need anything (a Perl example is included). Works very well for us, just don't look at the duct tape behind the scenes. - Gerd. From willisb at unk.edu Mon Feb 13 15:49:51 2012 From: willisb at unk.edu (Barton Willis) Date: Mon, 13 Feb 2012 15:49:51 -0600 Subject: [Maxima] numerical testing of identity In-Reply-To: <4F32C2E7.7040804@lanl.gov> References: <4F32C2E7.7040804@lanl.gov> Message-ID: No, Maxima doesn't have nothing quite like that. Likely, Maxima has the tools to build such a function: (1) float or bfloat with various values of fpprec (or maybe nfloat), (2) rectform -- for complex values (float / bfloat don't always give a rectangular form), (3) random (4) errcatch -- deal with overflow, divsion by zero, ... (5) float_approx_equal and bfloat_approx_equal (undocumented, I think) --Barton maxima-bounces at math.utexas.edu wrote on 02/08/2012 12:45:59 PM: > From: Paul Channell > To: maxima at math.utexas.edu > Date: 02/13/2012 02:44 PM > Subject: [Maxima] numerical testing of identity > Sent by: maxima-bounces at math.utexas.edu > > In Maple there is a command, testeq, that checks a purported identity by > numerically substituting random values > for variables to establish falsehood with certainty or truth (with high > probability). Is there an equivalent > command in Maxima? > > Paul Channell > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -------------- next part -------------- An HTML attachment was scrubbed... URL: From l_butler at users.sourceforge.net Mon Feb 13 17:26:44 2012 From: l_butler at users.sourceforge.net (Leo Butler) Date: Mon, 13 Feb 2012 23:26:44 +0000 Subject: [Maxima] Calling maxima from outside world In-Reply-To: (message from WIZ Me on Wed, 8 Feb 2012 19:44:18 +0000) Message-ID: <1qp8vk62u2z.fsf@iceland.freeshell.org> WIZ Me writes: > [1:multipart/alternative Hide] > [1/1:text/plain Hide] > > Hello,Is there a document explaining in simple terms how to delegate computations to Maxima from another programming language ? Any *simple* example appreciated (it's ok to be able to send/get a Lisp expression as the result of a computation, it will be translated into another language, I don't know yet which one).Thanks a lot, it's for a student project... > Dan > On the documentation page you will find mention of a Perl programme pMaxima. You can get the source code, which is quite short and self-contained from here http://melusine.eu.org/syracuse/maxima/pmaxima/ If memory serves, it works by forking a parent server and child Maxima process. The parent does the usual Perl-ish stuff, sends Maxima code to the Maxima child and reads the output. Leo > [1/2:text/html Show] > [2:text/plain Hide] > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- Leo Butler SDF Public Access UNIX System - http://sdf.lonestar.org From macrakis at alum.mit.edu Mon Feb 13 18:56:52 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Mon, 13 Feb 2012 19:56:52 -0500 Subject: [Maxima] numerical testing of identity In-Reply-To: <4F32C2E7.7040804@lanl.gov> References: <4F32C2E7.7040804@lanl.gov> Message-ID: For smooth functions of a single variable, Maxima has zeroequiv. It works all right for simple cases, but quickly breaks down. Some current limitations are documented in https://sourceforge.net/tracker/index.php?func=detail&aid=593530&group_id=4933&atid=104933 : x-atan(x) => Dontknow, but this is perfectly well-behaved and numerically nonzero for abs(x) > 1.0e-8. sin(1/1000) => true sin(asin(x)+1/1000)-x => true sin(x+1/1000)-sin(x) => true atan(x)^1000 => internal error -s On Wed, Feb 8, 2012 at 13:45, Paul Channell wrote: > In Maple there is a command, testeq, that checks a purported identity by > numerically substituting random values > for variables to establish falsehood with certainty or truth (with high > probability). Is there an equivalent > command in Maxima? > > Paul Channell > > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From filonenko.mikhail at gmail.com Mon Feb 13 23:13:51 2012 From: filonenko.mikhail at gmail.com (Michael Filonenko) Date: Tue, 14 Feb 2012 07:13:51 +0200 Subject: [Maxima] Calling maxima from outside world In-Reply-To: <1qp8vk62u2z.fsf@iceland.freeshell.org> References: <1qp8vk62u2z.fsf@iceland.freeshell.org> Message-ID: Also you can use simple stdin/stdout redirecting. Maxima is the usual console application. 2012/2/14 Leo Butler : > WIZ Me writes: > >> [1:multipart/alternative Hide] >> [1/1:text/plain Hide] >> >> Hello,Is there a document explaining in simple terms how to delegate computations to Maxima from another programming language ? Any *simple* example appreciated (it's ok to be able to send/get a Lisp expression as the result of a computation, it will be translated into another language, I don't know yet which one).Thanks a lot, it's for a student project... >> ? ?Dan >> > > On the documentation page you will find mention of a Perl programme > pMaxima. You can get the source code, which is quite short and > self-contained from here > > http://melusine.eu.org/syracuse/maxima/pmaxima/ > > If memory serves, it works by forking a parent server and child Maxima > process. The parent does the usual Perl-ish stuff, sends Maxima code to > the Maxima child and reads the output. > > Leo > > >> [1/2:text/html Show] >> [2:text/plain Hide] >> _______________________________________________ >> Maxima mailing list >> Maxima at math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima > > -- > Leo Butler ? ? ? ? ? ? ? ? > SDF Public Access UNIX System - ? http://sdf.lonestar.org > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- With best regards, Michael Filonenko From nijso at hotmail.com Tue Feb 14 03:12:07 2012 From: nijso at hotmail.com (nijso beishuizen) Date: Tue, 14 Feb 2012 10:12:07 +0100 Subject: [Maxima] Can maxima be used for renormalization group analysis? Message-ID: Dear all, Recently I have become interested in renormalization group analysis, specifically for applications in turbulence modeling (the work of Yakhot and Orszag, McComb etc.). So my question to you is: is there a RNG package for maxima? Has anyone done RNG analysis with maxima (probably for quantum mechanical problems)? So things like obtaining the Fourier transform of a PDE, finding fixed points, etc. Kind regards, NB -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Tue Feb 14 17:29:59 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 14 Feb 2012 15:29:59 -0800 Subject: [Maxima] float erf (%i) ?? Message-ID: <94F28DAF2DCC42DB8C0846BFD6D3F766@edwinc367e16bd> I am not getting erf(%i) to produce a float value. So this is a "feature request". If we use the manual def of erf(z), and the fact that the integrand is an entire function, the integral is independent of the path taken from the origin to the final complex point z. so we can choose a path along the imaginary axis to the final point %i to get erf(%i) = 2*%i*integrate(exp(y^2),y,0,1)/sqrt(%pi) = pure imaginary then use integrate with erfflag = false: ------------------------------------------- (%i1) expand(2*%i*integrate(exp(x^2),x,0,1)/sqrt(%pi)); (%o1) erf(%i) (%i2) float(%); (%o2) erf(%i) (%i3) erfflag; (%o3) true (%i4) erfflag:false$ (%i5) integrate(exp(x^2),x,0,1); (%o5) %i*gamma_incomplete(1/2,-1)/2-sqrt(%pi)*%i/2 (%i6) expand(float(%)); (%o6) 1.462651745907182 (%i7) float(2*%/sqrt(%pi)); (%o7) 1.650425758797543 ---------------------------------------------------------- so erf(%i) = 1.650425758797543*%i approx ------------------------------------- Ted Woollett From woollett at charter.net Tue Feb 14 17:55:47 2012 From: woollett at charter.net (Edwin Woollett) Date: Tue, 14 Feb 2012 15:55:47 -0800 Subject: [Maxima] float erf (%i) ?? Message-ID: On Feb. 14, 2012, I wrote ------------------- > I am not getting erf(%i) to produce a float > value. So this is a "feature request". ------------------------------------ Two possible routes to the correct answer in terms of existing Maxima functions are: ------------------------------------------- (%i1) %i*float(erfi(1)); (%o1) 1.650425758797543*%i (%i2) %i*imagpart(expand(float(1-gamma_incomplete(1/2,-1)/sqrt(%pi)))); (%o2) 1.650425758797543*%i ------------------------------------------------- Ted Woollett From lapeyre.math122a at gmail.com Tue Feb 14 18:01:45 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Wed, 15 Feb 2012 01:01:45 +0100 Subject: [Maxima] float erf (%i) ?? In-Reply-To: References: Message-ID: <4F3AF5E9.90906@gmail.com> It seems a bit weird and it's not documented, but ... (%i1) erf_representation:erfi$ (%i2) float(erf(%i)); (%o2) 1.650425758797543 %i From lapeyre.math122a at gmail.com Tue Feb 14 18:54:11 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Wed, 15 Feb 2012 01:54:11 +0100 Subject: [Maxima] float erf (%i) ?? In-Reply-To: References: Message-ID: <4F3B0233.7060702@gmail.com> In src/gamma.lisp, (defun simp-erf ... Add this immediately after the checks for minf and inf ((and (or (not (numberp ($imagpart z))) (/= 0 ($imagpart z))) (and (numberp ($realpart z)) (= 0 ($realpart z)))) (mul -1 '$%i (take '(%erfi) (mul '$%i z)))) Then, by default, erf(%i*z) will become %i erfi(z). And the float will be evaluated if requested. But, I think that's not the best, and I bet not foolproof, way to test for an explicitly imaginary argument. I didn't run tests to see what it breaks. -- John Lapeyre From toy.raymond at gmail.com Tue Feb 14 22:22:42 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 14 Feb 2012 20:22:42 -0800 Subject: [Maxima] float erf (%i) ?? In-Reply-To: <4F3B0233.7060702@gmail.com> References: <4F3B0233.7060702@gmail.com> Message-ID: <4F3B3312.7030806@gmail.com> On 2/14/12 4:54 PM, John Lapeyre wrote: > > In src/gamma.lisp, (defun simp-erf ... > > Add this immediately after the checks for minf and inf > > ((and (or (not (numberp ($imagpart z))) (/= 0 ($imagpart z))) > (and (numberp ($realpart z)) (= 0 ($realpart z)))) > (mul -1 '$%i (take '(%erfi) (mul '$%i z)))) > > Then, by default, erf(%i*z) will become %i erfi(z). And > the float will be evaluated if requested. But, I think that's > not the best, and I bet not foolproof, way to test for an > explicitly imaginary argument. I didn't run tests to see > what it breaks. I don't think this is the right thing to do. Why? Because: erf(%i),numer; returns 1.650425758797543 %i. How did I know? I cheated and looked at the code for float-numerical-eval-p which has a check for $numer. Perhaps %erf needs a 'subc property added to its property list? I also thought that float(erf(%i)) was supposed to convert the arguments to float, but that doesn't seem to be happening because erf(1.0*%i) instantly returns a numerical result. Ray From toy.raymond at gmail.com Tue Feb 14 22:22:42 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Tue, 14 Feb 2012 20:22:42 -0800 Subject: [Maxima] float erf (%i) ?? In-Reply-To: <4F3B0233.7060702@gmail.com> References: <4F3B0233.7060702@gmail.com> Message-ID: <4F3B3312.7030806@gmail.com> On 2/14/12 4:54 PM, John Lapeyre wrote: > > In src/gamma.lisp, (defun simp-erf ... > > Add this immediately after the checks for minf and inf > > ((and (or (not (numberp ($imagpart z))) (/= 0 ($imagpart z))) > (and (numberp ($realpart z)) (= 0 ($realpart z)))) > (mul -1 '$%i (take '(%erfi) (mul '$%i z)))) > > Then, by default, erf(%i*z) will become %i erfi(z). And > the float will be evaluated if requested. But, I think that's > not the best, and I bet not foolproof, way to test for an > explicitly imaginary argument. I didn't run tests to see > what it breaks. I don't think this is the right thing to do. Why? Because: erf(%i),numer; returns 1.650425758797543 %i. How did I know? I cheated and looked at the code for float-numerical-eval-p which has a check for $numer. Perhaps %erf needs a 'subc property added to its property list? I also thought that float(erf(%i)) was supposed to convert the arguments to float, but that doesn't seem to be happening because erf(1.0*%i) instantly returns a numerical result. Ray From jan.mueller at math.uni-dortmund.de Wed Feb 15 10:07:18 2012 From: jan.mueller at math.uni-dortmund.de (Jan Mueller) Date: Wed, 15 Feb 2012 17:07:18 +0100 Subject: [Maxima] sin computation Message-ID: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> Hi, I am just writing an article about how pocket calculators compute values of trigonometric functions (especially Volders CORDIC algorithm). I also contacted Casio and TI about it but they gave no information because of company secrets. Could anyone explain to me how Maxima solves it? sin would be sufficient for me Jan From macrakis at alum.mit.edu Wed Feb 15 10:15:10 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 15 Feb 2012 11:15:10 -0500 Subject: [Maxima] sin computation In-Reply-To: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> References: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> Message-ID: For floating-point calculations, Maxima uses the numerical system of the underlying Lisp system, which typically uses the arithmetic packages provided with the underlying implementation language or operating system. For arbitrary-precision calculations (aka bfloats or bigfloats), the usual approximations are not useful -- Maxima reduces the range by subtracting the appropriate multiple of pi, then uses the Taylor expansion. The full Lisp code (functions fpsin and fpsincos1) is available for browsing at http://maxima.git.sourceforge.net/git/gitweb.cgi?p=maxima/maxima;a=blob;f=src/float.lisp;h=b881f47fcb443ee8c0a4a9c2887cf3261f08af06;hb=HEAD or via git. It is pretty simple if you're comfortable with Lisp, though some of the details are specific to the big float package. -s On Wed, Feb 15, 2012 at 11:07, Jan Mueller wrote: > Hi, > I am just writing an article about how pocket calculators compute values > of trigonometric functions (especially Volders CORDIC algorithm). I also > contacted Casio and TI about it but they gave no information because of > company secrets. Could anyone explain to me how Maxima solves it? sin would > be sufficient for me > Jan > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ephemeris at grayswandir.com Wed Feb 15 10:27:19 2012 From: ephemeris at grayswandir.com (Norman Beam) Date: Wed, 15 Feb 2012 11:27:19 -0500 Subject: [Maxima] sin computation In-Reply-To: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> References: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> Message-ID: <4F3BDCE7.8020200@grayswandir.com> Jan. If you have a good library available, see if they have a copy of the book 'Software Manual for the Elementary Functions' by William J. Cody Jr. and William Waite, 1980, Prentice Hall. The book was for compiler writers and assembly coder who needed to implement efficient finite word length floating point. Regards, Eph On 2/15/12 11:07 AM, Jan Mueller wrote: > Hi, > I am just writing an article about how pocket calculators compute values of trigonometric functions (especially Volders CORDIC algorithm). I also contacted Casio and TI about it but they gave no information because of company secrets. Could anyone explain to me how Maxima solves it? sin would be sufficient for me > Jan > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > From vext01 at gmail.com Wed Feb 15 10:45:44 2012 From: vext01 at gmail.com (Edd Barrett) Date: Wed, 15 Feb 2012 16:45:44 +0000 Subject: [Maxima] return statement Message-ID: <20120215164544.GP21867@edd-i386.kent.ac.uk> Hi, Is there kind of return statement which actually returns from a function and not just a block (even when nested)? I don't see one in the manual, did I miss it? Cheers -- Best Regards Edd Barrett http://www.theunixzoo.co.uk From macrakis at alum.mit.edu Wed Feb 15 10:44:47 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 15 Feb 2012 11:44:47 -0500 Subject: [Maxima] return statement In-Reply-To: <20120215164544.GP21867@edd-i386.kent.ac.uk> References: <20120215164544.GP21867@edd-i386.kent.ac.uk> Message-ID: I believe you need to use catch/throw for this. -s On Wed, Feb 15, 2012 at 11:45, Edd Barrett wrote: > Hi, > > Is there kind of return statement which actually returns from a function > and not just a block (even when nested)? > > I don't see one in the manual, did I miss it? > > Cheers > > -- > Best Regards > Edd Barrett > > http://www.theunixzoo.co.uk > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mxue at vroomlab.com Wed Feb 15 10:54:26 2012 From: mxue at vroomlab.com (mxue at vroomlab.com) Date: Wed, 15 Feb 2012 09:54:26 -0700 Subject: [Maxima] =?utf-8?q?ev_-_diff_error=3F?= Message-ID: <20120215095426.b7b3fc7d0c6ca0d100c8a34890539092.ba0f9ac6e0.wbe@email06.secureserver.net> An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Wed Feb 15 10:59:55 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 15 Feb 2012 11:59:55 -0500 Subject: [Maxima] ev - diff error? In-Reply-To: <20120215095426.b7b3fc7d0c6ca0d100c8a34890539092.ba0f9ac6e0.wbe@email06.secureserver.net> References: <20120215095426.b7b3fc7d0c6ca0d100c8a34890539092.ba0f9ac6e0.wbe@email06.secureserver.net> Message-ID: When you say ev(diff(sin(x),x),x=1); You are asking Maxima to calculate diff(sin(x),x) in a context where all x's are replaced by 1. That would give diff(sin(1),1), which is not what you want. What you want is first to calculate diff(sin(x),x), and only *then* substitute x=1. You can do that in various ways: subst(x=1,diff(sin(x),x)) at(diff(sin(x),x),x=1) ex: diff(sin(x),x)$ ev(ex,x=1) Maxima's notion of variable conflates *programming* variables and *mathematical *variables, which aren't really the same thing, but can be treated as the same in many cases. But in some cases, you have to be careful about the difference. -s On Wed, Feb 15, 2012 at 11:54, wrote: > Hi Maxima Jedis, > > I have the following encounter with maxima 5.23.2: > > (%i3) ev(diff(sin(x),x),x=1); > > diff: second argument must be a variable; found 1 > -- an error. To debug this try: debugmode(true); > > > but > > (%i5) diff(sin(x),x); > (%o5) cos(x) > (%i6) ev(%, x=1); > (%o6) cos(1) > > works ok. so is: > > (%i9) ev(diff(sin(x),x), x=%pi); > (%o9) 0 > > however, > (%i8) ev(diff(sin(x),x), x=%pi/2); > > %pi > diff: second argument must be a variable; found --- > 2 > > > Is this a bug of maxima or error/misunderstanding on my part? Could someone > enlighten me ? > > Thanks! > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From talon at lpthe.jussieu.fr Wed Feb 15 11:03:04 2012 From: talon at lpthe.jussieu.fr (Michel Talon) Date: Wed, 15 Feb 2012 17:03:04 +0000 (UTC) Subject: [Maxima] sin computation References: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> Message-ID: Jan Mueller wrote: > Hi, > I am just writing an article about how pocket calculators compute values of trigonometric functions (especially Volders CORDIC algorithm). I also contacted Casio and TI about it but they gave no information because of company secrets. Could anyone explain to me how Maxima solves it? sin would be sufficient for me > Jan Apparently the software for the HP 48 calculator has been written by the french mathematician B. Parisse from Grenoble, and can be downloaded here: ftp://ftp-fourier.ujf-grenoble.fr/linux/xcas/hpcas/erablsrc.zip so you can take a look at it. For the TI calculator it is the software Derive, i don't think one can get the source code. Another source for access to trig functions computations is to take a look at the source code for the libc and libm in free operating systems. For example for FreeBSD you can take a look at http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/ but the code for i387 obviously uses hardware nstructions in the processor so it will ne be very useful to you. But there is a generic computation, for example for the sin here: http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/src/k_sin.c?rev=1.11 which shows how one can proceed with approximate formula. -- Michel Talon From mxue at vroomlab.com Wed Feb 15 11:25:30 2012 From: mxue at vroomlab.com (michael) Date: Wed, 15 Feb 2012 17:25:30 +0000 (UTC) Subject: [Maxima] ev - diff error? References: <20120215095426.b7b3fc7d0c6ca0d100c8a34890539092.ba0f9ac6e0.wbe@email06.secureserver.net> Message-ID: Thank you very much for your quick reply. I am still puzzled by the fact that ev(diff(sin(x),x), x=%pi) returns 0 instead of an error. such as in the case of ev(diff(sin(x),x), x=%pi/4). From mxue at vroomlab.com Wed Feb 15 11:33:00 2012 From: mxue at vroomlab.com (michael) Date: Wed, 15 Feb 2012 17:33:00 +0000 (UTC) Subject: [Maxima] ev - diff error? References: <20120215095426.b7b3fc7d0c6ca0d100c8a34890539092.ba0f9ac6e0.wbe@email06.secureserver.net> Message-ID: Stavros Macrakis alum.mit.edu> writes: > > When you say > > ? ? ?ev(diff(sin(x),x),x=1);? > > You are asking Maxima to calculate diff(sin(x),x) in a context where all x's are replaced by 1. > > ? ? ? ? ? ? -s > > > Thank you very much for your quick reply. I am still puzzled by the fact that ev(diff(sin(x),x), x=%pi) returns 0 instead of an error. such as in the case of ev(diff(sin(x),x), x=%pi/4). From macrakis at alum.mit.edu Wed Feb 15 11:35:24 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 15 Feb 2012 12:35:24 -0500 Subject: [Maxima] ev - diff error? In-Reply-To: References: <20120215095426.b7b3fc7d0c6ca0d100c8a34890539092.ba0f9ac6e0.wbe@email06.secureserver.net> Message-ID: Thank you for reporting that problem. Indeed, diff(..., %pi) (or w.r.t. any other constant) should give an error. I have filed this as a bug, and assigned it to myself to fix. -s On Wed, Feb 15, 2012 at 12:25, michael wrote: > > Thank you very much for your quick reply. > I am still puzzled by the fact that > ev(diff(sin(x),x), x=%pi) returns 0 > instead of an error. such as in the case of > ev(diff(sin(x),x), x=%pi/4). > > > > > > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.mueller at math.uni-dortmund.de Wed Feb 15 11:46:44 2012 From: jan.mueller at math.uni-dortmund.de (=?ISO-8859-1?Q?Jan_Hendrik_M=FCller?=) Date: Wed, 15 Feb 2012 18:46:44 +0100 Subject: [Maxima] sin computation In-Reply-To: <4F3BDCE7.8020200@grayswandir.com> References: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> <4F3BDCE7.8020200@grayswandir.com> Message-ID: <4F3BEF84.7090905@math.uni-dortmund.de> Hi, the book is fortunately available via http://bookfi.org/dl/546944/f9a577 many thanks for your (plural!) help and hints! Jan Norman Beam schrieb: > Jan. > > If you have a good library available, see if they have a copy of the > book 'Software Manual for the Elementary Functions' by William J. Cody > Jr. and William Waite, 1980, Prentice Hall. The book was for compiler > writers and assembly coder who needed to implement efficient finite > word length floating point. > > Regards, > > Eph > > > On 2/15/12 11:07 AM, Jan Mueller wrote: >> Hi, >> I am just writing an article about how pocket calculators compute >> values of trigonometric functions (especially Volders CORDIC >> algorithm). I also contacted Casio and TI about it but they gave no >> information because of company secrets. Could anyone explain to me >> how Maxima solves it? sin would be sufficient for me >> Jan >> >> >> _______________________________________________ >> 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 lapeyre.math122a at gmail.com Wed Feb 15 12:29:11 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Wed, 15 Feb 2012 19:29:11 +0100 Subject: [Maxima] float erf (%i) ?? In-Reply-To: <4F3B3312.7030806@gmail.com> References: <4F3B0233.7060702@gmail.com> <4F3B3312.7030806@gmail.com> Message-ID: <4F3BF977.7040409@gmail.com> > > I don't think this is the right thing to do. Why? Because: > > erf(%i),numer; > > returns 1.650425758797543 %i. > > How did I know? I cheated and looked at the code for > float-numerical-eval-p which has a check for $numer. > Perhaps %erf needs a 'subc property added to its property list? I don't understand how that works, except that it has something to to with creating a subcontext. I just noticed there is erf_%iargs which behaves like %iargs for erf, but maybe it is not documented ? Also it is false by default and I think %iargs is true by default. One consequence of erf_%iargs:true is that float(erf(%i)) givs a number, which is at least a workaround. But float(erf(2*%i)) works as expected even with erf_%iargs:false; tracing shows that simp-erf is called twice, the second time , 2 has been converted to 2.0, and complex-float-numerical-eval-p returns true. But with float(erf(1*%i)), 1*%i -> %i and float leave this as it is, so complex-float-numerical-eval-p returns false. > I also thought that float(erf(%i)) was supposed to convert the arguments > to float, but that doesn't seem to be happening because erf(1.0*%i) > instantly returns a numerical result. simp-erf calls complex-float-numerical-eval-p and finds the 1.0. It seems there should be a way of having float(erf(%i)) work that is independent of how erf simplifies to erfi. John From fateman at eecs.berkeley.edu Wed Feb 15 13:04:46 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Wed, 15 Feb 2012 11:04:46 -0800 Subject: [Maxima] sin computation In-Reply-To: References: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> Message-ID: <4F3C01CE.1070900@eecs.berkeley.edu> I think you will be able to find more information from Hewlett Packard. See, for example http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1979-12.pdf Also, I think you will find other material on wkahan's home page. As far as the algorithms for bigfloats in Maxima, they are generally inappropriate for calculators because they are "unrestricted" in the sense used by R.P. Brent. They provide algorithms for any precision. Calculators have some fixed precision, e.g. 10 decimal digits. (or 13, with guard digits etc.) So quite different routines are used. RJF On 2/15/2012 9:03 AM, Michel Talon wrote: > Jan Mueller wrote: >> Hi, >> I am just writing an article about how pocket calculators compute values of > trigonometric functions (especially Volders CORDIC algorithm). I also > contacted Casio and TI about it but they gave no information because of > company secrets. Could anyone explain to me how Maxima solves it? sin would be > sufficient for me >> Jan > Apparently the software for the HP 48 calculator has been written by the > french mathematician B. Parisse from Grenoble, and can be downloaded here: > ftp://ftp-fourier.ujf-grenoble.fr/linux/xcas/hpcas/erablsrc.zip > so you can take a look at it. For the TI calculator it is the software Derive, > i don't think one can get the source code. > > Another source for access to trig functions computations is to take a look at > the source code for the libc and libm in free operating systems. For example > for FreeBSD you can take a look at > http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/ > but the code for i387 obviously uses hardware nstructions in the processor so > it will ne be very useful to you. But there is a generic computation, for > example for the sin here: > http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/src/k_sin.c?rev=1.11 > which shows how one can proceed with approximate formula. > > From volkervannek at googlemail.com Wed Feb 15 15:49:35 2012 From: volkervannek at googlemail.com (Volker van Nek) Date: Wed, 15 Feb 2012 22:49:35 +0100 Subject: [Maxima] return statement In-Reply-To: References: <20120215164544.GP21867@edd-i386.kent.ac.uk> Message-ID: Yes. Here is an example: (%i1) f(x) := catch( block([y:0], for i thru 3 do if i = x then throw(i), y) )$ (%i2) map(f, [1,2,3,4,5,6,7]); (%o2) [1, 2, 3, 0, 0, 0, 0] Volker van Nek 2012/2/15 Stavros Macrakis > I believe you need to use catch/throw for this. > > -s > > On Wed, Feb 15, 2012 at 11:45, Edd Barrett wrote: > >> Hi, >> >> Is there kind of return statement which actually returns from a function >> and not just a block (even when nested)? >> >> I don't see one in the manual, did I miss it? >> >> Cheers >> >> -- >> Best Regards >> Edd Barrett >> >> http://www.theunixzoo.co.uk >> _______________________________________________ >> 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: From macrakis at alum.mit.edu Wed Feb 15 17:26:26 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Wed, 15 Feb 2012 18:26:26 -0500 Subject: [Maxima] diff -- second argument Message-ID: Diff currently allows constants as a second argument; I've assigned the bugto myself (the fix is trivial). It also allows: diff(x,tan(x)) => 0 diff(x,f(x)) => 0 but not diff(x,1+x) => error In principle, all of these could of course be meaningful, but Maxima doesn't know that. Which seems more useful for users in such cases?: * Giving an error? * Leaving as noun forms? (which Maxima can't do anything useful with) I suspect that in most cases, an error would be welcome.... -s -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Wed Feb 15 18:25:07 2012 From: woollett at charter.net (Edwin Woollett) Date: Wed, 15 Feb 2012 16:25:07 -0800 Subject: [Maxima] new comm.lisp causes maxima to hang (a case) Message-ID: <84F9D0ED1F8847C5873A235E055B8558@edwinc367e16bd> If I don't load new comm.lisp (in compiled form) I get expected result (first example) If I do load new comm.lisp, the same example hangs maxima (gcl): ------------------------------------- /****** ok w/o comm-new.o *****/ Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) load("defint-new.o")$ (%i2) load("limit-new.o")$ (%i3) load("unwind_protect.lisp")$ (%i4) simp_assuming(e, [fcts]) ::= buildq([e,fcts], unwind_protect((apply(assume, fcts), expand(e,0,0)), apply(forget,fcts)))$ (%i5) integrate(2^(%i*x),x,1,10^4); (%o5) 2^%i*%i/log(2)-%i*2^(10000*%i)/log(2) (%i6) expand(float(rectform(%))); (%o6) 0.47915862215474*%i+0.37574425579291 (%i7) simp_assuming(integrate(sin(sin(x)),x,0,2), x >= 0, x <= 2); (%o7) 'integrate(sin(sin(x)),x,0,2) /*** not ok with comm-new.o ****/ Maxima 5.26.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) load("defint-new.o")$ (%i2) load("limit-new.o")$ (%i3) load ("comm-new.o")$ (%i4) load("unwind_protect.lisp")$ (%i5) simp_assuming(e, [fcts]) ::= buildq([e,fcts], unwind_protect((apply(assume, fcts), expand(e,0,0)), apply(forget,fcts)))$ (%i6) integrate(2^(%i*x),x,1,10^4); (%o6) 2^%i*%i/log(2)-%i*2^(10000*%i)/log(2) (%i7) expand(float(rectform(%))); (%o7) 0.47915862215474*%i+0.37574425579291 /* this hangs maxima */ (%i8) simp_assuming(integrate(sin(sin(x)),x,0,2), x >= 0, x <= 2); -------------------------------- Ted Woollett (%i1) build_info()$ Maxima version: 5.26.0 Maxima build date: 22:48 1/15/2012 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 From robert.dodier at gmail.com Wed Feb 15 23:35:48 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Wed, 15 Feb 2012 22:35:48 -0700 Subject: [Maxima] new comm.lisp causes maxima to hang (a case) In-Reply-To: <84F9D0ED1F8847C5873A235E055B8558@edwinc367e16bd> References: <84F9D0ED1F8847C5873A235E055B8558@edwinc367e16bd> Message-ID: On 2/15/12, Edwin Woollett wrote: > If I don't load new comm.lisp (in compiled form) > I get expected result (first example) > > If I do load new comm.lisp, the same example > hangs maxima (gcl): I can't reproduce this problem. I tried it with GCL and with CMUCL. I have to wonder what are defint-new and limit-new. I'm working with Maxima as retrieved from the source code repository (Git) and built all at once instead of loading some modified files. I suppose that probably makes a difference. best Robert Dodier From robert.dodier at gmail.com Thu Feb 16 01:28:12 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Thu, 16 Feb 2012 00:28:12 -0700 Subject: [Maxima] diff -- second argument In-Reply-To: References: Message-ID: On 2/15/12, Stavros Macrakis wrote: > diff(x,tan(x)) => 0 > diff(x,f(x)) => 0 > > but not > > diff(x,1+x) => error > > In principle, all of these could of course be meaningful, but Maxima > doesn't know that. > > Which seems more useful for users in such cases?: > > * Giving an error? > * Leaving as noun forms? (which Maxima can't do anything useful with) Well, in general it seems useful, and consistent with Maxima's behavior in other cases, to return a noun form. Then sufficiently clever people (whether it's the developers or anybody else) can impose an interpretation of such expressions via the simplification system. An error might be appropriate for cases in which Maxima has determined that the expression is undefined. best, Robert Dodier From A.G.Grozin at inp.nsk.su Thu Feb 16 02:59:01 2012 From: A.G.Grozin at inp.nsk.su (Andrey G. Grozin) Date: Thu, 16 Feb 2012 15:59:01 +0700 (NOVT) Subject: [Maxima] sin computation In-Reply-To: <4F3BEF84.7090905@math.uni-dortmund.de> References: <60EAC646-F635-45F9-9E88-27D048E89716@math.uni-dortmund.de> <4F3BDCE7.8020200@grayswandir.com> <4F3BEF84.7090905@math.uni-dortmund.de> Message-ID: Algorithms to calculate elementary functions with arbitrarily high precision can also be fount in the sources of the python package mpmath. The code is well commented. Andrey From lapeyre.math122a at gmail.com Thu Feb 16 06:45:18 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Thu, 16 Feb 2012 13:45:18 +0100 Subject: [Maxima] bug in 'is' ? Message-ID: <4F3CFA5E.3000409@gmail.com> These both cause an error (in both 5.26.0, 5.25.1, and gcl,sbcl) is("zebra" > 0); every(lambda([x],is(x>0)), [1,2,"zebra"]); with sbcl: Maxima encountered a Lisp error: The value "zebra" is not of type LIST. gcl: Error in MACSYMA-TOP-LEVEL [or a callee]: Caught fatal error [memory may be damaged] -- John Lapeyre From macrakis at alum.mit.edu Thu Feb 16 06:54:59 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 16 Feb 2012 07:54:59 -0500 Subject: [Maxima] bug in 'is' ? In-Reply-To: <4F3CFA5E.3000409@gmail.com> References: <4F3CFA5E.3000409@gmail.com> Message-ID: Yes, anything that gives an internal error is a bug -- could you please report it? (see bug_report() ) Since strings are not (currently) in the domain of the Maxima comparison operators, this should either give an error or return 'unknown'. I think I know what Robert's preference would be.... -s On Thu, Feb 16, 2012 at 07:45, John Lapeyre wrote: > > These both cause an error (in both 5.26.0, 5.25.1, and gcl,sbcl) > > is("zebra" > 0); > > every(lambda([x],is(x>0)), [1,2,"zebra"]); > > with sbcl: > Maxima encountered a Lisp error: > The value "zebra" is not of type LIST. > > gcl: > Error in MACSYMA-TOP-LEVEL [or a callee]: > Caught fatal error [memory may be damaged] > > -- John Lapeyre > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From toy.raymond at gmail.com Thu Feb 16 10:42:18 2012 From: toy.raymond at gmail.com (Raymond Toy) Date: Thu, 16 Feb 2012 08:42:18 -0800 Subject: [Maxima] diff -- second argument In-Reply-To: References: Message-ID: On Wed, Feb 15, 2012 at 11:28 PM, Robert Dodier wrote: > On 2/15/12, Stavros Macrakis wrote: > > > diff(x,tan(x)) => 0 > > diff(x,f(x)) => 0 > > > > but not > > > > diff(x,1+x) => error > > > > In principle, all of these could of course be meaningful, but Maxima > > doesn't know that. > > > > Which seems more useful for users in such cases?: > > > > * Giving an error? > > * Leaving as noun forms? (which Maxima can't do anything useful with) > > Well, in general it seems useful, and consistent with Maxima's > behavior in other cases, to return a noun form. Then sufficiently > clever people (whether it's the developers or anybody else) can > impose an interpretation of such expressions via the simplification > system. > Returning a noun form does seem to be Maxima's standard behavior, but I often find it rather annoying. Say I do an integral and I get a noun form back. Not because maxima can't really do the integral but because some function deep in the bowels of the integration routines failed. Rather than giving some indication of that, maxima silently returns a noun form. Noun forms are nice for users, but sometimes painful for developers. I don't know what the right balance should be. Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: From woollett at charter.net Thu Feb 16 13:01:00 2012 From: woollett at charter.net (Edwin Woollett) Date: Thu, 16 Feb 2012 11:01:00 -0800 Subject: [Maxima] new comm.lisp causes maxima to hang (a case) Message-ID: <90BE5DB3A8CB4D46B83921432F51796A@edwinc367e16bd> On Feb. 15, 2012, Robert Dodier wrote: -------------------------------------- >> If I do load new comm.lisp, the same example >> hangs maxima (gcl): > >I can't reproduce this problem. I tried it with GCL and with CMUCL. > >I have to wonder what are defint-new and limit-new. > these are compiled versions of the latest defint.lisp and limit.lisp from git; just loading them on top of 5.26.0 seems to cure the integral bugs which gave rise to the new versions. >I'm working with Maxima as retrieved from the source code repository >(Git) and built all at once instead of loading some modified files. >I suppose that probably makes a difference. That's good info for me. I can just avoid using the new comm.lisp for now. Thanks for the test, Ted From macrakis at alum.mit.edu Thu Feb 16 13:12:48 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Thu, 16 Feb 2012 14:12:48 -0500 Subject: [Maxima] diff -- second argument In-Reply-To: References: Message-ID: Actually, a little reflection makes it clear that diff(f(x),g(x)) should not be an error or a noun form, because in fact it is perfectly well-defined and meaningful: diff(A,B) == ev(diff(A)/diff(B),del) For example, diff(sin(x),x) == cos(x)*del(x)/del(x) == cos(x) << diff(...,V) reduces to normal differentiation diff(sin(x),cos(x)) == cos(x)*del(x)/(-sin(x)*del(x)) == -cos(x)/sin(x) << in diff(f(x),g(x)), del(x)/del(x) => 1 diff(x*y,x^2+y^2) == (x*del(y)+y*del(x)) / (2*y*del(y) + 2*x*del(x)) << consistent handling of multiple-variable case How useful is this? I'll leave that to others.... Right now, Maxima doesn't do much of interest with del(...) -- not even giving an error for del(1) -- but it does do ev(del(x^2),del) == diff(x^2) == 2*x*del(x). You can even try ratsubst('diff(x,y),del(x)/del(y),...) on del expressions and get things that look reasonable (and useful?).... One problem: diff(del(x)) => 'diff(del(x),x)*del(x), which is I suppose correct, but ugly and hard to work with. Can be deferred for now. Any objections to this definition of diff with a second argument which is an expression? -s On Thu, Feb 16, 2012 at 11:42, Raymond Toy wrote: > > > On Wed, Feb 15, 2012 at 11:28 PM, Robert Dodier wrote: > >> On 2/15/12, Stavros Macrakis wrote: >> >> > diff(x,tan(x)) => 0 >> > diff(x,f(x)) => 0 >> > >> > but not >> > >> > diff(x,1+x) => error >> > >> > In principle, all of these could of course be meaningful, but Maxima >> > doesn't know that. >> > >> > Which seems more useful for users in such cases?: >> > >> > * Giving an error? >> > * Leaving as noun forms? (which Maxima can't do anything useful with) >> >> Well, in general it seems useful, and consistent with Maxima's >> behavior in other cases, to return a noun form. Then sufficiently >> clever people (whether it's the developers or anybody else) can >> impose an interpretation of such expressions via the simplification >> system. >> > > Returning a noun form does seem to be Maxima's standard behavior, but I > often find it rather annoying. Say I do an integral and I get a noun form > back. Not because maxima can't really do the integral but because some > function deep in the bowels of the integration routines failed. Rather > than giving some indication of that, maxima silently returns a noun form. > > Noun forms are nice for users, but sometimes painful for developers. > > I don't know what the right balance should be. > > Ray > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hbaker1 at pipeline.com Thu Feb 16 15:52:20 2012 From: hbaker1 at pipeline.com (Henry Baker) Date: Thu, 16 Feb 2012 13:52:20 -0800 Subject: [Maxima] diff -- second argument In-Reply-To: References: Message-ID: Whatever you do with 2nd arg for diff should also be mirrored in 2nd arg for integrate. At 11:12 AM 2/16/2012, Stavros Macrakis wrote: >Actually, a little reflection makes it clear that diff(f(x),g(x)) should not be an error or a noun form, because in fact it is perfectly well-defined and meaningful: > > diff(A,B) == ev(diff(A)/diff(B),del) > >For example, > > diff(sin(x),x) == cos(x)*del(x)/del(x) == cos(x) > << diff(...,V) reduces to normal differentiation > diff(sin(x),cos(x)) == cos(x)*del(x)/(-sin(x)*del(x)) == -cos(x)/sin(x) > << in diff(f(x),g(x)), del(x)/del(x) => 1 > diff(x*y,x^2+y^2) == (x*del(y)+y*del(x)) / (2*y*del(y) + 2*x*del(x)) > << consistent handling of multiple-variable case > >How useful is this? I'll leave that to others.... > >Right now, Maxima doesn't do much of interest with del(...) -- not even giving an error for del(1) -- but it does do ev(del(x^2),del) == diff(x^2) == 2*x*del(x). You can even try ratsubst('diff(x,y),del(x)/del(y),...) on del expressions and get things that look reasonable (and useful?).... > >One problem: diff(del(x)) => 'diff(del(x),x)*del(x), which is I suppose correct, but ugly and hard to work with. Can be deferred for now. > >Any objections to this definition of diff with a second argument which is an expression? > > -s > >On Thu, Feb 16, 2012 at 11:42, Raymond Toy wrote: > >On Wed, Feb 15, 2012 at 11:28 PM, Robert Dodier wrote: >On 2/15/12, Stavros Macrakis wrote: > >> diff(x,tan(x)) => 0 >> diff(x,f(x)) => 0 >> >> but not >> >> diff(x,1+x) => error >> >> In principle, all of these could of course be meaningful, but Maxima >> doesn't know that. >> >> Which seems more useful for users in such cases?: >> >> * Giving an error? >> * Leaving as noun forms? (which Maxima can't do anything useful with) > >Well, in general it seems useful, and consistent with Maxima's >behavior in other cases, to return a noun form. Then sufficiently >clever people (whether it's the developers or anybody else) can >impose an interpretation of such expressions via the simplification >system. > >Returning a noun form does seem to be Maxima's standard behavior, but I often find it rather annoying. Say I do an integral and I get a noun form back. Not because maxima can't really do the integral but because some function deep in the bowels of the integration routines failed. Rather than giving some indication of that, maxima silently returns a noun form. > >Noun forms are nice for users, but sometimes painful for developers. > >I don't know what the right balance should be. > >Ray From cloos at jhcloos.com Thu Feb 16 17:31:18 2012 From: cloos at jhcloos.com (James Cloos) Date: Thu, 16 Feb 2012 18:31:18 -0500 Subject: [Maxima] float erf (%i) ?? In-Reply-To: <94F28DAF2DCC42DB8C0846BFD6D3F766@edwinc367e16bd> (Edwin Woollett's message of "Tue, 14 Feb 2012 15:29:59 -0800") References: <94F28DAF2DCC42DB8C0846BFD6D3F766@edwinc367e16bd> Message-ID: >>>>> "EW" == Edwin Woollett writes: EW> I am not getting erf(%i) to produce a float FWIW, erf(1.0*%i) and erf(1.0B0*%i) work. -JimC -- James Cloos OpenPGP: 1024D/ED7DAEA6 From wmixon at berry.edu Thu Feb 16 17:49:51 2012 From: wmixon at berry.edu (Mixon, Wilson) Date: Thu, 16 Feb 2012 23:49:51 +0000 Subject: [Maxima] Problem with lsquares_estimates Message-ID: I can't estimate the parameters of a function when the data have been generated with rk. I attach a wxMaxima file. The commands are below The first pass is taken from Woollett. In this case lsquares_estimates works as expected. dataL : [ [1,1], [2,7/4], [3,11/4], [4,13/4]]$ dataM : apply('matrix, dataL)$ dataM; load(lsquares)$ lsquares_estimates(dataM, [x, y], y = a+b*x^c, [a,b,c],initial=[0,1,1], iprint=[-1,0]); Next, I create some data using rk. As far as I can see, the data matrix is well-behaved, but lsquares_estimates now generates an error message. kill(all)$ w:2*%pi$ w0:1.5*w$ b:w0/4$ g:1.5$ phi0:-%pi/2$ data6a: rk( [y,-2*b*y-w0*w0*sin(x) + g*w0*w0*cos(w*t)], [x,y], [phi0,0], [t, 0, 20*%pi/w, 1])$ data6b: rk([y,-2*b*y-w0*w0*sin(x) + g*w0*w0*cos(w*t)], [x,y], [phi0+0.01,0], [t, 0, 20*%pi/w, 1])$ data6a: data6a, numer$ data6b: data6b, numer$ logDx: makelist(log(abs(data6a[i][2]-data6b[i][2])), i,1,11)$ tList: makelist(t,t,1,11)$ dataD: transpose(matrix(tList,logDx)); lsquares_estimates(dataD, [time, lDx], lDx = a+b*time, [a,b], initial=[1,1], iprint=[-1,0]); Next I recreate the Woollett exercise, getting error messages. dataL : [ [1,1], [2,7/4], [3,11/4], [4,13/4]]$ dataM : apply('matrix, dataL); load(lsquares)$ lsquares_estimates(dataM, [x, y], y = a+b*x^c, [a,b,c], initial=[0,1,1], iprint=[-1,0]); Finally, I execute kill(all)$ and recreate the Woollett exercise. Now lsquares_estimates works. kill(all)$ dataL : [ [1,1], [2,7/4], [3,11/4], [4,13/4]]$ dataM : apply('matrix, dataL)$ load(lsquares)$ lsquares_estimates(dataM, [x, y], y = a+b*x^c, [a,b,c], initial=[0,1,1], iprint=[-1,0]); -------------- next part -------------- A non-text attachment was scrubbed... Name: lsquares.wxm Type: application/octet-stream Size: 2498 bytes Desc: lsquares.wxm URL: From brianchacko at yahoo.com Fri Feb 17 01:47:28 2012 From: brianchacko at yahoo.com (Brian Chacko) Date: Thu, 16 Feb 2012 23:47:28 -0800 (PST) Subject: [Maxima] Error using Sockets with Maxima In-Reply-To: References: <1324444437.54181.YahooMailNeo@web39401.mail.mud.yahoo.com> <1324486072.94758.YahooMailNeo@web39403.mail.mud.yahoo.com> Message-ID: <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> Hi, I wanted my API to communicate with maxima using sockets the same way WxMaxima is being used. Using this method,? I created a local server application and try to connect maxima to the server using the command [Path to maxima.bat]/maxima.bat -s 7755 I get the following error... [Path to Maxima]\bin>maxima.bat -s 7755 Connecting Maxima to server on port 7755 Maxima encountered a Lisp error: ?Error in LISP:LAMBDA-CLOSURE [or a callee]: Could not connect Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. Error in START-CLIENT [or a callee]: The tag RETURN-FROM-DEBUGGER is undefined. Fast links are on: do (use-fast-links nil) for debugging Broken at CONDITIONS::CLCS-UNIVERSAL-ERROR-HANDLER.? Type :H for Help. ?1 (Abort) Return to top level. dbl:MAXIMA>> Could someone help me to resolve this? Thanks in advance... Brian Gee Chacko -------------- next part -------------- An HTML attachment was scrubbed... URL: From brianchacko at yahoo.com Fri Feb 17 01:54:01 2012 From: brianchacko at yahoo.com (Brian Chacko) Date: Thu, 16 Feb 2012 23:54:01 -0800 (PST) Subject: [Maxima] Fw: Error using Sockets with Maxima In-Reply-To: <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> References: <1324444437.54181.YahooMailNeo@web39401.mail.mud.yahoo.com> <1324486072.94758.YahooMailNeo@web39403.mail.mud.yahoo.com> <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> Message-ID: <1329465241.5641.YahooMailNeo@web39403.mail.mud.yahoo.com> Hi all, The error was the case sensitive 's' either, the actual command argument is maxima.bat -S 7755 while I used maxima.bat -s 7755 earlier. This was the issue. Regards, Brian Gee Chacko ----- Forwarded Message ----- From: Brian Chacko To: "maxima at math.utexas.edu" Sent: Friday, February 17, 2012 1:17 PM Subject: Error using Sockets with Maxima Hi, I wanted my API to communicate with maxima using sockets the same way WxMaxima is being used. Using this method,? I created a local server application and try to connect maxima to the server using the command [Path to maxima.bat]/maxima.bat -s 7755 I get the following error... [Path to Maxima]\bin>maxima.bat -s 7755 Connecting Maxima to server on port 7755 Maxima encountered a Lisp error: ?Error in LISP:LAMBDA-CLOSURE [or a callee]: Could not connect Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. Error in START-CLIENT [or a callee]: The tag RETURN-FROM-DEBUGGER is undefined. Fast links are on: do (use-fast-links nil) for debugging Broken at CONDITIONS::CLCS-UNIVERSAL-ERROR-HANDLER.? Type :H for Help. ?1 (Abort) Return to top level. dbl:MAXIMA>> Could someone help me to resolve this? Thanks in advance... Brian Gee Chacko -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.dodier at gmail.com Fri Feb 17 10:01:18 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 17 Feb 2012 09:01:18 -0700 Subject: [Maxima] Error using Sockets with Maxima In-Reply-To: <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> References: <1324444437.54181.YahooMailNeo@web39401.mail.mud.yahoo.com> <1324486072.94758.YahooMailNeo@web39403.mail.mud.yahoo.com> <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> Message-ID: On 2/17/12, Brian Chacko wrote: > I wanted my API to communicate with maxima using sockets the same way > WxMaxima is being used. Using this method, I created a local server > application and try to connect maxima to the server using the command > > [Path to maxima.bat]/maxima.bat -s 7755 > > I get the following error... > > [Path to Maxima]\bin>maxima.bat -s 7755 > Connecting Maxima to server on port 7755 > Maxima encountered a Lisp error: > > Error in LISP:LAMBDA-CLOSURE [or a callee]: Could not connect Brian, maxima -s doesn't create a Maxima server (i.e. listening on the specified port). Instead it creates a client, which attempts to connect to a server (such as wxMaxima) on the port. Take a look at pMaxima, which is a Maxima server implemented in Perl. There's a little bit about it in this message: http://permalink.gmane.org/gmane.comp.mathematics.maxima.general/37185 HTH Robert Dodier From robert.dodier at gmail.com Fri Feb 17 10:11:55 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 17 Feb 2012 09:11:55 -0700 Subject: [Maxima] Fw: Error using Sockets with Maxima In-Reply-To: <1329465241.5641.YahooMailNeo@web39403.mail.mud.yahoo.com> References: <1324444437.54181.YahooMailNeo@web39401.mail.mud.yahoo.com> <1324486072.94758.YahooMailNeo@web39403.mail.mud.yahoo.com> <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> <1329465241.5641.YahooMailNeo@web39403.mail.mud.yahoo.com> Message-ID: On 2/17/12, Brian Chacko wrote: > The error was the case sensitive 's' either, the actual command argument is > > maxima.bat -S 7755 I don't think that's right. When I try that, I get "Warning: argument S not recognized." HTH Robert Dodier From talon at lpthe.jussieu.fr Fri Feb 17 11:33:45 2012 From: talon at lpthe.jussieu.fr (Michel Talon) Date: Fri, 17 Feb 2012 17:33:45 +0000 (UTC) Subject: [Maxima] Error using Sockets with Maxima References: <1324444437.54181.YahooMailNeo@web39401.mail.mud.yahoo.com> <1324486072.94758.YahooMailNeo@web39403.mail.mud.yahoo.com> <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> <1324444437.54181.YahooMailNeo@web39401.mail.mud.yahoo.com> <1324486072.94758.YahooMailNeo@web39403.mail.mud.yahoo.com> <1329464848.46406.YahooMailNeo@web39404.mail.mud.yahoo.com> Message-ID: Robert Dodier wrote: > On 2/17/12, Brian Chacko wrote: > >> I wanted my API to communicate with maxima using sockets the same way >> WxMaxima is being used. Using this method, I created a local server >> application and try to connect maxima to the server using the command >> >> [Path to maxima.bat]/maxima.bat -s 7755 >> >> I get the following error... >> >> [Path to Maxima]\bin>maxima.bat -s 7755 >> Connecting Maxima to server on port 7755 >> Maxima encountered a Lisp error: >> >> Error in LISP:LAMBDA-CLOSURE [or a callee]: Could not connect > > Brian, maxima -s doesn't create a Maxima server (i.e. listening on > the specified port). Instead it creates a client, which attempts to > connect to a server (such as wxMaxima) on the port. > > Take a look at pMaxima, which is a Maxima server implemented > in Perl. There's a little bit about it in this message: > http://permalink.gmane.org/gmane.comp.mathematics.maxima.general/37185 > > HTH > > Robert Dodier Indeed maxima -s doesn't create a listening socket so needs someone else to do that. What pMaxima does is that the perl program creates a listening socket and listens on it, and at the same time forks a child which fires up a maxima -s program connected to the same port. At lest for me, maxima -s does *not* work for whatever reason. If i do in one window Last login: Fri Feb 17 18:21:42 on ttys000 lilas% nc -l 8888 pid=13746 (%i1) 1+1; that is i create a listening socket with nc and in another window i create the maxima -s Last login: Fri Feb 17 01:18:08 on ttys000 lilas% maxima -s 8888 Connecting Maxima to server on port 8888 then i get the prompt (%i1) and i can type 1+1; but then everything hangs and i have no further output. Maybe this is nor exactly the intended use. If insted of using maxima -s i do the following lilas% maxima -r ":lisp (setup-client 8888)" (%i1) Then in the other window i have a maxima server which is not hanged: lilas% nc -l 8888 pid=13770 (%i1) 1+1; (%o1) 2 (%i2) What is the exact difference with maxima -s i don't know, but for me one works and not the other. -- Michel Talon From robert.dodier at gmail.com Fri Feb 17 13:01:33 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Fri, 17 Feb 2012 12:01:33 -0700 Subject: [Maxima] Problem with lsquares_estimates In-Reply-To: References: Message-ID: The variable b is assigned a value 0.75*%pi so that's why lsquares_estimates complains. Try kill(b) before the call to lsquares_estimates. HTH Robert Dodier From mickle.mouse at gmail.com Fri Feb 17 15:08:29 2012 From: mickle.mouse at gmail.com (Mike Valenzuela) Date: Fri, 17 Feb 2012 14:08:29 -0700 Subject: [Maxima] Missing documentation or feature request Message-ID: I've been working on a particularly tricky problem and wanted to check my math. The problem simply an inverse matrix calculus derivative problem. Particularly: diff( -1/2 * transpose(invert(transpose(A)).(z-x)).(invert(transpose(A)).(z-x)), A), where A is a matrix ( cholesky decomposition of a covariance matrix), and z & x are vectors of the same length. I ran into several problems: 1) Invert only works on matrices if they are given - I need a symbolic matrix inversion for any sized matrix. I know differentiation of an inverted matrix is possible (see orion.uwaterloo.ca/~hwolkowi/matrixcookbook.pdf) 2) I tried other matrix calculus such as diff (transpose(x) . A . x, x), but Maxima returned " 'diff(transpose(x)) . A". The correct answer is " x . ( A + transpose(A) ) " 3) I have tried checking itensor and ctensor packages, but neither of them seemed to support a symbolic inverse. I'm not sure that even if it did, would I be able to differentiate the resulting expression. 4) Another thing I looked for, but couldn't find was a symbolic function inverse. I know the identity " diff( inverse(f(x)), x) = 1 / ( 'diff(f ( inverse f( x ) ), x ) " (see http://en.wikipedia.org/wiki/Inverse_functions_and_differentiation) So I guess this is a feature request unless someone can tell me how to use maxima to differentiate an expression (involving matrix inverses) with respect to the matrix. Features specifically useful would be: a) "Full" symbolic matrix inversion, which operates on any sized matrix and does not require specifying its components. b) Matrix calculus c) Symbolic function inverses (along with the associated calculus rules) or d) Better itensor/centsor documentation demonstrating how to handle a problem similar to mine. Thank you in advance for any advice. -------------- next part -------------- An HTML attachment was scrubbed... URL: From macrakis at alum.mit.edu Fri Feb 17 15:25:33 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Fri, 17 Feb 2012 16:25:33 -0500 Subject: [Maxima] Missing documentation or feature request In-Reply-To: References: Message-ID: I can't help with the rest, but note that Maxima's notation for matrix inverse (symbolic or not) is A^^-1. "invert" is just a routine implementing a particular way of calculating explicit matrix inverses. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mickle.mouse at gmail.com Fri Feb 17 16:18:11 2012 From: mickle.mouse at gmail.com (Mike Valenzuela) Date: Fri, 17 Feb 2012 15:18:11 -0700 Subject: [Maxima] Missing documentation or feature request In-Reply-To: References: Message-ID: Thank you - but the calculus rules are still wrong: /* [wxMaxima: input start ] */ diff( A(t)^^-1, t); /* [wxMaxima: input end ] */ 'diff(A(t)^^(-1),t,1) Should be A^^-1 . 'diff(A(t),t) . A^^-1 (http://orion.uwaterloo.ca/~hwolkowi/matrixcookbook.pdf) On Fri, Feb 17, 2012 at 2:25 PM, Stavros Macrakis wrote: > I can't help with the rest, but note that Maxima's notation for matrix > inverse (symbolic or not) is A^^-1. "invert" is just a routine > implementing a particular way of calculating explicit matrix inverses. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maillistor-cas at yahoo.se Sat Feb 18 03:00:52 2012 From: maillistor-cas at yahoo.se (Per Liss) Date: Sat, 18 Feb 2012 09:00:52 +0000 (GMT) Subject: [Maxima] The letter j as imaginary unit Message-ID: <1329555652.56753.YahooMailNeo@web171511.mail.ir2.yahoo.com> Hello, I'm am completely new to Maxima and computer algebra systems and am trying to learn how to make best use of it. After reading and introductory textbook, I have been now spent some time finding information on the Internet on how to make Maxima using the letter "j" as the imaginary unit in order not to make confusion with the symbol "i" for current. I would like Maxima not only to understand input using "%j" which I believe could be done by defining a constant, but also produce outputs using "j" instead of "i". My final goal is to find a way to permanently configure my installation to use the letter j. I would appreciate any tips where to find such info. I have searched the archive for this list and done a general Google search but didn't find any info. My installation is: Ubuntu Linux on an IBM T42p laptop running wxMaxima 0.8.4 (don't know hot to extract the Maxima core version) Best Regards, Per Liss From lapeyre.math122a at gmail.com Sat Feb 18 09:53:43 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Sat, 18 Feb 2012 16:53:43 +0100 Subject: [Maxima] how to format foreign object? Message-ID: <4F3FC987.1090209@gmail.com> I would like to tell Maxima how to format a particular lisp struct. I notice that for lisp list expressions there are some hooks that I don't understand. eg in nset.lisp. An example is the graph package: (%i68) (display2d:false, clebsch_graph()); (%o68) ?GRAPH\(16\ vertices\,\ 40\ edges\) (%i69) (display2d:true, clebsch_graph()); (%o69) GRAPH(16 vertices, 40 edges) (%i70) But, in particular, I am thinking of a struct with two slots that represents a maxima expression. If expr is a lisp list then the first slot is (car expr), the second is (cdr expr) copied to an array. The easiest is to convert the expression back to a list for printing. But sometimes, I want some indication of the representation. I can load a modified msize that tests with typep if the argument is this struct and converts it to a list. This is simple and seems fool-proof, but makes the array representation invisible. Also something like this does not belong at the top of msize, but somewhere down below the msize-atom code, I suppose. Maybe this is a complicated problem... John Lapeyre From l_butler at users.sourceforge.net Sat Feb 18 10:00:40 2012 From: l_butler at users.sourceforge.net (Leo Butler) Date: Sat, 18 Feb 2012 16:00:40 +0000 Subject: [Maxima] Missing documentation or feature request In-Reply-To: (message from Mike Valenzuela on Fri, 17 Feb 2012 14:08:29 -0700) Message-ID: <1qp4nuo2kt3.fsf@iceland.freeshell.org> Mike Valenzuela writes: > [1:multipart/alternative Hide] > [1/1:text/plain Hide] > I've been working on a particularly tricky problem and wanted to check my > math. The problem simply an inverse matrix calculus derivative problem. > Particularly: > > diff( -1/2 * > transpose(invert(transpose(A)).(z-x)).(invert(transpose(A)).(z-x)), A), > where A is a matrix ( cholesky decomposition of a covariance matrix), and z > & x are vectors of the same length. > > I ran into several problems: > 1) Invert only works on matrices if they are given - I need a symbolic > matrix inversion for any sized matrix. I know differentiation of an > inverted matrix is possible (see > orion.uwaterloo.ca/~hwolkowi/matrixcookbook.pdf) > > 2) I tried other matrix calculus such as diff (transpose(x) . A . x, x), > but Maxima returned " 'diff(transpose(x)) . A". The correct answer is " x > . ( A + transpose(A) ) " > > 3) I have tried checking itensor and ctensor packages, but neither of them > seemed to support a symbolic inverse. I'm not sure that even if it did, > would I be able to differentiate the resulting expression. > > 4) Another thing I looked for, but couldn't find was a symbolic function > inverse. I know the identity " diff( inverse(f(x)), x) = 1 / ( 'diff(f ( > inverse f( x ) ), x ) " (see > http://en.wikipedia.org/wiki/Inverse_functions_and_differentiation) > > > So I guess this is a feature request unless someone can tell me how to use > maxima to differentiate an expression (involving matrix inverses) with > respect to the matrix. Features specifically useful would be: > a) "Full" symbolic matrix inversion, which operates on any sized matrix and > does not require specifying its components. > > b) Matrix calculus > > c) Symbolic function inverses (along with the associated calculus rules) > > or > > d) Better itensor/centsor documentation demonstrating how to handle a > problem similar to mine. Maxima has the capability to have simplification rules added to its built-in simplifier. Here are some: (%i1) kill(all)$ (%i1) display2d:false $ (%i2) matchdeclare(X,lambda([u],get(u,matrixp))) $ (%i3) matchdeclare(t,atom) $ (%i4) put(B,true,matrixp) $ (%i5) depends([A,B],x) $ (%i6) tellsimp('diff(X^^(-1),t),-X^^(-1) . diff(X,t) . X^^(-1)); (%i7) tellsimp('diff('transpose(X),t),transpose(diff(X,t))); tellsimp is a command that adds simplification rules; matchdeclare lets us apply these rules selectively. Now, we can try things out: (%i8) diff(B,x); (%o8) 'diff(B,x,1) (%i9) diff(B^^(-1),x); (%o9) -B^^(-1) . ('diff(B,x,1)) . B^^(-1) The correct answer. (%i10) diff(A,x); (%o10) 'diff(A,x,1) (%i11) diff(A^^(-1),x); (%o11) 'diff(A^^(-1),x,1) Because we have not told Maxima that A is a matrix, the simplifier leaves the expression unevaluated. (%i12) diff(transpose(B),x); (%o12) 'transpose('diff(B,x,1)) Again, the correct answer. (%i13) diff(transpose(B). A . B, x); (%o13) 'transpose('diff(B,x,1)) . A . B+'transpose(B) . ('diff(A,x,1)) . B +'transpose(B) . A . 'diff(B,x,1) Looks good, to.. (%i14) diff(transpose(B). C . B, x); (%o14) 'transpose('diff(B,x,1)) . C . B+'transpose(B) . C . 'diff(B,x,1) Looks good (Maxima treats C as a constant, unlike in %o13). -- Leo Butler SDF Public Access UNIX System - http://sdf.lonestar.org From christian.stengg at gmx.at Sat Feb 18 10:33:38 2012 From: christian.stengg at gmx.at (Christian Stengg) Date: Sat, 18 Feb 2012 17:33:38 +0100 Subject: [Maxima] overview options of draw package Message-ID: <4F3FD2E2.7030009@gmx.at> Hello, is there anywhere an overview of all options (incl. possible values) of draw2d? Thank you, Christian From robert.dodier at gmail.com Sat Feb 18 10:44:07 2012 From: robert.dodier at gmail.com (Robert Dodier) Date: Sat, 18 Feb 2012 09:44:07 -0700 Subject: [Maxima] how to format foreign object? In-Reply-To: <4F3FC987.1090209@gmail.com> References: <4F3FC987.1090209@gmail.com> Message-ID: On 2/18/12, John Lapeyre wrote: > I would like to tell Maxima how to format a particular lisp > struct. I notice that for lisp list expressions there are > some hooks that I don't understand. eg in nset.lisp. For 2-d display, Maxima gets the formatting function name as (GET (CAAR EXPR) 'DIMENSION) and then calls that. For 1-d display, the property is GRIND The display code is pretty obtuse. When I need a display function I always just copy an existing one and then modify that. That only works for ordinary Maxima expressions which have the form ((FOO) ...). If you have some other kind of expression, I guess it won't work; you'd have to hack src/displa.lisp or src/grind.lisp. best Robert Dodier From p3aul1 at cox.net Sat Feb 18 01:20:17 2012 From: p3aul1 at cox.net (Paul) Date: Sat, 18 Feb 2012 02:20:17 -0500 Subject: [Maxima] inequities Message-ID: <4F3F5131.8060700@cox.net> I s Maxima intending to support inequities any time soon? Thanks, Paul From hbaker1 at pipeline.com Sat Feb 18 10:54:15 2012 From: hbaker1 at pipeline.com (Henry Baker) Date: Sat, 18 Feb 2012 08:54:15 -0800 Subject: [Maxima] "Portable" Maxima for PC's ?? Message-ID: Is Maxima available as a "portable" app for Windows ? "Portable" apps don't mess with the Registry, and they require only a limited number of read-only and read-write file locations. This allows the apps to live on a flash memory USB drive and be executed on a PC _without having to install the app on the PC itself_. In normal practise, the app is "installed" on the USB drive, and then merely inserted into the PC. The PC can then merely execute the app directly from the USB drive; all of the usual information that the app needs is on the USB drive, and any databases it needs are also on the USB drive. A Portable Maxima could be carried around on a USB drive, along with all of your own Maxima programs and data, which would allow you to run Maxima on nearly any PC that you have access to -- without having to "install" Maxima on that PC. Thus, if someone has a high performance PC & your home PC is too wimpy, you can plug your Maxima into the more powerful PC for a particularly difficult computation. More information here: http://portableapps.com/ http://portableapps.com/development From willisb at unk.edu Sat Feb 18 11:09:49 2012 From: willisb at unk.edu (Barton Willis) Date: Sat, 18 Feb 2012 11:09:49 -0600 Subject: [Maxima] The letter j as imaginary unit In-Reply-To: <1329555652.56753.YahooMailNeo@web171511.mail.ir2.yahoo.com> References: <1329555652.56753.YahooMailNeo@web171511.mail.ir2.yahoo.com> Message-ID: You might try declaring j to be an alias for %i. The command alias(j,%i) does this. You'll discover that j will print as %i: (%i3) exp(j * x); (%o3) %e^(%i*x) Maybe there is a workaround that prevents j from displaying as %i. Also, the alias command doesn't change the properties of %i--it is still the imaginary unit. Finally, there might be some limitations to alias that I don't know about. You can put the alias command into the Maxima initialization file "maxima-init.mac". To learn how to do this, see http://maxima.sourceforge.net/ui-tips.html. Working with any CAS involves some compromise with preferred notion, I think. Some users aren't thrilled that Maxima displays a+b+c as c+b+a. --Barton -----maxima-bounces at math.utexas.edu wrote: ----- >To: Inl?gg Maximalista >From: Per Liss >Sent by: maxima-bounces at math.utexas.edu >Date: 02/18/2012 03:00AM >Subject: [Maxima] The letter j as imaginary unit > >Hello, I'm am completely new to Maxima and computer algebra systems and >am trying to learn how to make best use of it. After reading and >introductory textbook, I have been now spent some time finding information >on the Internet on how to make Maxima using the letter "j" as the >imaginary unit in order not to make confusion with the symbol "i" for >current. I would like Maxima not only to understand input using "%j" which >I believe could be done by defining a constant, but also produce outputs >using "j" instead of "i". My final goal is to find a way to permanently >configure my installation to use the letter j. I would appreciate any >tips where to find such info. I have searched the archive for this list >and done a general Google search but didn't find any info. My >installation is: Ubuntu Linux on an IBM T42p laptop running wxMaxima 0.8.4 >(don't know hot to extract the Maxima core version) Best Regards, Per >Liss _______________________________________________ Maxima mailing list >Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima From fateman at eecs.berkeley.edu Sat Feb 18 11:54:18 2012 From: fateman at eecs.berkeley.edu (Richard Fateman) Date: Sat, 18 Feb 2012 09:54:18 -0800 Subject: [Maxima] how to format foreign object? In-Reply-To: References: <4F3FC987.1090209@gmail.com> Message-ID: <4F3FE5CA.1070205@eecs.berkeley.edu> On 2/18/2012 8:44 AM, Robert Dodier wrote: > On 2/18/12, John Lapeyre wrote: > >> I would like to tell Maxima how to format a particular lisp >> struct. I notice that for lisp list expressions there are >> some hooks that I don't understand. eg in nset.lisp. > For 2-d display, Maxima gets the formatting function name as > (GET (CAAR EXPR) 'DIMENSION) and then calls that. > For 1-d display, the property is GRIND > > The display code is pretty obtuse. When I need a display function > I always just copy an existing one and then modify that. > > That only works for ordinary Maxima expressions which have > the form ((FOO) ...). If you have some other kind of expression, > I guess it won't work; you'd have to hack src/displa.lisp or src/grind.lisp. > > best > > Robert Dodier > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima If your internal expression is a lisp list of random stuff, then the obvious way to deal with maxima's display (and almost everything else) is to tag it, even though YOU don't need the tag. Robert's suggestion is more like an imperative. If you make it ((my_special_tag) mystuff1 mystuff2 ....) then everything else "works". A more modern approach would be to use an object system (like CLOS) in which each type of structure (= class) has a printing method. Maxima's organization is more around functions (e.g. display, simplify) than around objects (e.g. algebraic sum, matrix, ...) RJF From rswarbrick at gmail.com Sat Feb 18 11:47:10 2012 From: rswarbrick at gmail.com (Rupert Swarbrick) Date: Sat, 18 Feb 2012 17:47:10 +0000 Subject: [Maxima] The letter j as imaginary unit References: <1329555652.56753.YahooMailNeo@web171511.mail.ir2.yahoo.com> Message-ID: <1q4519xkm2.ln2@hake.rswarbrick.dnsalias.com> Per Liss writes: > After reading and introductory textbook, I have been now spent some > time finding information on the Internet on how to make Maxima using > the letter "j" as the imaginary unit in order not to make confusion > with the symbol "i" for current. I would like Maxima not only to > understand input using "%j" which I believe could be done by defining > a constant, but also produce outputs using "j" instead of "i". My > final goal is to find a way to permanently configure my installation > to use the letter j. The symbol %i is hard-coded throughout the source, so I'm pretty certain you just can't. However, %i is not the same as I or i, so I shouldn't think it's all that confusing seeing two of them in the same expression. If you want to be able to enter things using %j, you could start with the line %j: %i; But any calculation producing the imaginary unit will display as %i. If you've an expression that you want to eyeball without those distracting %i symbols, you could always do subst ('%j, %i, myexpr); which will replace them for you. Frankly, I'm not convinced it's worth the effort. Rupert -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 315 bytes Desc: not available URL: From macrakis at alum.mit.edu Sat Feb 18 12:28:33 2012 From: macrakis at alum.mit.edu (Stavros Macrakis) Date: Sat, 18 Feb 2012 13:28:33 -0500 Subject: [Maxima] inequities In-Reply-To: <4F3F5131.8060700@cox.net> References: <4F3F5131.8060700@cox.net> Message-ID: Maxima will fight inequity wherever it is found! Maxima believes in liberty and justice and.... Oh, maybe you meant "inequalities"... Never mind. -s On Sat, Feb 18, 2012 at 02:20, Paul wrote: > I s Maxima intending to support inequities any time soon? > Thanks, > Paul > ______________________________**_________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/**mailman/listinfo/maxima > -------------- next part -------------- An HTML attachment was scrubbed... URL: From willisb at unk.edu Sat Feb 18 12:48:18 2012 From: willisb at unk.edu (Barton Willis) Date: Sat, 18 Feb 2012 12:48:18 -0600 Subject: [Maxima] inequities In-Reply-To: References: , <4F3F5131.8060700@cox.net> Message-ID: >On Sat, Feb 18, 2012 at 02:20, Paul wrote: > Is Maxima intending to support inequities any time soon? We do have fourier elimination (enter ? fourier_elim) and the simplex method (enter ?? simplex); further: (%i17) load(solve_rat_ineq)$ (%i18) solve_rat_ineq( (x-1)^2*(x+1) > 1+x ); (%o18) [[x>-1,x<0],[x>2]] Do any of these packages do what you need? --Barton From pbowyer at olynet.com Sat Feb 18 14:15:27 2012 From: pbowyer at olynet.com (Paul Bowyer) Date: Sat, 18 Feb 2012 12:15:27 -0800 Subject: [Maxima] "Portable" Maxima for PC's ?? In-Reply-To: References: Message-ID: <4F4006DF.4010806@olynet.com> On 02/18/2012 08:54 AM, Henry Baker wrote: > Is Maxima available as a "portable" app for Windows ? > > "Portable" apps don't mess with the Registry, and they require only a limited number of read-only and read-write file locations. > > This allows the apps to live on a flash memory USB drive and be executed on a PC _without having to install the app on the PC itself_. > > In normal practise, the app is "installed" on the USB drive, and then merely inserted into the PC. The PC can then merely execute the app directly from the USB drive; all of the usual information that the app needs is on the USB drive, and any databases it needs are also on the USB drive. > > A Portable Maxima could be carried around on a USB drive, along with all of your own Maxima programs and data, which would allow you to run Maxima on nearly any PC that you have access to -- without having to "install" Maxima on that PC. Thus, if someone has a high performance PC& your home PC is too wimpy, you can plug your Maxima into the more powerful PC for a particularly difficult computation. > > More information here: > > http://portableapps.com/ > > http://portableapps.com/development > > _______________________________________________ > Maxima mailing list > Maxima at math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > Would a web interface satisfy your needs? http://www.vroomlab.com:8081/nhome/# I haven't really used it for anything of any complexity, but it does mention maxima is used. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksasd873 at gmail.com Sat Feb 18 14:41:56 2012 From: aleksasd873 at gmail.com (Aleksas Domarkas) Date: Sat, 18 Feb 2012 22:41:56 +0200 Subject: [Maxima] inequities Message-ID: (%i1) load(solve_rat_ineq)$ (%i2) ineq:(x^2-x-6)/(x^2-7*x+12)<0; (%o2) (x^2-x-6)/(x^2-7*x+12)<0 (%i3) solve_rat_ineq(ineq); (%o3) [[x>-2,x<4]] Is x=3 solution? (%i4) subst(x=3,ineq); expt: undefined: 0 to a negative exponent. -- an error. To debug this try: debugmode(true); Aleksas D -------------- next part -------------- An HTML attachment was scrubbed... URL: From lapeyre.math122a at gmail.com Sat Feb 18 15:39:10 2012 From: lapeyre.math122a at gmail.com (John Lapeyre) Date: Sat, 18 Feb 2012 22:39:10 +0100 Subject: [Maxima] how to format foreign object? In-Reply-To: <4F3FE5CA.1070205@eecs.berkeley.edu