I could not solve your problem, but tried a lot which might be helpful. The basic problem is that your equations are far too complicated and must be simplified before use. But even this does not work straight forward.
See the attached notebook "210219 Solve Simplify.nb" to understand what I was thinking about.
There is pretty strange and incorrect code within your first post: Use a block or module, use semicolons and commas, avoid symbols starting with uppercase letters. The code can be formulated shorter. Solve and everything else should run over Reals.
Since you don't solve for y is it true that y is some fixed given general parameter?
I have added the symbol eqns for your system of equations and simplified it. I realized that your original system is too complicated. It can't even be simplified, let alone solved, in a reasonable amount of time.
Even by assuming some conditions conds the system cannot be simplified. Just by examining your original system I found necessary conditions (that are hopefully correct for your original problem):
- The p1, p2, p3, p4 have to be positive reals.
- The l1, l2, l3 have to be real.
- The sum lambda = l1+l2+l3 has to be real and unequal to -1 and unequal to 0.
- The given value y has to be real.
Unfortunatly this system cannot be simplified by Simplify or FullSimplify. I try to solve it anyway for the variables p1, p2, p3, p4, l1, l2, l3, lambda, which doesn't succeed. This is expected and the same what you observed.
All of this is still too complicated to be simplified and solved. See the following code marked with comments "First Attempt". This is exactly your code, only reformulated.
There are several problems with your equations which pre-empt simplification:
- The complicated expression for pn appears over and over again.
- The expression l1+l2+l3 appears over and over again.
That's why in the second attempt (marked with "Second Attempt" and the changes marked with "--#--"):
- I didn't assign pn first, but left it unevaluated for now, then simplified everything
and inserted it only at the very end.
- I didn't assign lambda first, but left it unevaluated for now, then simplified everything
and inserted it only at the very end.
- Actually I reused fl = f[lambda] and dfls = D[f[lambda],li], i=1,2,3, from the first attempt
and replaced the sums l1+l2+l3 by lambda.
- I used the fact that all partial derivatives dfls are equal and independend of the li.
I name them dfl.
This gives the new equations eqns2.
The conditions conds2 slighty change:
- From the definition of pn one can see that pn must be real positive.
- The value of lambda has to be real and unequal to -1.
- l1, l2, l3 do no longer occur.
This system can now be significantly simplified. I try to solve it then for the variables p1, p2, p3, p4, pn, lambda. But this does not succeed. Hence we are not further on than before.
If this succeeded I would back-replace pn and lambda into the solution, possibly solve again a new System and verify that the solution satisfies the original system. This is not yet coded.
As an extra step I try to proof that after back-replacement of pn and lambda into eqns2 and a further simplification step the new system eqns2a is equivalent to the original system eqns under conds. Usually such proofs are done with Resolve, but this doesn't succeed either. May be the proof is too complicated for Resolve, or I made some error and eqns2a is indeed not equivalent to eqns.
I think you need to significantly simplify your original problem and thus its equations to arrive at a solution. Formal simplification, as I have tried, is not sufficient, but you have to start with the underlying physics (or whatever).
The following code within the attached notebook executes both attempts.
Set test=True to see what happens.
Set maxTime as the maximal time for execution of FullSimplify and Resolve, maxTimeS as the maximal time for execution of Solve. I use them just for forcing continuation and termination of the program within reasonable time.
Block[{test = True, maxTime = 5, maxTimeS = 10, maxT, f, lambda, l1,
l2, l3, fl, dfls, attempt, c1, c2, c3, c4, pn, s1, s2, s3, s4, p1,
p2, p3, p4, y, eqns, conds, eqns0, abort, sol, pn2, lambda2, fl2,
dfl2s, dfl2, eqns2, conds2, sol2, eqns2a, proof, proofRes, sol2a},
(* Defining the base function and calculating its partial \
derivatives *)
f[x_] := x/(1 + x);
(*...
See the attached notebook for the complete coding
... *)
(* Solving the system *)
maxT = If[! abort, maxTimeS, maxTime];
abort = False;
sol2a = TimeConstrained[
Solve[Join[eqns2a, conds2], {p1, p2, p3, p4, l1, l2, l3}, Reals]
, maxT, abort = True];
If[abort, sol2a = {};
Echo[Row[{"no solution after ", maxT, " sec"}],
attempt <> "Solve aborted: "]];
If[test && ! abort, Echo[Column[sol2a], attempt <> "sol2a:\n"]];
(* Return solution *)
Print[Style[Row[{attempt, "sol2a = ", Column[sol2a]}], Blue, Bold]];
Print[];
]
Attachments: