FindRoot with 2 variables plus parameters (Mathematica)

In summary, the conversation discusses the struggle to find roots to a system of equations in 2 unknowns (p,q) with parameters in symbolic form. Various methods such as creating tables and using Nminimize are explored, but do not provide the desired solutions in terms of the parameters. Suggestions are made to use Reduce, Backsubstitution, and Eliminate, but the desired results are still not obtained. Some attempts are made to provide implicit forms for Pu and Ql that are free of each other, but it is acknowledged that these are not likely to be the desired solutions.
  • #1
ale77
4
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
  • #2
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:
  • #3
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...
 
  • #4
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:
  • #5
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...
 
  • #6
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.
 
  • #7
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
 
  • #8
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:

Related to FindRoot with 2 variables plus parameters (Mathematica)

What is the purpose of using FindRoot with 2 variables plus parameters in Mathematica?

The purpose of using FindRoot with 2 variables plus parameters in Mathematica is to find the numerical values of the variables that satisfy a given set of equations with parameters. This allows for solving complex systems of equations and obtaining accurate solutions.

How does FindRoot with 2 variables plus parameters work?

FindRoot with 2 variables plus parameters works by using an iterative process to refine the values of the variables until they satisfy the set of equations. It starts with an initial guess for the values of the variables and then uses numerical methods to improve the accuracy of the solution.

What are the limitations of using FindRoot with 2 variables plus parameters?

One limitation of using FindRoot with 2 variables plus parameters is that it may not always find a solution or may converge to a non-unique solution. This can happen if the equations are not well-defined or if the initial guess is too far from the actual solution.

How can I improve the accuracy of the solution obtained from FindRoot with 2 variables plus parameters?

To improve the accuracy of the solution obtained from FindRoot with 2 variables plus parameters, you can try using a more precise initial guess or adjusting the options for the numerical methods used in the iterative process. You can also try using a different starting point or reformulating the equations to make them more well-defined.

Can FindRoot with 2 variables plus parameters be used for non-linear systems of equations?

Yes, FindRoot with 2 variables plus parameters can be used for non-linear systems of equations. However, it may require a more careful choice of initial guess and adjustment of the options to ensure convergence to the correct solution. It is also important to check the accuracy and validity of the solution obtained.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Replies
3
Views
359
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Differential Equations
Replies
1
Views
1K
  • Math Proof Training and Practice
2
Replies
42
Views
7K
Back
Top