From: Kostas Oikonomou <k.oikonomou@at...>  20140801 17:11:48

It would be very useful and convenient to users familiar with e.g. maxima or Mathematica, and looking at Reduce as an alternative, if Reduce had the ability to perform some vector operations on lists. For example, A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; c*A > {c*a1,..,c*a4} A + B > {a1+b1,...,a4+b4} A*B > {a1*b1,...,a4*b4} and presumably such an extension would also handle linear expressions like c1*A + c2*B, ... Unless, I'm missing something major, these manipulations, which are quite convenient (in evaluating functions with vector arguments, in my case), are very cumbersome to do in Reduce. I saw a related thread on this from 2011, but apparently nothing further was done. Kostas 
From: René Grognard <dositheus41@gm...>  20140808 20:59:27
Attachments:
Message as HTML

I was under the impression that my report on Eberhard Schruefer's *listvecops.red * was addressed to the reduceforum but it appears I was mistaken. My apologies if some people receive the two reports! +++++ Thanks to Eberhard Schruefer's *listvecops.red * I converted most of my wxMaxima tutorials on the CayleyDickson recursion and its modification to regain associativity obtaining thereby the corresponding Clifford algebras. In the conversion the* linear algebra *part of the nested lists operations is put to (very heavy!) use and I am happy to report that in this respect I get the same results as with wxMaxima. Multiplication of lists by lists is *not* used in this work since multiplication of hypercomplex numbers is of course ruled by the CayleyDickson recursion or its variants and ultimately rests on ordinary multiplication. [1] There is one minor point. With *for ... sum ... *the sum is returned *unevaluated* (see 7 below) and thus I had to call *aeval* to get it (see 8): 2: off nat; 3: array X(3); 4: X(1):={{x0,x1},{x2,x3}}; x(1) := {{x0,x1},{x2,x3}} 5: X(2):={{y0,y1},{y2,y3}}; x(2) := {{y0,y1},{y2,y3}} 6: X(3):={{z0,z1},{z2,z3}}; x(3) := {{z0,z1},{z2,z3}} 7: Y:=for k:=1:3 sum mkid(a,k)*X(k); y := {{x0,x1},{x2,x3}}*a1 + {{y0,y1},{y2,y3}}*a2 + {{z0,z1},{z2,z3}}*a3 8: Y:=aeval Y; y := {{a1*x0 + a2*y0 + a3*z0, a1*x1 + a2*y1 + a3*z1}, {a1*x2 + a2*y2 + a3*z2, a1*x3 + a2*y3 + a3*z3}} [2] It would be nice to include a *listdf *where the differentiation operator *df* would be applied to every element of the nested list as done by maxima: (%i1) U:[[u0,u1],[u2,u3]]; (%o1) [[u0,u1],[u2,u3]] (%i2) depends([u0,u1,u2,u3],x); (%o2) [u0(x),u1(x),u2(x),u3(x)] (%i3) diff(U,x); (%o3) [['diff(u0,x,1),'diff(u1,x,1)],['diff(u2,x,1),'diff(u3,x,1)]] In maxima the full syntax of diff is diff(U,x1,n1,...,xk,nk) and is applied to every element in the nested list U. Many thanks again to Eberhard Schruefer ! 
From: Eberhard Schruefer <eschruefer@ca...>  20140808 21:25:33
Attachments:
Message as HTML

On 08/08/14 22:59, René Grognard wrote: > I was under the impression that my report on Eberhard Schruefer's > /listvecops.red / was addressed to the reduceforum but it appears I > was mistaken. My apologies if some people receive the two reports! > > +++++ > > Thanks to Eberhard Schruefer's /listvecops.red / I converted most of > my wxMaxima tutorials on the CayleyDickson recursion and its > modification to regain associativity obtaining thereby the > corresponding Clifford algebras. > > In the conversion the/linear algebra /part of the nested lists > operations is put to (very heavy!) use and I am happy to report that > in this respect I get the same results as with wxMaxima. > > Multiplication of lists by lists is /not/ used in this work since > multiplication of hypercomplex numbers is of course ruled by the > CayleyDickson recursion or its variants and ultimately rests on > ordinary multiplication. > > [1] There is one minor point. With /for ... sum ... /the sum is > returned /unevaluated/ (see 7 below) and thus I had to call /aeval/ to > get it (see 8): > > 2: off nat; > > 3: array X(3); > > 4: X(1):={{x0,x1},{x2,x3}}; > x(1) := {{x0,x1},{x2,x3}} > > 5: X(2):={{y0,y1},{y2,y3}}; > x(2) := {{y0,y1},{y2,y3}} > > 6: X(3):={{z0,z1},{z2,z3}}; > x(3) := {{z0,z1},{z2,z3}} > > 7: Y:=for k:=1:3 sum mkid(a,k)*X(k); > y := {{x0,x1},{x2,x3}}*a1 + {{y0,y1},{y2,y3}}*a2 + {{z0,z1},{z2,z3}}*a3 > > 8: Y:=aeval Y; > y := {{a1*x0 + a2*y0 + a3*z0, > a1*x1 + a2*y1 + a3*z1}, > {a1*x2 + a2*y2 + a3*z2, > a1*x3 + a2*y3 + a3*z3}} This is very strange. I cannot reproduce it here. Did you rebuild the whole REDUCE? It is necessary since I made some changes in other modules besides the ones in listvecops. > > [2] It would be nice to include a /listdf /where the differentiation > operator /df/ would be applied to every element of the nested list as > done by maxima: > > (%i1) U:[[u0,u1],[u2,u3]]; > (%o1) [[u0,u1],[u2,u3]] > (%i2) depends([u0,u1,u2,u3],x); > (%o2) [u0(x),u1(x),u2(x),u3(x)] > > (%i3) diff(U,x); > (%o3) [['diff(u0,x,1),'diff(u1,x,1)],['diff(u2,x,1),'diff(u3,x,1)]] > > In maxima the full syntax of diff is diff(U,x1,n1,...,xk,nk) and is > applied to every element in the nested list U. This is done now and also for int. 7: df({{x^2,x},{x^3,x^5}},x); 2 4 {{2*x,1},{3*x ,5*x }} 8: int(ws ,x); 2 3 5 {{x ,x},{x ,x }} Eberhard > > Many thanks again to Eberhard Schruefer ! > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > > > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers 
From: René Grognard <dositheus41@gm...>  20140810 05:33:26
Attachments:
Message as HTML

>> 7: Y:=for k:=1:3 sum mkid(a,k)*X(k); y := {{x0,x1},{x2,x3}}*a1 + {{y0,y1},{y2,y3}}*a2 + {{z0,z1},{z2,z3}}*a3 8: Y:=aeval Y; y := {{a1*x0 + a2*y0 + a3*z0, a1*x1 + a2*y1 + a3*z1}, {a1*x2 + a2*y2 + a3*z2, a1*x3 + a2*y3 + a3*z3}} * This is very strange. I cannot reproduce it here. Did you rebuild the whole REDUCE? It is necessary since I made some changes in other modules besides the ones in listvecops.* << This would explain it. Rebuilding the whole reduce has never been done in my case (using Cygwin always missing yet another package or its required update) without calling Arthur Norman for help. Thus if other modules are also necessary it'll take some time to do it. Meanwhile I simply added *aeval* when needed. In fact every so often I had to force the evaluation through <<...>> instead of simple brackets or relying on precedence of operators so I guess I need a full rebuild. However I now completed the conversion to reduce of my maxima tutorials on hypercomplex algebras. After a full rebuild of reduce I have no doubt that some cleaning up will only be required. Thanks for adding *df* which I "patched" since strictly speaking I only needed the linear algebra of nested lists but a proper procedure for differentiate nested lists is much better, avoiding a lot of ugly coding. Strangely I found that *trigsimp* worked on nested list exactly as its equivalent does in maxima. Of course it is essential for the algebra of reflection and rotation operators, perhaps one of the most compelling reason to use hypercomplex algebra in space and spacetime geometries. Again warm thanks to Eberhard Schruefer ! René. On Sat, Aug 9, 2014 at 7:25 AM, Eberhard Schruefer <eschruefer@... > wrote: > > On 08/08/14 22:59, René Grognard wrote: > > I was under the impression that my report on Eberhard Schruefer's > *listvecops.red * was addressed to the reduceforum but it appears I was > mistaken. My apologies if some people receive the two reports! > > +++++ > > Thanks to Eberhard Schruefer's *listvecops.red * I converted most of my > wxMaxima tutorials on the CayleyDickson recursion and its modification to > regain associativity obtaining thereby the corresponding Clifford algebras. > > In the conversion the* linear algebra *part of the nested lists > operations is put to (very heavy!) use and I am happy to report that in > this respect I get the same results as with wxMaxima. > > Multiplication of lists by lists is *not* used in this work since > multiplication of hypercomplex numbers is of course ruled by the > CayleyDickson recursion or its variants and ultimately rests on ordinary > multiplication. > > [1] There is one minor point. With *for ... sum ... *the sum is returned > *unevaluated* (see 7 below) and thus I had to call *aeval* to get it (see > 8): > > 2: off nat; > > 3: array X(3); > > 4: X(1):={{x0,x1},{x2,x3}}; > x(1) := {{x0,x1},{x2,x3}} > > 5: X(2):={{y0,y1},{y2,y3}}; > x(2) := {{y0,y1},{y2,y3}} > > 6: X(3):={{z0,z1},{z2,z3}}; > x(3) := {{z0,z1},{z2,z3}} > > 7: Y:=for k:=1:3 sum mkid(a,k)*X(k); > y := {{x0,x1},{x2,x3}}*a1 + {{y0,y1},{y2,y3}}*a2 + {{z0,z1},{z2,z3}}*a3 > > 8: Y:=aeval Y; > y := {{a1*x0 + a2*y0 + a3*z0, > a1*x1 + a2*y1 + a3*z1}, > {a1*x2 + a2*y2 + a3*z2, > a1*x3 + a2*y3 + a3*z3}} > > > This is very strange. I cannot reproduce it here. Did you rebuild the > whole REDUCE? It is necessary since I made some changes in other modules > besides > the ones in listvecops. > > > > [2] It would be nice to include a *listdf *where the differentiation > operator *df* would be applied to every element of the nested list as > done by maxima: > > (%i1) U:[[u0,u1],[u2,u3]]; > (%o1) [[u0,u1],[u2,u3]] > > (%i2) depends([u0,u1,u2,u3],x); > (%o2) [u0(x),u1(x),u2(x),u3(x)] > > (%i3) diff(U,x); > (%o3) [['diff(u0,x,1),'diff(u1,x,1)],['diff(u2,x,1),'diff(u3,x,1)]] > > In maxima the full syntax of diff is diff(U,x1,n1,...,xk,nk) and is > applied to every element in the nested list U. > > > This is done now and also for int. > > 7: df({{x^2,x},{x^3,x^5}},x); > > 2 4 > {{2*x,1},{3*x ,5*x }} > > 8: int(ws ,x); > > 2 3 5 > {{x ,x},{x ,x }} > > Eberhard > > > > > Many thanks again to Eberhard Schruefer ! > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now.http://p.sf.net/sfu/bds > > > > _______________________________________________ > Reducealgebradevelopers mailing listReducealgebradevelopers@...nethttps://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers > > > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers > > 
From: Eberhard Schruefer <eschruefer@ca...>  20140801 18:48:49

I think I already told off the list that this is not hard to implement. I will put a small package together over the next few weeks. Eberhard On 01/08/14 19:10, Kostas Oikonomou wrote: > It would be very useful and convenient to users familiar with e.g. > maxima or Mathematica, and looking at Reduce as an alternative, if > Reduce had the ability to perform some vector operations on lists. For > example, > > A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; > > c*A > {c*a1,..,c*a4} > > A + B > {a1+b1,...,a4+b4} > > A*B > {a1*b1,...,a4*b4} > > and presumably such an extension would also handle linear expressions like > > c1*A + c2*B, ... > > Unless, I'm missing something major, these manipulations, which are > quite convenient (in evaluating functions with vector arguments, in my > case), are very cumbersome to do in Reduce. > > I saw a related thread on this from 2011, but apparently nothing further > was done. > > Kostas > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers 
From: Kostas Oikonomou <k.oikonomou@at...>  20140801 20:59:39

Eberhard, That would be welcome, thanks. Another point of confusion for me is arrays vs. lists. As far as I can see, in Reduce arrays provide access by index, which other systems (e.g. maxima) also allow for lists. Arrays are also global in scope, which to me seems debatable. Are there any other differences visible to the user? Or reasons why one would want to use arrays? Kostas On 08/01/2014 14:48, Eberhard Schruefer wrote: > I think I already told off the list that this is not hard to implement. > I will put a small package together over the next few weeks. > > Eberhard > > On 01/08/14 19:10, Kostas Oikonomou wrote: >> It would be very useful and convenient to users familiar with e.g. >> maxima or Mathematica, and looking at Reduce as an alternative, if >> Reduce had the ability to perform some vector operations on lists. For >> example, >> >> A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; >> >> c*A > {c*a1,..,c*a4} >> >> A + B > {a1+b1,...,a4+b4} >> >> A*B > {a1*b1,...,a4*b4} >> >> and presumably such an extension would also handle linear expressions like >> >> c1*A + c2*B, ... >> >> Unless, I'm missing something major, these manipulations, which are >> quite convenient (in evaluating functions with vector arguments, in my >> case), are very cumbersome to do in Reduce. >> >> I saw a related thread on this from 2011, but apparently nothing further >> was done. >> >> Kostas >> >> >>  > 
From: Tony Roberts <anthony.roberts@ad...>  20140802 00:14:06

BEGIN PGP SIGNED MESSAGE Hash: SHA1 Regarding arrays versus lists: I suggest to prefer arrays, unless you have a good reason for lists. 1. Arrays are more compact: v(3) cf part(v,3) and a(3,2) cf part(part(a,3),2) 2. Arrays have better error checking: the statement v(0):=... is allowed and sensible, but part(v,0):=... is allowed but generates nonsense; referring to v(1) is sensibly erroneous, but part(v,1) is the end element 3. Arrays are initialised to zero automatically, whereas lists have to be initialised explicitly (although some would argue this is a reason to prefer lists). However, lists are nice to check a set of conditions, such as whether residuals are zero or not as in "if {res1,res2,res3}={0,0,0} then quit;" Tony On 2/08/2014 6:31 am, Kostas Oikonomou wrote: > Eberhard, > > That would be welcome, thanks. > > Another point of confusion for me is arrays vs. lists. As far as I can > see, in Reduce arrays provide access by index, which other systems (e.g. > maxima) also allow for lists. Arrays are also global in scope, which to > me seems debatable. Are there any other differences visible to the > user? Or reasons why one would want to use arrays? > > Kostas > > On 08/01/2014 14:48, Eberhard Schruefer wrote: >> I think I already told off the list that this is not hard to implement. >> I will put a small package together over the next few weeks. >> >> Eberhard >> >> On 01/08/14 19:10, Kostas Oikonomou wrote: >>> It would be very useful and convenient to users familiar with e.g. >>> maxima or Mathematica, and looking at Reduce as an alternative, if >>> Reduce had the ability to perform some vector operations on lists. For >>> example, >>> >>> A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; >>> >>> c*A > {c*a1,..,c*a4} >>> >>> A + B > {a1+b1,...,a4+b4} >>> >>> A*B > {a1*b1,...,a4*b4} >>> >>> and presumably such an extension would also handle linear expressions like >>> >>> c1*A + c2*B, ... >>> >>> Unless, I'm missing something major, these manipulations, which are >>> quite convenient (in evaluating functions with vector arguments, in my >>> case), are very cumbersome to do in Reduce. >>> >>> I saw a related thread on this from 2011, but apparently nothing further >>> was done. >>> >>> Kostas >>> >>> >>>  >> > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers >     Professor A.J. Roberts School of Mathematical Sciences phone: +61 8 8313 3035 University of Adelaide fax: +61 8 8313 3696 South Australia 5005. mailto:anthony.roberts@... http://www.maths.adelaide.edu.au/anthony.roberts/ ==.0000001000000100000110001000011010001111110010111011101000010000== BEGIN PGP SIGNATURE Version: GnuPG v1 Comment: Using GnuPG with Thunderbird  http://www.enigmail.net/ iEYEARECAAYFAlPcLTsACgkQ7TX8dTbro1vRUwCdEHXYudtfD1skBPbVAgQhUgRQ I9MAnjRhrX0lTy29D03VtP6Fzuwq5ANZ =Lvu9 END PGP SIGNATURE 
From: Eberhard Schruefer <eschruefer@ca...>  20140802 17:40:33

I commited a basic package for the operations you asked for. Please fetch the latest svn and then go 'load_package listvecops;" . Your examples then result in 1: load_package listvecops; 2: A := {a1,a2,a3,a4}; a := {a1,a2,a3,a4} 3: B := {b1,b2,b3,b4}; b := {b1,b2,b3,b4} 4: c*A ; {a1*c, a2*c, a3*c, a4*c} 5: A + B; {a1 + b1, a2 + b2, a3 + b3, a4 + b4} 6: A*B; {a1*b1, a2*b2, a3*b3, a4*b4} 7: c1*A + c2*B; {a1*c1 + b1*c2, a2*c1 + b2*c2, a3*c1 + b3*c2, a4*c1 + b4*c2} Is the product of two lists like you wanted it? It looks a little bit odd to me, but if this is the convention in other systems thats fine. Eberhard On 01/08/14 23:01, Kostas Oikonomou wrote: > Eberhard, > > That would be welcome, thanks. > > Another point of confusion for me is arrays vs. lists. As far as I can > see, in Reduce arrays provide access by index, which other systems (e.g. > maxima) also allow for lists. Arrays are also global in scope, which to > me seems debatable. Are there any other differences visible to the > user? Or reasons why one would want to use arrays? > > Kostas > > On 08/01/2014 14:48, Eberhard Schruefer wrote: >> I think I already told off the list that this is not hard to implement. >> I will put a small package together over the next few weeks. >> >> Eberhard >> >> On 01/08/14 19:10, Kostas Oikonomou wrote: >>> It would be very useful and convenient to users familiar with e.g. >>> maxima or Mathematica, and looking at Reduce as an alternative, if >>> Reduce had the ability to perform some vector operations on lists. For >>> example, >>> >>> A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; >>> >>> c*A > {c*a1,..,c*a4} >>> >>> A + B > {a1+b1,...,a4+b4} >>> >>> A*B > {a1*b1,...,a4*b4} >>> >>> and presumably such an extension would also handle linear expressions like >>> >>> c1*A + c2*B, ... >>> >>> Unless, I'm missing something major, these manipulations, which are >>> quite convenient (in evaluating functions with vector arguments, in my >>> case), are very cumbersome to do in Reduce. >>> >>> I saw a related thread on this from 2011, but apparently nothing further >>> was done. >>> >>> Kostas >>> >>> >>>  > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers 
From: Tony Roberts <anthony.roberts@ad...>  20140801 21:14:21

BEGIN PGP SIGNED MESSAGE Hash: SHA1 I wonder if a better solution is to document the way I mostly do vectormatrix things in Reduce. My recommendation is to write vector expressions in terms of basis vectors, say e(j): operator e; r:=x*e(1)+y*e(2)+z*e(3); then defines a vector on which which you can immediately do addition, scalar multiplication, integration, differentiation, etc. Invoking let {e(~i)*e(~j)=>0,e(~i)^2=>e(i)}; encodes multiplication as component wise, namely r^2 evaluates to x^2*e(1)+y^2*e(2)+z^2*e(3) (an easy change would alternatively code * as a dot product if you wanted). Matrices have two alternatives. One alternative is to code matrices as their action as a linear operator. For example, operator aa; linear aa; let {aa(e(1),e)=>e(2)e(3), a(e(2),e)=>e(3)e(1), a(e(3),e)=>e(1)e(2)}; encodes aa(r,e) as multiplication by matrix [0 1 1; 1 0 1; 1 1 0] A second alternative is to use matrix basis e(i,j) so that, for example, the above matrix would be defined as aa:=e(1,2)e(1,3)e(2,1)+e(2,3)+e(3,1)e(3,2); and then used in expressions such as aa*r upon defining the pattern let { e(~i,~j)*e(~k)=>e(i) when j=k, e(~i,~j)*e(~k)=>0 when j neq k}; (although be careful with commutativity for matrixmatrix products). Tony On 2/08/2014 4:18 am, Eberhard Schruefer wrote: > I think I already told off the list that this is not hard to implement. > I will put a small package together over the next few weeks. > > Eberhard > > On 01/08/14 19:10, Kostas Oikonomou wrote: >> It would be very useful and convenient to users familiar with e.g. >> maxima or Mathematica, and looking at Reduce as an alternative, if >> Reduce had the ability to perform some vector operations on lists. For >> example, >> >> A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; >> >> c*A > {c*a1,..,c*a4} >> >> A + B > {a1+b1,...,a4+b4} >> >> A*B > {a1*b1,...,a4*b4} >> >> and presumably such an extension would also handle linear expressions like >> >> c1*A + c2*B, ... >> >> Unless, I'm missing something major, these manipulations, which are >> quite convenient (in evaluating functions with vector arguments, in my >> case), are very cumbersome to do in Reduce. >> >> I saw a related thread on this from 2011, but apparently nothing further >> was done. >> >> Kostas >> >> >>  >> Want fast and easy access to all the code in your enterprise? Index and >> search up to 200,000 lines of code with a free copy of Black Duck >> Code Sight  the same software that powers the world's largest code >> search on Ohloh, the Black Duck Open Hub! Try it now. >> http://p.sf.net/sfu/bds >> _______________________________________________ >> Reducealgebradevelopers mailing list >> Reducealgebradevelopers@... >> https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers >     Professor A.J. Roberts School of Mathematical Sciences phone: +61 8 8313 3035 University of Adelaide fax: +61 8 8313 3696 South Australia 5005. mailto:anthony.roberts@... http://www.maths.adelaide.edu.au/anthony.roberts/ ==.0000001000000100000110001000011010001111110010111011101000010000== BEGIN PGP SIGNATURE Version: GnuPG v1 Comment: Using GnuPG with Thunderbird  http://www.enigmail.net/ iEYEARECAAYFAlPcABAACgkQ7TX8dTbro1tnIgCbBVPmseZEPAL5C9HIRvb/JTEo TYIAn1sdl19as9Pok4Dn8up+7eBxQhMm =rKA2 END PGP SIGNATURE 
From: Tony Roberts <anthony.roberts@ad...>  20140803 01:35:02
Attachments:
Message as HTML

BEGIN PGP SIGNED MESSAGE Hash: SHA1 Yes, componentwise transcendental functions (and division) are a bit tricky using the basis vector ideaone has to do something like for j:=1:n sum e(j)*log(coeffn(z,e(j),1)), although this is similar to what I think has to be done for lists namely for j:=1:n collect log(part(z,j)); Tony On 2/08/2014 11:23 pm, Kostas Oikonomou wrote: > Hello Tony, thank you for the vector examples, I had not thought of dealing with vectors it this way. > > However, I may have used the "functions with vector arguments" in misleading way. > What I had in mind was an example like this: > > Say x and y are two lists of arbitrary length, and you want to compute the function > > H(c*x + (1c)*y), c in [0,1], > > where H(z) = sum_i z_i log(z_i). Given vectorlike operations on lists, I could write this nicely as > > z := c*x + (1c)*y, H := z . log(z), > > where "." is the dot product. > > Kostas > > What I had in mind is > On 08/01/2014 17:01, Tony Roberts wrote: > > >> I wonder if a better solution is to document the way I mostly do >> vectormatrix things in Reduce. >> >> My recommendation is to write vector expressions in terms of basis >> vectors, say e(j): >> operator e; >> r:=x*e(1)+y*e(2)+z*e(3); >> then defines a vector on which which you can immediately do >> addition, scalar multiplication, integration, differentiation, etc. >> Invoking >> let {e(~i)*e(~j)=>0,e(~i)^2=>e(i)}; >> encodes multiplication as component wise, namely r^2 evaluates to >> x^2*e(1)+y^2*e(2)+z^2*e(3) (an easy change would alternatively code >> * as a dot product if you wanted). >> >> Matrices have two alternatives. >> One alternative is to code matrices as their action as a linear >> operator. For example, >> operator aa; linear aa; >> let {aa(e(1),e)=>e(2)e(3), a(e(2),e)=>e(3)e(1), a(e(3),e)=>e(1)e(2)}; >> encodes aa(r,e) as multiplication by matrix [0 1 1; 1 0 1; 1 1 0] >> A second alternative is to use matrix basis e(i,j) so that, for >> example, the above matrix would be defined as >> aa:=e(1,2)e(1,3)e(2,1)+e(2,3)+e(3,1)e(3,2); >> and then used in expressions such as aa*r upon defining the pattern >> let { e(~i,~j)*e(~k)=>e(i) when j=k, e(~i,~j)*e(~k)=>0 when j neq k}; >> (although be careful with commutativity for matrixmatrix products). >> >> Tony >> >> On 2/08/2014 4:18 am, Eberhard Schruefer wrote: >> > I think I already told off the list that this is not hard to implement. >> > I will put a small package together over the next few weeks. >> >> > Eberhard >> >> > On 01/08/14 19:10, Kostas Oikonomou wrote: >> >> It would be very useful and convenient to users familiar with e.g. >> >> maxima or Mathematica, and looking at Reduce as an alternative, if >> >> Reduce had the ability to perform some vector operations on >> lists. For >> >> example, >> >> >> >> A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; >> >> >> >> c*A > {c*a1,..,c*a4} >> >> >> >> A + B > {a1+b1,...,a4+b4} >> >> >> >> A*B > {a1*b1,...,a4*b4} >> >> >> >> and presumably such an extension would also handle linear >> expressions like >> >> >> >> c1*A + c2*B, ... >> >> >> >> Unless, I'm missing something major, these manipulations, which are >> >> quite convenient (in evaluating functions with vector arguments, >> in my >> >> case), are very cumbersome to do in Reduce. >> >> >> >> I saw a related thread on this from 2011, but apparently nothing >> further >> >> was done. >> >> >> >> Kostas >> >> >> >> >> >> >>  >> >> Want fast and easy access to all the code in your enterprise? >> Index and >> >> search up to 200,000 lines of code with a free copy of Black Duck >> >> Code Sight  the same software that powers the world's largest code >> >> search on Ohloh, the Black Duck Open Hub! Try it now. >> >> http://p.sf.net/sfu/bds >> >> _______________________________________________ >> >> Reducealgebradevelopers mailing list >> >> Reducealgebradevelopers@... >> >> >> https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers >> >> >> >>  >> > Want fast and easy access to all the code in your enterprise? >> Index and >> > search up to 200,000 lines of code with a free copy of Black Duck >> > Code Sight  the same software that powers the world's largest code >> > search on Ohloh, the Black Duck Open Hub! Try it now. >> > http://p.sf.net/sfu/bds >> > _______________________________________________ >> > Reducealgebradevelopers mailing list >> > Reducealgebradevelopers@... >> > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers >> >> > > > > > >  > > Want fast and easy access to all the code in your enterprise? Index and > > search up to 200,000 lines of code with a free copy of Black Duck > > Code Sight  the same software that powers the world's largest code > > search on Ohloh, the Black Duck Open Hub! Try it now. > > http://p.sf.net/sfu/bds > > _______________________________________________ > > Reducealgebradevelopers mailing list > > Reducealgebradevelopers@... > > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers > > > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > > > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers     Professor A.J. Roberts School of Mathematical Sciences phone: +61 8 8313 3035 University of Adelaide fax: +61 8 8313 3696 South Australia 5005. mailto:anthony.roberts@... http://www.maths.adelaide.edu.au/anthony.roberts/ ==.0000001000000100000110001000011010001111110010111011101000010000== BEGIN PGP SIGNATURE Version: GnuPG v1 Comment: Using GnuPG with Thunderbird  http://www.enigmail.net/ iEYEARECAAYFAlPdka8ACgkQ7TX8dTbro1un7ACggXRSBurN+ldL/mctnPnr9kgb +JUAnjShRUTqOXIoSC4in7TSbxAhmRAr =2MyF END PGP SIGNATURE 
From: Rainer Schöpf <rainer.schoepf@gm...>  20140803 05:47:59

On Sun, 3 Aug 2014 at 11:04 +0930, Tony Roberts wrote: > Yes, componentwise transcendental functions (and division) are a > bit tricky using the basis vector ideaone has to do something > like for j:=1:n sum e(j)*log(coeffn(z,e(j),1)), although this is > similar to what I think has to be done for lists namely for j:=1:n > collect log(part(z,j)); Which an be written shorter as map(log,z) Below is an idea how to define an operator listdot that implements the dot product for lists. The real problem is that it is difficult to overload standard operators like + * or . (dot) . Rainer  1: procedure listdot(u,v); 1: if length u neq length v then rederr "lists of different lengths" 1: else begin scalar s; 1: while u neq {} do << s:= first u * first v +s ; u:=rest u; v:= rest v >>; 1: return s; 1: end; listdot 2: infix listdot; 3: l := {z1,z2,z3}; l := {z1,z2,z3} 4: l listdot map(log,l); log(z1)*z1 + log(z2)*z2 + log(z3)*z3  
From: Kostas Oikonomou <k.oikonomou@at...>  20140802 13:51:26
Attachments:
Message as HTML

Hello Tony, thank you for the vector examples, I had not thought of dealing with vectors it this way. However, I may have used the "functions with vector arguments" in misleading way. What I had in mind was an example like this: Say x and y are two lists of arbitrary length, and you want to compute the function H(c*x + (1c)*y), c in [0,1], where H(z) = sum_i z_i log(z_i). Given vectorlike operations on lists, I could write this nicely as z := c*x + (1c)*y, H := z . log(z), where "." is the dot product. Kostas What I had in mind is On 08/01/2014 17:01, Tony Roberts wrote: > > I wonder if a better solution is to document the way I mostly do > vectormatrix things in Reduce. > > My recommendation is to write vector expressions in terms of basis > vectors, say e(j): > operator e; > r:=x*e(1)+y*e(2)+z*e(3); > then defines a vector on which which you can immediately do > addition, scalar multiplication, integration, differentiation, etc. > Invoking > let {e(~i)*e(~j)=>0,e(~i)^2=>e(i)}; > encodes multiplication as component wise, namely r^2 evaluates to > x^2*e(1)+y^2*e(2)+z^2*e(3) (an easy change would alternatively code > * as a dot product if you wanted). > > Matrices have two alternatives. > One alternative is to code matrices as their action as a linear > operator. For example, > operator aa; linear aa; > let {aa(e(1),e)=>e(2)e(3), a(e(2),e)=>e(3)e(1), a(e(3),e)=>e(1)e(2)}; > encodes aa(r,e) as multiplication by matrix [0 1 1; 1 0 1; 1 1 0] > A second alternative is to use matrix basis e(i,j) so that, for > example, the above matrix would be defined as > aa:=e(1,2)e(1,3)e(2,1)+e(2,3)+e(3,1)e(3,2); > and then used in expressions such as aa*r upon defining the pattern > let { e(~i,~j)*e(~k)=>e(i) when j=k, e(~i,~j)*e(~k)=>0 when j neq k}; > (although be careful with commutativity for matrixmatrix products). > > Tony > > On 2/08/2014 4:18 am, Eberhard Schruefer wrote: > > I think I already told off the list that this is not hard to implement. > > I will put a small package together over the next few weeks. > > > Eberhard > > > On 01/08/14 19:10, Kostas Oikonomou wrote: > >> It would be very useful and convenient to users familiar with e.g. > >> maxima or Mathematica, and looking at Reduce as an alternative, if > >> Reduce had the ability to perform some vector operations on > lists. For > >> example, > >> > >> A := {a1,a2,a3,a4}; B := {b1,b2,b3,b4}; > >> > >> c*A > {c*a1,..,c*a4} > >> > >> A + B > {a1+b1,...,a4+b4} > >> > >> A*B > {a1*b1,...,a4*b4} > >> > >> and presumably such an extension would also handle linear > expressions like > >> > >> c1*A + c2*B, ... > >> > >> Unless, I'm missing something major, these manipulations, which are > >> quite convenient (in evaluating functions with vector arguments, > in my > >> case), are very cumbersome to do in Reduce. > >> > >> I saw a related thread on this from 2011, but apparently nothing > further > >> was done. > >> > >> Kostas > >> > >> > >> >  > >> Want fast and easy access to all the code in your enterprise? > Index and > >> search up to 200,000 lines of code with a free copy of Black Duck > >> Code Sight  the same software that powers the world's largest code > >> search on Ohloh, the Black Duck Open Hub! Try it now. > >> http://p.sf.net/sfu/bds > >> _______________________________________________ > >> Reducealgebradevelopers mailing list > >> Reducealgebradevelopers@... > >> > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers > > > >  > > Want fast and easy access to all the code in your enterprise? > Index and > > search up to 200,000 lines of code with a free copy of Black Duck > > Code Sight  the same software that powers the world's largest code > > search on Ohloh, the Black Duck Open Hub! Try it now. > > http://p.sf.net/sfu/bds > > _______________________________________________ > > Reducealgebradevelopers mailing list > > Reducealgebradevelopers@... > > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers > > > > >  > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight  the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Reducealgebradevelopers mailing list > Reducealgebradevelopers@... > https://lists.sourceforge.net/lists/listinfo/reducealgebradevelopers 