00:13 -!- Prax01D(n=Prax01D@tor58-23b-94-86.dynamic.rogerstelecom.net) has joined #maxima 02:07 -!- rtoym(n=chatzill@user-0c8hpll.cable.mindspring.com) has joined #maxima 03:32 -!- HaraldG(n=rldprog@g4v1.g4.wien.funkfeuer.at) has joined #maxima 03:33 davidm123: Perhaps you find the following to be a useful start: 03:33 apply_to_part(f, expr, part):=block([l:args(expr)], l[part]:f(l[part]), apply(op(expr), l)); 03:34 apply_to_part(lambda([x],x^2), a*b*c, 2); 03:40 HaraldG, yes, that looks good. 03:41 I just need to figure out how to extend that so that to select an arbitrary subexpression. 03:41 for example, apply_to_part(lambda([x],factor(x)), a*(x+(x/z+y/z)), 2,2); 03:41 to only factor the (x/z+y/z) 03:44 or, actually, that's the same as apply_to_part(factor, a*(x+(x/z+y/z)), 2,2); 03:45 args(x+y+z) 03:47 Hm, this will be a bit more elaborate, but it should be possible to do this following the same idea if you make apply_to_part() a recursive function. 03:48 yeah. not quite sure yet how that is expressed (this is my first day on maxima) 03:51 -!- Prax01D(n=Prax01D@tor58-4-75-105.dynamic.rogerstelecom.net) has joined #maxima 04:03 It needs to be sort of like substpart 04:10 Yes, I think I know what you want. This is a short code example. You will need to work out the details, error checking, etc... Perhaps somebody else has a better idea: 04:11 apply_to_part(f, expr, il):=block([l:args(expr), ind:il[1]], l[ind]:if length(il) > 1 then apply_to_part(f, l[ind], rest(il)) else f(l[ind]), apply(op(expr), l)); 04:11 apply_to_part(foo, a*(b+c)*d, [2]); 04:11 apply_to_part(foo, a*(b+c)*d, [2,1]); 04:12 Hm, this function now is long enough, that it would be better to write into some .mac file... 04:13 i think it might be possible to write by reusing part and substpart actually 04:13 (nonrecursively) 04:21 -!- davidm123(n=davidm12@host-24-149-183-81.patmedia.net) has joined #maxima 04:22 (irc client crashed) 04:24 but I was thinking of something almost like this: apply_to_part(f, expr, [partnums]):=block([], substpart(f(part(expr,partnums)), expr, partnums) ) 04:40 The following is somewhat ugly but should work: 04:40 apply_to_part(f, expr, [partnums]):=block([arglist:cons(expr,partnums)], 04:40 apply(substpart, cons(f(apply(part, arglist)), arglist))); 04:43 yeah (almost exactly what I had) 04:46 I think there's some odd behavior though since Maxima rearranges the expression... 04:46 apply_to_part(expand,(a+1)^2+(b+1)^2+(c+1)^2,1) 04:47 ---> c^2+2*c+(b+1)^2+(a+1)^2+1 04:47 since (a+1)^2+(b+1)^2+(c+1)^2; --> (c+1)^2+(b+1)^2+(a+1)^2 04:48 well, apparently that affects built-in maxima functions too: part((a+1)^2+(b+1)^2+(c+1)^2,1) --> (c+1)^2 04:55 Well, just enter (a+1)^2+(b+1)^2+(c+1)^2 into the maxima prompt and you will see the reason. 04:55 yes, oh well. 04:56 That's maxima's core simplifier at work - it's trying to get the expressions into some canonical form. 04:59 I need to get some sleep now. Good luck with your first steps with maxima! :-) 06:35 -!- stw_(n=stw@e176178138.adsl.alicedsl.de) has joined #maxima 07:47 -!- turn-omg_(n=turn-omg@FLH1Aah024.fki.mesh.ad.jp) has joined #maxima 08:30 -!- Prax01D(n=Prax01D@149.99.86.219) has joined #maxima 12:42 -!- eggauah(n=daniel@201.82.9.163) has joined #maxima 14:36 -!- Prax01D(n=Prax01D@tor58-4-75-241.dynamic.rogerstelecom.net) has joined #maxima 14:45 -!- szymon(n=szymon@cat99.neoplus.adsl.tpnet.pl) has joined #maxima 20:34 -!- Prax01D(n=Prax01D@tor58-23b-95-39.dynamic.rogerstelecom.net) has joined #maxima 21:29 -!- szymon(n=szymon@cad3.neoplus.adsl.tpnet.pl) has joined #maxima 21:45 -!- JohnFlux_(n=JohnFlux@gates3.resnet.susx.ac.uk) has joined #maxima