# Attacking a “Mathematica can't solve” problem

Mathematica throws the following message when I try to solve the equation below

"Solve::nsmet: This system cannot be solved with the methods available to Solve".

Setting $P_T = 0.5$, $\sigma=0.1$ and $S=1$ and plotting with $w$ from $0$ to $1$, however, provides clear indication the equation crosses through $0$.

So, what are my options for advancing. At the very least, I would like numerical approximations Assuming[
Subscript[P, T] >= 0 && Subscript[P, T] <= 1 && Subscript[w, 1] <= 1 && Subscript[w, 1] >= 0 && σ > 0,
Solve[1/(6 σ^2 (-1 + Subscript[w, 1]) Subscript[w, 1])S ((Log[Sqrt σ + Subscript[P, T]] - Log[Subscript[P, T] + Sqrt σ (1 - 2 Subscript[w, 1])]) Subscript[P,T] (Sqrt σ + Subscript[P, T]) - (6 σ^2 +Sqrt σ (Log[-Sqrt σ + Subscript[P, T]] +Log[Sqrt σ + Subscript[P, T]] - 2 Log[Subscript[P, T] + Sqrt σ (1 - 2 Subscript[w, 1])]) Subscript[P, T] + (-Log[-Sqrt σ + Subscript[P, T]] + Log[Sqrt σ + Subscript[P, T]])\!$$\*SubsuperscriptBox[\(P$$, $$T$$, $$2$$]\)) Subscript[w, 1] + 6 σ^2 \!$$\*SubsuperscriptBox[\(w$$, $$1$$, $$2$$]\)) == 0, Subscript[w,1]
]
]

• See NSolve or FindRoot. – Henrik Schumacher Jun 23 '18 at 10:18
• You should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here – rhermans Jun 23 '18 at 10:29
• There are things to do after your question is answered. It's a good idea to stay vigilant for some time, better approaches may come later improving over previous replies. Experienced users may point alternatives, caveats or limitations. New users should test answers before voting and wait 24 hours before accepting the best one. Participation is essential for the site, please do your part. – rhermans Jun 30 '18 at 11:19

With[
{Pt = 0.5, σ = 0.1 , S = 1},
FindRoot[
1/(6 σ^2 (-1 + w) w)
S ((Log[Sqrt σ + Pt] -
Log[Pt + Sqrt σ (1 - 2 w)]) Pt (Sqrt σ +
Pt) - (6 σ^2 +
Sqrt σ (Log[-Sqrt σ + Pt] +
Log[Sqrt σ + Pt] -
2 Log[Pt +
Sqrt σ (1 - 2 w)]) Pt + (-Log[-Sqrt[
3] σ + Pt] +
Log[Sqrt σ + Pt]) Pt^2) w + 6 σ^2 w^2) == 0
, {w, 0.5}
]
]
(* {w -> 0.409537} *)

• If given a range spec such as 0<=w<=10 then NSolve can find solutions although one is spurious. Giving exact values for the parameters fixes that issue though. – Daniel Lichtblau Jun 23 '18 at 13:18

Using exact numbers Solve will provide an exact solution expressed as a Root object.

sol = With[{Pt = 1/2, σ = 1/10, S = 1},
Solve[{1/(6 σ^2 (-1 + w) w) S ((Log[Sqrt σ + Pt] -
Log[Pt + Sqrt σ (1 - 2 w)]) Pt (Sqrt σ +
Pt) - (6 σ^2 +
Sqrt σ (Log[-Sqrt σ + Pt] +
Log[Sqrt σ + Pt] -
2 Log[Pt +
Sqrt σ (1 - 2 w)]) Pt + (-Log[-Sqrt σ +
Pt] + Log[Sqrt σ + Pt]) Pt^2) w +
6 σ^2 w^2) == 0, 0 <= w <= 1}, w]][] // FullSimplify

(* {w -> Root[{5 (5 + Sqrt) Log[
5 + Sqrt] (-1 + #1) + (6 + 5 (-5 + Sqrt) Log[5 - Sqrt] -
6 #1) #1 +
5 Log[5 + Sqrt - 2 Sqrt #1] (5 + Sqrt - 2 Sqrt #1) &,
0.40953666596770227094}]} *)


The last argument to Root is the approximate numeric value

sol // N[#, 20] &

(* {w -> 0.40953666596770227094} *)


EDIT: Note that Solve does not use Assumptions

Options[Solve]

{Cubics -> True, GeneratedParameters -> C, InverseFunctions -> Automatic,
MaxExtraConditions -> 0, Method -> Automatic, Modulus -> 0, Quartics -> True,
VerifySolutions -> Automatic, WorkingPrecision -> ∞}


Consequently, conditions from Assuming (e.g., 0 <= w <= 1) are not used by Solve and must be entered as part of the "system expr of equations or inequalities".