## maxima-discuss — Maxima discussion list

You can subscribe to this list here.

 2014 2015 Jan Feb (232) Mar (323) Apr (383) May (359) Jun (435) Jul (252) Aug (172) Sep (265) Oct (263) Nov (350) Dec (359) Jan (267) Feb (220) Mar (311) Apr (269) May (388) Jun (403) Jul (64) Aug Sep Oct Nov Dec
S M T W T F S

1

2

3

4

5

6

7
(1)
8

9
(3)
10
(3)
11
(1)
12
(7)
13
(8)
14
(13)
15
(18)
16
(13)
17
(11)
18
(17)
19
(25)
20
(22)
21
(10)
22
(2)
23
(16)
24
(5)
25
(11)
26
(10)
27
(10)
28
(26)

Showing 16 results of 16

 Re: [Maxima-discuss] rules and patterns for non-commuting multiplication From: Robert Dodier - 2014-02-23 23:52:32 ```On 2014-02-20, Mark wrote: > Let's say I have two atoms a and b, they can be non-commutatively > multiplied, and should satisfy the rule > > a.b = b.a + 1 > > now it is (far too) simple to > > tellsimp(a.b,b.a+1); > > But this will only apply the rule to > a.b > The generic case of any product, with any number and order of a and b, > is not expanded according to a.b = b.a + 1. > > How would one do this? I think I figured it out (after several attempts of varying success). As you have observed, the problem is that Maxima won't match a pattern with 2 operands to an expression with more than 2. I've worked around that by regrouping any instance of a.b so that it matches (function FOO in the code). Also, I set a couple of global flags -- dotexptsimp=false so that products aren't rolled up into exponents and dotdistrib=true so that stuff.(b.a + 1) is expanded automatically. Also, sometimes 'expand' is needed at the end to convince Maxima to simplify stuff*(foo + bar). There's more that could be said but anyway let's just see some examples. load ("boson.mac"); a.b; => b . a + 1 a.a.b.b; => a . a . b . b apply1 (a.a.b.b, boson_rule); => b . b . a . a+2*(b . a+1)+2*b . a expand (apply1 (a.a.b.b, boson_rule)); => b . b . a . a+4*b . a+2 ev (%, dotexptsimp=true); => b^^2 . a^^2+4*b . a+2 /* http://arxiv.org/pdf/quant-ph/0507206.pdf example on p 8 */ expand (apply1 (a.b.a.a.b.a.a.b, boson_rule)); => b . b . b . a . a . a . a . a+9*b . b . a . a . a . a+18*b . a . a . a+6*a . a ev (%, dotexptsimp=true); => b^^3 . a^^5+9*b^^2 . a^^4+18*b . a^^3+6*a^^2 The main problem solved here is that Maxima needs encouragement to group n-ary operands by twos. It is plausible that functionality might be incorporated into automatically-generated rules -- I'll think about that. best Robert Dodier PS. \$ cat boson.mac dotexptsimp : false; dotdistrib : true; tellsimp (a . b, b . a + 1); matchdeclare (aa, lambda ([e], not atom(e) and op(e) = ".")); defrule (boson_rule, aa, apply (".", FOO (args (aa)))); FOO (l) := collect (for i thru length (l) do if i < length (l) and l[i] = 'a and l[i + 1] = 'b then (emit (a . b), i : i + 1) else emit (l[i])); collect (e) ::= buildq ([e], block([stuff : []], e, stuff)); emit (x) := push (x, stuff); push (xx, yy) ::= buildq ([xx, yy], yy : append (yy, [xx])); ```
 Re: [Maxima-discuss] Naive Use of the Lambda Function with Quadpack Double Integrals From: Leo Butler - 2014-02-23 23:14:59 ```> From: Edwin Woollett > Date: Sun, 23 Feb 2014 12:48:39 -0800 > Content-Type: text/plain; charset="us-ascii" > > I have been following the discussion of quadpack numerical double > integrals with the present state of Maxima with interest, particularly > the code written by Leo Butler. > > My lack of knowledge about the use of the anonymous lambda function > in this context is an opportunity, for me, to learn something new. > > I was trying to help a college classmate with setting up the calulation > of a large number of double numerical integrals needed to compute the > mass profile of a thin galaxy disc, predicted by a very unusual model. > ----------------------------------------------------------- > > How can I get the explicit (x,th) dependent expression myexpr used inside > this lambda function to work in this context? Here is what the code I posted does: (%i17) mintegrate(myexpr,[x,th],[0,0],[2*%pi,20],%quad_qags,[epsrel=1e-8,epsabs=0.0,limit=100]); (%o17) %quad_qags(lambda([th], %quad_qags( lambda([x], .7886751345948129*x*%e^-x /(x^2 +.2988584907226844 *(.5773502691896258 *sin(th) +cos(th))*x+1) ^(3/2)),x,0,2*%pi, epsrel = 1.e-8,epsabs = 0.0, limit = 100)),th,0,20, epsrel = 1.e-8,epsabs = 0.0,limit = 100) (%i18) ''%; (%o18) 3.904464256327696 Leo ```
 Re: [Maxima-discuss] [Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_32-base-61-g793ed00 From: Volker van Nek - 2014-02-23 21:44:50 ```Steve and Robert, thanks for your help. I am not familiar with terminal editors like /usr/bin/vim, so the -F file option might be a good alternative. I will give it a try. Volker Am 23.02.2014 20:53, schrieb Robert Dodier: > On 2014-02-23, Steve Haflich wrote: > >> If you omit the -m argument, git will try to connect to your local editor >> server (emacs, vim, whatever) providing a commit message template. > > For example, in a bash shell (typical Linux environment), I think one > could enter > > EDITOR=\$whatever git commit > > where whatever=/usr/bin/vim or something. > > HTH > > Robert Dodier > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > ```
 Re: [Maxima-discuss] Odd Error When Integrating a Complicated Function From: Robert Dodier - 2014-02-23 20:51:17 ```On 2014-02-23, Sean Lake wrote: > fun : n/(2*%pi*sigt * sigr) * exp( -1/(2*sigt^2) * ( n*logtheta - log( thetasee^n + exp(n*logr) / Da^n ) )^2 - 1/(2*sigr^2) * ( logr - mu_r )^2 ); > integrate( fun, logr, minf, inf ); > > Is n positive, negative or zero? > > pos; > Is mu_r positive, negative or zero? > > pos; > Binding stack exhausted. Well, that's a bug -- a little debugging indicates that Maxima gets stuck in LIMIT calling SIMPLIMIT calling SIMPLIMLN calling LIMIT ... If you have time, can you enter a bug report about this problem: http://sourceforge.net/p/maxima/bugs You will need to create a Sourceforge login in order to create a bug report -- sorry for the bother. I find that I can avoid error by asserting that various constants are positive. I don't know why that avoids the problem. assume (n > 0, mu_r > 0, sigr > 0, sigt > 0); integrate (fun, logr, minf, inf); => ('integrate noun expression) Sorry I can't be more helpful, Robert Dodier ```
 [Maxima-discuss] Naive Use of the Lambda Function with Quadpack Double Integrals From: Edwin Woollett - 2014-02-23 20:48:44 ```I have been following the discussion of quadpack numerical double integrals with the present state of Maxima with interest, particularly the code written by Leo Butler. My lack of knowledge about the use of the anonymous lambda function in this context is an opportunity, for me, to learn something new. I was trying to help a college classmate with setting up the calulation of a large number of double numerical integrals needed to compute the mass profile of a thin galaxy disc, predicted by a very unusual model. These double integrals all depend on four or five parameters: a, b, c, p, q, and y. The eventual goal was to define a function for each type of integral and then sum the values for a range of values of y from zero to, say, 10. If I remain in a purely interactive mode, as a start, and consider a typical double integral calculation using quadpack, it goes like this: ---------------------------------------------- Maxima 5.31.2 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL) (%i1) (a : float(1/sqrt(2)), b : float(1/sqrt(3)), p : 1 + b, q : 1 - b, y : 1, t4 : p*y/2, D2 : (x^2 + y^2 + a*q*x*y*(cos(th) + b*sin(th)))^(3/2), myexpr : x*exp(-x)*t4/D2); (%o1) 0.78867513459481*x*%e^-x/(x^2+0.29885849072268 *(0.57735026918963*sin(th)+cos(th))*x+1) ^(3/2) (%i2) quad_qags(quad_qags(myexpr,th,0,2*%pi)[1],x,0,20)[1]; quad_qags: Cannot numerically evaluate 0.78867513459481*x*%e^-x/(x^2+0.29885849072268 *(0.57735026918963*sin(th)+cos(th))*x +1) ^(3/2) at 3.141592653589793 -- an error. To debug this try: debugmode(true); (%i3) quad_qags(quad_qags('lambda([x,th], myexpr),th,0,2*%pi)[1],x,0,20)[1]; quad_qags: Cannot numerically evaluate quad_qags(lambda([x,th],myexpr),th,0,2*%pi,epsrel = 1.0E-8, epsabs = 0.0,limit = 200)[ 1] at 10.0 -- an error. To debug this try: debugmode(true); (%i4) quad_qags(quad_qags('lambda([x,th], ''myexpr),th,0,2*%pi)[1],x,0,20)[1]; quad_qags: Cannot numerically evaluate errexp1 at 10.0 -- an error. To debug this try: debugmode(true); (%i5) quad_qags(quad_qags('lambda([x,th], ev(myexpr)),th,0,2*%pi)[1],x,0,20)[1]; quad_qags: Cannot numerically evaluate quad_qags(lambda([x,th],ev(myexpr)),th,0,2*%pi,epsrel = 1.0E-8, epsabs = 0.0,limit = 200)[ 1] at 10.0 -- an error. To debug this try: debugmode(true); (%i7) quad_qags(quad_qags('lambda([x,th], ev(myexpr,eval)),th,0,2*%pi)[1],x,0,20)[1]; quad_qags: Cannot numerically evaluate quad_qags(lambda([x,th],ev(myexpr,eval)),th,0,2*%pi,epsrel = 1.0E-8, epsabs = 0.0,limit = 200)[ 1] at 10.0 -- an error. To debug this try: debugmode(true); (%i8) myexpr; (%o8) 0.78867513459481*x*%e^-x/(x^2+0.29885849072268 *(0.57735026918963*sin(th)+cos(th))*x+1) ^(3/2) ----------------------------------------------------------- How can I get the explicit (x,th) dependent expression myexpr used inside this lambda function to work in this context? Ted Woollett ```
 Re: [Maxima-discuss] [Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_32-base-61-g793ed00 From: Robert Dodier - 2014-02-23 19:53:58 ```On 2014-02-23, Steve Haflich wrote: > If you omit the -m argument, git will try to connect to your local editor > server (emacs, vim, whatever) providing a commit message template. For example, in a bash shell (typical Linux environment), I think one could enter EDITOR=\$whatever git commit where whatever=/usr/bin/vim or something. HTH Robert Dodier ```
 Re: [Maxima-discuss] factory functions - howto From: Barton Willis - 2014-02-23 13:47:34 ```> Given some function f(t,p). I'd like to write a function (macro?) > which generates the function t->f(t,p0) for some given p0. Try the buildq macro; example (pfa = partial function application) (%i1) pfa(f, yo) := block([x : gensym()], buildq([x, g : f(x,yo)], lambda([x], g))); (%o1) pfa(f,yo):=block([x:gensym()],buildq([x,g:f(x,yo)],lambda([x],g))) Test--the function argument is purely symbolic (%i2) pfa(g,2014); (%o2) lambda([g33825],g(g33825,2014)) Apply this function to 42 (%i3) %(42); (%o3) g(42,2014) Function argument is a lambda form (%i4) pfa(lambda([p,q], p^2 + q^2),%pi); (%o4) lambda([g33826],g33826^2+%pi^2) Evaluation at 1 yields %pi^2 + 1 (%i5) %(1); (%o5) %pi^2+1 Function argument defined locally as a lambda form (%i6) pfa(g,2014), g : lambda([p,q],p+q); (%o6) lambda([g33827],g33827+2014) And the reason for the gensym is pfa(g,x) =/= lambda([x], g(x,x)); example (%i7) pfa(g,x); (%o7) lambda([g33828],g(g33828,x)) (%i8) pfa(lambda([x,y],x+y),x); (%o8) lambda([g33829],x+g33829) Enter ?? buildq to read the user documentation. --Barton ```
 Re: [Maxima-discuss] [Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_32-base-61-g793ed00 From: Steve Haflich - 2014-02-23 13:43:48 Attachments: Message as HTML ```If you omit the -m argument, git will try to connect to your local editor server (emacs, vim, whatever) providing a commit message template. Of course the editor must be set up, and you need to be familiar with that editor on whichever host you are using, so instead you can compose the message in a file and use the -F filename option to git commit. Git is a complex system that can be overwhelming unless one wants to devote long study to it (except for the simple, vanilla operations). But it is very well self documenting. Every git command accepts the --help option e.g. "git commit --help" which will emit many pages of options. You would have found the -F option that way. ```
 [Maxima-discuss] factory functions - howto From: Helmut Jarausch - 2014-02-23 12:44:20 ```Hi, I still don't understand the mechanism of quoting. Given some function f(t,p). I'd like to write a function (macro?) which generates the function t->f(t,p0) for some given p0. Among others I've tried F(p):= block(return(lambda([t],f(t,''p)))); but F(1) still doesn't return lambda([t],f(t,1)) What am I missing? Many thanks for your help, Helmut ```
 Re: [Maxima-discuss] [Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_32-base-61-g793ed00 From: Volker van Nek - 2014-02-23 11:45:56 ```Am 23.02.2014 01:31, schrieb Robert Dodier: > On 2014-02-22, Volker van Nek wrote: > >> I have uploaded new code (and some comments) for fppi1 resp. comppi >> which I regard as a bugfix and an improvement. >> >> I performed tests in which I compared the original code from Bill >> Gosper, the revision I made in 2007 and todays code. > > Looks good to me. Thanks & keep up the good work. > > As an aside, I think that it might make sense to paste some/all of the > test results into the commit log. It might forestall some questions > about the commit (or it might not -- YMMV). Just something to consider. > I know that my commit comments are always quite short. My knowledge about git is limited. I only know git commit -a -m "bla" and I don't know how to make formatting (line breaks etc.) inside of "bla". How can I create a commit.log? Can someone help with a command or with a reference where I can read that? Thanks Volker > best > > Robert Dodier > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > ```
 Re: [Maxima-discuss] Odd Error When Integrating a Complicated Function From: Sean Lake - 2014-02-23 11:20:24 ```Thought I should add: Maxima 5.32.1 http://maxima.sourceforge.net using Lisp SBCL 1.1.14 On Feb 23, 2014, at 3:18, Sean Lake wrote: > Hello all, > The following commands make for some odd errors. I'm trying to sum over an irrelevant degree of freedom in a quasi log-normal 2d distribution. I don't actually expect Maxima to be able to do the integral, but would be pleasantly surprised if it could. Regardless, it shouldn't produce an error. > > fun : n/(2*%pi*sigt * sigr) * exp( -1/(2*sigt^2) * ( n*logtheta - log( thetasee^n + exp(n*logr) / Da^n ) )^2 - 1/(2*sigr^2) * ( logr - mu_r )^2 ); > integrate( fun, logr, minf, inf ); > > Is n positive, negative or zero? > > pos; > Is mu_r positive, negative or zero? > > pos; > INFO: Binding stack guard page unprotected > Binding stack guard page temporarily disabled: proceed with caution > Maxima encountered a Lisp error: > > Binding stack exhausted. > > PROCEED WITH CAUTION. > > Automatically continuing. > To enable the Lisp debugger set *debugger-hook* to nil. > INFO: Binding stack guard page reprotected ```
 [Maxima-discuss] Odd Error When Integrating a Complicated Function From: Sean Lake - 2014-02-23 11:18:44 ```Hello all, The following commands make for some odd errors. I'm trying to sum over an irrelevant degree of freedom in a quasi log-normal 2d distribution. I don't actually expect Maxima to be able to do the integral, but would be pleasantly surprised if it could. Regardless, it shouldn't produce an error. fun : n/(2*%pi*sigt * sigr) * exp( -1/(2*sigt^2) * ( n*logtheta - log( thetasee^n + exp(n*logr) / Da^n ) )^2 - 1/(2*sigr^2) * ( logr - mu_r )^2 ); integrate( fun, logr, minf, inf ); Is n positive, negative or zero? pos; Is mu_r positive, negative or zero? pos; INFO: Binding stack guard page unprotected Binding stack guard page temporarily disabled: proceed with caution Maxima encountered a Lisp error: Binding stack exhausted. PROCEED WITH CAUTION. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. INFO: Binding stack guard page reprotected ```
 [Maxima-discuss] debugging with wxmaxima? From: Helmut Jarausch - 2014-02-23 11:15:04 ```Hi, is it possible to use Maxima's source debugging with WxMaxima? For me, if Maxima hits a break point I cannot enter anything in WxMaxima. What am I missing? Many thanks for a hint, Helmut ```
 Re: [Maxima-discuss] quadpack double integral error in v. 5.31.2 From: Robert Dodier - 2014-02-23 00:47:25 ```On 2014-02-21, Raymond Toy wrote: > Suggestions on what I should do? Should I revert the change? Should > we just say you have to quote the inner calls to quadpack? The former > is not so nice since some bug was fixed, but the latter is not nice > either since that's an incompatible change. Well, I can see advantages either way, but I am learning towards reverting the change. Maxima has a general policy (not consistently enforced) of returning a partial result when there is not enough data to derive a numerical result. Returning a partially-evaluated function call is consistent with that policy, and any kind of error is inconsistent with it. An error is essentially an assertion that it doesn't make sense in the current context, and furthermore there is no context in which it could possibly make sense. The latter part is difficult to prove, so I claim errors should be used but sparingly. best Robert Dodier ```
 Re: [Maxima-discuss] [Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_32-base-61-g793ed00 From: Robert Dodier - 2014-02-23 00:32:25 ```On 2014-02-22, Volker van Nek wrote: > I have uploaded new code (and some comments) for fppi1 resp. comppi > which I regard as a bugfix and an improvement. > > I performed tests in which I compared the original code from Bill > Gosper, the revision I made in 2007 and todays code. Looks good to me. Thanks & keep up the good work. As an aside, I think that it might make sense to paste some/all of the test results into the commit log. It might forestall some questions about the commit (or it might not -- YMMV). Just something to consider. best Robert Dodier ```
 Re: [Maxima-discuss] quadpack double integral error in v. 5.31.2 From: Leo Butler - 2014-02-23 00:04:26 ```> >> > Perhaps this is an evaluation issue, where the outer > >> > quad_qags is evaluating the integrand, causing the inner > >> > quad_qags to be evaluated which triggers the error? > >> > >> Pretty sure the the inner call is being evaluated first > >> (according to standard evaluation policy) and that's why it > >> triggers an error -- the variable of integration of the outer > >> call isn't assigned a value yet. When the outer call evaluates > >> its integrand, it will succeed since by then both variables are > >> defined. > > Leo> Yes, that is what is happening, and that is why the code that > Leo> I posted works: it wraps inner calls in lambda forms to > Leo> prevent premature evaluation of the inner calls to quad_*. > > Suggestions on what I should do? Should I revert the change? Should > we just say you have to quote the inner calls to quadpack? The former > is not so nice since some bug was fixed, but the latter is not nice > either since that's an incompatible change. > I am inclined to leave the patch as is. The thing that is fouling up the recursive application of quadpack functions is Maxima's normal evaluation rules. So, it seems to me, the fix would be to offer a front-end for multi-variable integrals so that an end-user does not need to think about whether inner calls need to be quoted or not. Perhaps Ted could weigh in, though, since he called attention to this situation. Leo ```

Showing 16 results of 16