| > | restart; with(plots): |
Warning, the name changecoords has been redefined
Intro to t he Lambert function
About this worksheet
Author and Date:
Matthias Kawski
kawski@asu.edu
http://math.asu.edu/~kawki
July, 2005.
All rights reserved.
| > |
Content, Purpose and Use
| > |
Some very simple observations -- mostly grafically about the Lambert function.
These arose from confusion when the Lambert function appeared in the solution
of an oscllatory predator prey system -- which of course leads to two branches
in the solution.
This worksheet shows the origin and use of LambertW(-1,x) and LambertW(x).
The main prupose is to serve as a quick reference...
Updates and log of modifications.
None yet.
| > |
The algebraic definition and a graphical interpretation
The defining algebraic equation for the Lambert function is
| > | eq:=x*exp(x)=y: eq; |
The Lambert function is the inverse (principal branch) of the function
| > | f:=x->x*exp(x); |
| > | x=solve(eq,x); |
Graphically it is convenient to look at this function as the parameterized locii of the
point of intersection of an expoenential and a straight line
| > | eqq:=simplify(eq*exp(-x)/y): eqq; |
| > | z1:=lhs(eqq); z2:=rhs(eqq); |
| > | display([ plot(z2,x=-3..10,thickness=3,color=red), seq(plot(subs(y=tan(Pi/112*k),z1),x=-2..10,thickness=1,color=cyan), k=1..55), seq(plot(subs(y=tan(Pi/112*k),z1),x=-3..10,thickness=1,color=blue), k=-12..-1), seq(plot(subs(y=tan(Pi/112*k),z1),x=-3..10,thickness=1,color=pink), k=-55..-13), textplot([2,25,`Domain of Lambert function`],font=[TIMES,BOLD,16],align={ABOVE,RIGHT}), textplot([2,22,`Minimal slope -exp(-1)`],font=[TIMES,ROMAN,16],align={ABOVE,RIGHT}), textplot([2,20,`double valued for slopes in (-exp(1),0)`],font=[TIMES,BOLD,16],align={ABOVE,RIGHT}), textplot([2,18,`single valued for slopes in (0,infinity)`],font=[TIMES,ROMAN,16],align={ABOVE,RIGHT}) ], view=[-3..10,0..30]); |
This image is very suggestive, and immediately leads to the following
Domain and range of the branches of the Lambert function
| > |
| > | display([ plot(x*exp(x),x=-10..3,thickness=3,color=red), plot(LambertW(x),x=-exp(-1)..10,thickness=3,color=blue), plot(LambertW(-1,x),x=-exp(-1)..0,thickness=3,color=magenta), plot(-exp(-1),x=-10..0,thickness=1,color=pink), plot([-1,t,t=-exp(-1)..0],thickness=1,color=red), plot([-exp(-1),t,t=-10..0],thickness=1,color=cyan), plot(-1,-exp(-1)..0,thickness=1,color=black), textplot([-4.9,0.3,`f(u)=u*exp(u) has min at (-1,-exp(-1)`], color=red,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}), textplot([-4.9,1.3,`the range of f(u)=u*e^u is (-e^(-1),inf)`], color=red,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}), textplot([0.1,-1,`the domain of LambertW is (-e^(-1),inf)`], color=blue,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}), textplot([0.5,1.5,`the growth of LambertW is slower than log`], color=blue,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}), textplot([0.1,-0.5,`the range of LambertW is (-1,inf)`], color=blue,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}), textplot([-2.1,-3,`the domain of LambertW(-1,.) is (-e^(-1),0)`], color=magenta,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}), textplot([-2.1,-3.5,`the range of LambertW(-1,.) is (-inf,-1)`], color=magenta,font=[TIMES,ROMAN,12],align={ABOVE,RIGHT}) ],view=[-5..5,-5..5]); |
Derivative of the Lambert functions
The Lambert function satisfies e.g. the following separable differential equation:
| > | Diff(LambertW(x),x)=diff(LambertW(x),x); Diff(LambertW(-1,x),x)=diff(LambertW(-1,x),x); |
| > | DEL:=(1+y(x))/y(x)*diff(y(x),x)=x: DEL; |
| > | dsolve(DEL,y(x)); |
Lambert functions in predator prey systems
This differential equation appears e.g. after elimination of the time-dependence
in the predator prey system
| > | diff(x(t),t)=x(t)*(1-y(t)); diff(y(t),t)=y(t)*(1-x(t)); |
has the first integral
| > | FI:=log(y)-y+log(x)-x: FI=C; |
Solving either the first integral for y, or d-solving the differential equation
| > | DE:=diff(y(x),x)=-y(x)*(1-x)/x/(1-y(x)): DE; |
returns a solution in terms of the Lambert function
| > | asol:=y=solve(FI=subs(x=x0,y=y0,FI),y): asol; |
| > | dsol:=simplify(dsolve({DE,y(x0)=y0},y(x))): dsol; |
The second branch IS NOT returned automatically!
| > | sol2:=y=-LambertW(-1,-exp(x-y0-x0)*y0/x*x0): sol2; |
| > | sampledata:=x0=2,y0=3: sampledata1:=x0=2,y0=1: sampledata2:=x0=2,y0=2: sampledata4:=x0=2,y0=4: |
| > | display([ plot(subs(sampledata,rhs(sol2)),x=0..4,thickness=2,color=blue,view=0..5), plot(subs(sampledata,rhs(asol)),x=0..4,thickness=4,color=magenta,view=0..5), plot(subs(sampledata1,rhs(sol2)),x=0..4,thickness=1,color=blue,view=0..5), plot(subs(sampledata1,rhs(asol)),x=0..4,thickness=2,color=magenta,view=0..5), plot(subs(sampledata2,rhs(sol2)),x=0..4,thickness=1,color=blue,view=0..5), plot(subs(sampledata2,rhs(asol)),x=0..4,thickness=2,color=magenta,view=0..5), plot(subs(sampledata4,rhs(sol2)),x=0..4,thickness=1,color=blue,view=0..5), plot(subs(sampledata4,rhs(asol)),x=0..4,thickness=2,color=magenta,view=0..5)]); |
| > |
| > |
| > |