Legrange->System of equations

  • Thread starter Thread starter adm_strat
  • Start date Start date
adm_strat
Messages
13
Reaction score
0
[SOLVED] Legrange-->System of equations

Homework Statement



Suppose (a,b) is on the graph of [tex]f(x)=x^{2}[/tex] and (c,d) is on the graph of g(x)=ln(x)

a) Accurately approximate the minimum distance between (a,b) and (c,d)
b) Accurately approximate (a,b) and (c,d)
c) What is the relationship between f'(a) and g'(c)


Homework Equations



Just a Legrange


The Attempt at a Solution



The function that needs to be minimized is [tex]\sqrt{(a-c)^{2} + (b-d)^{2}}[/tex]
Which can be left as [tex](a-c)^{2} + (b-d)^{2}[/tex] because they will both be minimized at the same place

The Legrange:
[tex]L(a,b,c,d,\lambda ,\mu )=(a-c)^{2} + (b-d)^{2} - \lambda (a - b^{2}) - \mu (b-ln(d))[/tex]

This gave me the six equations:

[tex]L_{a}= 2a - 2c - \lambda = 0[/tex]
[tex]L_{b}= 2b - 2d - 2\lambda b = 0[/tex]
[tex]L_{c}= 2c - 2a - \mu = 0[/tex]
[tex]L_{d}= 2d - 2b - \frac{\mu }{d}= 0[/tex]
[tex]L_{\lambda }= a = b^{b}[/tex]
[tex]L_{\mu }= c = ln (d)[/tex]

This is where I am stuck
I tried for quite some time to solve for the system of equations and I am at a point where i don't know where to go.

The things I got out of them is:

[tex]\lambda[/tex] = -[tex]\mu[/tex] This is from [tex]L_{a}=L_{c}[/tex]
and
[tex]bd=\frac{1}{2}[/tex]

I got this by taking [tex]L_{a}=0[/tex] and [tex]L_{b}=0[/tex] therefore:
[tex]L_{a} = L_{b}[/tex] --> [tex]L_{a} - L_{b} = 0[/tex] --> [tex]L_{a} - L_{b} = L_{c}[/tex]

And so on till I got: [tex]L_{a} - L_{b} - L_{c} - L_{d} = 0[/tex]
Then using some substitution for [tex]\lambda[/tex] and [tex]\mu[/tex] I got bd =[tex]\frac{1}{2}[/tex]


The instructor of my course said I could use software on any of the problems in the handout but even when I tried plugging the equations into mathematica I got an error. I just don't know where to go with the equations.
 
on Phys.org
[itex]L_\lambda = a - b^2[/itex] and [itex]L_\mu= c - ln (d)[/itex] are binding; so a = b^2 and c = ln (d). These plus the 4 equations Lp = 0 for p = a, b, c, d give you 6 equations in 6 unknowns (a, b, c, d, [itex]\lambda, \mu[/itex]).

In mathematica try Solve[eq1 == ... == eq6 == 0}. (Edit: Solve[eq1 == ... == eq6 == 0].)
 
Last edited:
Thanks for the response

I typed it in as you instructed (as close as possible to yours)

I received the response that is shown in my attachment. Why does it not give me numeric results? I could have received 20 different representations for that if I wanted to simply by rearranging equations.
Can I use these results to get numerical results in mathematica or do I need to sit down and start to rearrange equations again?
(which I am doing anyways)

Thanks again
 

Attachments

  • Mma.JPG
    Mma.JPG
    12.9 KB · Views: 428
My guess is that the "Log" term is creating a nonlinearity that Mathematica finds difficult to solve analytically. An alternative solution method:

FindRoot[
{
D[L[a, b, c, d, \[Lambda], \[Mu]], a] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], b] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], c] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], d] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], \[Lambda]] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], \[Mu]] == 0
},
{{a, 1}, {b, 1}, {c, 2}, {d, Log[2]}, {\[Lambda], 1}, {\[Mu], 1}}
]

yields:

{a -> 0.289624, b -> 0.538168, c -> -0.0735622,
d -> 0.929078, \[Lambda] -> 0.726373, \[Mu] -> -0.726373}
 
Last edited:
You can also try substituting Exp[c] = d for c = Log[d]. The "Exp" expression seems to work with Solve. Defined that way, Solve yields:

{a -> 0.289624, b -> 0.538168, c -> -0.0735622,
d -> 0.929078, \[Lambda] -> 0.726373, \[Mu] -> -0.726373}

which is the identical to the FindRoot solution above.
 
adm_strat said:

Homework Statement



Suppose (a,b) is on the graph of [tex]f(x)=x^{2}[/tex] and (c,d) is on the graph of g(x)=ln(x)

Are you supposed to use Lagrange multipliers? Perhaps the approach minimizing would be good, too.

Reformulation: Minimize [tex]H(s,t)=(t-s)^2+(t^2-\ln s)^2[/tex] for [tex]s,t \in \mathbb R[/tex] and [tex]s>0[/tex].

Differentiating:
[tex]H_t=2(t-s)+4t(t^2-\ln s)=0[/tex]
[tex]H_s=-2(t-s)-\frac{2(t^2-\ln s)}s=0[/tex]

Adding these two equations yields:
[tex]4t(t^2-\ln s)-\frac{2(t^2-\ln s)}s=0[/tex]
[tex](t^2-\ln s)\left(4t-\frac{2}s\right)=0[/tex]

Using these equations we get [tex]2ts=1[/tex].

By plugging this into one of the above equation we get
[tex]2(t-1/2t)+4t(t^2+\ln(2t))=0[/tex]
One equation, one unknown - perhaps easier to solve.

More generally: Minimize [tex]H(s,t)=(t-s)^2+(f(t)-g(s))^2[/tex].

Differentiating:
[tex]H_t=2(t-s)+2f'(t)(f(t)-g(s))=0[/tex]
[tex]H_s=-2(t-s)-2g'(s)(f(t)-g(s))=0[/tex]


[tex]f'(t)(f(t)-g(s))-g'(s)(f(t)-g(s))=(f'(t)-g'(s))(f(t)-g(s))=0[/tex]

Two possibilities:
[tex]f(t)=g(s)[/tex] which implies (using the above equations) [tex]t=s[/tex], i.e. the two graphs have intersection.
[tex]f'(t)=g'(s)[/tex] (the tangent lines are parallel) and [tex]t-s+f'(t)(f(t)-g(s))=0[/tex] (the line segment between the two points is perpendicular to the tangent line)
This corresponds very nicely to our geometrical intuition.
[I guess this is what your teacher wants you to see - at least that's why there is the last question.]
 
I tried to simply minimize the equation like you did kompik since I cannot get mathematica to spit out the results (I don't know why, but it doesn't matter).

I couldn't get mathematica to solve the equation so I simply put it into my calculator and used the zero function to get my answer. I got 0.538168 for the s value in your equation.

To find the error in this estimation (since my calculator only gives me the answer to a few decimals)

t = 0.538168

[tex]2(t-1/2t)+4t(t^2+\ln(2t))=3.6947 x 10^{-6}[/tex]

[tex]\frac{0.538168-3.6947 x 10^{-6}}{0.538168} x 100 = 99.9993 Percent[/tex] << Good enough for me. Thanks for the help.
 
Last edited:

Similar threads

  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
6
Views
3K
  • · Replies 30 ·
2
Replies
30
Views
3K