1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Legrange->System of equations

  1. Dec 1, 2007 #1
    [SOLVED] Legrange-->System of equations

    1. The problem statement, all variables and given/known data

    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)


    2. Relevant equations

    Just a Legrange


    3. 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.
     
  2. jcsd
  3. Dec 1, 2007 #2

    EnumaElish

    User Avatar
    Science Advisor
    Homework Helper

    [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: Dec 2, 2007
  4. Dec 2, 2007 #3
    Thanks for the response

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

    I recieved the response that is shown in my attachment. Why does it not give me numeric results? I could have recieved 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
     

    Attached Files:

    • Mma.JPG
      Mma.JPG
      File size:
      13.2 KB
      Views:
      59
  5. Dec 2, 2007 #4

    EnumaElish

    User Avatar
    Science Advisor
    Homework Helper

    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: Dec 2, 2007
  6. Dec 2, 2007 #5

    EnumaElish

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  7. Dec 2, 2007 #6
    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.]
     
  8. Dec 3, 2007 #7
    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: Dec 3, 2007
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Legrange-&gt;System of equations
  1. System of equations (Replies: 14)

  2. System of equations (Replies: 2)

  3. System of equations (Replies: 6)

  4. System of Equations (Replies: 9)

  5. System of equations (Replies: 5)

Loading...