## 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 (47) Aug Sep Oct Nov Dec

Showing results of 5298

<< < 1 2 3 4 .. 212 > >> (Page 2 of 212)
 Re: [Maxima-discuss] Ordered pairs in Maxima From: Ronald Modesitt - 2015-07-01 22:00:02 Attachments: Message as HTML Stavros, As usual you have given me plenty to think about. I like the lists approach and think that will work for me. I really appreciate the help. Ron PS: Do you have a favorite Complex Analysis book? Ronald F. Modesitt 1215 Ptarmigan Dr. Longmont, CO 80504 303-485-3887 On Tue, Jun 30, 2015 at 4:27 PM, Stavros Macrakis (Σταῦρος Μακράκης) < macrakis@...> wrote: > A more "structured" approach would be to use a specific operator for your > complex pairs, e.g., complex. You don't need to declare it or anything: > > complex(2,-3) represents 2-3*%i > > creal(ob) := if op(ob)='complex then part(ob,1) else error("Not > complex",ob)$> cimag(ob) := if op(ob)='complex then part(ob,2) else error("Not > complex",ob)$ > > cmult(a,b) := complex( creal(a)*creal(b) - cimag(a)*cimag(b), > ..... ) > > (For the efficiency-hounds out there, yes, this will be a little slower, > but I doubt that the original poster is planning to do millions of > calculations with these objects, so it doesn't matter.) > > By the way, this (and the previous approach using lists) all allows > symbolic as well as numeric values, e.g., > > cmult(complex(2,q), complex(r,3)) => complex(2*r-3*q,q*r+6) > > > > On Tue, Jun 30, 2015 at 5:07 PM, Stavros Macrakis (Σταῦρος Μακράκης) < > macrakis@...> wrote: > >> In Maxima, you can treat lists as vectors (with the default value of >> listarith:true): >> >> [1,2] + [2,3] => [3,5] >> >> Operations are pairwise, so of course though addition corresponds to >> complex addition, multiplication doesn't. >> >> You can of course define: >> >> padd(a,b) := [ a[1]+b[1], a[2]+b[2]]$>> pmult(a,b) := [ a[1]*b[1] - a[2]*b[2], a[1]*b[2] + a[2]*b[1] ]$ >> >> etc. >> >> Does that help? >> >> On Tue, Jun 30, 2015 at 5:01 PM, Ronald Modesitt < >> ronald.modesitt.835@...> wrote: >> >>> >>> Can anyone direct me to a discussion of, or a package for the >>> mathematics of ordered pairs in Maxima? >>> >>> I am reviewing complex numbers which begins with ordered pairs in my >>> textbook. >>> >>> Thanks >>> Ron >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Don't Limit Your Business. Reach for the Cloud. >>> GigeNET's Cloud Solutions provide you with the tools and support that >>> you need to offload your IT needs and focus on growing your business. >>> Configured For All Businesses. Start Your Cloud Today. >>> https://www.gigenetcloud.com/ >>> _______________________________________________ >>> Maxima-discuss mailing list >>> Maxima-discuss@... >>> https://lists.sourceforge.net/lists/listinfo/maxima-discuss >>> >>> >> > 
 [Maxima-discuss] Risch, user interfaces, visual languages ... was Re: ​Re: in case you find yourself in Portland From: Richard Fateman - 2015-07-01 21:52:16 On 7/1/2015 11:08 AM, Marduk Bolaños wrote: >> If Maxima ain't good at inequality resolution, it doesn't make it small >> anywhere because its an algorithm that remains to be coded. > Well, that's like saying "If you are not a good piano player, that does > not mean you are a worse musician than those that play well. You just > have to learn how to do it." > > Seriously, the fact that Maxima does not implement the Risch algorithm > in its full glory and Axiom does should not be taken lightly. Actually, this may be less obvious than you think. Last I heard, Axiom did NOT implement the "complete" Risch "algorithm". But maybe you know more? Also (as you seem to know, partly) it is not an algorithm. Neither is it a decision procedure, since a sub-problem requires solving the (provably unsolvable) zero-equivalence determination test over the class of expressions supposedly being integrated. Also, the Risch procedure addresses the [1] indefinite symbolic antiderivative problem [2] in terms of elementary functions. Both items [1] and [2] are substantial defects to the problem of interest, which is to find the (perhaps non-elementary) definite integral of expressions with parameters, in terms of the functions of applied mathematics, or that failing, a good numerical procedure for evaluating the integral in question. Mostly effective numerical procedures fill the needs of almost every computational scientist. So much so that searching for closed forms in practice may be primarily of interest in the case of iterated (multi-dimensional) integrals where getting some of the results symbolically is helpful. So, nice as it is to have a good implementation of the ideas from Risch's work, e.g. from Manuel Bronstein, it is really of more interest in theory than practice. > Both have > been around since about the same time. Maxima came from Macsyma, Axiom from Scratchpad. circa 1967, though each had earlier roots. > I know that it is not an > algorithm, but a decision method and it is rather lengthy and difficult > to implement. But still it has to be done. See below for my proposal. > >> There is need of new thoughts in CAS, say Visual programming languages or >> semantic pattern matching or knowledge representation or more... > I think that the developers of Computer Algebra Systems have to start > working on automating the process of implementing symbolic algorithms in > a similar vein to FLAME (http://www.cs.utexas.edu/~flame/web/). That > would allow implementing every algorithm in every CAS with a > considerable reduction of effort. I don't see why you believe this. FLAME has to do with dense linear algebra written in C. If you want to look at a project with people actually doing Computer Algebra, implementing each known algorithm over again in a language that is only slightly unsuitable, you can look up SymPy. Python-based routines for CAS. > One of the most interesting outcomes > of the FLAME project is the language-independent representation of > algorithms in XML and the development of a source-to-source translator > that generates code in any programming language. To me this sounds implausible for symbolic systems because the representation in XML of even the simplest primitives in an actual CAS would not be language-independent. For example, "+" means quite different things in Maxima, Mathematica, Maple, Matlab (which of course is NOT really a CAS), Axiom, Fricas. If you have some evidence that XML is suitable for non-trivial interlanguage communication between any two of these systems, I'd like to see it! > > See ftp://net9.cs.utexas.edu/pub/techreports/tr08-49.pdf (1) dates from 2008 (2) deals with the language of matrices of floating-point numbers. (3) hence not the evidence I would like to see. > > > Speaking of visual programming, this paper discusses the integration of > FLAME with LabView: > > http://www.cs.utexas.edu/users/flame/pubs/flawn38.pdf Since FLAME does only dense linear algebra, it is addressing a very small subset of what might facetiously be referred to as "Anything anyone calls mathematics". True, it is a subset that is of considerable use in scientific computation. But it is not "symbolic". There is a long history of visual programming in CAS, e.g. MathCAD, or LiveMath, or Theorist or Graphing Calculator ....and others as well. They haven't really caught on, so far as I can tell. There is a survey article http://www.cs.berkeley.edu/~fateman/temp/kajler-soiffer.pdf that dates from 1998, which covers most of the topics up to 1998, and probably those that have been (re-) invented subsequently :) . More textual ones (TK Solver) may have had more of an impact. My own experiments with stylus/tablet interfaces suggests that a big, mostly-unexploited, opportunity for hacking interfaces is speech. You can, after all, speak into your phone. And it is arguably easier to speak math than to scribble it on your phone, and get it right. Or at least close enough so you can correct it. Richard 
 Re: [Maxima-discuss] Breaking a Segment From: Stavros Macrakis (Σταῦρος Μακράκης) - 2015-07-01 20:07:54 Attachments: Message as HTML On Wed, Jul 1, 2015 at 3:58 PM, Robert Dodier wrote: > mean_max_du(n,nreps):= > mean(makelist(block([u:sort(makelist(random(1.0),n)),du], > du:rest(u)-rest(u,-1),lmax(du)),nreps))$> To include the end pieces, how about: mean_max_du(n,nreps):= mean(makelist(block([u:sort(append([0,1], makelist(random(1.0),n-1))),du], du:rest(u)-rest(u,-1),lmax(du)),nreps))$ 
 Re: [Maxima-discuss] Breaking a Segment From: Robert Dodier - 2015-07-01 19:59:14 On 2015-06-28, Lorenzo Isella wrote: > My problem is the following: I have a unit segment and I take k > points, from random distribution in [0,1] along this segment. > Let's say that the k points are already ordered so that > x_1<=x_2<=...<=x_k. I thus break the segment into k+1 fragments. > Now, my problem is to determine the expectation value of the maximum > interval between two consecutive numbers (in other words: I fragment > at random a [0,1] segment and I want to have the expectation size of > the largest fragment). I've made some progress. Maybe this will help. This discussion [1] says the distribution of the difference of the r'th and s'th order statistics of a sample from a uniform distribution is Beta(s - r, n - s + r + 1) with 1 <= r < s <= n where n is the sample size. (Note that this ignores the segments at the ends of the interval -- a more careful analysis would take those into account.) For s = r + 1 (i.e. successive differences), that's Beta(1, n). The maximum of an independent random sample has a cumulative distribution function which is the product of the c.d.f.'s of the sample elements. So, supposing the differences are independent (this is certainly incorrect, since they are constrained to sum to less than 1), the c.d.f. of the maximum interval size is just P(w, n)^n where P(w, n) is the c.d.f. of a Beta(1, n) variable, i.e. 1 - (1 - w)^n, and the corresponding probability density function is diff(P(w, n), w) and finally the expected value is integrate(w*diff(P(w, n), w), w, 0, 1). Although that's just a polynomial in w, Maxima needs some help to solve it -- changing variables from w to w1 = 1 - w enables Maxima to solve it and the result is 1 - n*beta(n, (n + 1)/n) where beta(x, y) = gamma(x)*gamma(y)/gamma(x + y). Comparing that result to a simulation, namely mean_max_du(n,nreps):= mean(makelist(block([u:sort(makelist(random(1.0),n)),du], du:rest(u)-rest(u,-1),lmax(du)),nreps))$it seems that the approximation is poor for small n but gets better as n increases. E.g. for n=10, 1 - n*beta(n, (n + 1)/n) = 0.248... while mean_max_du(10, 10000) = 0.257, and for n=100, the former is 0.0505 while the latter is 0.0513. Hope I haven't made too many mistakes -- you'll want to verify these results. Remember I've assumed independence and ignored the end pieces. best Robert Dodier [1] http://math.stackexchange.com/questions/68749/difference-of-order-statistics-in-a-sample-of-uniform-random-variables   Re: [Maxima-discuss] ​Re: in case you find yourself in Portland From: Stavros Macrakis (Σταῦρος Μακράκης) - 2015-07-01 19:29:41 Attachments: Message as HTML Marduk, I certainly agree that we shouldn't be complacent about Maxima's capabilities. As a volunteer-driven open source project, we are delighted with contributions from the community, many of which make it into the standard system; others of which are added to our "contributed code" library. We can also point interested people to areas we think are important. If you would like to work on a language-independent representation of one or more important algorithms for symbolic computation and the related translator(s), that would be fantastic! If you can interest other members of the Maxima community to work with you on it, even better! -s On Wed, Jul 1, 2015 at 2:08 PM, Marduk Bolaños wrote: > > If Maxima ain't good at inequality resolution, it doesn't make it small > > anywhere because its an algorithm that remains to be coded. > > Well, that's like saying "If you are not a good piano player, that does > not mean you are a worse musician than those that play well. You just > have to learn how to do it." > > Seriously, the fact that Maxima does not implement the Risch algorithm > in its full glory and Axiom does should not be taken lightly. Both have > been around since about the same time. I know that it is not an > algorithm, but a decision method and it is rather lengthy and difficult > to implement. But still it has to be done. See below for my proposal. > > > There is need of new thoughts in CAS, say Visual programming languages or > > semantic pattern matching or knowledge representation or more... > > I think that the developers of Computer Algebra Systems have to start > working on automating the process of implementing symbolic algorithms in > a similar vein to FLAME (http://www.cs.utexas.edu/~flame/web/). That > would allow implementing every algorithm in every CAS with a > considerable reduction of effort. One of the most interesting outcomes > of the FLAME project is the language-independent representation of > algorithms in XML and the development of a source-to-source translator > that generates code in any programming language. > > See ftp://net9.cs.utexas.edu/pub/techreports/tr08-49.pdf > > > Speaking of visual programming, this paper discusses the integration of > FLAME with LabView: > > http://www.cs.utexas.edu/users/flame/pubs/flawn38.pdf > > > Regards, > Marduk > > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss >   Re: [Maxima-discuss] Why is Maxima Asking this Question? From: Robert Dodier - 2015-07-01 19:29:01 On 2015-07-01, Thomas LaBone wrote: > When I try to solve this integral Maxima asks "Is b-1 positive, > negative, or zero?" and proceeds to give the same correct result > regardless of how I answer. Why does Maxima want to know this? > > fxy(x,y) := a*x^(a-1) * b*y^(b-1); > assume(a>b,a>0,b>0); > assume(z>0,z<1); > 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); Well, in general, Maxima might ask questions that aren't actually necessary for computing an integral. In this case I see that there is some code to look for a pole -- that's where the question comes from -- but the result turns out to be the same whatever the answer. I speculate that this might be a special case of a more general integral in which the answer does make a difference. But in this particular case, I think there might be a bug. For a=0 or b=0, the result should contain logarithms, shouldn't it? So the result should be different depending on the values of a and b. By the way, are you trying to suppress the questions by using 'assume'? May I ask what is the context or goal of this specific question? best, Robert Dodier   Re: [Maxima-discuss] ​Re: in case you find yourself in Portland From: Robert Dodier - 2015-07-01 19:17:24 On 2015-07-01, Marduk Bolaños wrote: > I think that the developers of Computer Algebra Systems have to start > working on automating the process of implementing symbolic algorithms in > a similar vein to FLAME (http://www.cs.utexas.edu/~flame/web/). That > would allow implementing every algorithm in every CAS with a > considerable reduction of effort. One of the most interesting outcomes > of the FLAME project is the language-independent representation of > algorithms in XML and the development of a source-to-source translator > that generates code in any programming language. Well, my own pet project for the automated reasoning (in the spirit of Leibniz) is an implementation of decision networks, which are declarative models comprising Bayesian belief networks for the belief part and utility functions for the preference or value part. The general idea is that one sets up a model that expresses how one believes the world works, then to answer any question (inferential or decision) one simply has to turn the crank -- "calculemus". The crank-turning generically involves computing integrals and has all the usual problems associated with that. I'm a big fan of declarative models in general -- much easier to express how things work and then ask an automated tool to derive inferences from that. For what it's worth, Robert Dodier   Re: [Maxima-discuss] Why is Maxima Asking this Question? From: Thomas LaBone - 2015-07-01 18:31:27 Attachments: Message as HTML Here is what I get with Maxima 5.36.1 with wxMaxima 15.04.0 (the latest Windows release): %i1) fxy(x,y) := a*x^(a-1) * b*y^(b-1); (%o1) fxy(x,y):=a*x^(a-1)*b*y^(b-1) (%i2) assume(a>b,a>0,b>0); (%o2) [a>b,a>0,b>0] (%i3) assume(z>0,z<1); (%o3) [z>0,z<1] (%i4) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); "Is "b-1" positive, negative or zero?"positive; (%o4) 1-a*b*((a*z^b+b-a)/(a*b^2-a^2*b)-z^a/(a*b-a^2)) (%i5) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); "Is "b-1" positive, negative or zero?"negative; "Is "x*(z-x)" positive, negative or zero?"positive; "Is "x" positive or negative?"positive; (%o5) 1-a*b*((a*z^b+b-a)/(a*b^2-a^2*b)-z^a/(a*b-a^2)) (%i6) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); "Is "b-1" positive, negative or zero?"zero; (%o6) 1-a*b*((a*z^b+b-a)/(a*b^2-a^2*b)-z^a/(a*b-a^2)) (%i7) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); "Is "b-1" positive, negative or zero?"negative; "Is "x*(z-x)" positive, negative or zero?"negative; "Is "x" positive or negative?"positive; (%o7) 1-a*b*((a*z^b+b-a)/(a*b^2-a^2*b)-z^a/(a*b-a^2)) and so on. On 7/1/2015 2:08 PM, maxima-discuss-request@... wrote: > Message: 2 > Date: Wed, 1 Jul 2015 12:46:43 -0400 > From: Przemek Klosowski > Subject: Re: [Maxima-discuss] Why is Maxima Asking this Question? > To: > Message-ID:<55941973.9070308@...> > Content-Type: text/plain; charset="windows-1252" > > On 07/01/2015 05:34 AM, Thomas LaBone wrote: >> >When I try to solve this integral Maxima asks "Is b-1 positive, >> >negative, or zero?" and proceeds to give the same correct result >> >regardless of how I answer. Why does Maxima want to know this? >> > >> >fxy(x,y) := a*x^(a-1) * b*y^(b-1); >> >assume(a>b,a>0,b>0); >> >assume(z>0,z<1); >> >1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); >> > > In my Maxima 5.34.1 using Lisp SBCL 1.2.4-1.fc21 I get different results > when I answer 'positive': > > (%i31) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); > Is b-1 positive, negative or zero? > > positive; > (%o31) 1-a*b*((a*z^b+b-a)/(a*b^2-a^2*b)-z^a/(a*b-a^2)) > > than when I answer 'negative': > > (%i35) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); > Is b-1 positive, negative or zero? > > negative; > Is x*(z-x) positive, negative or zero? > > negative; > Is x positive or negative? > > negative; > Is a-1 positive, negative or zero? > > negative; > (%o35) 1-a*b*%e^-(b*log(z)) > *((a*z^b+(a-b)*z^a+b-a)*%e^(b*log(z))-a*z^b*%e^(a*log(z))) > /(a*b^2-a^2*b)   Re: [Maxima-discuss] Is this an exact result? From: Gunter Königsmann - 2015-07-01 18:17:33 Attachments: Message as HTML Found it. It was: https://en.wikipedia.org/wiki/Wilkinson%27s_polynomial Kind regards, Gunter. On Di, Jun 30, 2015 at 12:55 , Kai Velten wrote: > Thank you. I'd like to read that article, could you send me that link? > > Kai > > On 30.06.2015 12:52, Gunter Königsmann wrote: >> >> >> On Di, Jun 30, 2015 at 12:42 , Kai Velten >> wrote: >>> Thank you, this solves my problem. >>> >>> From a practical point of view, however, it would be good if >>> everything would work with the 1.5, too. if a number such as 1.5 is >>> involved in the program, then it would be good if the programmer >>> could just write that number without any further thoughts. This >>> would also improve the readability of programs. >> You can use rationalize() to convert all numbers in a formula. >> The reason I switched to maxima was that the program I used before >> did do so automatically - which really felt like a good idea. But >> you will be surprised how many times a intermediate result of a >> calculation contains something like (1+0.0000000000001 - 1)/2 and a >> program that automatically determines what a floating-point number >> might mean produces plausible results - that sometimes are deeply >> wrong. Richard Fateman once sent me a link to an article that showed >> how big errors even small numerical changes can do to such simple >> things like finding the zeros of a polynom. >> >> Kind regards, >> >> Gunter. >> >   Re: [Maxima-discuss] ​Re: in case you find yourself in Portland From: Marduk Bolaños - 2015-07-01 18:08:37 > If Maxima ain't good at inequality resolution, it doesn't make it small > anywhere because its an algorithm that remains to be coded. Well, that's like saying "If you are not a good piano player, that does not mean you are a worse musician than those that play well. You just have to learn how to do it." Seriously, the fact that Maxima does not implement the Risch algorithm in its full glory and Axiom does should not be taken lightly. Both have been around since about the same time. I know that it is not an algorithm, but a decision method and it is rather lengthy and difficult to implement. But still it has to be done. See below for my proposal. > There is need of new thoughts in CAS, say Visual programming languages or > semantic pattern matching or knowledge representation or more... I think that the developers of Computer Algebra Systems have to start working on automating the process of implementing symbolic algorithms in a similar vein to FLAME (http://www.cs.utexas.edu/~flame/web/). That would allow implementing every algorithm in every CAS with a considerable reduction of effort. One of the most interesting outcomes of the FLAME project is the language-independent representation of algorithms in XML and the development of a source-to-source translator that generates code in any programming language. See ftp://net9.cs.utexas.edu/pub/techreports/tr08-49.pdf Speaking of visual programming, this paper discusses the integration of FLAME with LabView: http://www.cs.utexas.edu/users/flame/pubs/flawn38.pdf Regards, Marduk   Re: [Maxima-discuss] Why is Maxima Asking this Question? From: Przemek Klosowski - 2015-07-01 16:46:58 Attachments: Message as HTML On 07/01/2015 05:34 AM, Thomas LaBone wrote: > When I try to solve this integral Maxima asks "Is b-1 positive, > negative, or zero?" and proceeds to give the same correct result > regardless of how I answer. Why does Maxima want to know this? > > fxy(x,y) := a*x^(a-1) * b*y^(b-1); > assume(a>b,a>0,b>0); > assume(z>0,z<1); > 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); > In my Maxima 5.34.1 using Lisp SBCL 1.2.4-1.fc21 I get different results when I answer 'positive': (%i31) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); Is b-1 positive, negative or zero? positive; (%o31) 1-a*b*((a*z^b+b-a)/(a*b^2-a^2*b)-z^a/(a*b-a^2)) than when I answer 'negative': (%i35) 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); Is b-1 positive, negative or zero? negative; Is x*(z-x) positive, negative or zero? negative; Is x positive or negative? negative; Is a-1 positive, negative or zero? negative; (%o35) 1-a*b*%e^-(b*log(z)) *((a*z^b+(a-b)*z^a+b-a)*%e^(b*log(z))-a*z^b*%e^(a*log(z))) /(a*b^2-a^2*b)   Re: [Maxima-discuss] Is this an exact result? From: Richard Fateman - 2015-07-01 14:04:26 Attachments: Message as HTML More comments... 3/2 is briefer than ratsimp(1.5) and doesn't provoke any warning messages. The formulas include division by 2, which could be done by multiplication by 0.5. If the objective is to do computations in degrees, you could define tand() and cosd() etc, and defer the question of "exactness" to those functions, instead of repeatedly dividing by 180. Finally, the input routine for bigfloats works by reading in a number in decimal, converting it to an EXACT RATIONAL, and then returning the closest binary bigfloat to that number in the designated precision. That is, 0.1b0 is converted to 1/10, and then that is rounding to ?fpprec bits as a bigfloat. One could modify the system to leave the number as 1/10. (Changing the lisp), but this does not effect the other change, which would be to um, write certain fractions with decimal points. Perhaps fractions whose denominators were factors of 10^n? Hence 1/2 is 0.5, 1/5 is 0.2, 1/50 is 0.02 1/100 is 0.01. And 1/3 is just 1/3. RJF On 7/1/2015 6:40 AM, Stavros Macrakis (Σταῦρος Μακράκης) wrote: > Some comments on your code below: > > c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); > beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; > gamma:180-beta-alpha; > d:ratsimp(1.5)/tan(gamma*%pi/180); > e:ratsimp(1.5)/tan(beta*%pi/180); > > > L(a,b,alpha):=ev(c-d-e); > > > Two issues here: > > 1) This will use the values of c,d,e at the time it is /called, > /not at the time it is defined. Is that your intent? > 2) "ev" should generally be avoided in code except for certain > special cases. > > > Instead, I would recommend using "define" as you do for L1, namely > > define(L(a,b,alpha),c-d-e) > > > That will use the values of c, d, e at the time of definition, and > does not require ev. > > define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); > > L1(a,b,alpha); > > > In fact, since you are not actually using L and L1 as functions with > non-trivial parameters, a more natural way to do this in Maxima is: > > L: c-d-e; > > L1: diff(L,alpha); > > ​ This is more the way Maxima was designed to be used — and is of > course more concise —, though defining functions also works. > > ​ If you do want other values for a, b, alpha, you can either define > functions as you did, or use (e.g.) subst([a=3,b=x^2-1],L1)​. > > > -s​ > > > On Wed, Jul 1, 2015 at 3:03 AM, Kai Velten > wrote: > > I have just read Richard Fateman's comments on error propagation, > and I > think this is a misunderstanding. I wanted an exact formula from the > program below. This achieved by David's suggestion to use ratsimp(1.5) > as a replacement of 1.5. I think we all agree with Richard's > remarks on > numerical evaluation and error propagation issues, but the focus > of the > discussion was the question if the formula produced by the program > below > is exact, independent of its numerical evaluation. > > > c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); > beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; > gamma:180-beta-alpha; > d:ratsimp(1.5)/tan(gamma*%pi/180); > e:ratsimp(1.5)/tan(beta*%pi/180); > L(a,b,alpha):=ev(c-d-e); > define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); > L1(a,b,alpha); >   Re: [Maxima-discuss] Is this an exact result? From: Stavros Macrakis (Σταῦρος Μακράκης) - 2015-07-01 13:40:43 Attachments: Message as HTML Some comments on your code below: c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; gamma:180-beta-alpha; d:ratsimp(1.5)/tan(gamma*%pi/180); e:ratsimp(1.5)/tan(beta*%pi/180); L(a,b,alpha):=ev(c-d-e); Two issues here: 1) This will use the values of c,d,e at the time it is *called, *not at the time it is defined. Is that your intent? 2) "ev" should generally be avoided in code except for certain special cases. Instead, I would recommend using "define" as you do for L1, namely define(L(a,b,alpha),c-d-e) That will use the values of c, d, e at the time of definition, and does not require ev. define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); L1(a,b,alpha); In fact, since you are not actually using L and L1 as functions with non-trivial parameters, a more natural way to do this in Maxima is: L: c-d-e; L1: diff(L,alpha); ​This is more the way Maxima was designed to be used — and is of course more concise —, though defining functions also works. ​If you do want other values for a, b, alpha, you can either define functions as you did, or use (e.g.) subst([a=3,b=x^2-1],L1)​. -s​ On Wed, Jul 1, 2015 at 3:03 AM, Kai Velten wrote: > I have just read Richard Fateman's comments on error propagation, and I > think this is a misunderstanding. I wanted an exact formula from the > program below. This achieved by David's suggestion to use ratsimp(1.5) > as a replacement of 1.5. I think we all agree with Richard's remarks on > numerical evaluation and error propagation issues, but the focus of the > discussion was the question if the formula produced by the program below > is exact, independent of its numerical evaluation. > > > c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); > beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; > gamma:180-beta-alpha; > d:ratsimp(1.5)/tan(gamma*%pi/180); > e:ratsimp(1.5)/tan(beta*%pi/180); > L(a,b,alpha):=ev(c-d-e); > define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); > L1(a,b,alpha); > > > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss >   Re: [Maxima-discuss] Request for Comments on Graphs Based on Galois Fields From: Andrej Vodopivec - 2015-07-01 12:02:38 Hi David, I do not know much about the gf package so I cannot comment on that part of the code. You can replace the for loops with create_list function: elements: listify(elements); vectors: create_list([x,y,z], x, elements, y, elements, z, elements)$ To create the graph you can use the make_graph function. dp(p,q) := apply(gf_add, map(gf_mult, p, q))$pg: make_graph(vertices, lambda([p,q], is(dp(p,q)=0)))$ HTH, Andrej On Wed, Jul 1, 2015 at 12:58 PM, David Narvaez wrote: > Hi, > > I am not a Maxima expert but would very much like learning more about > it. Months ago I was working with graphs whose vertices are vectors in > a Galois field and whose edges are included or not depending on the > dot product of these vectors. I came up with the following script to > visualize them: > > load(gf)$> load(graphs)$ > gf_set_data(3,1)$> g:gf_primitive()$ > elements:makeset(gf_exp(g, i), [i], makelist([i], i, 0, 6))$> elements: adjoin(0, elements)$ > vectors:{}$> for x in elements do for y in elements do for z in elements do > vectors: adjoin([x, y, z], vectors)$ > vectors:delete([0,0,0], vectors)$> pointclasses:equiv_classes(vectors, lambda ([A, B], some(lambda ([k], > equal(map(gf_p2n, A), map(gf_p2n, map(gf_mult, [k, k, k], B)))), > elements)))$ > vertices:listify(map(lambda([p], first(p)), pointclasses))$> verticesint:[]$ > edgesint: []$> for i: 1 thru length(vertices) do > verticesint: cons(i, verticesint)$ > for i: 1 thru length(vertices) do > for j in sublist_indices(vertices, lambda([p], > is(gf_add(gf_mult(vertices[i][1], p[1]), > gf_add(gf_mult(vertices[i][2], p[2]), gf_mult(vertices[i][3], p[3]))) > = 0))) do > if i > j then > edgesint: cons([i, j], edgesint)$> edgesint: unique(edgesint)$ > pg: create_graph(verticesint, edgesint)$> draw_graph(pg, redraw=true, spring_embedding_depth=500); > > I would appreciate if more experienced users could help me improve > several things in this code: > > 1) Is > > for x in elements do for y in elements do for z in elements do > vectors: adjoin([x, y, z], vectors)$ > > the best way to get all vectors in the field? > > 2) The lambda used in equiv_classes > > lambda ([A, B], some(lambda ([k], equal(map(gf_p2n, A), map(gf_p2n, > map(gf_mult, [k, k, k], B)))), elements)) > > basically asks if A is a scalar multiple of B. Is there a succint way > to ask that? > > 3) The for loops to fill verticesint and edgesint are one of my > biggest issues with this code. What happens here is that I cannot use > the concept of the vector directly because I represent these vectors > as arrays, and telling create_graph to use arrays as vertices will > make it think the second element in the array is just the label of the > vertex. Is there a way to have a proper vector object I can build and > use directly in this part? It would also help with the following > issue. > > 4) The other biggest issue is the lambda > > is(gf_add(gf_mult(vertices[i][1], p[1]), > gf_add(gf_mult(vertices[i][2], p[2]), gf_mult(vertices[i][3], p[3]))) > = 0) > > which is nothing more than is(vertices[i].vertices[j] = 0) with the > binary operations * and + replaced by gf_mult and gf_add respectively. > Is there a way to override these operators when calling the . > operator? I come from object oriented languages where I would probably > address 3 and 4 with a class that encapsualtes the concept of a vector > and what addition and multiplication mean but I do not know if this > makes any sense in Maxima/Lisp. > > I would really appreaciate any reviews/comments on this. Thanks in advance. > > David E. Narvaez > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss 
 [Maxima-discuss] ​Re: in case you find yourself in Portland From: Pankaj Sejwal - 2015-07-01 11:39:16 Attachments: Message as HTML ​Well certainly such conferences are important but most of them are going to discuss new algorithms to do new stuff. There are no conferences on CAS because there has not been any significant changes in computer algebra systems since Macsyma was released. Maxima or Matlab or Mathematica or Axiom they are are same its just that some sell more because of features difference and marketing. If Maxima ain't good at inequality resolution, it doesn't make it small anywhere because its an algorithm that remains to be coded. But also Maxima has nothing good enough that it can ​be part of conference in terms of core CAS functionality(great for it time but not anymore). All CAS have largely failed to keep up with emerging technologies including Mathematica, just how much it has changed in last 25-30 years other than adding new libraries to it. There is need of new thoughts in CAS, say Visual programming languages or semantic pattern matching or knowledge representation or more .... there has to be a genuine reason for people to attend the conference otherwise it will be another unnoticed attempt. Maxima is cool but needs to get cooler....:) On Tue, Jun 30, 2015 at 7:50 AM, < maxima-discuss-request@...> wrote: > Message: 1 > Date: Tue, 30 Jun 2015 13:43:50 +0200 > From: Dimiter Prodanov > Subject: > ​​ > Re: [Maxima-discuss] in case you find yourself in Portland > To: "maxima-discuss@..." > > Message-ID: > < > CAFV0ecY4TfnzKCXVZ-9nVJ-RjRzH5SzRfp_uQbuPoFXdMqC_og@...> > Content-Type: text/plain; charset="utf-8" > > A special session on Maxima on a certain conference will be good. > > I will participate in this conference in July: > > http://www-ma2.upc.edu/agacse2015/ > -- Regards, Pankaj Sejwal 
 [Maxima-discuss] Request for Comments on Graphs Based on Galois Fields From: David Narvaez - 2015-07-01 10:59:09 Hi, I am not a Maxima expert but would very much like learning more about it. Months ago I was working with graphs whose vertices are vectors in a Galois field and whose edges are included or not depending on the dot product of these vectors. I came up with the following script to visualize them: load(gf)$load(graphs)$ gf_set_data(3,1)$g:gf_primitive()$ elements:makeset(gf_exp(g, i), [i], makelist([i], i, 0, 6))$elements: adjoin(0, elements)$ vectors:{}$for x in elements do for y in elements do for z in elements do vectors: adjoin([x, y, z], vectors)$ vectors:delete([0,0,0], vectors)$pointclasses:equiv_classes(vectors, lambda ([A, B], some(lambda ([k], equal(map(gf_p2n, A), map(gf_p2n, map(gf_mult, [k, k, k], B)))), elements)))$ vertices:listify(map(lambda([p], first(p)), pointclasses))$verticesint:[]$ edgesint: []$for i: 1 thru length(vertices) do verticesint: cons(i, verticesint)$ for i: 1 thru length(vertices) do for j in sublist_indices(vertices, lambda([p], is(gf_add(gf_mult(vertices[i][1], p[1]), gf_add(gf_mult(vertices[i][2], p[2]), gf_mult(vertices[i][3], p[3]))) = 0))) do if i > j then edgesint: cons([i, j], edgesint)$edgesint: unique(edgesint)$ pg: create_graph(verticesint, edgesint)$draw_graph(pg, redraw=true, spring_embedding_depth=500); I would appreciate if more experienced users could help me improve several things in this code: 1) Is for x in elements do for y in elements do for z in elements do vectors: adjoin([x, y, z], vectors)$ the best way to get all vectors in the field? 2) The lambda used in equiv_classes lambda ([A, B], some(lambda ([k], equal(map(gf_p2n, A), map(gf_p2n, map(gf_mult, [k, k, k], B)))), elements)) basically asks if A is a scalar multiple of B. Is there a succint way to ask that? 3) The for loops to fill verticesint and edgesint are one of my biggest issues with this code. What happens here is that I cannot use the concept of the vector directly because I represent these vectors as arrays, and telling create_graph to use arrays as vertices will make it think the second element in the array is just the label of the vertex. Is there a way to have a proper vector object I can build and use directly in this part? It would also help with the following issue. 4) The other biggest issue is the lambda is(gf_add(gf_mult(vertices[i][1], p[1]), gf_add(gf_mult(vertices[i][2], p[2]), gf_mult(vertices[i][3], p[3]))) = 0) which is nothing more than is(vertices[i].vertices[j] = 0) with the binary operations * and + replaced by gf_mult and gf_add respectively. Is there a way to override these operators when calling the . operator? I come from object oriented languages where I would probably address 3 and 4 with a class that encapsualtes the concept of a vector and what addition and multiplication mean but I do not know if this makes any sense in Maxima/Lisp. I would really appreaciate any reviews/comments on this. Thanks in advance. David E. Narvaez 
 [Maxima-discuss] Why is Maxima Asking this Question? From: Thomas LaBone - 2015-07-01 09:52:11 When I try to solve this integral Maxima asks "Is b-1 positive, negative, or zero?" and proceeds to give the same correct result regardless of how I answer. Why does Maxima want to know this? fxy(x,y) := a*x^(a-1) * b*y^(b-1); assume(a>b,a>0,b>0); assume(z>0,z<1); 1-integrate(integrate(fxy(x,y),y,z/x,1),x,z,1); Tom 
 Re: [Maxima-discuss] Is this an exact result? From: Kai Velten - 2015-07-01 08:51:46 Attachments: Message as HTML This was no question, I have just stated that, as a result of the previous discussion, the program modified using ratsimp generates an exact formula as required. Am 01.07.2015 um 09:51 schrieb Stavros Macrakis (Σταῦρος Μακράκης): > > Not sure I understand what question you're asking now. > > On Jul 1, 2015 3:03 AM, "Kai Velten" > wrote: > > I have just read Richard Fateman's comments on error propagation, > and I > think this is a misunderstanding. I wanted an exact formula from the > program below. This achieved by David's suggestion to use ratsimp(1.5) > as a replacement of 1.5. I think we all agree with Richard's > remarks on > numerical evaluation and error propagation issues, but the focus > of the > discussion was the question if the formula produced by the program > below > is exact, independent of its numerical evaluation. > > > c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); > beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; > gamma:180-beta-alpha; > d:ratsimp(1.5)/tan(gamma*%pi/180); > e:ratsimp(1.5)/tan(beta*%pi/180); > L(a,b,alpha):=ev(c-d-e); > define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); > L1(a,b,alpha); > > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > -- Kai Velten Hochschule Geisenheim University Zentrum für Weinforschung und Verfahrenstechnologie der Getränke AG Modellierung und Systemanalyse von-Lade-Straße 1 D-65366 Geisenheim, Germany Tel. +49 6722.502.734, 0157.354.353.89 Fax 03222.3.943.753 kai.velten at hs-gm.de ms.hs-geisenheim.de 
 Re: [Maxima-discuss] Is this an exact result? From: Stavros Macrakis (Σταῦρος Μακράκης) - 2015-07-01 07:51:45 Attachments: Message as HTML Not sure I understand what question you're asking now. On Jul 1, 2015 3:03 AM, "Kai Velten" wrote: > I have just read Richard Fateman's comments on error propagation, and I > think this is a misunderstanding. I wanted an exact formula from the > program below. This achieved by David's suggestion to use ratsimp(1.5) > as a replacement of 1.5. I think we all agree with Richard's remarks on > numerical evaluation and error propagation issues, but the focus of the > discussion was the question if the formula produced by the program below > is exact, independent of its numerical evaluation. > > > c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); > beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; > gamma:180-beta-alpha; > d:ratsimp(1.5)/tan(gamma*%pi/180); > e:ratsimp(1.5)/tan(beta*%pi/180); > L(a,b,alpha):=ev(c-d-e); > define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); > L1(a,b,alpha); > > > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > 
 Re: [Maxima-discuss] Wrong thread ... From: Gunter Königsmann - 2015-07-01 07:17:37 Attachments: Message as HTML I think mailman reads the header containing the message id of the message you reply to. Unfortunately you won't have such a thing when you don't have the original message to reply to. Kind regards, Gunter. Am 1. Juli 2015 09:12:21 MESZ, schrieb Kai Velten : >In my last post, I tried to continue an old thread by using > >"Re: [Maxima-discuss] Is this an exact result?" > >as the subject of my email to the list, but this generated a new thread >... > >What was wrong? > > >------------------------------------------------------------------------------ >Don't Limit Your Business. Reach for the Cloud. >GigeNET's Cloud Solutions provide you with the tools and support that >you need to offload your IT needs and focus on growing your business. >Configured For All Businesses. Start Your Cloud Today. >https://www.gigenetcloud.com/ >_______________________________________________ >Maxima-discuss mailing list >Maxima-discuss@... >https://lists.sourceforge.net/lists/listinfo/maxima-discuss -- Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
 [Maxima-discuss] Wrong thread ... From: Kai Velten - 2015-07-01 07:12:29 In my last post, I tried to continue an old thread by using "Re: [Maxima-discuss] Is this an exact result?" as the subject of my email to the list, but this generated a new thread ... What was wrong? 
 Re: [Maxima-discuss] Is this an exact result? From: Kai Velten - 2015-07-01 07:03:16 I have just read Richard Fateman's comments on error propagation, and I think this is a misunderstanding. I wanted an exact formula from the program below. This achieved by David's suggestion to use ratsimp(1.5) as a replacement of 1.5. I think we all agree with Richard's remarks on numerical evaluation and error propagation issues, but the focus of the discussion was the question if the formula produced by the program below is exact, independent of its numerical evaluation. c:sqrt(b^2+a^2-2*a*b*cos(alpha*%pi/180)); beta:acos((b^2+c^2-a^2)/2/b/c)*180/%pi; gamma:180-beta-alpha; d:ratsimp(1.5)/tan(gamma*%pi/180); e:ratsimp(1.5)/tan(beta*%pi/180); L(a,b,alpha):=ev(c-d-e); define(L1(a,b,alpha),diff(L(a,b,alpha),alpha)); L1(a,b,alpha); 
 Re: [Maxima-discuss] first question From: sbh - 2015-06-30 23:18:32 Hmm. Well I'm not too quick on understanding yet as I haven't used first, rest, last, etc, nor been using Maxima very long. I think your answer is certainly very promising but I will have to think about it and experiment a little to fully understand... sorry for the inevitable delay ;) Brett P.S. I should have wrote out the first few W_{g,n}'s and their dependencies (which I paste here from the message part that didn't show up in my first post): eta:0 W_{0,3}^{i0,i1,i2}(z0,z1,z2) := sum_{j=0}^{N=2} Res_{z->0} K^{i0,j}(z,z0) * [ W_{0,2}^{j,i1}(z,z1)*W_{0,2}^{j,i2}(-z,z2) + W_{0,2}^{j,i2}(-z,z2)*W_{0,2}^{j,i2}(-z,z1) ] W_{1,1}^{i0}(z0) := sum_{j=0}^{N=2} Res_{z->0} K^{i0,j}(z,z0) * [ W_{0,2}^{j,j}(z,-z) ] eta:1 W_{0,4}^{i0,i1,i2,i3} := sum_{j=0}^{N=2} Res_{z->0} K^{i0,j}(z,z0) * [ W_{0,2}^{j,i1}(z,z1)*W_{0,3}^{j,i2,i3}(-z,z2,z3) + W_{0,2}^{j,i2}(z,z2)*W_{0,3}^{j,i1,i3}(-z,z1,z3) + W_{0,2}^{j,i3}(z,z3)*W_{0,3}^{j,i1,i2}(-z,z1,z2) + W_{0,3}^{j,i1,i2}(z,z1,z2)*W_{0,2}^{j,i3}(-z,z3) + W_{0,3}^{j,i1,i3}(z,z1,z3)*W_{0,2}^{j,i2}(-z,z2) + W_{0,3}^{j,i2,i3}(z,z2,z3)*W_{0,2}^{j,i1}(-z,z1) ] eta:2 W_{1,2}^{i0,i1}(z0,z1) := sum_{j=0}^{N=2} Res_{z->0} K^{i0,j}(z,z0) * [ W_{0,3}^{j,j,i1}(z,-z,z1) + W_{1,1}^{j}(z)*W_{0,2}^{j,i1}(-z,z1) + W_{0,2}^{j,i1}(z,z1)*W_{1,1}^{j}(-z) ] On 15-06-30 04:54 PM, Stavros Macrakis (Σταῦρος Μακράκης) wrote: > Without studying your post in detail, it looks to me like you want to > define a recursive function of two arguments, both of which are > list-valued. Function applications would look like f([a,b,c],[d,e]). > > You can have arbitrary logic in the definition of the function (whether > memoizing or not). Things like > f(a,b) := > if a=[] > then (if b=[] > then 1 > else first(b)*f([first(b)],rest(b)) ) > else first(a)*f(rest(a),b)+1; > > Or have I completely misunderstood the problem? > > On Tue, Jun 30, 2015 at 5:58 PM, sbh wrote: > >> Hello, here is my question: >> >> I have a recursive equation that I want to evaluate. >> >> I know how to use simple memoizing functions like in the following two >> examples - the factorial and the coefficients for the binomial; >> >> F[n]:= if (n<=1) then 1 else n*F[n-1]; >> >> and >> >> F[a,b]:= if ((a=0) or (b=0)) then 1 else F[a-1,b]+F[a,b-1]; >> >> which is much better (I think) then the more programmatic way of doing >> it, i.e. for the factorial, >> >> facto(n):= block([], >> tmp:1, >> for i:1 thru n do( >> tmp: tmp*i >> ), >> tmp >> ); >> >> But my equation is a little more complicated - I include it because it >> may help. >> >> It is **recursive in eta**, which is defined to be >> >> eta: 2g-2+n such that the first few allowable (g,n) pairs, for etas are >> as follows. >> >> eta:1 -> {(0,3),(1,1)} >> eta:2 -> {(0,4),(1,2),(2,0)} >> eta:3 -> {(0,5),(1,3),(2,1)} >> eta:4 -> {(0,6),(1,4),(2,2),(3,0)} >> >> ********************************** >> Here is the equation: >> >> Given N (the number of locations', >> >> the input data is functions, y_i(z) - so there are N of these. >> **So how to distinguish them and carry different ones around in >> calculations?** >> >> Should it be y[i](z) := i+z^2? >> Should it be y(i,z) := i+z^2? >> Should it be y(i):= i*z^2? >> Should it be y[i]:= i*z^2? >> etc. >> >> I imagine I'll be able to use ev() or subst() if I need to change a z to >> z1 for example. >> >> Moving on, I have as input - **Written in LaTeX since I'm not sure how >> to say it in Maxima, i.e. see above.** >> >> y(k)= f(z); /*one for each location' - k \in {1,...,N}*/ >> B(i,j)=f( y(k) ) OR B^{i,j}(z,z')=f( y(k),subst(z',z,y(l)) ) /*for >> instance*/ >> K(i,j)=f( y(k), B(i,j) ); >> >> One can **think** of these as n-forms or tensors, so W_{0,2}^{i,j}, >> where i \in {1,2} and j in {1,2} would consist of W_{0,2}^{1,1}, >> W_{0,2}^{1,2}, W_{0,2}^{2,1}, and W_{0,2}^{2,2}. So each copy (this has >> two copies - n=2) can have a location' either 1 or 2, i.e. from >> {1,...,N} (here I chose N=2). >> >> W_{0,3}^{i0,i1,i2}(z0,z1,z2) has three copies', with each slot(3) being >> from 1 to N. >> >> W_{0,1}^i(z)=0 (**) >> W_{0,2}^{i,j}(z,z')=B^{i,j}(z,z') >> >> The recursion - for W_{g,n}^{i0,i1,...,in}(z0,z1,...,zn): (define >> W_{g,n'} in >> terms of W_{g,n'+1} \equiv W_{g,n}) >> >> W_{g,n+1}^{i0,i1,...,in}(z0,z1,...,zn):=\sum_{j=1}^N Residue_{z->0} >> K(i0,j)(z,z0) * >> >> [ >> >> W_{g-1,n+2}^{j,j,i1,...,in}(z,-z,z1,...,zn) + >> >> sum_{A union B={1,...,n}} sum_{h=0}^g >> >> W_{h,|A|+1}^{j,iA}(z,zA) * W_{g-h,|B|+1}^{j,iB}(-z,zB) >> >> ] >> >> where in the last line, these products are taken over all different ways >> of partitioning' up the union of A and B (equal to {1,...,n}) - I'll >> probably use the powerset for A and some setdifference stuff for B. >> >> For instance, if >> >> AUB={1,2,3}, then one member could be A:={2} and B:={1,3}, etc. The iA >> would be i2, the iB would be {i1,i3}, the zA would be z2, and the zB >> would be z1,z3. >> >> E.G.: W_{1,1}^{i0} = W_{1,0+1}^{i0} = sum_{j=1}^N Res_{z->0} >> K^{i0,j}(z,z0) * >> [W_{0,2}^{j,j}(z,-z) + nothing remains due to (**)] >> >> I then want to define the elements for which the recursion is for (no >> superscripts), >> >> W_{g,n+1}(z0,z1,...,zn) >> >> as follows, >> >> W_{g,n+1}(z0,z1,...,zn) := >> W_{g,n+1}^{1,1,...,1}(z0,z1,...,zn) + ... >> W_{g,n+1}^{2,1,...,N}(z0,z1,...,zn) + ... >> W_{g,n+1}^{N,N,...,N}(z0,z1,...,zn) >> >> where these are attained through something like cartesian_product() - >> see f(n,N) below. >> ********************************** >> >> So in pseudocode/Latex, and for the explicit case of eta=1..3 I have this: >> (how do I define functions with varying numbers of superscripts and >> arguments automatically? Do I need to?) >> >> &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& >> n is the number of locations' and each location index i_x can range >> from 1 to N >> ******************************** >> eta:1 /*-> {(1,1),(0,3)}*/ >> g: fn1(eta,...); >> n: fn2(eta,...); >> W^1_{1,1}(z0) = ...; >> W^2_{1,1}(z0) = ...; >> ... >> W^N_{1,1}(z0) = ...; >> >> W_{1,1} = sum of all (1,1)'s above. >> >> W^{1,1,1}_{0,3}(z0,z1,z2) = ...; >> W^{1,1,2}_{0,3}(z0,z1,z2) = ...; >> ... >> W^{N,N,N}_{0,3}(z0,z1,z2) = ...; >> >> W_{0,3} = sum of all (0,3)'s above. >> >> >> eta:2 /*-> {(0,4),(1,2),(2,0)} - exclude if 2nd index is 0 */ >> g: fn1(eta,...); >> n: fn2(eta,...); >> W^{1,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; >> W^{1,1,1,2}_{0,4}(z0,z1,z2,z3) = ...; >> W^{1,1,1,N}_{0,4}(z0,z1,z2,z3) = ...; >> ... >> W^{1,1,2,1}_{0,4}(z0,z1,z2,z3) = ...; >> ... >> W^{N,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; >> ... >> W^{N,N,N,N}_{0,4}(z0,z1,z2,z3) = ...; >> >> W_{0,4) = sum of all (0,4)'s above. >> >> >> W^{1,1}_{1,2}(z0,z1) = ...; >> W^{1,2}_{1,2}(z0,z1) = ...; >> W^{1,N}_{1,2}(z0,z1) = ...; >> ... >> W^{2,1}_{1,2}(z0,z1) = ...; >> ... >> W^{N,1}_{1,2}(z0,z1) = ...; >> ... >> W^{N,N}_{1,2}(z0,z1) = ...; >> >> W_{1,2} = sum of all (1,2)'s above. >> >> W^{1,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; >> W^{1,1,1,2}_{0,4}(z0,z1,z2,z3) = ...; >> W^{1,1,1,N}_{0,4}(z0,z1,z2,z3) = ...; >> ... >> W^{1,1,2,1}_{0,4}(z0,z1,z2,z3) = ...; >> ... >> W^{N,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; >> ... >> W^{N,N,N,N}_{0,4}(z0,z1,z2,z3) = ...; >> >> W_{0,4} = sum of all (0,4)'s above. >> >> eta:3 /* {(0,5),(1,3),(2,1)} */ >> g: fn1(eta,...); >> n: fn2(eta,...); >> W^{1,1,1,1,1}_{0,5}(z0,z1,z2,z3,z4) = ...; >> W^{1,1,1,1,2}_{0,5}(z0,z1,z2,z3,z4) = ...; >> W^{1,1,1,1,N}_{0,5}(z0,z1,z2,z3,z4) = ...; >> ... >> W^{N,N,N,N,N}_{0,5}(z0,z1,z2,z3,z4) = ...; >> >> W_{0,5} = sum of all (0,5)'s above. >> >> W^{1,1,1}_{1,3}(z0,z1,z2) = ...; >> W^{1,1,2}_{1,3}(z0,z1,z2) = ...; >> ... >> W^{N,N,N}_{1,3}(z0,z1,z2) = ...; >> >> W_{1,3} = sum of all (1,3)'s above. >> >> W^{1}_{2,1}(z0) = ...; >> W^{2}_{2,1}(z0) = ...; >> ... >> W^N_{2,1}(z0) = ...; >> >> W_{2,1} = sum of all (2,1)'s above. >> >> >> Here the upper indices range over all ordered configurations, with >> repetition, and the lower indices are effectively determined by >> functions g and n. The number of indices equals the value in the second >> subscripted slot. The later W's calculated for higher eta, will rely on >> the complicated recursion formula of W's calculated from lower eta's. >> &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& >> >> >> Maybe the biggest problem is that I don't know how to carry around the >> "decorations" - the subscripts and superscripts - of >> which are varying lengths in all places. >> >> I get 4 different functions here: >> A[[1],[1]]:=x; >> A[[1],[2]]:=x*y; >> A[[2],[1]]:=x*y*z; >> A[[2],[2]]:=x*y*z*w; >> >> but this >> >> for i:1 thru 2 do( >> for j:1 thru 2 do( >> A[[i],[j]](x):= x+Q+i+j; >> ) >> ); >> >> causes the call >> >> A[[1],[2]](u) = Q + u + i + j, so no evaluation of i' and j'. >> >> As an aside, I see how this works: >> for i:1 thru 2 do( for j:1 thru 2 do( W[g,n,i0](z):= g+n+i0+z+Q)); and >> gives >> W[a,b,c](d) = a + b + c + d + Q >> >> I also don't know how to define, via a for >> loop say - automatically - the growing number of variables to call, e.g., >> W_{g,n}^{i0,...,in}(z0,...,zn):= function of >> W_{g-1,n+2}^{j,j,i1,...,in}(z,-z,z1,...,zn) + other sized' previously >> calculated functions/values... - I can't even do the simpler example >> just above - with A[[i],[j]](x), though maybe this is unrelated. >> >> I don't think it would be wise to try and use a tensor package but I'm >> not sure. >> >> I've also tried building strings (automatically) at each level and using >> eval_string() but it hasn't been working on very simple cases and is >> very laborious, and possibly prone to error. >> >> My pseudocode of what I have so far: >> ######################################### >> callme(_etaMax):=block([], >> for eta:1 thru etaMax do( >> gnset1: gnSetForEta(eta),/*SEE BELOW. calc. (g,n) pairs */ >> gnset:[], >> for i:1 thru length(gnset1) do( >> if (gnset1[i][2]#0) then >> gnset: push(gnset1[i],gnset) >> ), >> for i:1 thru length(gnSet) do( >> temporary1: construct the ordered, with repetition, set of >> indices, e.g. {...,[i0,i1,...,in],...} using f(n,N) below, >> >> for q:1 thru length(temporary1) do ( >> W_{g,n+1}^{i0,i1,...,in}(z0,z1,...,zn):= equation here >> ), >> W_{g,n+1}:=sum_{i0,i1,...,in} W_{g,n+1}^{i0,i1,...,in}(z0,z1,...,zn), >> print("Moving on to next (g,n) pair.") >> ), >> print("Moving on to next eta value, up to etaMax.") >> ) >> ); >> >> /*is a better way*/ >> etafn(g,n):= 2*g-2+n; >> ans:[]; >> gnSetForEta(eeta):= block([], >> ans:[], >> for g:0 thru max(floor((eeta+2)/2),floor(eeta/2)+1) do >> for n:0 thru eeta+2 do >> ( >> if(etafn(g,n)=eeta) then ans:push([g,n],ans) else print("bad"[g,n]) >> ), >> ans >> ); >> >> f(n,N):=block([], >> print("Args: (n,N). This is for n^N - n choices for each N spots."), >> L:[], >> tmp1:setify(numlist(I,0,n)), >> for j:1 thru N do( >> L:push(tmp1,L) >> ), >> tmp2:apply(cartesian_product,L), >> listify(flatten(tmp2)) /* to access like a list */ >> ); >> >> numlist(l,s,e):=block([], >> tmp:[], >> for j:0 thru e-s do( >> push(concat(l,string(s+j-0)),tmp) ), >> reverse(tmp) >> ); >> ######################################### >> >> >> So I hope this was clear, succinct, and relatively easy to follow. >> >> In summary: >> >> I ascend in eta, building the varying number of (g,n) pairs as I >> go. >> >> For each (g,n) pair I **calculate** all W_{g,n}^{i0,...,in} and then add >> them up to one variable, called W_{g,n}. >> >> I don't really want to re-calculate anything if I have to - it may take >> too much time. That's why it would be nice to have memoizing functions. >> I don't need to keep the W_{g,n}'s with the superscripts, just the plain >> W_{g,n}'s. >> >> I wrote pretty much everything out so more experienced eyes could >> possibly flesh out any problems. I think I have just a couple >> fundamental problems of understanding how to use Maxima, hopefully less >> than what my lengthy question would suggest. ha ha >> >> Extremely grateful for help :) >> >> P.S. I can find a pdf of the equation if needed. >> >> P.P.S. Please ask if anything is unclear. >> >> >> ------------------------------------------------------------------------------ >> Don't Limit Your Business. Reach for the Cloud. >> GigeNET's Cloud Solutions provide you with the tools and support that >> you need to offload your IT needs and focus on growing your business. >> Configured For All Businesses. Start Your Cloud Today. >> https://www.gigenetcloud.com/ >> _______________________________________________ >> Maxima-discuss mailing list >> Maxima-discuss@... >> https://lists.sourceforge.net/lists/listinfo/maxima-discuss >> > 
 Re: [Maxima-discuss] first question From: Stavros Macrakis (Σταῦρος Μακράκης) - 2015-06-30 22:54:34 Attachments: Message as HTML Without studying your post in detail, it looks to me like you want to define a recursive function of two arguments, both of which are list-valued. Function applications would look like f([a,b,c],[d,e]). You can have arbitrary logic in the definition of the function (whether memoizing or not). Things like f(a,b) := if a=[] then (if b=[] then 1 else first(b)*f([first(b)],rest(b)) ) else first(a)*f(rest(a),b)+1; Or have I completely misunderstood the problem? On Tue, Jun 30, 2015 at 5:58 PM, sbh wrote: > Hello, here is my question: > > I have a recursive equation that I want to evaluate. > > I know how to use simple memoizing functions like in the following two > examples - the factorial and the coefficients for the binomial; > > F[n]:= if (n<=1) then 1 else n*F[n-1]; > > and > > F[a,b]:= if ((a=0) or (b=0)) then 1 else F[a-1,b]+F[a,b-1]; > > which is much better (I think) then the more programmatic way of doing > it, i.e. for the factorial, > > facto(n):= block([], > tmp:1, > for i:1 thru n do( > tmp: tmp*i > ), > tmp > ); > > But my equation is a little more complicated - I include it because it > may help. > > It is **recursive in eta**, which is defined to be > > eta: 2g-2+n such that the first few allowable (g,n) pairs, for etas are > as follows. > > eta:1 -> {(0,3),(1,1)} > eta:2 -> {(0,4),(1,2),(2,0)} > eta:3 -> {(0,5),(1,3),(2,1)} > eta:4 -> {(0,6),(1,4),(2,2),(3,0)} > > ********************************** > Here is the equation: > > Given N (the number of locations', > > the input data is functions, y_i(z) - so there are N of these. > **So how to distinguish them and carry different ones around in > calculations?** > > Should it be y[i](z) := i+z^2? > Should it be y(i,z) := i+z^2? > Should it be y(i):= i*z^2? > Should it be y[i]:= i*z^2? > etc. > > I imagine I'll be able to use ev() or subst() if I need to change a z to > z1 for example. > > Moving on, I have as input - **Written in LaTeX since I'm not sure how > to say it in Maxima, i.e. see above.** > > y(k)= f(z); /*one for each location' - k \in {1,...,N}*/ > B(i,j)=f( y(k) ) OR B^{i,j}(z,z')=f( y(k),subst(z',z,y(l)) ) /*for > instance*/ > K(i,j)=f( y(k), B(i,j) ); > > One can **think** of these as n-forms or tensors, so W_{0,2}^{i,j}, > where i \in {1,2} and j in {1,2} would consist of W_{0,2}^{1,1}, > W_{0,2}^{1,2}, W_{0,2}^{2,1}, and W_{0,2}^{2,2}. So each copy (this has > two copies - n=2) can have a location' either 1 or 2, i.e. from > {1,...,N} (here I chose N=2). > > W_{0,3}^{i0,i1,i2}(z0,z1,z2) has three copies', with each slot(3) being > from 1 to N. > > W_{0,1}^i(z)=0 (**) > W_{0,2}^{i,j}(z,z')=B^{i,j}(z,z') > > The recursion - for W_{g,n}^{i0,i1,...,in}(z0,z1,...,zn): (define > W_{g,n'} in > terms of W_{g,n'+1} \equiv W_{g,n}) > > W_{g,n+1}^{i0,i1,...,in}(z0,z1,...,zn):=\sum_{j=1}^N Residue_{z->0} > K(i0,j)(z,z0) * > > [ > > W_{g-1,n+2}^{j,j,i1,...,in}(z,-z,z1,...,zn) + > > sum_{A union B={1,...,n}} sum_{h=0}^g > > W_{h,|A|+1}^{j,iA}(z,zA) * W_{g-h,|B|+1}^{j,iB}(-z,zB) > > ] > > where in the last line, these products are taken over all different ways > of partitioning' up the union of A and B (equal to {1,...,n}) - I'll > probably use the powerset for A and some setdifference stuff for B. > > For instance, if > > AUB={1,2,3}, then one member could be A:={2} and B:={1,3}, etc. The iA > would be i2, the iB would be {i1,i3}, the zA would be z2, and the zB > would be z1,z3. > > E.G.: W_{1,1}^{i0} = W_{1,0+1}^{i0} = sum_{j=1}^N Res_{z->0} > K^{i0,j}(z,z0) * > [W_{0,2}^{j,j}(z,-z) + nothing remains due to (**)] > > I then want to define the elements for which the recursion is for (no > superscripts), > > W_{g,n+1}(z0,z1,...,zn) > > as follows, > > W_{g,n+1}(z0,z1,...,zn) := > W_{g,n+1}^{1,1,...,1}(z0,z1,...,zn) + ... > W_{g,n+1}^{2,1,...,N}(z0,z1,...,zn) + ... > W_{g,n+1}^{N,N,...,N}(z0,z1,...,zn) > > where these are attained through something like cartesian_product() - > see f(n,N) below. > ********************************** > > So in pseudocode/Latex, and for the explicit case of eta=1..3 I have this: > (how do I define functions with varying numbers of superscripts and > arguments automatically? Do I need to?) > > &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& > n is the number of locations' and each location index i_x can range > from 1 to N > ******************************** > eta:1 /*-> {(1,1),(0,3)}*/ > g: fn1(eta,...); > n: fn2(eta,...); > W^1_{1,1}(z0) = ...; > W^2_{1,1}(z0) = ...; > ... > W^N_{1,1}(z0) = ...; > > W_{1,1} = sum of all (1,1)'s above. > > W^{1,1,1}_{0,3}(z0,z1,z2) = ...; > W^{1,1,2}_{0,3}(z0,z1,z2) = ...; > ... > W^{N,N,N}_{0,3}(z0,z1,z2) = ...; > > W_{0,3} = sum of all (0,3)'s above. > > > eta:2 /*-> {(0,4),(1,2),(2,0)} - exclude if 2nd index is 0 */ > g: fn1(eta,...); > n: fn2(eta,...); > W^{1,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; > W^{1,1,1,2}_{0,4}(z0,z1,z2,z3) = ...; > W^{1,1,1,N}_{0,4}(z0,z1,z2,z3) = ...; > ... > W^{1,1,2,1}_{0,4}(z0,z1,z2,z3) = ...; > ... > W^{N,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; > ... > W^{N,N,N,N}_{0,4}(z0,z1,z2,z3) = ...; > > W_{0,4) = sum of all (0,4)'s above. > > > W^{1,1}_{1,2}(z0,z1) = ...; > W^{1,2}_{1,2}(z0,z1) = ...; > W^{1,N}_{1,2}(z0,z1) = ...; > ... > W^{2,1}_{1,2}(z0,z1) = ...; > ... > W^{N,1}_{1,2}(z0,z1) = ...; > ... > W^{N,N}_{1,2}(z0,z1) = ...; > > W_{1,2} = sum of all (1,2)'s above. > > W^{1,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; > W^{1,1,1,2}_{0,4}(z0,z1,z2,z3) = ...; > W^{1,1,1,N}_{0,4}(z0,z1,z2,z3) = ...; > ... > W^{1,1,2,1}_{0,4}(z0,z1,z2,z3) = ...; > ... > W^{N,1,1,1}_{0,4}(z0,z1,z2,z3) = ...; > ... > W^{N,N,N,N}_{0,4}(z0,z1,z2,z3) = ...; > > W_{0,4} = sum of all (0,4)'s above. > > eta:3 /* {(0,5),(1,3),(2,1)} */ > g: fn1(eta,...); > n: fn2(eta,...); > W^{1,1,1,1,1}_{0,5}(z0,z1,z2,z3,z4) = ...; > W^{1,1,1,1,2}_{0,5}(z0,z1,z2,z3,z4) = ...; > W^{1,1,1,1,N}_{0,5}(z0,z1,z2,z3,z4) = ...; > ... > W^{N,N,N,N,N}_{0,5}(z0,z1,z2,z3,z4) = ...; > > W_{0,5} = sum of all (0,5)'s above. > > W^{1,1,1}_{1,3}(z0,z1,z2) = ...; > W^{1,1,2}_{1,3}(z0,z1,z2) = ...; > ... > W^{N,N,N}_{1,3}(z0,z1,z2) = ...; > > W_{1,3} = sum of all (1,3)'s above. > > W^{1}_{2,1}(z0) = ...; > W^{2}_{2,1}(z0) = ...; > ... > W^N_{2,1}(z0) = ...; > > W_{2,1} = sum of all (2,1)'s above. > > > Here the upper indices range over all ordered configurations, with > repetition, and the lower indices are effectively determined by > functions g and n. The number of indices equals the value in the second > subscripted slot. The later W's calculated for higher eta, will rely on > the complicated recursion formula of W's calculated from lower eta's. > &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& > > > Maybe the biggest problem is that I don't know how to carry around the > "decorations" - the subscripts and superscripts - of > which are varying lengths in all places. > > I get 4 different functions here: > A[[1],[1]]:=x; > A[[1],[2]]:=x*y; > A[[2],[1]]:=x*y*z; > A[[2],[2]]:=x*y*z*w; > > but this > > for i:1 thru 2 do( > for j:1 thru 2 do( > A[[i],[j]](x):= x+Q+i+j; > ) > ); > > causes the call > > A[[1],[2]](u) = Q + u + i + j, so no evaluation of i' and j'. > > As an aside, I see how this works: > for i:1 thru 2 do( for j:1 thru 2 do( W[g,n,i0](z):= g+n+i0+z+Q)); and > gives > W[a,b,c](d) = a + b + c + d + Q > > I also don't know how to define, via a for > loop say - automatically - the growing number of variables to call, e.g., > W_{g,n}^{i0,...,in}(z0,...,zn):= function of > W_{g-1,n+2}^{j,j,i1,...,in}(z,-z,z1,...,zn) + other sized' previously > calculated functions/values... - I can't even do the simpler example > just above - with A[[i],[j]](x), though maybe this is unrelated. > > I don't think it would be wise to try and use a tensor package but I'm > not sure. > > I've also tried building strings (automatically) at each level and using > eval_string() but it hasn't been working on very simple cases and is > very laborious, and possibly prone to error. > > My pseudocode of what I have so far: > ######################################### > callme(_etaMax):=block([], > for eta:1 thru etaMax do( > gnset1: gnSetForEta(eta),/*SEE BELOW. calc. (g,n) pairs */ > gnset:[], > for i:1 thru length(gnset1) do( > if (gnset1[i][2]#0) then > gnset: push(gnset1[i],gnset) > ), > for i:1 thru length(gnSet) do( > temporary1: construct the ordered, with repetition, set of > indices, e.g. {...,[i0,i1,...,in],...} using f(n,N) below, > > for q:1 thru length(temporary1) do ( > W_{g,n+1}^{i0,i1,...,in}(z0,z1,...,zn):= equation here > ), > W_{g,n+1}:=sum_{i0,i1,...,in} W_{g,n+1}^{i0,i1,...,in}(z0,z1,...,zn), > print("Moving on to next (g,n) pair.") > ), > print("Moving on to next eta value, up to etaMax.") > ) > ); > > /*is a better way*/ > etafn(g,n):= 2*g-2+n; > ans:[]; > gnSetForEta(eeta):= block([], > ans:[], > for g:0 thru max(floor((eeta+2)/2),floor(eeta/2)+1) do > for n:0 thru eeta+2 do > ( > if(etafn(g,n)=eeta) then ans:push([g,n],ans) else print("bad"[g,n]) > ), > ans > ); > > f(n,N):=block([], > print("Args: (n,N). This is for n^N - n choices for each N spots."), > L:[], > tmp1:setify(numlist(I,0,n)), > for j:1 thru N do( > L:push(tmp1,L) > ), > tmp2:apply(cartesian_product,L), > listify(flatten(tmp2)) /* to access like a list */ > ); > > numlist(l,s,e):=block([], > tmp:[], > for j:0 thru e-s do( > push(concat(l,string(s+j-0)),tmp) ), > reverse(tmp) > ); > ######################################### > > > So I hope this was clear, succinct, and relatively easy to follow. > > In summary: > > I ascend in eta, building the varying number of (g,n) pairs as I > go. > > For each (g,n) pair I **calculate** all W_{g,n}^{i0,...,in} and then add > them up to one variable, called W_{g,n}. > > I don't really want to re-calculate anything if I have to - it may take > too much time. That's why it would be nice to have memoizing functions. > I don't need to keep the W_{g,n}'s with the superscripts, just the plain > W_{g,n}'s. > > I wrote pretty much everything out so more experienced eyes could > possibly flesh out any problems. I think I have just a couple > fundamental problems of understanding how to use Maxima, hopefully less > than what my lengthy question would suggest. ha ha > > Extremely grateful for help :) > > P.S. I can find a pdf of the equation if needed. > > P.P.S. Please ask if anything is unclear. > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Maxima-discuss mailing list > Maxima-discuss@... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > 
 Re: [Maxima-discuss] Ordered pairs in Maxima From: Stavros Macrakis (Σταῦρος Μακράκης) - 2015-06-30 22:27:45 Attachments: Message as HTML A more "structured" approach would be to use a specific operator for your complex pairs, e.g., complex. You don't need to declare it or anything: complex(2,-3) represents 2-3*%i creal(ob) := if op(ob)='complex then part(ob,1) else error("Not complex",ob)$cimag(ob) := if op(ob)='complex then part(ob,2) else error("Not complex",ob)$ cmult(a,b) := complex( creal(a)*creal(b) - cimag(a)*cimag(b), ..... ) (For the efficiency-hounds out there, yes, this will be a little slower, but I doubt that the original poster is planning to do millions of calculations with these objects, so it doesn't matter.) By the way, this (and the previous approach using lists) all allows symbolic as well as numeric values, e.g., cmult(complex(2,q), complex(r,3)) => complex(2*r-3*q,q*r+6) On Tue, Jun 30, 2015 at 5:07 PM, Stavros Macrakis (Σταῦρος Μακράκης) < macrakis@...> wrote: > In Maxima, you can treat lists as vectors (with the default value of > listarith:true): > > [1,2] + [2,3] => [3,5] > > Operations are pairwise, so of course though addition corresponds to > complex addition, multiplication doesn't. > > You can of course define: > > padd(a,b) := [ a[1]+b[1], a[2]+b[2]]$> pmult(a,b) := [ a[1]*b[1] - a[2]*b[2], a[1]*b[2] + a[2]*b[1] ]$ > > etc. > > Does that help? > > On Tue, Jun 30, 2015 at 5:01 PM, Ronald Modesitt < > ronald.modesitt.835@...> wrote: > >> >> Can anyone direct me to a discussion of, or a package for the mathematics >> of ordered pairs in Maxima? >> >> I am reviewing complex numbers which begins with ordered pairs in my >> textbook. >> >> Thanks >> Ron >> >> >> >> ------------------------------------------------------------------------------ >> Don't Limit Your Business. Reach for the Cloud. >> GigeNET's Cloud Solutions provide you with the tools and support that >> you need to offload your IT needs and focus on growing your business. >> Configured For All Businesses. Start Your Cloud Today. >> https://www.gigenetcloud.com/ >> _______________________________________________ >> Maxima-discuss mailing list >> Maxima-discuss@... >> https://lists.sourceforge.net/lists/listinfo/maxima-discuss >> >> > 

Showing results of 5298

<< < 1 2 3 4 .. 212 > >> (Page 2 of 212)