Question: How do I avoid sqrt(-Y^2) type expressions?

I know this sort of simplify question has been asked many times, but I still don't seem to have 'got it'.  In a nutshell, there's a conservative real 2-D vector field (cartesian X,Y coordinates) with an extra non-positive parameter Z, and Maple 12 is able to compute the scalar potential.  But it presents it in a long (6 lines), perversely complicated form, involving the imaginary sqrt(-Y^2).  I tried to show it here using the Maple leaf Tag and pasting the expressions there, but all I got was indecipherable ascii.  The vector field X and Y components are

    vfX  =  (X-1)*(2*Rp-Z)/(Rp^2*(Rp-Z)) - (X+1)*(2*Rm-Z)/(Rm^2*(Rm-Z))

    vfY  =    Y  *(2*Rp-Z)/(Rp^2*(Rp-Z)) -   Y  *(2*Rm-Z)/(Rm^2*(Rm-Z))

where  Rp,m = sqrt( (X -,+ 1)^2 + Y^2 + Z^2 ).  The scalar potential was computed with the instruction

    sp  =  ScalarPotential( vf )

It only took a page and a half to simplify 'sp' by hand to something pretty straightforward:

    sp  =  ln( Rp/Rm * (Rp - Z)/(Rm - Z) )

But I couldn't find any combination of instructions that could reduce Maple's 'sp' to anywhere close to this.  All were still 5 lines long  Among the variations I tried were 

    sp  =  ScalarPotential( vf )  assuming real

    sp  =  ScalarPotential( vf )  assuming X::real, Y::real, Z<=0

and various combinations of simplify, convert, combine, and assuming.  In fact, using simplify and assuming as immediately above produced expressions involving imaginaries.

I would appreciate any recommendations, especially generally applicable ones.

- Dushan

 

Please Wait...