Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
1  
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]. –  whuber Jan 16 '13 at 18:20

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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. –  minthao_2011 Jan 16 '13 at 15:15
    
@minthao_2011 (I assume you mean change Cos[Pi/6] to Cos[Pi/3].) Yes, that's correct. What's your point? –  Mr.Wizard Jan 16 '13 at 15:17
    
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. –  minthao_2011 Jan 16 '13 at 15:22
    
@minthao_2011 I'm not understanding you. Are you proposing that the solutions should be the same? –  Mr.Wizard Jan 16 '13 at 15:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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