# Finding an analytical solution for a quadratic equation

I'm trying to solve an elastoplastic problem analytically (extended Druker-Prager), as an alternative the numerical solution. I need to find xi in the expression bellow making it equal to zero (A,B,I1,J2,G,K,a are constants):

eq=-((2 (Sqrt[3] A^2 G I1 + 3 Sqrt[3] a B^2 K - 3 A^2 G xi -
3 B^2 K xi - (9 a A B K)/Sqrt[(
3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/J2] + (3 Sqrt[3] A B K xi)/
Sqrt[(3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/J2]))/(9 A^2 G K))


I have tried this:

sol = Solve[eq==0, xi]


and this:

sol = Minimize[eq, xi]


But mma return nothing. Any hints?

## 4 Answers

eq = -((2 (Sqrt[3] A^2 G I1 + 3 Sqrt[3] a B^2 K - 3 A^2 G xi -
3 B^2 K xi - (9 a A B K)/
Sqrt[(3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/
J2] + (3 Sqrt[3] A B K xi)/
Sqrt[(3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/J2]))/(9 A^2 G K));


Add any known constraints on the parameters and variable. For example, if everything is positive,

assume = And @@ Thread[Variables[Level[eq, {-1}]] > 0]

(* a > 0 && A > 0 && B > 0 && G > 0 && I1 > 0 && J2 > 0 && K > 0 && xi > 0 *)

sol = Assuming[assume, Solve[assume && eq == 0, xi, Reals] // Simplify];


The resulting conditional expressions are quite long

LeafCount /@ sol

(* {6415, 7236, 3632} *)


For specific values of parameters,

sol /. {A -> 10, G -> 100, I1 -> 50, B -> 30, K -> 2, a -> 0.1,
J2 -> 1000}

(* {{xi -> Undefined}, {xi -> 28.0452}, {xi -> Undefined}} *)


Undefined indicates that the condition evaluated to False for the specified parameter values.

• thank you for your answer, it was really helpfull. Commented Feb 13, 2019 at 20:25
• PS: In the assume, I1 and xi are not greater then zero, but the other constans are. Commented Feb 13, 2019 at 20:41
• "I1 and xi are not greater than zero" do you mean <= 0 or just not necessarily > 0. If you know that they are <= 0 add those constraints. Similarly, if you know any relations between the parameters, e.g., a < A, add those. The more you can constrain the parameters or variables the simpler the results are likely to be. See documentation on Root objects. If their order is not too great, they can be converted to radicals with ToRadicals. Result would then be longer. Commented Feb 13, 2019 at 22:34
• Thank you. I1 and xi are not necessarily greater then zero, they can be either, smaller or greater. The other constants are greater. Commented Feb 13, 2019 at 22:40
• the fact tha in the solution exists #1, #1^2, #1^3 and #1^4 signifies that it's a quartic equation? Commented Feb 16, 2019 at 17:26

If you know the numerical values of the constants (I choice random integers) you can evaluate it numerically:

Solve[N[1/(9 A^2 G k)
2 (A^2 G (Sqrt[3] I1 - 3 xi) +
3 B^2 k (Sqrt[3] a - xi) + (3 A B k (-3 a + Sqrt[3] xi))/
Sqrt[(3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/J2]) /.
A -> 10 /. G -> 100 /. I1 -> 50 /. B -> 30 /. k -> 2 /.
a -> 0.1 /. J2 -> 1000] == 0, xi]


It returns

{{xi -> -17.1861}, {xi -> 28.0452}}

• I appreciate your effort, but this is not what I want. I need an expression of  xi in function of the constants, precisely xi(A,B,K,G,a,I1,J2). Commented Feb 13, 2019 at 15:52

First, it is necessary to simplify the equation as much as possible, using short notation for the coefficients

eq = -((2 (Sqrt[3] A^2 G I1 + 3 Sqrt[3] a B^2 K - 3 A^2 G xi -
3 B^2 K xi - (9 a A B K)/
Sqrt[(3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/
J2] + (3 Sqrt[3] A B K xi)/
Sqrt[(3 a^2 - 3 A^2 - 2 Sqrt[3] a xi + xi^2)/
J2]))/(9 A^2 G K));

eq1 = c1 + c2*xi + c3*y + c4*xi*y == 0 &&
y == 1/Sqrt[c5 + c6*xi + xi^2];
(*{c1 = Sqrt[3]*A^2*G*I1 + 3*Sqrt[3]*a B^2 *k, c2 = -3*A^2*G - 3*B^2*k,
c3 = -(9*a*A*B*k)*Sqrt[J2], c4 = 3*Sqrt[3]*A*B*k*Sqrt[J2],
c5 = 3*a^2 - 3*A^2, c6 = -2*Sqrt[3]*a }*)


In this form, the equation is easily solved

sol = Solve[eq1, {xi, y}];

xi /. sol[[1]]

(*-((2 c1 + c2 c6)/(4 c2)) -
1/2 \[Sqrt]((2 c1 + c2 c6)^2/(4 c2^2) - (
2 (c1^2 - c4^2 + c2^2 c5 + 2 c1 c2 c6))/(
3 c2^2) + (2^(
1/3) (12 c2^2 (-c3^2 + c1^2 c5) -
3 c2 (-2 c3 c4 + 2 c1 c2 c5 + c1^2 c6) (2 c1 +
c2 c6) + (c1^2 - c4^2 + c2^2 c5 +
2 c1 c2 c6)^2))/(3 c2^2 (27 c2^2 (-2 c3 c4 + 2 c1 c2 c5 +
c1^2 c6)^2 +
27 c2^2 (-c3^2 + c1^2 c5) (2 c1 + c2 c6)^2 -
72 c2^2 (-c3^2 + c1^2 c5) (c1^2 - c4^2 + c2^2 c5 +
2 c1 c2 c6) -
9 c2 (-2 c3 c4 + 2 c1 c2 c5 + c1^2 c6) (2 c1 +
c2 c6) (c1^2 - c4^2 + c2^2 c5 + 2 c1 c2 c6) +
2 (c1^2 - c4^2 + c2^2 c5 +
2 c1 c2 c6)^3 + \[Sqrt](-4 (12 c2^2 (-c3^2 + c1^2 c5) -
3 c2 (-2 c3 c4 + 2 c1 c2 c5 + c1^2 c6) (2 c1 +
c2 c6) + (c1^2 - c4^2 + c2^2 c5 +
2 c1 c2 c6)^2)^3 + (27 c2^2 (-2 c3 c4 + 2 c1 c2 c5 +
c1^2 c6)^2 +
27 c2^2 (-c3^2 + c1^2 c5) (2 c1 + c2 c6)^2 -
72 c2^2 (-c3^2 + c1^2 c5) (c1^2 - c4^2 + c2^2 c5 +
2 c1 c2 c6) -
9 c2 (-2 c3 c4 + 2 c1 c2 c5 + c1^2 c6) (2 c1 +
c2 c6) (c1^2 - c4^2 + c2^2 c5 + 2 c1 c2 c6) +
2 (c1^2 - c4^2 + c2^2 c5 + 2 c1 c2 c6)^3)^2))^(
1/3)) + (1/(
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*Sqrt[3]*a B^2 *k,
c2 = -3*A^2*G - 3*B^2*k, c3 = -(9*a*A*B*k)*Sqrt[J2],
c4 = 3*Sqrt[3]*A*B*k*Sqrt[J2], c5 = 3*a^2 - 3*A^2,
c6 = -2*Sqrt[3]*a }, xi /. sol[[1]]]


Compare with the numerical solution that got @GaeP

    Table[
With[{c1 = Sqrt[3]*A^2*G*I1 + 3*Sqrt[3]*a B^2 *k,
c2 = -3*A^2*G - 3*B^2*k, c3 = -(9*a*A*B*k)*Sqrt[J2],
c4 = 3*Sqrt[3]*A*B*k*Sqrt[J2], c5 = 3*a^2 - 3*A^2,
c6 = -2*Sqrt[3]*a }, xi /. sol[[i]]] /. A -> 10 /.
G -> 100 /. I1 -> 50 /. B -> 30 /. k -> 2 /. a -> 0.1 /.
J2 -> 1000, {i, 1, 4}]

(*Out[]= {-17.1861 - 2.22045*10^-16 I, 19.2341 + 1.82486 I,
19.2341 - 1.82486 I, 28.0452 + 5.66214*10^-15 I}*)


The first and last root is the same as the solution @GaeP (The imaginary part should be discarded since he used N[]).

• simplifying the equation with constants is a good idea. But I need a smaller expression as an answer. Commented Feb 13, 2019 at 20:26

This is not an answer, it's just a long comment.

Using Reduce ConditionalExpression desapears. But I cant understand the result obtained.

sol = Reduce[
J2 > 0 && a > 0 && B > 0 && G > 0 && A > 0 && K > 0 && (eq == 0),
xi, Reals] // Simplify


Result:

What is the meaning of #1, #1^2, #1^3 and #1^4 in the solution? I've checked with the numerical results and, substituting the appropriate constants in the analytical solution given by mma, the correct one appears to be the first one. What I need is to transform the following expression in a more simple equation (i.e. whitout the term Root and #1, #1^2, #1^3 and #1^4).

Root[3 a^2 A^4 G^2 I1^2 - 3 A^6 G^2 I1^2 + 18 a^3 A^2 B^2 G I1 K -
18 a A^4 B^2 G I1 K + 27 a^4 B^4 K^2 - 27 a^2 A^2 B^4 K^2 -
27 a^2 A^2 B^2 J2 K^2 + (-6 Sqrt[3] a^2 A^4 G^2 I1 +
6 Sqrt[3] A^6 G^2 I1 - 2 Sqrt[3] a A^4 G^2 I1^2 -
18 Sqrt[3] a^3 A^2 B^2 G K + 18 Sqrt[3] a A^4 B^2 G K -
18 Sqrt[3] a^2 A^2 B^2 G I1 K + 6 Sqrt[3] A^4 B^2 G I1 K -
36 Sqrt[3] a^3 B^4 K^2 + 18 Sqrt[3] a A^2 B^4 K^2 +
18 Sqrt[3] a A^2 B^2 J2 K^2) #1 + (9 a^2 A^4 G^2 - 9 A^6 G^2 +
12 a A^4 G^2 I1 + A^4 G^2 I1^2 + 54 a^2 A^2 B^2 G K -
18 A^4 B^2 G K + 18 a A^2 B^2 G I1 K + 54 a^2 B^4 K^2 -
9 A^2 B^4 K^2 -
9 A^2 B^2 J2 K^2) #1^2 + (-6 Sqrt[3] a A^4 G^2 -
2 Sqrt[3] A^4 G^2 I1 - 18 Sqrt[3] a A^2 B^2 G K -
2 Sqrt[3] A^2 B^2 G I1 K -
12 Sqrt[3] a B^4 K^2) #1^3 + (3 A^4 G^2 + 6 A^2 B^2 G K +
3 B^4 K^2) #1^4 &, 1]