The distance formula for polar coordinated is shown here: http://math.ucsd.edu/~wgarner/math4c/derivations/distance/distancepolar.htm
I've tried doing it this way:
(defun distant-formula (r1 r2 t1 t2)
(setq d ( sqrt (*(-(+ (expt r1 2)(expt r2 2))(* 2 r1 r2))
(cos(- t1 t2))))))
but the extra parenthesis between the subtraction and multiplication changes the formula, however I'm not quite sure how to do it without correctly, any help would be appreciated.
The variable D in your code is of no use. You should not assign values to undefined variables. Lisp also returns the value of the computation. That makes such an assignment especially useless.
You can write the formula like this:
Note that the layout of the code over three lines makes it easier to understand the formula, than using just one line. Use the automatic indentation of the editor to help with the layout.