0

In R, solve will solve systems of linear equations and ode can solve initial value problem differential equations. I've got a system of equations that I can't figure out how to fit into either. Can someone show me how it's solved?

I asked earlier how to fit a curve to four points where the y value for one point is unknown, just that it's a maximum:

Three of the points are known, but the fourth one is a little tricky. I have the x value for the maximum y value, but I don't know what the maximum y value is. For example, let's say there are known points at (0,0), (1,1), and (4,0). The maximum y value is at x=3 so the fourth point is (3, ymax).

Someone showed me how to set a system of equations to satisfy those equations:

Actually it is possible since you require the y value at x=3 should be maximum. So, a degree 4 polynomial has 5 coefficients to be determined and you have the following equations:

y(0) = 0

y(1) = 1

y(4) = 0

dy/dx(3) = 0 (first derivative at x=3 should be 0)

d2y/dx2(3) < 0 (2nd derivative at x=3 should be negative)

I've been trying to figure out how to solve that using R but I'm hitting a brick wall. I can't use solve because equations four and five are differential. But I can't figure out how to use ode either because the initial values are at a couple different x values. Am I missing something obvious?

Community
  • 1
  • 1
  • You can't solve this without assuming a model, e.g., a polynomial. Then this is high school maths (and not something you should use a numeric solver for). – Roland Nov 08 '14 at 16:04
  • I've posted an answer at your previous question. I would vote to close this as a duplicate, but the magic high-rep hammer would close it instantaneously, and I'm not quite sure. – Ben Bolker Nov 08 '14 at 16:48

0 Answers0