Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
solve: multiple equations multiple parameters

Subject: solve: multiple equations multiple parameters

From: Katharina Zwicky

Date: 28 Mar, 2010 13:06:05

Message: 1 of 5

I am new, trying for figure out matlab and can't seem to get it to solve this problem. ive spend my whole weekend browsing through help,user communities etc. maybe somebody could help me?
i ve these 5 equations: f, g, their derivatives df and dg and the product of the derivatives is supposed to be one (df*dg=1). i would like to solve for k11,k22 and y as a function of x for a synthetic biology switch thing. matlab is always telling me that no explicit function can be found.
what am I doing wrong?
thank you very much in advance for any helpful tipps...

k11=sym('k11');
k22=sym('k22');
x=sym('x');
y=sym('y');
n=sym('n');
f=sym('f');
g=sym('g');
df=sym('df');
dg=sym('dg');

df=diff(f,'y')
dg=diff(g,'x')

syms x y k11 k22 n
eqn{1}='f=k11/(1+y^n)'
eqn{2}='g=k22/(1+x)'
eqn{3}='df=-k11/(1+y^n)^2*y^n*n/y'
eqn{4}='dg=-k22/(1+x)^2'
eqn{5}='dg*df=1'

[k11,k22,y]=solve(eqn{1},eqn{2},eqn{3},eqn{4},eqn{5})

Subject: solve: multiple equations multiple parameters

From: Roger Stafford

Date: 28 Mar, 2010 21:02:02

Message: 2 of 5

"Katharina Zwicky" <katharina.zwicky@gmail.com> wrote in message <honk7t$lqf$1@fred.mathworks.com>...
> .....
> i ve these 5 equations: f, g, their derivatives df and dg and the product of the derivatives is supposed to be one (df*dg=1). i would like to solve for k11,k22 and y as a function of x .....
> ........
> syms x y k11 k22 n
> eqn{1}='f=k11/(1+y^n)'
> eqn{2}='g=k22/(1+x)'
> eqn{3}='df=-k11/(1+y^n)^2*y^n*n/y'
> eqn{4}='dg=-k22/(1+x)^2'
> eqn{5}='dg*df=1'
>
> [k11,k22,y]=solve(eqn{1},eqn{2},eqn{3},eqn{4},eqn{5})
---------------
  As I understand it, you have two functions, f(y) and g(x), which are each known except for parameters k11, k22, and n, and you specify that the product of their respective derivatives shall be unity. Therefore what you are requiring is that:

 -k11/(1+y^n)^2*(n*y^(n-1)) = -k22/(1+x)

(Your derivative for df was in error.)

  That is one equation and a lot of unknowns and is therefore not a well-defined problem. The only thing you can really state is that if the ratio of k11 to k22 is given and n is also given, you could in principle determine y as a function of x, though many solutions may be possible, depending on n.

  Given k11/k22 and n, you could certainly determine x as a function of y, but the reverse of finding y as an explicit function of x may not be possible if n is four or greater. Remember that it has been mathematically proven that no explicit solution for general polynomial equations of degree five or higher exists over the rationals in terms of radicals. Matlab can be forgiven if it gives up on such problems.

Roger Stafford

Subject: solve: multiple equations multiple parameters

From: Arthur Goldsipe

Date: 29 Mar, 2010 14:38:26

Message: 3 of 5

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hoog4a$o1$1@fred.mathworks.com>...
> "Katharina Zwicky" <katharina.zwicky@gmail.com> wrote in message <honk7t$lqf$1@fred.mathworks.com>...
> > .....
> > i ve these 5 equations: f, g, their derivatives df and dg and the product of the derivatives is supposed to be one (df*dg=1). i would like to solve for k11,k22 and y as a function of x .....
> > ........
> > syms x y k11 k22 n
> > eqn{1}='f=k11/(1+y^n)'
> > eqn{2}='g=k22/(1+x)'
> > eqn{3}='df=-k11/(1+y^n)^2*y^n*n/y'
> > eqn{4}='dg=-k22/(1+x)^2'
> > eqn{5}='dg*df=1'
> >
> > [k11,k22,y]=solve(eqn{1},eqn{2},eqn{3},eqn{4},eqn{5})
> ---------------
> As I understand it, you have two functions, f(y) and g(x), which are each known except for parameters k11, k22, and n, and you specify that the product of their respective derivatives shall be unity. Therefore what you are requiring is that:
>
> -k11/(1+y^n)^2*(n*y^(n-1)) = -k22/(1+x)
>
> (Your derivative for df was in error.)
>
> That is one equation and a lot of unknowns and is therefore not a well-defined problem. The only thing you can really state is that if the ratio of k11 to k22 is given and n is also given, you could in principle determine y as a function of x, though many solutions may be possible, depending on n.
>
> Given k11/k22 and n, you could certainly determine x as a function of y, but the reverse of finding y as an explicit function of x may not be possible if n is four or greater. Remember that it has been mathematically proven that no explicit solution for general polynomial equations of degree five or higher exists over the rationals in terms of radicals. Matlab can be forgiven if it gives up on such problems.
>
> Roger Stafford

I think Roger's final equation is "df = dg" instead of "df*dg = 1", but his general point is still valid: Your system of equations can be reduced to a single equation involving k11, k22, n, x, and y. You can still come up with an analytical solution for x in terms of the other variables. Here's how I would have solved the problem, also using the Symbolic Toolbox to calculate the derivatives:

>> syms x y k11 k22 n
>> df = diff(k11/(1+y^n), y)
 
df =
 
-(k11*n*y^(n - 1))/(y^n + 1)^2
 
>> dg = diff(k22/(1+x), x)
 
dg =
 
-k22/(x + 1)^2
 
>> solution = solve(df*dg-1, x)
 
solution =
 
   ((k11*k22*n*y^n)/y)^(1/2)/(y^n + 1) - 1
 - ((k11*k22*n*y^n)/y)^(1/2)/(y^n + 1) - 1

Subject: solve: multiple equations multiple parameters

From: Roger Stafford

Date: 29 Mar, 2010 15:45:26

Message: 4 of 5

"Arthur Goldsipe" <REMOVE.Arthur.Goldsipe@REMOVE.mathworks.com> wrote in message <hoqe12$9nf$1@fred.mathworks.com>...
> I think Roger's final equation is "df = dg" instead of "df*dg = 1", but his general point is still valid: Your system of equations can be reduced to a single equation involving k11, k22, n, x, and y. You can still come up with an analytical solution for x in terms of the other variables. Here's how I would have solved the problem, also using the Symbolic Toolbox to calculate the derivatives:
>
> >> syms x y k11 k22 n
> >> df = diff(k11/(1+y^n), y)
>
> df =
>
> -(k11*n*y^(n - 1))/(y^n + 1)^2
>
> >> dg = diff(k22/(1+x), x)
>
> dg =
>
> -k22/(x + 1)^2
>
> >> solution = solve(df*dg-1, x)
>
> solution =
>
> ((k11*k22*n*y^n)/y)^(1/2)/(y^n + 1) - 1
> - ((k11*k22*n*y^n)/y)^(1/2)/(y^n + 1) - 1

  Thank you for pointing that out, Arthur. Also the right side of my equation was missing a square and should have been

 -k22/(1+x)^2

(I'm getting increasingly careless in my old age.)

  As you say, in the correct version of the problem, x can still be expressed as an explicit function of y, given k11, k22, and n, namely the two you obtained. It is also still true that expressing y as a function of x involves solving a polynomial equation in y of the 2*n degree and the symbolic toolbox cannot in general find an explicit solution for such polynomials.

Roger Stafford

Subject: solve: multiple equations multiple parameters

From: Katharina Zwicky

Date: 29 Mar, 2010 16:18:06

Message: 5 of 5

Thanks so much for your help.
Now I am able to solve my problem...

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us