2
$\begingroup$

Is there any way to solve below equation in Mathematica? I want to find vector 'X' as a function of vectors: A,V, and constants: b, e and d. All vectors are 1 by 3. Equation is:

A + b V X.X + X (d V.X + 1 + e X.X) == 0

Which 0 in right-hand side is a 3 component vector. It is not a linear equation. The code I used is as below:

A = {a1, a2, a3};
v = {v1, v2, v3};
x = {x1, x2, x3};
Solve[-A.A + (-2 n - v.v ) (c + b x.x) + x.x (e f x.x + d v.x)^2 == 
 0, x, Real]
$\endgroup$
10
  • $\begingroup$ What is X^2? Square brackets have a special meaning in Mathematica; please replace them with parentheses if that is what you meant by them. $\endgroup$
    – Myridium
    Commented Sep 28, 2016 at 4:57
  • $\begingroup$ If A is a vector, then the right-hand side should also be a vector. $\endgroup$
    – Jens
    Commented Sep 28, 2016 at 5:56
  • $\begingroup$ It is. A, V, X and zero are vectors. Could you help me to find the answer? $\endgroup$
    – sara nj
    Commented Sep 28, 2016 at 5:58
  • $\begingroup$ @Jens - I think it is clear from the OP's previous versions of this question that they have not used Mathematica before and do not understand the syntax necessary to encode a zero-vector. $\endgroup$
    – Myridium
    Commented Sep 28, 2016 at 6:22
  • $\begingroup$ It seems that you have understand the syntax and you have worked with mathematica, so please answer the question. If not, please don't waste the time $\endgroup$
    – sara nj
    Commented Sep 28, 2016 at 6:36

1 Answer 1

3
$\begingroup$

This is not an answer, but too long for a comment. I can't manage to solve the question myself, but here are some things:

  • In Mathematica, the three-component zero-vector is {0,0,0}. You should replace 0 with this.
  • Unless otherwise specified, Mathematica will assume that symbols are complex numbers, not real vectors. What you should do is something like this:

    V = {v1, v2, v3}; A = {a1, a2, a3}; X = {x1, x2, x3};

Now when you type the expression A + b V X.X + X (d V.X + 1 + e X.X) and evaluate it, you will see that Mathematica recognises it as a three-component vector:

 {a1 + b v1 (x1^2 + x2^2 + x3^2) + 
  x1 (1 + d (v1 x1 + v2 x2 + v3 x3) + e (x1^2 + x2^2 + x3^2)), 

 a2 + b v2 (x1^2 + x2^2 + x3^2) + 
  x2 (1 + d (v1 x1 + v2 x2 + v3 x3) + e (x1^2 + x2^2 + x3^2)), 

 a3 + b v3 (x1^2 + x2^2 + x3^2) + 
  x3 (1 + d (v1 x1 + v2 x2 + v3 x3) + e (x1^2 + x2^2 + x3^2))}

Remember: each of these symbols will be assumed by Mathematica to be a scalar, and that's what we want.

  • To stop Mathematica giving you complex solutions and to speed up the solving, you should specify that you want to solve over the Reals:

    Solve[ X^2 (d V.X + e f X^2)^2 - (a^2 + V^2 (b X^2 + c) + 2 a.V (b X^2 + c)) == {0,0,0}, X, Reals]

Note that solving for X here happens to work because X evaluates to {x1,x2,x3} which is the list of variables to solve for. (See the documentation for Solve)

Unfortunately, even after this syntax is all corrected, Mathematica seems to have trouble solving this equation. Hopefully someone else can help with that.

$\endgroup$
1
  • $\begingroup$ Thank you. I made my code better. I put the new code in question. The new problem is, when I use Reals, it doesn't work! :( Do you know where is the problem? $\endgroup$
    – sara nj
    Commented Sep 28, 2016 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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