2
$\begingroup$

I have two codes to find the integer numbers $m$, $x$, $y$, $z$ in the system of equations. First code

Solve[{( m  x +   y - 7 z)^2 == 
   Cos[\[Pi]/3]^2*(x^2 + y^2 + z^2)*(m^2 + 1^2 + 7^2), -10 <= m <= 
   10, -10 <= x <= 10, -10 <= y <= 10, -10 <= z <= 10}, {m, x, y, 
  z}, Integers]

Second code

Clear[a, b];
a = {m, 1, -7};
b = {x, y, z};
Solve[{Abs[a . b]/(Norm[a] Norm[b]) == Cos[\[Pi]/6], 0 <= m <= 10, 
  0 <= x <= 10, 0 <= y <= 10, 0 <= z <= 10}, {m, x, y, z}, Integers]

The first code run faster the second code. I can not get the answer of the second code. How to edit the second code? How do I tell Mathematica to do that?

$\endgroup$
1
  • 1
    $\begingroup$ It would help you to understand your functions better. (Geometrically, $m$ determines a conical surface in $(x,y,z)$.) By making a plot it will become apparent that you can limit the search in the second code to 0 <= m <= 10, 0 <= x <= 6, 0 <= y <= 4, 0 <= z <= 10. For instance, explore the situation with Manipulate[ContourPlot3D[f[m, x, y, z], {x, 0, 10}, {y, 0, 10}, {z, 0, 10}, Contours -> {0}, AxesLabel -> {x, y, z}], {m, 0, 10}] after defining f[m_, x_, y_, z_] := With[{a = {m, 1, -7}, b = {x, y, z}}, (a.b)^2 - (a.a) (b.b) Cos[\[Pi]/6]^2]. $\endgroup$
    – whuber
    Jan 16, 2013 at 18:20

1 Answer 1

3
$\begingroup$

I don't believe there is a solution. If you use a system option to increase the explicit search range such that it applies to this problem:

SetSystemOptions["ReduceOptions" -> "ExhaustiveSearchMaxPoints" -> {10000, 100000}];

Clear[a, b];
a = {m, 1, -7};
b = {x, y, z};

Reduce[{Abs[a.b]/(Norm[a] Norm[b]) == Cos[\[Pi]/6], 0 <= m <= 10, 0 <= x <= 10, 
  0 <= y <= 10, 0 <= z <= 10}, {m, x, y, z}, Integers]

False

Quoting the documentation:

Mathematica enumerates the solutions explicitly only if the number of integer solutions of the system does not exceed the maximum of the p[Null]^th power of the value of the system option DiscreteSolutionBound, where p is the dimension of the solution lattice of the equations, and the second element of the value of the system option ExhaustiveSearchMaxPoints.

For systems containing explicit lower and upper bounds on all variables, Mathematica uses exhaustive search to find solutions. The bounds of the search are specified by the value of the system option ExhaustiveSearchMaxPoints. The option value should be a pair of integers (the default is {1000,10000}). If the number of integer points within the bounds does not exceed the first integer, the exhaustive search is used instead of any solution methods other than univariate polynomial solving. Otherwise, if the number of integer points within the bounds does not exceed the second integer, the exhaustive search is performed after all other methods fail.

$\endgroup$
4
  • $\begingroup$ The first I typed Cos[Pi/3] and the second Cos[Pi/6]. If I change your code is Cos[Pi/6], I only get three solutions. $\endgroup$ Jan 16, 2013 at 15:15
  • $\begingroup$ @minthao_2011 (I assume you mean change Cos[Pi/6] to Cos[Pi/3].) Yes, that's correct. What's your point? $\endgroup$
    – Mr.Wizard
    Jan 16, 2013 at 15:17
  • $\begingroup$ You try Solve[{( m x + y - 7 z)^2 == Cos[[Pi]/3]^2*(x^2 + y^2 + z^2)*(m^2 + 1^2 + 7^2), -10 <= m <= 10, 0 <= x <= 10, 0 <= y <= 10, 0 <= z <= 10}, {m, x, y, z}, Integers] The number of solutions are more your code. $\endgroup$ Jan 16, 2013 at 15:22
  • $\begingroup$ @minthao_2011 I'm not understanding you. Are you proposing that the solutions should be the same? $\endgroup$
    – Mr.Wizard
    Jan 16, 2013 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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