3
$\begingroup$

I have the following Mathematica result under the assumption that {ax, bx, px, ay, by, py} \[Element] Reals, and after refinement by Simplify:

ConditionalExpression[-((
  ay/Sqrt[(ax - px)^2 + (ay - py)^2] - by/
   Sqrt[(bx - px)^2 + (by - 
      py)^2] + (-(1/Sqrt[(ax - px)^2 + (ay - py)^2]) + 1/
      Sqrt[(bx - px)^2 + (by - py)^2]) py)/(
  ay (bx - px) + by px - bx py + ax (-by + py))), 
 Im[((ax - bx) (ax - px) + (ay - by) (ay - py) - 
     I Abs[ay bx - ax by - ay px + by px + ax py - bx py])/((ax - 
       bx)^2 + (ay - by)^2)] < 0 || 
  Re[((ax - bx) (ax - px) + (ay - by) (ay - py) - 
     I Abs[ay bx - ax by - ay px + by px + ax py - bx py])/((ax - 
       bx)^2 + (ay - by)^2)] < 0 || 
  Im[((ax - bx) (ax - px) + (ay - by) (ay - py) - 
     I Abs[ay bx - ax by - ay px + by px + ax py - bx py])/((ax - 
       bx)^2 + (ay - by)^2)] > 0 || 
  Re[((ax - bx) (ax - px) + (ay - by) (ay - py) - 
     I Abs[ay bx - ax by - ay px + by px + ax py - bx py])/((ax - 
       bx)^2 + (ay - by)^2)] > 1]

Pictorially, it's this:

enter image description here

If you consider the first part of the OR, can you confirm that the Im[...] < 0 is nothing more than the stuff in the absolute value brackets (Abs[ay bx - ax by - ay px + by px + ax py - bx py]) being greater than zero?

Similar simplifications can be made for the rest of the conditions. How do I get Mathematica to execute these simplifications on its own?

$\endgroup$

1 Answer 1

3
$\begingroup$

With the expression in the question designated z, the conditions in the ConditionalExpression are given by z[[2]], which can be simplified by

FullSimplify[ComplexExpand[z[[2]]], {ax, bx, px, ay, by, py} ∈ Reals]
(* ((ax - bx)^2 + (ay - by)^2) Abs[ay (bx - px) + by px - bx py + ax (-by + py)] > 0
|| ((ax - bx)^2 + (ay - by)^2) (ax^2 + ay^2 + bx px - ax (bx + px) + by py - ay (by + py)) < 0
|| ((ax - bx)^2 + (ay - by)^2) ((ax - bx) (bx - px) + (ay - by) (by - py)) > 0 *)

Is this the sort of thing you had in mind?

$\endgroup$
5
  • $\begingroup$ Yes! I don't understand. How did this end up working when you put it this way? $\endgroup$
    – bzm3r
    Commented Sep 24, 2015 at 6:16
  • $\begingroup$ My theory on why this works, having read up on ComplexExpand: while I used Assumptions to specify that all variables are real in an Integrate command which created z, I did not use it when applying FullSimplify. $\endgroup$
    – bzm3r
    Commented Sep 24, 2015 at 6:39
  • $\begingroup$ Also, consider the result we get now: the first and third disjunct(((ax - bx)^2 + (ay - by)^2) Sqrt[(ay bx - ax by - ay px + by px + ax py - bx py)^2] > 0 || ((ax - bx)^2 + (ay - by)^2) Sqrt[(ay bx - ax by - ay px + by px + ax py - bx py)^2] < 0) is always true! This is because squaring a number always return a positive result, adding two positive numbers results in a positive number, and taking the square root returns a positive and negative root.So, the conditional is not even necessary because these two branches will always be true? $\endgroup$
    – bzm3r
    Commented Sep 24, 2015 at 6:49
  • $\begingroup$ @user89 Actually, squaring a real number does not always return a positive result. It could return zero. However, Mathematica could have dropped the second condition in your last comment, because that quantity is never negative. I have modified my answer to make this happen. $\endgroup$
    – bbgodfrey
    Commented Sep 24, 2015 at 12:12
  • $\begingroup$ You're right, and thank you very much for showing me this! $\endgroup$
    – bzm3r
    Commented Sep 25, 2015 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.