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?
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?