Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    1
    ReputationRep:
    NB This is a physics question which I feel is most suited to maths.

    A hill is described h(x,y) = 300exp(-(x^2+y^2)).
    A railway runs along the line x-y=2
    What's the steepest slope that the train will need to climb?

    I want to do as much as I ran myself, so am principally asking for a starting hint please. Specifically: there must be a way to view a 3D surface plot like this side on as defined by the railway line. Then I could parameterise this function h = f(t) and use normal 1D diff' to solve. Is this vaguely correct reasoning? If so, I don't have a clue how to carry put the initial 'projection'

    Thanks in advance.
    Offline

    22
    ReputationRep:
    (Original post by Sm0key)
    NB This is a physics question which I feel is most suited to maths.

    A hill is described h(x,y) = 300exp(-(x^2+y^2)).
    A railway runs along the line x-y=2
    What's the steepest slope that the train will need to climb?

    I want to do as much as I ran myself, so am principally asking for a starting hint please. Specifically: there must be a way to view a 3D surface plot like this side on as defined by the railway line. Then I could parameterise this function h = f(t) and use normal 1D diff' to solve. Is this vaguely correct reasoning? If so, I don't have a clue how to carry put the initial 'projection'

    Thanks in advance.
    Why not plug y = x-2 into h(x,y) to get h(x) = 300\exp(-(x^2 + (x-2)^2)) and then find a way to maximise h'(x) (this is probably all wrong) - otherwise, this sounds like something that can be tackled by Lagrange Multipliers, something I'm not very familiar with, in which case, I'll let somebody like atsruser or Greg jump in.
    Offline

    14
    (Original post by Zacken)
    Why not plug y = x-2 into h(x,y) to get h(x) = 300\exp(-(x^2 + (x-2)^2)) and then find a way to maximise h'(x)
    I would do this.
    Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
    Spoiler:
    Show
    Gives steepest slope of \displaystyle \pm 600e^{-\frac{5}{2}} if I haven't made a mistake.
    Offline

    22
    ReputationRep:
    (Original post by EricPiphany)
    I would do this.
    Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
    Spoiler:
    Show
    Gives steepest slope of \displaystyle \pm 600e^{-\frac{5}{2}} if I haven't made a mistake.
    Clever.
    Offline

    11
    ReputationRep:
    (Original post by Sm0key)
    NB This is a physics question which I feel is most suited to maths.
    Looks more like a maths question that's turned up in a physics course :-)

    A hill is described h(x,y) = 300exp(-(x^2+y^2)).
    A railway runs along the line x-y=2
    What's the steepest slope that the train will need to climb?
    I think that the usual way to approach this is to

    a) find the gradient function \nabla h for the surface in terms of x,y
    b) use that to find the directional derivative \frac{\partial h}{\partial n} = \nabla h \cdot \hat{n} in the direction of the line, unit vector \hat{n}
    c) then reduce the problem to one dimension via x-y=2

    The gradient function encapsulates information about the gradient of the surface at every point (x,y). The directional derivative extracts gradient information from the gradient function along a line defined by a vector. A trivial directional derivative is \frac{\partial f}{\partial x}, which extracts gradient information from the function f(x,y) along the line defined by the x-axis, or the vector \bold{i}.
    • Thread Starter
    Offline

    1
    ReputationRep:
    Thanks all for the replies - much appreciated.
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by atsruser)
    Looks more like a maths question that's turned up in a physics course :-)



    I think that the usual way to approach this is to

    a) find the gradient function \nabla h for the surface in terms of x,y
    b) use that to find the directional derivative \frac{\partial h}{\partial n} = \nabla h \cdot \hat{n} in the direction of the line, unit vector \hat{n}
    c) then reduce the problem to one dimension via x-y=2

    The gradient function encapsulates information about the gradient of the surface at every point (x,y). The directional derivative extracts gradient information from the gradient function along a line defined by a vector. A trivial directional derivative is \frac{\partial f}{\partial x}, which extracts gradient information from the function f(x,y) along the line defined by the x-axis, or the vector \bold{i}.
    I wanted to do a directional derivative approach BUT didn't know how to compute the actual scalar product.

    Please could you guide me through those steps?
    Offline

    11
    ReputationRep:
    (Original post by atsruser)
    a) find the gradient function \nabla h for the surface in terms of x,y
    We have \nabla h = \frac{\partial h}{\partial x}\bold{i} + \frac{\partial h}{\partial y}\bold{j}

    I'll assume that you are happy with computing that unless you say otherwise.

    b) use that to find the directional derivative \frac{\partial h}{\partial n} = \nabla h \cdot \hat{n} in the direction of the line, unit vector \hat{n}
    We need a vector in the direction of the line. Since y=x-2, we have a line of gradient 1 in the x-y plane, which means that we go 1 unit along the y-axis for 1 unit along the x-axis. A vector in this direction is thus \bold{i}+\bold{j}

    You must now

    1) turn this into a unit vector \hat{n} and
    2) compute the dot product of \hat{n} with the gradient that you found above.

    When you've done this, you will have a function d(x,y) which computes the gradient of the surface in the *direction* of your line (i.e. along a vector parallel to it), but at any point (x,y) in the x-y plane...

    c) then reduce the problem to one dimension via x-y=2
    ... What you want, however, is a function that computes the gradient of the surface specifically on the points that lie on y=x-2. But to get that function, you merely have to impose the constraint y=x-2 on d(x,y) i.e. use it to substitute for either x or y in d(x,y), to give you, say, e(x).

    You can then find e'(x) in the usual way to maximise the gradient.
    Offline

    11
    ReputationRep:
    (Original post by Sm0key)
    I wanted to do a directional derivative approach BUT didn't know how to compute the actual scalar product.

    Please could you guide me through those steps?
    Please see my response to my response above.
    Offline

    14
    (Original post by atsruser)
    We have \nabla h = \frac{\partial h}{\partial x}\bold{i} + \frac{\partial h}{\partial y}\bold{j}

    I'll assume that you are happy with computing that unless you say otherwise.



    We need a vector in the direction of the line. Since y=x-2, we have a line of gradient 1 in the x-y plane, which means that we go 1 unit along the y-axis for 1 unit along the x-axis. A vector in this direction is thus \bold{i}+\bold{j}

    You must now

    1) turn this into a unit vector \hat{n} and
    2) compute the dot product of \hat{n} with the gradient that you found above.

    When you've done this, you will have a function d(x,y) which computes the gradient of the surface in the *direction* of your line (i.e. along a vector parallel to it), but at any point (x,y) in the x-y plane...



    ... What you want, however, is a function that computes the gradient of the surface specifically on the points that lie on y=x-2. But to get that function, you merely have to impose the constraint y=x-2 on d(x,y) i.e. use it to substitute for either x or y in d(x,y), to give you, say, e(x).

    You can then find e'(x) in the usual way to maximise the gradient.
    What if the curve in the x-y plane wasn't a line?
    Say y= x^2, the unit 'direction vector' of the curve varies.

    I suppose you could parametrise the 'direction vector' in terms of x too, in my head that looks very messy.
    Offline

    14
    (Original post by EricPiphany)
    I would do this.
    Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
    Spoiler:
    Show
    Gives steepest slope of \displaystyle \pm 600e^{-\frac{5}{2}} if I haven't made a mistake.
    Just realized why this won't work in the general case.
    You would have to parametrise in terms of curve length l think.
    Offline

    11
    ReputationRep:
    (Original post by EricPiphany)
    What if the curve in the x-y plane wasn't a line?
    Say y= x^2, the unit 'direction vector' of the curve varies.

    I suppose you could parametrise the 'direction vector' in terms of x too, in my head that looks very messy.
    The tangent line to y=x^2 at any point P(x,y) has the gradient 2x, so the tangent vector at P has components "1 along x, 2x along y" i.e. it is \bold{i} + 2x \bold{j} giving \hat{n} = \frac{1}{\sqrt{1+4x^2}}(\bold{i} + 2x \bold{j})

    So you can follow the prescription as above with that unit vector, and finally constrain the gradient to y=x^2 to get a 1D problem, then differentiate.
    Offline

    11
    ReputationRep:
    (Original post by Zacken)
    Why not plug y = x-2 into h(x,y) to get h(x) = 300\exp(-(x^2 + (x-2)^2)) and then find a way to maximise h'(x) (this is probably all wrong) - otherwise, this sounds like something that can be tackled by Lagrange Multipliers, something I'm not very familiar with, in which case, I'll let somebody like atsruser or Greg jump in.
    This looks fine, except that I think you may end up out by a constant factor of \sqrt{2} if you do it naively, due to the fact that you have ended up with a function of x, and a unit increment in x does not equate to a unit increment along y=x-2, which defines the direction that you are really interested in.

    In fact, a unit increment along x gives you an increment of \sqrt{2} along y=x-2 so this will make the calculated gradient too big (too small?). The gradient method that I showed evades this, since it allows us to differentiate naturally in the direction of the line in question, and at one point we calculate a unit tangent along that direction to make sure that we are working in terms of unit increments along that line.

    [edit: in calculating the gradient along the line via Zacken's method, this happens: Suppose that the height of the function above the x-y plane is z(x,y). We work with an x-change of dx along the x-axis - however, due to the slope of y=x-2, this corresponds to points on the function that are really \sqrt{2}dx apart along y=x-2, so our z-delta turns out to be \sqrt{2}dz and the slope of z(x,y) is computed as \frac{\sqrt{2}dz}{dx} which is too big.]
    Offline

    11
    ReputationRep:
    (Original post by EricPiphany)
    I would do this.
    Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
    Spoiler:
    Show
    Gives steepest slope of \displaystyle \pm 600e^{-\frac{5}{2}} if I haven't made a mistake.
    I don't think that this is fundamentally different from Zacken's suggestion, but it suffers from the same problem (of step size) which I described above.
    Offline

    14
    (Original post by atsruser)
    I don't think that this is fundamentally different from Zacken's suggestion, but it suffers from the same problem (of step size) which I described above.
    Thanks. Realised that eventually over here.

    (Original post by EricPiphany)
    Just realized why this won't work in the general case.
    You would have to parametrise in terms of curve length l think.
    Offline

    11
    ReputationRep:
    (Original post by Zacken)
    Why not plug y = x-2 into h(x,y) to get h(x) = 300\exp(-(x^2 + (x-2)^2)) and then find a way to maximise h'(x) (this is probably all wrong) - otherwise, this sounds like something that can be tackled by Lagrange Multipliers, something I'm not very familiar with, in which case, I'll let somebody like atsruser or Greg jump in.
    You can, in fact, do this via Lagrange multipliers, but I couldn't see how for a bit (because I'm quite thick). You need to first find the directional derivative function \frac{\partial h}{\partial n}(x,y) then maximise subject to the constraint x-y=2. So you form:

    g(x,y) = \frac{\partial h}{\partial n} - \lambda(x-y-2)

    and then solve the series of equations:

    \frac{\partial g}{\partial x} = 0, \frac{\partial g}{\partial y} = 0, \frac{\partial g}{\partial \lambda} = 0

    The last one is boring; it just reproduces the constraint that you started with, but the other two give you the equations in x,y that you need to solve to find the extrema. This looks like it's equivalent to the gradient method in some sense, though [Maybe Gregorius can explain the exact connection?]
    Offline

    13
    ReputationRep:
    (Original post by atsruser)
    [Maybe Gregorius can explain the exact connection?]
    Eeek! I was never any good at this sort of stuff. But from a geometric point of view, one needs to observe that to do the parametrization approach correctly (the idea of if x-y=2 then y = x - 2) the resulting curve must be normalized by arc-length - or you end up out by a factor of root two as has already been observed. My guess is getting the unit vector \hat{n} corresponds to the arc length normalization step.
    Offline

    11
    ReputationRep:
    (Original post by Gregorius)
    Eeek! I was never any good at this sort of stuff. But from a geometric point of view, one needs to observe that to do the parametrization approach correctly (the idea of if x-y=2 then y = x - 2) the resulting curve must be normalized by arc-length - or you end up out by a factor of root two as has already been observed. My guess is getting the unit vector \hat{n} corresponds to the arc length normalization step.
    This is correct (see my insightful geometric explanation earlier ) but the question that I was a little hazy on was the connection between solving the problem via Lagrange multipliers and by merely substituting for y to reduce the problem to 1D.

    Having thought about it a bit, in this simple case, these are indeed merely the same thing, since once we have got our 3 equations by partial differentiation (one of which just gives us back the constraint) we then have to solve them (by substitution..) so Lagrange multipliers gives us nothing here.

    My question was fairly stupid, in fact.
    Offline

    13
    ReputationRep:
    (Original post by atsruser)
    My question was fairly stupid, in fact.
    They're often the best sorts of questions!
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Would you like to hibernate through the winter months?
    Useful resources

    Make your revision easier

    Maths

    Maths Forum posting guidelines

    Not sure where to post? Read the updated guidelines here

    Equations

    How to use LaTex

    Writing equations the easy way

    Student revising

    Study habits of A* students

    Top tips from students who have already aced their exams

    Study Planner

    Create your own Study Planner

    Never miss a deadline again

    Polling station sign

    Thinking about a maths degree?

    Chat with other maths applicants

    Can you help? Study help unanswered threads

    Groups associated with this forum:

    View associated groups
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.