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:
eqution solving

Subject: eqution solving

From: Sam

Date: 9 Oct, 2013 18:22:08

Message: 1 of 5

(x^0.25) (e^-x)=(y^0.25)(e^-y).
In this x value is 0 to 0.3 with an interval 0.01
I got theLeft side equation now.
I ve to use each value and solve for y. Can anyone help me out!!!!
 I used x=0:0.01:0.3 and w=(x.^0.25).*exp(-x) to get LHS.

Subject: eqution solving

From: Nasser M. Abbasi

Date: 9 Oct, 2013 19:22:52

Message: 2 of 5

On 10/9/2013 1:22 PM, Sam wrote:
> (x^0.25) (e^-x)=(y^0.25)(e^-y).
> In this x value is 0 to 0.3 with an interval 0.01
> I got theLeft side equation now.
> I ve to use each value and solve for y. Can anyone help me out!!!!
> I used x=0:0.01:0.3 and w=(x.^0.25).*exp(-x) to get LHS.
>


clear all;
a=0.25;
x=0:0.01:0.3;
rhs=@(x) (x.^a).*exp(-x);
y=-a*lambertw(- (rhs(x).^(1/a))/a);
y'

                    0
    0.010000000000000
    0.020000000000000
    0.030000000000000
    0.040000000000000
    0.050000000000000
    0.060000000000000
    0.070000000000000
    0.080000000000000
    0.090000000000000
    0.100000000000000
    0.110000000000000
    0.120000000000000
    0.130000000000000
    0.140000000000000
    0.150000000000000
    0.160000000000000
    0.170000000000000
    0.180000000000000
    0.190000000000000
    0.200000000000000
    0.210000000000000
    0.220000000000000
    0.230000000000001
    0.239999999999999
    0.249999992763806
    0.240259757783919
    0.231012917885145
    0.222223441956900
    0.213859005353982
    0.205890500687635


--Nasser

Subject: eqution solving

From: Sam

Date: 9 Oct, 2013 19:43:05

Message: 3 of 5

Thank u for the answer.. That really helps.
Can u explain
(1)why we r using @(x)
(2)What this equation does y=-a*lambertw(- (rhs(x).^(1/a))/a)??



"Nasser M. Abbasi" wrote in message <l34ae9$36m$1@speranza.aioe.org>...
> On 10/9/2013 1:22 PM, Sam wrote:
> > (x^0.25) (e^-x)=(y^0.25)(e^-y).
> > In this x value is 0 to 0.3 with an interval 0.01
> > I got theLeft side equation now.
> > I ve to use each value and solve for y. Can anyone help me out!!!!
> > I used x=0:0.01:0.3 and w=(x.^0.25).*exp(-x) to get LHS.
> >
>
>
> clear all;
> a=0.25;
> x=0:0.01:0.3;
> rhs=@(x) (x.^a).*exp(-x);
> y=-a*lambertw(- (rhs(x).^(1/a))/a);
> y'
>
> 0
> 0.010000000000000
> 0.020000000000000
> 0.030000000000000
> 0.040000000000000
> 0.050000000000000
> 0.060000000000000
> 0.070000000000000
> 0.080000000000000
> 0.090000000000000
> 0.100000000000000
> 0.110000000000000
> 0.120000000000000
> 0.130000000000000
> 0.140000000000000
> 0.150000000000000
> 0.160000000000000
> 0.170000000000000
> 0.180000000000000
> 0.190000000000000
> 0.200000000000000
> 0.210000000000000
> 0.220000000000000
> 0.230000000000001
> 0.239999999999999
> 0.249999992763806
> 0.240259757783919
> 0.231012917885145
> 0.222223441956900
> 0.213859005353982
> 0.205890500687635
>
>
> --Nasser

Subject: eqution solving

From: Nasser M. Abbasi

Date: 9 Oct, 2013 19:49:50

Message: 4 of 5

On 10/9/2013 2:43 PM, Sam wrote:
> Thank u for the answer.. That really helps.
> Can u explain
> (1)why we r using @(x)
> (2)What this equation does y=-a*lambertw(- (rhs(x).^(1/a))/a)??
>
>

This is just the analytical solution. I just used
a numerical function for it:

clear all; syms y a rhs; solve( y^a*exp(-y)==rhs,y)
   
-a*lambertw(0, -exp(log(rhs)/a)/a)

ps. exp(ln(rhs)) is the same as rhs
pss. the @(x) is just standard matlab way to defin a function on the fly.

--Nasser

>
> "Nasser M. Abbasi" wrote in message <l34ae9$36m$1@speranza.aioe.org>...
>> On 10/9/2013 1:22 PM, Sam wrote:
>>> (x^0.25) (e^-x)=(y^0.25)(e^-y).
>>> In this x value is 0 to 0.3 with an interval 0.01
>>> I got theLeft side equation now.
>>> I ve to use each value and solve for y. Can anyone help me out!!!!
>>> I used x=0:0.01:0.3 and w=(x.^0.25).*exp(-x) to get LHS.
>>>
>>
>>
>> clear all;
>> a=0.25;
>> x=0:0.01:0.3;
>> rhs=@(x) (x.^a).*exp(-x);
>> y=-a*lambertw(- (rhs(x).^(1/a))/a);
>> y'
>>
>> 0
>> 0.010000000000000
>> 0.020000000000000
>> 0.030000000000000
>> 0.040000000000000
>> 0.050000000000000
>> 0.060000000000000
>> 0.070000000000000
>> 0.080000000000000
>> 0.090000000000000
>> 0.100000000000000
>> 0.110000000000000
>> 0.120000000000000
>> 0.130000000000000
>> 0.140000000000000
>> 0.150000000000000
>> 0.160000000000000
>> 0.170000000000000
>> 0.180000000000000
>> 0.190000000000000
>> 0.200000000000000
>> 0.210000000000000
>> 0.220000000000000
>> 0.230000000000001
>> 0.239999999999999
>> 0.249999992763806
>> 0.240259757783919
>> 0.231012917885145
>> 0.222223441956900
>> 0.213859005353982
>> 0.205890500687635
>>
>>
>> --Nasser

Subject: eqution solving

From: Roger Stafford

Date: 10 Oct, 2013 01:38:09

Message: 5 of 5

"Sam" wrote in message <l346sg$r0c$1@newscl01ah.mathworks.com>...
> (x^0.25) (e^-x)=(y^0.25)(e^-y).
> In this x value is 0 to 0.3 with an interval 0.01
> I got theLeft side equation now.
> I ve to use each value and solve for y. Can anyone help me out!!!!
> I used x=0:0.01:0.3 and w=(x.^0.25).*exp(-x) to get LHS.
- - - - - - - - - -
  As Nassar has indicated, there is a matlab function in the Symbolic Toolbox that can solve your problem. It is called 'lambertw'. See its documentation at:

 http://www.mathworks.com/help/symbolic/lambertw.html

To see how you can use it, first take the fourth power of both sides of your equation and then multiply both sides by -4, and you get the equation:

 -4*x*exp(-4*x) = -4*y*exp(-4*y)

If you then call w = -4*y and z = -4*x*exp(-4*x), you arrive at the Lambert W function which expresses w as a function of z:

 w*exp(w) = z

This accounts for the computation performed by Nassar.

  However, you should realize that in the range of your numbers, there are two real branches of solutions. That is, for a given x there are two possible values of y that satisfy the equation. Nassar called on

 lambertw(z)

which gives values in the range -1 <= w <= 0 and therefore 0 <= y <= 1/4. If you call on

 lambertw(-1,z)

you will get values in the other branch which will range -inf < w <= -1 and therefore 1/4 <= y < inf. It is up to you which branch you want your values to be taken from as solutions for y. You may want to use values from the "-1" branch for values from 0 to .25 and values from the other branch from .25 to .3, which would constitute a continuous function differing from the obvious solution y = x.

Roger Stafford

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