# Thread: Translation of cubic graphs

1. ## Translation of cubic graphs

I'm trying to work out what the new co-efficients for a cubic function would be if it was shifted distance p along the x axis.

I don't know why i can't seem to do it!

I can do it using f(x-p), like y=a(x-p)^3+b(x-p)^2+c(x-p)+d

but i need it so that i just have a single co-efficient for a b c and d, so when i find the roots of that equation, i find the roots=x, not the roots=x-p (i know i can just +p afters, but that doesn't work in the particular application i'm using).

I graphed a few on excel (as it's got the curve fit that displays eqns) but i can't find a relationship, more to the point I perhaps don't know how to go about it when it's more complicated than just x^3.

From what I've done, i can see there must be a standard way of creating co-efficients so that i can shift in x, if anyone can tell me how to get to there, i'd be really greatful.

Thanks!

2. Originally Posted by potticus
I'm trying to work out what the new co-efficients for a cubic function would be if it was shifted distance p along the x axis.

I don't know why i can't seem to do it!

I can do it using f(x-p), like y=a(x-p)^3+b(x-p)^2+c(x-p)+d

but i need it so that i just have a single co-efficient for a b c and d, so when i find the roots of that equation, i find the roots=x, not the roots=x-p (i know i can just +p afters, but that doesn't work in the particular application i'm using).

I graphed a few on excel (as it's got the curve fit that displays eqns) but i can't find a relationship, more to the point I perhaps don't know how to go about it when it's more complicated than just x^3.

From what I've done, i can see there must be a standard way of creating co-efficients so that i can shift in x, if anyone can tell me how to get to there, i'd be really greatful.

Thanks!
I'm not sure if I understand your problem. (?)

Expand the brackets:

$\displaystyle y=a(x-p)^3+b(x-p)^2+c(x-p)+d ~\implies$ $\displaystyle ~ y = a·x^3 - 3·a·p·x^2 + b·x^2 + 3·a·p^2·x - 2·b·p·x + c·x - a·p^3 + b·p^2 - c·p + d$

Collect the coefficient of the powers of x:

$\displaystyle y = ax^3+(b-3ap)x^2 + (3ap^2-2bp+c)x+(d-ap^3+bp^2-cp)$

3. By doing that, you are saying that (here a=b=c=d=1, x=2 and p=1):

1(2-1)^3 = 1(2^3 - 1^3)

1 = 7

You can't just expand the brackets like that, so I don't know what to do

4. Originally Posted by potticus
By doing that, you are saying that (here a=b=c=d=1, x=2 and p=1):

1(2-1)^3 = 1(2^3 - 1^3)

1 = 7

You can't just expand the brackets like that, so I don't know what to do
earboth never said 1(2-1)^3 = 1(2^3 - 1^3). You cant expand identities that way. You should know algebra well to understand co-ordinate geometry.

Try expanding $\displaystyle (a-b)^3$ and tell me the answer...

You will see earboth is correct!

5. My bad - I was sitting here doing it while you posted ... but I got different co-efficients, and neither set worked when i plugged them into excel, comparing them to numbers calculated using (x-p)... directly.

My x and y values are something like this ...

0 0 1
0.1 0.181 1.111
0.2 0.328 1.248
0.3 0.447 1.417

x values: 0, 0.1, 0.2, 0.3
(x-p)...: 0, 0.181, 0.328, 0.447
expanded: 1, 1.111, 1.248, 1.417

6. Originally Posted by potticus
My bad - I was sitting here doing it while you posted ... but I got different co-efficients, and neither set worked when i plugged them into excel, comparing them to numbers calculated using (x-p)... directly.

My x and y values are something like this ...

0 0 1
0.1 0.181 1.111
0.2 0.328 1.248
0.3 0.447 1.417

x values: 0, 0.1, 0.2, 0.3
(x-p)...: 0, 0.181, 0.328, 0.447
expanded: 1, 1.111, 1.248, 1.417
Instead of the values, could you show your working? Work out the coefficients and we will tell you where you went wrong....

Its more instructive than trying values...

7. expanding (x-p)^2:
(x^2 - 2px + p^2)

expanding (x-p)^3:
(x^3 - 2px^2 + p^2x +px^2 - 2p^2x + p^3)

stick in the coefficients and rearrange ...

I get (a)x^3 + (b-3ap)x^2 + (2ap^2 - 2bp +c)x + (d-cp-ap^3+bp^2)

But not the same answers as for (x-p)... directly.

8. I missed a term >_<

Should be 3ap^2, as 2nd post ...

But still doesn't work

9. Originally Posted by potticus
expanding (x-p)^2:
(x^2 - 2px + p^2)
Right

expanding (x-p)^3:
(x^3 - 2px^2 + p^2x +px^2 - 2p^2x + p^3)
Wrong!
(x-p)^3 = (x^3 - 2px^2 + p^2x - px^2 + 2p^2x - p^3)

stick in the coefficients and rearrange ...

I get (a)x^3 + (b-3ap)x^2 + (2ap^2 - 2bp +c)x + (d-cp-ap^3+bp^2)

But not the same answers as for (x-p)... directly.
Try again...

10. Including the term i missed out (above) it is actually right, but i had a excel error, brackets in the wrong place!

>_<

11. Originally Posted by potticus
Including the term i missed out (above) it is actually right, but i had a excel error, brackets in the wrong place!

>_<
Good

Generally its better to review your algebra, if you are worried about such an expression. Most likely you will gain better from that. Of course, I am not denying the usage of excel but merely asking you to trust your algebra

12. True, but I'm using this in a computer program i'm writing, so comparing it on excel at least assures me that it's correct before i do some implementation with it to find everything's wrong :P