Solving system of equations with R Suppose I have the following function :
$f(x,y,z,a)= \cos(ax) + 12y^2 - 9az$ 
and I want to solve the following syste of equations.
$ f(x,y,z,1)= 10 $, 
$f(x,y,z,5)= 7 $, 
and 
$f(x,y,z,-3)= 17 $.
These are equivalent to 
$\cos(x) + 12 y^2 - 9 z(1) = 10$, 
$ \cos(5x) + 12y^2 - 9 z(5) = 7 $,
and $ \cos(-3x) + 12y^2 +27z = 17 $.
How do I solve these equations for $x$, $y$,  and $z$? I would like to solve these equations, if possible, using R or any other computer tools.

$cos(x) + 12 y^2 - 9 az = 10$
$cos(5x) + 12 y^2 - 45 az = 7$
$cos(-3x) + 12 y^2 + 27 az = 17 = cos(3x) + …$
$12y^2$ is the easiest to eliminate, so this becomes
$12 y^2 = 10 + 9az - cos(x) = 7 + 45az - cos(5x) = 17 - 27az - cos(3x)$
Since each of these three functions now equal each other, we can subtract them from each other to get 3 pairs of $0$
$10 + 9az - cos(x) - 7 - 45az + cos(5x) = 3 - 36az - cos(x) + cos(5x) = 0$
$17 - 27az - cos(3x) - 10 - 9az + cos(x) = 7 - 36az + cos(x) - cos(3x) = 0$
$17 - 27az - cos(3x) - 7 - 45az + cos(5x) = 10 - 72az - cos(3x) + cos(5x) = 0$
We can now eliminate az by saying
$36az = 3 - cos(x) + cos(5x) = 7 + cos(x) - cos(3x)$
and then
$7 + cos(x) - cos(3x) - 3 + cos(x) - cos(5x) = 4 + 2cos(x) - cos(3x)  = 0$
The cleanest identity for $cos(3x)$ is $4cos^3(x) - 3cos(x)$, which then gives us
$4 + 5cos(x) - 4cos^3(x) = 0$
You can then use cubic roots to calculate the possible values of cosx, which can then be plugged into the original formulae using the identities $cos(3x) = 4cos^3(x) - 3cos(x)$ and $cos(5x) = 16cos^5(x) - 20cos^3(x) + 5cos(x)$. After that, "y" and "z" can be calculated by subtracting the pairs of equations created by these new constraints.
