mm-699 === Subject: Re: Maple procedures >Is there anyway way to read how maple procedures are programmed? > In addition to Joe RielÕs suggestion, sometimes showstat(procedure_name) > gives more readable output than eval(procedure_name). And sometimes the > eval(...) will be the more readable one. A disadvantage of showstat, particularly if you want to cut and paste the output, is that it includes line numbers. Here is a simple procedure I threw together to remove the line numbers. PrintProc := proc(p::name,lines::{posint,posint..posint}) local s,width; description Print like showstat, but without line numbers; width := interface(ÔscreenwidthÕ=in[CapitalThorn]nity); try s := sprintf(%s,debugopts(ÔprocdumpÕ= `if`(nargs=1,p,[p,lines]))); # This is a bit crude, but easier than counting the digits in # the line numbers. use StringTools in s := RegSubs(n [0-9] =n ,s); s := RegSubs(n [0-9][0-9] =n ,s); s := RegSubs(n [0-9][0-9][0-9] =n ,s); s := RegSubs(n[0-9][0-9][0-9][0-9] =n ,s); # Decrease initial indentation to 2. s := RegSubs(n =n ,s); end use; printf(%s,s); catch procedure name expected: error %1 is not a procedure name,p [CapitalThorn]nally interface(ÔscreenwidthÕ=width) end try; NULL end: Joe Riel === Subject: Re: Maple procedures > A disadvantage of showstat, particularly if you want to cut and paste > the output, is that it includes line numbers. Here is a simple > procedure I threw together to remove the line numbers. > PrintProc := proc(p::name,lines::{posint,posint..posint}) ... > end: HereÕs a cleaned up version. The separate calls to RegSubs were combined into one large regexp. Note the use of MapleÕs implicit string catenation to write the large regexp. PrintProc := proc(p::name,lines::{posint,posint..posint}) local width; description Print like showstat, but without line numbers; width := interface(ÔscreenwidthÕ=in[CapitalThorn]nity); try printf(%s, StringTools:-RegSubs( n( ( ) |( [1-9]) |( [1-9][0-9]) |( [1-9][0-9][0-9]) |([1-9][0-9][0-9][0-9]) ) = n ,debugopts(ÔprocdumpÕ= `if`(nargs=1,p,[args])))) catch procedure name expected: error %1 is not a procedure name,p [CapitalThorn]nally interface(ÔscreenwidthÕ=width) end try; NULL end: Joe Riel === Subject: Re: Maple procedures > HereÕs a cleaned up version. I had previously avoided using the post[CapitalThorn]x repetition operator in the regular expression (regexp) because I thought it might match an actual code line that started with a number. On reßection, that wonÕt happen because such a line must have a line number, and the line number is what is matched (the n anchors the match). So the regular expression can be replaced by the simpler n *[0-9]+ (or n * [1-9][0-9]* ). I wondered whether this regexp could also match a string like n 1234 that was embedded in a procedure. It wonÕt. The reason is that debugopts converts such a string to n 1234 so that it displays properly, that is, the single return character is replaced with two characters, a backslash and an `nÕ. Here is the procedure with the simpli[CapitalThorn]ed regexp: PrintProc := proc(p::name,lines::{posint,posint..posint}) local width; description Print like showstat, but without line numbers; width := interface(ÔscreenwidthÕ=in[CapitalThorn]nity); try printf(%s, StringTools:-RegSubs( n *[0-9]+ = n ,debugopts(ÔprocdumpÕ= `if`(nargs=1,p,[args])))) catch procedure name expected: error %1 is not a procedure name,p [CapitalThorn]nally interface(ÔscreenwidthÕ=width) end try; NULL end: Joe === Subject: Re: Maple procedures .................... Here is the procedure with the > simpli[CapitalThorn]ed regexp: > PrintProc := proc(p::name,lines::{posint,posint..posint}) > local width; > description Print like showstat, but without line numbers; > width := interface(ÔscreenwidthÕ=in[CapitalThorn]nity); > try > printf(%s, > StringTools:-RegSubs( > n *[0-9]+ = n > ,debugopts(ÔprocdumpÕ= > `if`(nargs=1,p,[args])))) > catch procedure name expected: > error %1 is not a procedure name,p > [CapitalThorn]nally interface(ÔscreenwidthÕ=width) > end try; > NULL > end: I like that: before i had a dirty solution in Excel with copy & paste. But it was simple to remove just the _trailing 7 characters_ for lines of the body. === Subject: Re: Maple procedures > I like that: before i had a dirty solution in Excel > with copy & paste. But it was simple to remove just > the _trailing 7 characters_ for lines of the body. Hmmm, that is simpler. It also points out an error in my previous version, lines with out line numbers are not properly indented. Here is the [CapitalThorn]x (apologies for multiple versions): PrintProc := proc(p::name,lines::{posint,posint..posint}) local width; description Print like showstat, but without line numbers; width := interface(ÔscreenwidthÕ=in[CapitalThorn]nity); try printf(%s, StringTools:-RegSubs( n .... = n ,debugopts(ÔprocdumpÕ= `if`(nargs=1,p,[args])))) catch procedure name expected: error %1 is not a procedure name,p [CapitalThorn]nally interface(ÔscreenwidthÕ=width) end try; NULL end: This works with procedures that have up to 999 numbered lines. It is unlikely that Maple procedures will be longer, however, if you need to handle them, use n( |[1-9]).... for the regexp, that will take you out to 9999. I havenÕt bothered testing beyond that. Joe Riel === Subject: Porting Maxima Hi Does anyone know if it would be possible to port the Maxima CAS to the palm operating system? Is this too big a project for a fairly new coder to undertake? Mike === Subject: Re: Porting Maxima One of the nice parts about Macsyma is the modularity. On the PDP-10 where it was developed in MacLisp, there was a decent sized kernel that was loaded. Additional packages, such as for SOLVE, INTEGRATE, etc. would load up as required. Can you implement such a method for the Palm? If you can remove non-essential lisp features such as the compiler from the [CapitalThorn]nal executable, perhaps you can manage in the available space. My recollection is that DOE-Macsyma on the VAX VMS was about 11 MB, and for the SUN4, Paramax was about 13 MB. These included all of the built-in functions in-core, with autoloads from the SHARE library. > Hi > Does anyone know if it would be possible to port the Maxima CAS to the > palm operating system? Is this too big a project for a fairly new > coder to undertake? > Mike === Subject: Re: Porting Maxima > Does anyone know if it would be possible to port the Maxima CAS to the > palm operating system? Is this too big a project for a fairly new > coder to undertake? Well, [CapitalThorn]rst youÕll need a port of lisp. Apparently LispMe is available for the Palm, it provides a variant of Scheme. IÕd say that porting Maxima would be a nontrivial undertaking... Joe === Subject: Re: Porting Maxima > Does anyone know if it would be possible to port the Maxima CAS to the > palm operating system? Is this too big a project for a fairly new > coder to undertake? > Well, [CapitalThorn]rst youÕll need a port of lisp. Apparently LispMe is available > for the Palm, it provides a variant of Scheme. IÕd say that porting > Maxima would be a nontrivial undertaking... > Joe Try porting my CAS to the palm OS. It will be much easier. Mathomatic is a small, highly portable CAS written entirely in C. Let me know if you succeed in porting it. BTW, it is entirely free, like Maxima. George Gesslein II http://www.mathomatic.com === Subject: roots of polynomials by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i5NC6DP19329; [CapitalThorn]nd out one real root for the following uneven degree equation: f(x)=x^n+ax^m+b=0 n is uneven positive integer m is positive integer less than n f(x) is a rational integeral function of x (a&b) are real rational cooef[CapitalThorn]cients === Subject: Re: roots of polynomials by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i5NDiUi29365; >[CapitalThorn]nd out one real root for the following uneven degree equation: >f(x)=x^n+ax^m+b=0 >n is uneven positive integer >m is positive integer less than n >f(x) is a rational integeral function of x >(a&b) are real rational cooef[CapitalThorn]cients REPLY: DEAR ORGANIZER I found one real root for the case (a=b=1)& m is uneven positive integer,here is the solution: x=-{1-1/n+(2m-n+1)/(2!n^2)-(3m-2n+1)(3m-n+1)/(3!n^3) +(4m-3n+1)(4m-2n+1)(4m-n+1)/(4!n^4) -(5m-4n+1)(5m-3n+1)(5m-2n+1)(5m-n+1)/(5!n^5)+...} In fact, the proof of this (above mentioned equation )is too lengthy and it was part of my interest for so many years. The complete solutions for all cases are also obtainable. I dont know if i could convey this properly. === Subject: Re: roots of polynomials >[CapitalThorn]nd out one real root for the following uneven degree equation: >f(x)=x^n+ax^m+b=0 >n is uneven positive integer >m is positive integer less than n >f(x) is a rational integeral function of x >(a&b) are real rational cooef[CapitalThorn]cients > REPLY: > DEAR ORGANIZER > I found one real root for the case (a=b=1)& m is uneven positive > integer,here is the solution: > x=-{1-1/n+(2m-n+1)/(2!n^2)-(3m-2n+1)(3m-n+1)/(3!n^3) > +(4m-3n+1)(4m-2n+1)(4m-n+1)/(4!n^4) > -(5m-4n+1)(5m-3n+1)(5m-2n+1)(5m-n+1)/(5!n^5)+...} > In fact, the proof of this (above mentioned equation )is too lengthy > and it was part of my interest for so many years. > The complete solutions for all cases are also obtainable. > I dont know if i could convey this properly. Interesting. LetÕs do x^5+x+1. Then your solution is (Maple notation)... > k = 0 .. in[CapitalThorn]nity)) in[CapitalThorn]nity ----- k /1 1 ) 5 5 / - / --------------------------- ----- /6 4 5 5 / Numerically with 100 terms we get -0.7548776662, which is a solution, or symbolically Maple says the sum is: -hypergeom([-1/20, 1/5, 9/20, 7/10], [2/5, 3/5, 4/5],-256/3125) +1/5*hypergeom([3/20, 2/5, 13/20, 9/10], [3/5, 4/5, 6/5],-256/3125) +1/25*hypergeom([7/20, 3/5, 17/20, 11/10], [4/5, 6/5, 7/5],-256/3125) +1/125*hypergeom([11/20, 4/5, 21/20, 13/10], [6/5, 7/5, 8/5],-256/3125) For convergence: Maple says that is asymptotic to a constant times k^(-3/2)*(2^(8/5)/5)^k and since 2^(8/5)/5 < 1, the series converges absolutely. -- G. A. Edgar http://www.math.ohio-state.edu/~edgar/ === Subject: Re: roots of polynomials |>[CapitalThorn]nd out one real root for the following uneven degree equation: |>f(x)=x^n+ax^m+b=0 |>n is uneven positive integer |>m is positive integer less than n |>f(x) is a rational integeral function of x |>(a&b) are real rational cooef[CapitalThorn]cients |>I found one real root for the case (a=b=1)& m is uneven positive |>integer,here is the solution: |>x=-{1-1/n+(2m-n+1)/(2!n^2)-(3m-2n+1)(3m-n+1)/(3!n^3) |> +(4m-3n+1)(4m-2n+1)(4m-n+1)/(4!n^4) |> -(5m-4n+1)(5m-3n+1)(5m-2n+1)(5m-n+1)/(5!n^5)+...} A very interesting formula. It comes, I think, from a series in powers of t for a root of x^n + t x^m - 1. According to Maple: [view in [CapitalThorn]xed-width font] > series(RootOf(x^n + t*x^m - 1, x), t); 1 n - 1 - 2 m 2 (2 n - 1 - 3 m) (n - 1 - 3 m) 3 1 - - t - ----------- t - ----------------------------- t n 2 3 2 n 6 n (3 n - 1 - 4 m) (n - 1 - 4 m) (2 n - 1 - 4 m) 4 - --------------------------------------------- t 4 24 n (n - 1 - 5 m) (3 n - 1 - 5 m) (2 n - 1 - 5 m) (4 n - 1 - 5 m) 5 - ------------------------------------------------------------- t 5 120 n / 6 + Ot / I donÕt know about the convergence of this series. Note that if n and m are odd, x^n + t x^m - 1 = 0 iff (-x)^n + t (-x)^m + 1 = 0. And for a root of z^n + a z^m + b = 0 you can take z = -b^(1/n) x where x is a root of x^n + a b^(m/n-1) x^m - 1 = 0. Robert Israel israel@math.ubc.ca Department of Mathematics http://www.math.ubc.ca/~israel University of British Columbia Vancouver, BC, Canada V6T 1Z2 === Subject: Re: roots of polynomials >A very interesting formula. It comes, I think, from a series in powers >of t for a root of x^n + t x^m - 1. According to Maple: >[view in [CapitalThorn]xed-width font] > series(RootOf(x^n + t*x^m - 1, x), t); > 1 n - 1 - 2 m 2 (2 n - 1 - 3 m) (n - 1 - 3 m) 3 >1 - - t - ----------- t - ----------------------------- t > n 2 3 > 2 n 6 n > (3 n - 1 - 4 m) (n - 1 - 4 m) (2 n - 1 - 4 m) 4 > - --------------------------------------------- t > 4 > 24 n > (n - 1 - 5 m) (3 n - 1 - 5 m) (2 n - 1 - 5 m) (4 n - 1 - 5 m) 5 > - ------------------------------------------------------------- t > 5 > 120 n > / 6 > + Ot / I think this is best viewed as a special case of the Lagrange Inversion Formula. See . Write the equation x^n + t x^m = s as z = s - t z^(m/n) = s + t p(z) where x = z^(1/n) = F(z) and p(z) = - z^(m/n). The Lagrange Inversion Formula says x = F(z) = F(s) + sum_{k=1}^in[CapitalThorn]nity t^k/k! (d/ds)^(k-1) (p(s)^k FÕ(s)) >I donÕt know about the convergence of this series. It will converge for suf[CapitalThorn]ciently small |t|. IÕm not sure exactly how small. Robert Israel israel@math.ubc.ca Department of Mathematics http://www.math.ubc.ca/~israel University of British Columbia Vancouver, BC, Canada V6T 1Z2 === Subject: Re: roots of polynomials > [CapitalThorn]nd out one real root for the following uneven degree equation: > f(x)=x^n+ax^m+b=0 > n is uneven positive integer > m is positive integer less than n > f(x) is a rational integeral function of x > (a&b) are real rational cooef[CapitalThorn]cients The Galois group for x^5+x+3 over the rationals is S5. What do you mean by [CapitalThorn]nd out? -- G. A. Edgar http://www.math.ohio-state.edu/~edgar/ === Subject: Re: roots of polynomials by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i5NFW1408127; Reply to Dr. G.A.Edgar this equation of an odd degree,therefore,it must intersects x-axes at least at one point,that is what I mean by ([CapitalThorn]nd out) that point of intersection.now if i assume (a&b) are real cooef[CapitalThorn]cients rather than real rational coof[CapitalThorn]cients ,would that make it uncofusiable. I saw a strange formula (on the same topic)from mr.karzeddin.I have been exersizing that formula for (n=5 )& (m=1 or 3)& surprizingly it gives me very close values of intersections(f(x)& x-axes) as long as I take more elements of that mentioned series I hoop,this would make it clear. sincerely yours === Subject: Re: f(x,y)= {f(x)*f(y) or f(x)+f(y) or f(x)*f(y) +f(x)} etc.} >basically I want to know be able to check to see if a multi valued >nonlinearity can be separated in terms of signal valued > nonlinearities >under addition and multiplication. Does maple have any built in >procedures to do this? >P.S. Does expand fully expand or does it only expand under the > current >opperator which you can [CapitalThorn]nd out by calling whattype. > Something of this sort came up not long ago in > A recommendation therein is to look at: > Frederick W. Chapman. An elementary algorithm for the automatic > derivation and proof of tensor product identities via computer > algebra. > Algebraic > The idea is to factor a bivariate function as a sum of products of > Maple) for this purpose. > Daniel Lichtblau > Wolfram Research I am interested in a similar problem but slightly simpler. f(x+y)=sum(g_n(x)g_m(y),m,n) I was thinking you could just sub x+y in for x use expand and Then check to see if each term in the product of each term in the sum only contained x or y. Some problems I could see with this approach is f may already contain the variable y. This leads to questions of scope of variables. What are maples rules for scope of variables anyway? Also the question remains should I assume anything about x and y. I guess I could assume they are real. I could also use about x or about y to make sure I donÕt mess up any previous assumptions. === Subject: Re: f(x,y)= {f(x)*f(y) or f(x)+f(y) or f(x)*f(y) +f(x)} etc.} >basically I want to know be able to check to see if a multi valued >nonlinearity can be separated in terms of signal valued > nonlinearities >under addition and multiplication. Does maple have any built in >procedures to do this? >P.S. Does expand fully expand or does it only expand under the > current >opperator which you can [CapitalThorn]nd out by calling whattype. > Something of this sort came up not long ago in > A recommendation therein is to look at: > Frederick W. Chapman. An elementary algorithm for the automatic > derivation and proof of tensor product identities via computer > algebra. > Algebraic > The idea is to factor a bivariate function as a sum of products of > Maple) for this purpose. > Daniel Lichtblau > Wolfram Research I am interested in a similar problem but slightly simpler. f(x+y)=sum(g_n(x)g_m(y),m,n) I was thinking you could just sub x+y in for x use expand and then check to see if each term in the product of each term in the sum only contained x or y. Some problems I could see with this approach is f may already contain the variable y. This leads to questions of scope of variables. What are maples rules for scope of variables anyway? Also the question remains should I assume anything about x and y. I guess I could assume they are real. I could also use about x or about y to make sure I donÕt mess up any previous assumptions. === Subject: PascalÕs Triangle in CAS Does any CAS system directly support building number walls? Extension packages? === Subject: Re: PascalÕs Triangle in CAS > Does any CAS system directly support building number walls? Extension > packages? IÕm pretty sure this is easy in all systems. In Maple, itÕs a one-liner: > for n from 0 to 5 do seq(binomial(n,k),k=0..n) end do; 1 1, 1 1, 2, 1 1, 3, 3, 1 1, 4, 6, 4, 1 1, 5, 10, 10, 5, 1 -- Thomas Richard Maple Support Scienti[CapitalThorn]c Computers GmbH http://www.scienti[CapitalThorn]c.de === Subject: Re: PascalÕs Triangle in CAS > Does any CAS system directly support building number walls? Extension > packages? > IÕm pretty sure this is easy in all systems. In Maple, itÕs a one-liner: > for n from 0 to 5 do seq(binomial(n,k),k=0..n) end do; > 1 > 1, 1 > 1, 2, 1 > 1, 3, 3, 1 > 1, 4, 6, 4, 1 > 1, 5, 10, 10, 5, 1 === Subject: implementation of the complex airy function I am looking for an implementation of the complex airy function in C/C++/C#. Can anybody help me [CapitalThorn]nd a piece of code for this function ? Laurent === Subject: Re: implementation of the complex airy function > I am looking for an implementation of the complex airy function > in C/C++/C#. Can anybody help me [CapitalThorn]nd a piece of code for this > function ? > Laurent You might look for it in Fortran and convert. Abramowitz & Stegun discuss the function and approximations to it. -- Julian V. Noble Professor Emeritus of Physics jvn@lessspamformother.virginia.edu ^^^^^^^^^^^^^^^^^^ http://galileo.phys.virginia.edu/~jvn/ For there was never yet philosopher that could endure the toothache patiently. -- Wm. Shakespeare, Much Ado about Nothing. Act v. Sc. 1.