Mathematica FindRoot with 2 variables plus parameters (Mathematica)

AI Thread Summary
The discussion revolves around solving a system of equations with two unknowns, Pu and Ql, while keeping the parameters alpha and beta symbolic. The user struggles to express Pu and Ql solely in terms of alpha and beta for later optimization using NMinimize. Attempts to use Reduce and Eliminate have not yielded the desired results, as the solutions still depend on each other. Suggestions include using implicit forms for Pu and Ql, but these do not fully meet the user's requirements. The conversation highlights the complexity of the problem due to the interdependence of the equations.
ale77
Messages
4
Reaction score
0
Hi all,

I have a hard time finding roots to the following system of equations in 2 unknowns (p,q):

eq1 = Pu == f(q, alfa, beta)
eq2 = Ql == g(p, alfa, beta)

If the 2 parameters (alfa, beta) are given numerical values beforehand, no issue. But I would like to retain the parameters in symbolic form, so as to later minimize the distance of Pu and Ql from two numbers.

I have only managed to work around this issue by creating a Table for each variable given various parameter variables so to compare it to a Table filled with the corresponding number. This method, however, seems rather cumbersome, and would rather use Nminimize if possible.

Thanks!
Ale
 
Physics news on Phys.org
From your question we know nothing about your f or g.

Is there any chance you might be able to Reduce[] for p or q?

In[5]:= f[p_,alpha_,beta_]:=p^2+alpha^3-beta;Reduce[Pu==f[p,alpha,beta],p]

Out[6]= p==-Sqrt[-alpha^3+beta+Pu] || p==Sqrt[-alpha^3+beta+Pu]

Note: Often the Mathematica questions are put in the Math&Science Software section
 
Last edited:
Bill Simpson said:
From your question we know nothing about your f or g.

Is there any chance you might be able to Reduce[] for p or q?

Thanks Bill.

The issue is that it is a system of equations:

Pu == E^((1 - Ql)*(4 - 18*\[Alpha]) + Ql*(10 - 2*\[Alpha]))/
(E^((1 - Ql)*(4 - 18*\[Alpha]) + Ql*(10 - 2*\[Alpha])) +
E^(9*Ql + (1 - Ql)*(14 - 6*\[Beta])))

Ql == E^(9*(1 - Pu) + Pu*(12 - 2*\[Beta]))/
(E^((1 - Pu)*(8 - 6*\[Alpha]) + Pu*(22 - 18*\[Beta])) +
E^(9*(1 - Pu) + Pu*(12 - 2*\[Beta])))

If I Reduce as you suggest

Reduce[P == f[Ql, \[Alpha], \[Beta], \[Lambda]] &&
Q == f[Pu, \[Alpha], \[Beta], \[Lambda]], {Pu, Ql}, Reals]

I get:

(0 < P < 1 && Q == 1/(1 + (1 - P)/P) &&
\[Alpha] == (1/6)*(-1 - Log[(1 - P)/P]) &&
\[Beta] == (1/16)*(10 - Log[(1 - P)/P])) || (11 + 6*\[Alpha] -
16*\[Beta] != 0 &&
0 < P < 1 && 0 < Q < 1 &&
Pu == (1 + 6*\[Alpha] + Log[(1 - Q)/Q])/
(11 + 6*\[Alpha] - 16*\[Beta]) &&
Ql == (1 + 6*\[Alpha] + Log[(1 - P)/P])/
(11 + 6*\[Alpha] - 16*\[Beta]))

while what I need is for each of Pu and Ql to be expressed solely in terms of the parameters, so that I can later NMinimize in alfa,beta the distance between Pu,Ql and two numbers.

So I am back to my struggle of solving with Findroot in the presence of parameters...
 
If I look at your result from Reduce it tells me
EITHER
(0<P<1 && Q==P && Alpha==(1/6)*(-1-Log[1/P-1]) && Beta==(1/16)*(10-Log[1/P-1])) (which says not a word about Pu and Ql and you might ponder why)
OR
(0<P<1 && 0<Q<1 && 11+6*Alpha-16*Beta!=0 && Pu==(1+6*Alpha+Log[1/Q-1])/(11+6*Alpha-16*Beta) && Ql==(1+6*Alpha+Log[1/P-1])/(11+6*Alpha-16*Beta)) (which gives explicit equations for your desired Pu and Ql as long as the inequalities are satisfied).

The way you interpret the output of Reduce is look at the logical combination of inequalities, make sure those are valid in the domain of interest and then use the equations that represent your desired variables.

Thus in the second case you have Pu and Ql expressed as you require as long as all the inequalities hold and neither you nor I nor Mathematica have made a mistake in any of this.
 
Last edited:
Thanks a lot for your help!

Even assuming all inequalities hold and I haven't made a mistake (I have no doubts you and Mathematica are right), this is still not what I am looking for. take the 1st equation:

Pu==(1+6*Alpha+Log[1/Q-1])/(11+6*Alpha-16*Beta)

it still depends on the other equation via Q (and the same applies to the other equation), while I am interested in the solutions to the system in terms of Alpha and Beta only...
 
I suppose you could try including the Reduce[] option Backsubstitution->True and see what happens.

I suppose you could see if Eliminate[] might be able to get rid of P and Q from your original equations.

Unfortunately most of this is guesswork because we don't know f or g.
 
sorry for the confusion. I meant that:

Pu=f(Ql, alpha, beta) as below

Pu == E^((1 - Ql)*(4 - 18*\[Alpha]) + Ql*(10 - 2*\[Alpha]))/
(E^((1 - Ql)*(4 - 18*\[Alpha]) + Ql*(10 - 2*\[Alpha])) +
E^(9*Ql + (1 - Ql)*(14 - 6*\[Beta])))

and Ql=g(Pu, alpha, beta) as below

Ql == E^(9*(1 - Pu) + Pu*(12 - 2*\[Beta]))/
(E^((1 - Pu)*(8 - 6*\[Alpha]) + Pu*(22 - 18*\[Beta])) +
E^(9*(1 - Pu) + Pu*(12 - 2*\[Beta])))

My aim is to solve the system and get:

Pu(alpha, beta)
Ql(alpha, beta)

None of the techniques tried so far achives the goal, including Backsubstitution in Reduce[] or Eliminate.

Thank you, a
 
I apologize, but I believe that from the beginning I have misunderstood what you are asking for and have not been able to tell what are your functions and what are your variables.

I realize this is almost certainly not going to be what you want, but I will offer you this and then let someone else take over.

These give you implicit forms for Pu that are free of Ql and for Ql that are free of Pu.

In[5]:= Simplify[Pu==E^((1-Ql)*(4-18*Alpha)+ Ql*(10-2*Alpha))/(E^((1-Ql)*(4-18*Alpha)+Ql*( 10-2*Alpha))+E^(9*Ql+(1-Ql)*(14-6*Beta)))/.Ql->E^(9*(1- Pu)+Pu*(12-2*Beta))/( E^((1-Pu)*(8-6*Alpha)+Pu*(22-18*Beta))+E^(9*(1-Pu)+Pu*( 12-2*Beta)))]

Out[5]= Pu==1/(1+E^(10+18*Alpha-6*Beta+((-11-16*Alpha+6*Beta)*E^(1+6*Alpha))/(E^(1+6*Alpha)+E^((11+6*Alpha-16*Beta)*Pu))))

In[6]:= Simplify[Ql==E^(9*(1-Pu)+Pu*(12-2*Beta))/(E^((1-Pu)*(8-6*Alpha)+Pu*(22-18*Beta))+E^(9*(1-Pu)+Pu*(12-2*Beta)))/.Pu->E^((1-Ql)*(4-18*Alpha)+Ql*(10-2*Alpha))/(E^((1-Ql)*(4-18*Alpha)+Ql*(10-2*Alpha))+E^(9*Ql+(1-Ql)*(14-6*Beta)))]

Out[6]= Ql==E^((9*E^(10+18*Alpha+6*Ql*Beta)+E^(11*Ql+16*Ql*Alpha+6*Beta)*(21-2*Beta))/(E^(11*Ql+16*Ql*Alpha+6*Beta)+E^(10+18*Alpha+6*Ql*Beta)))/(E^((E^(10+18*Alpha+6*Ql*Beta)*(8-6*Alpha)+E^(11*Ql+16*Ql*Alpha+6*Beta)*(31-18*Beta))/(E^(11*Ql+16*Ql*Alpha+6*Beta)+E^(10+18*Alpha+6*Ql*Beta)))+E^((9*E^(10+18*Alpha+6*Ql*Beta)+E^(11*Ql+16*Ql*Alpha+6*Beta)*(21-2*Beta))/(E^(11*Ql+16*Ql*Alpha+6*Beta)+E^(10+18*Alpha+6*Ql*Beta))))
 
Last edited:

Similar threads

Replies
1
Views
2K
Replies
5
Views
2K
Replies
1
Views
4K
Replies
10
Views
2K
Replies
1
Views
5K
Replies
3
Views
2K
Replies
2
Views
7K
Replies
6
Views
2K
Back
Top