Hi,
I have certain computations here. I use many parentheses just to make sure computations are all right. How can I write these Julia computations more cleaner?
p(x,y,α) = (-(2*α*y-1)^2)/(12*α^2)
q(x,y,α) = ((2*α*y-1)^3-(27*α^2)*(x^2))/(108*α^3)
del(x,y,α) = (27*α^2*x^4 - 2*(2*α*y-1)^3*x^2)/(1728*α^4)
case1(x,y,α) = ((-(α*y+1)/(3α)) + cbrt((-0.5*q(x,y,α)) + sqrt(del(x,y,α))) + cbrt((-0.5*q(x,y,α)) - sqrt(del(x,y,α))))
theta(x,y,α) = (-q(x,y,α)/2)/((-p(x,y,α)/3)^(3/2))
case2(x,y,α) = ((-(α*y+1)/(3α)) + ((abs(2α*y+1))/(3α))* cos((1/3)*acos(theta(x,y,α))))
r(x,y,α) = del(x,y,α) ≥ 0 ? case1(x,y,α) : case2(x,y,α)
Example use:
α=1/2
(x,y) =(3,10)
xresult(x,y,α) = x/(1 + 2 * α * r(x,y,α));
yresult(x,y,α) = y + r(x,y,α);
(xresult(x,y,α),yresult(x,y,α))
Any references/comments are appreciated. It could be a silly question: but hoping to learn something new. Thank you for your time.