Re: Straightforward factoring and simplification

*To*: mathgroup at smc.vnet.net*Subject*: [mg111770] Re: Straightforward factoring and simplification*From*: AES <siegman at stanford.edu>*Date*: Fri, 13 Aug 2010 06:52:57 -0400 (EDT)

Some time back there was a post in this group about how to convert the expression (Eq_1) a*b + a*c - 2*a*d + b*c - 2*b*d - 2*c*d + 3*d^2 into (Eq_2) (a-d)*(b-d) + (a-d)*(c-d) + (b-d)*(c-d) to which I made an absurd response. My meds are working better now, so I hope the following will make sense. Although I'm not attempting to answer the original question, I did want to understand better the symmetry of these expressions. So, suppose we scale a, b and c to d, and rename them as x, y, z. The expression then obviously has a zero at x=y=z=1, so shift the origin of coordinates to that point (suffix 's') and get f=(x-1)(y-1)+(x-1)(z-1)+(y-1)(z-1); fs=f/.{x->xs+1,y->ys+1,z->zs+1}; fs//Expand xs ys+xs zs+ys zs This has an obvious axis of symmetry, so rotate the axes into alignment with it (suffix 'r') and get {xs,ys,zs}=RotationMatrix[{{0,0,1},{1,1,1}}] .{xr,yr,zr}; fr=fs;fr//Expand -xr^2/2 - yr^2/2 + zr^2 Note sure what a geometer would call that, but it's obviously a figure of rotation about an axis (ellipsoid of rotation about an imaginary axis?). Confirm this by making a couple of plots: x=Sin[theta]Sin[phi];y=Sin[theta]Cos[phi];z=Cos[theta]; fs=x y +x z+y z; fr=z^2 - 0.5(x^2+y^2); ps=Graphics[SphericalPlot3D[fs,theta,phi]]; pr=Graphics[SphericalPlot3D[fr,theta,phi]]; GraphicsRow[{ps,pr}] or by mapping f onto the surface or spheres of varying diameter: Manipulate[ x=a Sin[theta]Sin[phi];y=a Sin[theta]Cos[phi];z=a Cos[theta]; f=z^2-0.5(x^2+y^2); Show[Graphics[SphericalPlot3D[a+ b f,theta,phi]]], {{a,1},0,5},{{b,0.1},0,1}] [and in the process learn that Mathematica allows spheres to have negative radii.] Follow-up question: Suppose you want to plot a unit sphere with SphericalPlot3D in which different areas or patches on the surface have different colors. depending on the theta, phi (or x,y,z) values. Or, a SphericalPlot3D[r[theta,phi], theta, phi] for which positive values of r give a red surface and negative values a blue surface. How might one do that in some simple way?