I have a curve which passes through the origin with gradient zero, and also through the point (d,1) with gradient zero. It also passes through the point (m,n) between the two. I believe this is a quartic with an equation of the form y = ax^4 + bx^3 + cx^2. I need to be able to programmatically find the equation for different m, n, and d. So I need expressions for a, b, and c in terms of m, n, and d.

I have found these three equations:

(1) ad^4 + bd^3 + cd^2 = 1 (from point (d,1))

(2) 4ad^2 + 3bd + 2c = 0 (from gradient at (d,1), divided by d as I know d to be non-zero)

(3) am^4 + bm^3 + cm^2 = n

Can a, b, and c be found programmatically? If not is there another curve which fits my purposes (flat at origin and (d,1), passes through (m,n) somewhere between the two, I must be able to change d, m, and n)?

Many thanks in advance for the help.

  • 1
    $\begingroup$ It's a linear system, very standard to solve. What do you mean by "programmatically"? $\endgroup$ – Aretino Sep 2 '16 at 13:31
  • $\begingroup$ Well, I need a computer to be able to do it for any m, n, and d. So I can't be doing factorizations that depend on actually having the numbers. I'm not saying it isn't easy, but I have been trying for a few hours and it's too hard for my tiny brain. $\endgroup$ – Gabriel Sep 2 '16 at 13:57
  • $\begingroup$ I eventually got to something that looks like this (you can see my equations for a, b, and c in the bottom left). Either I've gone at it from completely the wrong angle or made a stupid mistake. I'm going back through my working now but can't shake the feeling I'm missing something really simple. jsfiddle.net/themusicroob/fqwmu943/6 $\endgroup$ – Gabriel Sep 2 '16 at 14:00
  • $\begingroup$ Do you know how to solve a linear $3\times3$ system of equations. There are a lot of different ways to do that, it all depends on what kind of tools you have at your disposal and on how much linear algebra you know. $\endgroup$ – Aretino Sep 2 '16 at 14:00
  • $\begingroup$ I think I probably know somewhere in the back of my mind, but I left university almost three years ago and it's all gone. And I was so excited to have a real-world application for maths too... :( $\endgroup$ – Gabriel Sep 2 '16 at 14:03

You have three linear equations with three unknowns so it will solve in a few steps. While doing the calculations remember that $d$, $m$ and $n$ represent values while $a$, $b$ and $c$ are variables you want to find.

The working out will depend upon what techniques you know to solve systems of linear equations. I'll add something if you want but without knowing if you know matrices it's pretty ugly looking.

The final answer is:

$$a= \frac{d^3n-3 d m^2+2 m^3}{d^3 m^2 (d-m)^2}$$

$$b= \frac{2\left(-d^4 n+2 d^2 m^2-m^4\right)}{d^3 m^2 (d-m)^2}$$

$$c= \frac{d^4n-4 dm^3+3 m^4}{d^2 m^2 (d-m)^2}$$

  • $\begingroup$ You're my saviour! Many many thanks. I have a bonus question which you can feel free to ignore. jsfiddle.net/themusicroob/fqwmu943/8 You can see by sliding the points around on this graph, I've just set a maximum of 1 and a minimum of zero. But when the graph hits zero it does so sharply. What would make me really happy is if I could have a gradient of zero wherever the graph crosses the x axis, and wherever it crosses the line y = 1. Doable? $\endgroup$ – Gabriel Sep 2 '16 at 14:23
  • $\begingroup$ Btw, I would be interested to know the system for this. I do remember some matrices stuff, I could certainly still multiply a pair of matrices, but if you use anything with the word eigen in it I may well have a seizure. $\endgroup$ – Gabriel Sep 2 '16 at 14:31
  • $\begingroup$ You didn't state that the curve can't go below $0$ or above $1$. That is why you are getting the odd non-smooth behaviour with the line when you move your point close to either end. $\endgroup$ – Ian Miller Sep 2 '16 at 14:33
  • $\begingroup$ Yea I realise that, it wasn't something I had considered before I got the solution. Just wondering if it's possible to do this? Or, if I add another point along the x-axis (s,0), and say the graph must cross this point with gradient zero, will that make the problem much more complicated? Thanks again. $\endgroup$ – Gabriel Sep 2 '16 at 14:39
  • $\begingroup$ Maybe you can solidify/clarify your actual requirements for the graph then ask that in a new question (link back to this one and to your solution so far). I'm guessing you want a curve which is flat at $(0,0)$ and $(d,1)$ and increasing smoothly and monotonically from $x=0$ to $x=d$ and also passes through the point $(m,n)$. $\endgroup$ – Ian Miller Sep 2 '16 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.