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:
Symbolic toolbox solution

Subject: Symbolic toolbox solution

From: Serdar GOKHAN

Date: 9 Jul, 2010 11:39:04

Message: 1 of 11

Hi All,

How can we get analytical expressions of "kappa" and "gamma" from the below two equations by using Symbolic toolbox? Any kind of help is appreciated.
Regards
Serdar

     1.st equation
     Ip0*gamma+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)

     2.nd equation
     -Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma*z)*Is0*exp(-kappa*z)
     

Subject: Symbolic toolbox solution

From: Sean

Date: 9 Jul, 2010 13:44:04

Message: 2 of 11

"Serdar GOKHAN" <fs_gokhan@hotmail.com> wrote in message <i171oo$9av$1@fred.mathworks.com>...
> Hi All,
>
> How can we get analytical expressions of "kappa" and "gamma" from the below two equations by using Symbolic toolbox? Any kind of help is appreciated.
> Regards
> Serdar
>
> 1.st equation
> Ip0*gamma+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)
>
> 2.nd equation
> -Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma*z)*Is0*exp(-kappa*z)
>

How are those "equations"? They're not equal to anything...

Anyway, once you figure out what those are equal to:
>>syms gamma_1 alpha_p Ip0 gb K L z alpha_s kappa %Note don't use 'gamma' it's a built-in function

>>doc solve
>>solve('eqn1','eqn2',var1,var2); %var1 = gamma1, var = kappa
>>

Subject: Symbolic toolbox solution

From: Serdar GOKHAN

Date: 9 Jul, 2010 14:19:04

Message: 3 of 11

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i17934$del$1@fred.mathworks.com>...
> "Serdar GOKHAN" <fs_gokhan@hotmail.com> wrote in message <i171oo$9av$1@fred.mathworks.com>...
> > Hi All,
> >
> > How can we get analytical expressions of "kappa" and "gamma" from the below two equations by using Symbolic toolbox? Any kind of help is appreciated.
> > Regards
> > Serdar
> >
> > 1.st equation
> > Ip0*gamma+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)
> >
> > 2.nd equation
> > -Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma*z)*Is0*exp(-kappa*z)
> >
>
> How are those "equations"? They're not equal to anything...
>
> Anyway, once you figure out what those are equal to:
> >>syms gamma_1 alpha_p Ip0 gb K L z alpha_s kappa %Note don't use 'gamma' it's a built-in function
>
> >>doc solve
> >>solve('eqn1','eqn2',var1,var2); %var1 = gamma1, var = kappa
> >>
Thank you very much for your reply.
All the equations are equal to zero. And I changed gamma to gamma1

Ip0*gamma1+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)=0
-Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma1*z)*Is0*exp(-kappa*z)=0

when I try to solve usig your way, i.e,
solve('eqn1','eqn2',var1,var2); %var1 = gamma1, var = kappa

it says,
Unable to find closed form solution.
Do you have alternative way?
Thank you for your reply and assistance.
Regards.
Serdar

Subject: Symbolic toolbox solution

From: Walter Roberson

Date: 9 Jul, 2010 14:32:29

Message: 4 of 11

Serdar GOKHAN wrote:
> Hi All,
>
> How can we get analytical expressions of "kappa" and "gamma" from the
> below two equations by using Symbolic toolbox? Any kind of help is
> appreciated.
> Regards
> Serdar
>
> 1.st equation
> Ip0*gamma+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)
>
> 2.nd equation
>
> -Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma*z)*Is0*exp(-kappa*z)

If those two formula are to be equated to zero and then the pair solved
for gamma and kappa, then I do not believe there is an analytical
formula for them. Isolating the two variables in terms of the others
involves finding the root of something of the form

c0 + c1 * x + c2 * exp(c3 + c4 * exp(x))

If the term inside the first exp() only involved x linearly and not
exp(x), then the root could be determined analytically using the
LambertW function, but I do not know of any equivalent function that can
be used when there is an x + exp(exp(x)) form.

Subject: Symbolic toolbox solution

From: Sean

Date: 9 Jul, 2010 14:45:05

Message: 5 of 11

Walter Roberson <roberson@hushmail.com> wrote in message <1qGZn.10985$Hw.4661@newsfe10.iad>...
> Serdar GOKHAN wrote:
> > Hi All,
> >
> > How can we get analytical expressions of "kappa" and "gamma" from the
> > below two equations by using Symbolic toolbox? Any kind of help is
> > appreciated.
> > Regards
> > Serdar
> >
> > 1.st equation
> > Ip0*gamma+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)
> >
> > 2.nd equation
> >
> > -Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma*z)*Is0*exp(-kappa*z)
>
> If those two formula are to be equated to zero and then the pair solved
> for gamma and kappa, then I do not believe there is an analytical
> formula for them. Isolating the two variables in terms of the others
> involves finding the root of something of the form
>
> c0 + c1 * x + c2 * exp(c3 + c4 * exp(x))
>
> If the term inside the first exp() only involved x linearly and not
> exp(x), then the root could be determined analytically using the
> LambertW function, but I do not know of any equivalent function that can
> be used when there is an x + exp(exp(x)) form.


In addition to this, if you run just the first equation and solve for both variables you'll see:
>>vars = solve('Ip0*gamma1+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)=0',...
'gamma1','kappa');
>>vars.kappa
ans = z %meaning that kappa is equivalent to z.

I'm not sure if this is what you meant for and could be a typo in your equation.

Subject: Symbolic toolbox solution

From: Serdar GOKHAN

Date: 9 Jul, 2010 14:50:20

Message: 6 of 11

Hi. Again
Thank you very much for your valuable comments. When I run the below code, on the coomand window

>> S=solve('Ip0*gamma1+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)=0', '-Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma1*z)*Is0*exp(-kappa*z)=0')

The output is,

S =

    kappa: [1x1 sym]
        z: [1x1 sym]

>> S.kappa
 
ans =
 
log(-K*(gamma1+alpha_p)/gb/Is0)/L
 
 
>> S.z
 
ans =
 
log(K*(log(-K*(gamma1+alpha_p)/gb/Is0)+alpha_s*L)/gb/Ip0/L)/gamma1

Therefore,
=========================================
kappa=log(-K*(gamma1+alpha_p)/gb/Is0)/L and
z=log(K*(log(-K*(gamma1+alpha_p)/gb/Is0)+alpha_s*L)/gb/Ip0/L)/gamma1
=========================================
So from the above equations, How can get "gamma" and "kappa"
Thank you for your valuable replies.
Regards
Serdar

Subject: Symbolic toolbox solution

From: Walter Roberson

Date: 9 Jul, 2010 14:54:13

Message: 7 of 11

Sean wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message
> <1qGZn.10985$Hw.4661@newsfe10.iad>...
>> Serdar GOKHAN wrote:
>> > Hi All,
>> > > How can we get analytical expressions of "kappa" and "gamma" from
>> the > below two equations by using Symbolic toolbox? Any kind of help
>> is > appreciated.
>> > Regards
>> > Serdar
>> > > 1.st equation
>> > Ip0*gamma+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)
>> > > 2.nd equation
>> > >
>> -Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma*z)*Is0*exp(-kappa*z)
>>
>> If those two formula are to be equated to zero and then the pair
>> solved for gamma and kappa, then I do not believe there is an
>> analytical formula for them. Isolating the two variables in terms of
>> the others involves finding the root of something of the form
>>
>> c0 + c1 * x + c2 * exp(c3 + c4 * exp(x))
>>
>> If the term inside the first exp() only involved x linearly and not
>> exp(x), then the root could be determined analytically using the
>> LambertW function, but I do not know of any equivalent function that
>> can be used when there is an x + exp(exp(x)) form.
>
>
> In addition to this, if you run just the first equation and solve for
> both variables you'll see:
>>> vars = solve('Ip0*gamma1+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)=0',...
> 'gamma1','kappa');
>>> vars.kappa
> ans = z %meaning that kappa is equivalent to z.
>
> I'm not sure if this is what you meant for and could be a typo in your
> equation.

I think you are misinterpreting, Sean. The z there cannot be the same as
the z of the second equation because the first equation does not include
a z. The z returned is thus probably an indication of "any arbitrary
value", and vars.gamma1 would probably be expressed in terms of that
arbitrary z . This is to be expected when you solve a single equation in
terms of two variables, that the solver will allow one of the variables
to "run free" and express the second in terms of the value of the first.

Subject: Symbolic toolbox solution

From: Walter Roberson

Date: 9 Jul, 2010 14:57:02

Message: 8 of 11

Serdar GOKHAN wrote:
> Hi. Again
> Thank you very much for your valuable comments. When I run the below
> code, on the coomand window
>
>>> S=solve('Ip0*gamma1+alpha_p*Ip0+gb/K*Ip0*Is0*exp(kappa*L)=0',
>>> '-Is0*kappa*exp(-kappa*z)-alpha_s*Is0*exp(-kappa*z)+gb/K*Ip0*exp(gamma1*z)*Is0*exp(-kappa*z)=0')

Don't do that. Explicitly specify the variables to solve for.

If it then says there is no closed-form solution, it is because there
*is* no closed form solution, as per my previous posting that mentioned
Lambert's W function.

Subject: Symbolic toolbox solution

From: Serdar GOKHAN

Date: 9 Jul, 2010 15:11:05

Message: 9 of 11

Thank you Sir.
You did your best. The solution seems to be a function of Lambert's W function.
Regards.
Serdar

Subject: Symbolic toolbox solution

From: Walter Roberson

Date: 9 Jul, 2010 18:15:02

Message: 10 of 11

Serdar GOKHAN wrote:

> You did your best. The solution seems to be a function of Lambert's W
> function. Regards.

What solution did you come up with? Lambert's W function is good for solving
u*x = exp(v*x)
but it is not appropriate for solving
u*x = exp(v*exp(x))

Even if you have exact values for all of the constants, it does not appear to
me that you can find an _analytic_ solution for gamma and kappa as per your
original request. If you _do_ have all of the constants, it is still difficult
to solve numerically as the values involved can be very small (or large.)

Testing out some values, it appears that kappa might be very close to alpha_s
and that gamma1 might be very close to alpha_p . However, if you substitute
those in exactly and toss in some constants, cross-checking will show one of
the expressions coming out as about 1E-368 and the other coming out as about
1E54 if you operate with standard precision; it appears you have to operate
with over 100 digits to start getting more reasonable evaluations of the
equations.

Subject: Symbolic toolbox solution

From: Serdar GOKHAN

Date: 9 Jul, 2010 20:12:04

Message: 11 of 11

Hi Sir,
Thank you for your wise and valuable reply. As you guess, It is still difficult to get analytical solution. Your assertion is true that,

kappa is very close to (- alpha_s) and gamma1 is very close to (- alpha_s) with negative sign. However, not the same as you guess.

kappa ~ - alpha_s
gamma1 ~ - alpha_p

I think you conclude the solution with your last assertion.

Thank you very much for your kind helps and wise information.
Best Regards.
Serdar

Tags for 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