# NSolve and Solve run forever or give errors with big numbers

Posted 2 months ago
478 Views
|
5 Replies
|
2 Total Likes
|
 Hello,I didn't use Mathematica for years and I am VERY rusty regarding the best way to solve this problem :2*vectk.vectG = G^2,k = 2*pi/lambdaI have the G vector and I want to find all vector k that can fit into this previous equation. Vect k should use some "primitive" vectors b1, b2 and b3. Clear["Global*"]; la1 = 6.2696*10^-10; la2 = 40.3246*10^-10; la3 = 9.8488*10^-10; alpha = 90; beta = 99.464; gamma = 90; a1 = {la1, 0, 0}; a2 = {0, la2, 0}; a3 = {la3*Cos[beta Degree], 0, la3*Sin[beta Degree]}; omega = 2456.07*(10^-10)^3; lambda = 1.5*10^-10; b1 = 2*Pi*(Cross[a2, a3]/omega); b2 = 2*Pi*(Cross[a3, a1]/omega); b3 = 2*Pi*(Cross[a1, a2]/omega); G[h_, k_, l_] := h*b1 + k*b2 + l*b3; G = G[1, 7, 0] h = 1; k = 7; l = 0; Solve[2*Dot[k1*b1 + k2*b2 + k3*b3, h*b1 + k*b2 + l*b3] == Norm[h*b1 + k*b2 + l*b3]^2 && Norm[{k1*b1 + k2*b2 + k3*b3}] <= 2*Pi*1.01/lambda, {k1, k2, k3}, Integers, WorkingPrecision -> 100] When I execute it processes for ever.I don't know if Solve function can solve such a problem or if there is a problem with my syntax. If Solve cannot find such a solution, would you have some recommandations ? It is for a school project...Thanks Attachments:
5 Replies
Sort By:
Posted 2 months ago
 There are many problems with your code. The object {k1*b1, k2*b2, k3*b3} is a matrix. What do you mean by its Norm? The maximum singular value? Your first equation seems of the form vector==scalar. How can you hope to find integer solutions to an equation with inexact coefficients?
Posted 2 months ago
 Thank you for your answer. I was looking for the Norm[vector]. I corrected the code.Also, I thought (k1*b1 + k2*b2 + k3*b3).( h*b1 + k*b2 + l*b3) was a vector. I corrected it too with Dot[k1*b1 + k2*b2 + k3*b3, h*b1 + k*b2 + l*b3] 
Posted 2 months ago
 You say your vector g is given, { g1, g2, g3 } say.Now chose your vector k = { k1, k2, k3 } and form vectors ks1 and ks2 g = {g1, g2, g3}; k = {k1, k2, k3}; ks1 = k - g.k/g.g g ks2 = Cross[g, k] Then for arbitrary u and v k and (g.k/g.g g + u ks1 + v ks2) have the same sclar product, which means your problems has infinitly many solutions: g.k g.(g.k/g.g g + u ks1 + v ks2) // FullSimplify `