Transformation of Coordinates

From testwiki
Revision as of 13:27, 4 July 2022 by imported>ThaniosAkro (Ellipse)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Translation of Coordinate Axes

Template:RoundBoxTop

File:0626Translation00.png
Graph in 2 dimensions illustrating Translation of Coordinate Axes.
Points P,P are same point.
Point P is defined relative to origin O, black arrows.
Point P is defined relative to origin Ω, red arrows.

Any point in the 2 dimensional Cartesian plane is usually defined as (x,y) meaning that the point is x units horizontally from origin O=(0,0) and y units vertically from origin.

It is always possible, and sometimes desirable, to give the point a new name or definition that reflects its position relative to another point in the 2 dimensional plane, for example Ω, the position of which is defined as (h,k) relative to origin O.

In the diagram point P and point P are the same point. It's just that the point has the name or definition P when referenced to origin O (black arrows), and P when referenced to origin Ω (red arrows).


By inspection:

  • h+x=x or x=xh
  • k+y=y or y=yk.


Actual values:

Ω=(h,k)=(6,4)

P=(x,y)=(9,10.5)

P=(x,y)=(xh,yk)=(96,10.54)=(3,6.5).


Point P is defined as (9,10.5) relative to origin O, and point P, the same point, is defined as (3,6.5) relative to origin Ω.

Examples

Template:RoundBoxTop

Linear function

Template:RoundBoxTop

File:0626Translation03.png
Graph in 2 dimensions illustrating Translation of Coordinate Axes applied to linear function.
line1 can have 2 equations:
* 2x+3y18=0 relative to origin O.
* 2x+3y+6=0 relative to origin Ω.

In the diagram line1 has equation 2x+3y18=0.

What is equation of line1 relative to origin Ω=(6,4)?


Using x=x+h, y=y+k:

2(x+6)+3(y+4)18=0

2x+12+3y+1218=0

2x+3y+6=0


When x,y become x,y, this means that equation 2x+3y+6=0 is relative to origin Ω. line1 can have equation 2x+3y18=0 or equation 2x+3y+6=0.


Equation 2x+3y+6=0 relative to origin Ω is same as equation 2x+3y+6=0 relative to origin O.

Note that in both cases:

  • X intercept relative to origin is 3.
  • Y intercept relative to origin is 2.

Template:RoundBoxBottom Template:RoundBoxBottom Template:RoundBoxBottom

Rotation of Coordinate Axes

Template:RoundBoxTop

File:0627Rotation00.png
Graph in 2 dimensions illustrating Rotation of Coordinate Axes.
Point P has 2 names or definitions:
(x,y)=(15,30) when defined relative to black arrows.
(x,y)=(30,15) when defined relative to red arrows.

If X axis, line OX, is rotated through angle θ so that X axis of new system becomes OX then:

  • Counter-clockwise rotation occurs when θ is positive.
  • Y axis of new system becomes OY.
  • angle between OX and OX is θ.
  • angle between OY and OY is θ.


See diagram. By inspection:

Angle TPQ=θ

QR=ST=xsinθ

QT=RS=ysinθ

PQ=ycosθ

OS=xcosθ=OR+RS=x+ysinθ  (1)

PR=y=PQ+QR=ycosθ+xsinθ  (2)

From (1), x=xcosθysinθ  (3)

From (2), y=xsinθ+ycosθ  (4)


From (3) and (4):

x=xcosθ+ysinθ  (5)

y=ycosθxsinθ  (6)


Actual values: Template:RoundBoxTop Converting from (x,y) to (x,y) Template:RoundBoxTop

# Python code.
>>> c,s = cosθ,sinθ = 4/5,3/5 ; c,s
(0.8, 0.6)
>>> x,y = 15,30
>>> x1 = x*c + y*s
>>> y1 = y*c - x*s
>>> x1,y1
(30.0, 15.0)

Template:RoundBoxBottom Process reversed: Template:RoundBoxTop

# Python code.
>>> c,s = cosθ,sinθ = 4/5,-3/5 ; c,s
(0.8, -0.6)
>>> x,y = 30,15
>>> x1 = x*c + y*s
>>> y1 = y*c - x*s
>>> x1,y1
(15.0, 30.0)

Template:RoundBoxBottom Template:RoundBoxBottom

Examples

Template:RoundBoxTop

Linear function

Template:RoundBoxTop

File:0628Rotation00.png
Graph in 2 dimensions illustrating Rotation of Coordinate Axes applied to linear function.
line1 has 2 equations:
* 6x+17y=300 relative to OX,OY (black system).
* 3x+2y=60 relative to OX,OY (red system).

Let a line have equation: ax+by+d=0.

Let c=cosθ; s=sinθ.

After rotation, equation of line relative to OX,OY (red arrows) is:

a(xcys)+b(xs+yc)+d =axcays+bxs+byc+d =axc+bxs+bycays+d =xac+xbs+ybcyas+d =x(ac+bs)+y(bcas)+d =Ax+By+d=0  (1)

where: A=acosθ+bsinθ; B=bcosθasinθ.


In the diagram line1 has equation 6x+17y300=0, and cosθ=45.


What is equation of line1 relative to OX,OY (red system)?

# python code.
>>> a,b,d = 6,17,-300
>>> c,s = cosθ,sinθ = 4/5,3/5 ; c,s
(0.8, 0.6)
>>> A = a*c + b*s ; A
15.0
>>> B = b*c - a*s ; B
10.0

Equation of line1 relative to OX,OY: 15x+10y300=0 or 3x+2y=60.

OP=OP; OQ=OQ. Triangles OPQ,OPQ are congruent.

Line1: 3x+2y=60 has same position in red system as line2: 3x+2y=60 in black system. Template:RoundBoxBottom

Quartic function

Template:RoundBoxTop

File:0628Rotation02.png
Graph in 2 dimensions illustrating Rotation of Coordinate Axes applied to quartic function.
Position of black curve in red system is same as that of red curve in black system.

Let quartic function be defined as y=f(x)=1.5625x412.125x314.75x2+136.5x+11448.

In diagram, X and Y axes are rotated through angle θ to produce new system of coordinates OX,OY (red system.)


cosθ=45. What is equation of f(x) relative to red system?

Template:RoundBoxTop g(x,y)=ax4+bx3+cx2+dx+ey

After substituting appropriate values for a,b,c,d,e,x,y code supplied to application grapher is:

  (0.0325520833333333)  ((x(0.8) - y(0.6))^4) 
+ (-0.252604166666667)  ((x(0.8) - y(0.6))^3) 
+ (-0.307291666666667)  ((x(0.8) - y(0.6))^2) 
+            (2.84375)  ((x(0.8) - y(0.6))  )
+ (2.375)
- (x(0.6) + y(0.8)) = 0

Template:RoundBoxBottom Red curve in diagram has equation g(x,y)=0. Template:RoundBoxBottom

Ellipse

Template:RoundBoxTop

File:0701ellipse00.png
Graph in 2 dimensions illustrating Rotation of Coordinate Axes applied to ellipse.

Equation of ellipse in diagram is: f(x,y)=55x224xy+48y22496=0.

What is equation of f(x,y) relative to minor and major axes (red system)?


The most general equation of second degree in x,y has form: ax2+bxy+cy2+dx+ey+f=0.

Rotation of coordinate axes when applied to the general equation produces the primed equation: A(x)2+Bxy+C(y)2+Dx+Ey+F=0 where:

A=an2+bns+cs2

B=bn22ans+2cnsbs2=bn2+(2c2a)nsbs2

C=cn2bns+as2

D=dn+es

E=ends

F=f

n=cosθ

s=sinθ


Choose values of sinθ,cosθ that make coefficient B=0.

From coefficient B above:

bn2+(2c2a)nsbs2=0

bn2bs2=(2c2a)ns

Square both sides, substitute (1ss) for nn, expand, gather like terms and result is:

PS2+QS+R=0  (1) where:

S=sin2θ

P=4a2+4b2+4c28ac

Q=P

R=b2

See also: Solving ellipse at origin.


From (1) above, S=0.36 or 0.64.

sinθ=S=±0.6 or ±0.8. Template:RoundBoxTop

File:0701ellipse01.png
Graph in 2 dimensions showing 2 ellipses, f'(x,y), where f'(x,y) is f(x,y) relative to its minor and major axes.
# python code.
values_of_cosθ_sinθ = (
    (0.6,-0.8),
    (0.6,0.8),
    (0.8,-0.6),
    (0.8,0.6),
)

a,b,c,d,e,f = 55,-24,48,0,0,-2496

for ns in values_of_cosθ_sinθ :
    n,s = ns
    B = b*n*n + (2*c-2*a)*n*s - b*s*s
    if (abs(B) < 1e-14) :
        print ('ns =',n,s)
        A = a*n*n + b*n*s + c*s*s
        C = c*n*n - b*n*s + a*s*s
        D = d*n + e*s
        E = e*n - d*s
        F = f
        print ('   ',A,0,C,D,E,F)
ns = 0.6 0.8
    39.0 0 64.0 0.0 0.0 -2496
ns = 0.8 -0.6
    64.0 0 39.0 0.0 0.0 -2496

When cosθ,sinθ=0.6,0.8, f(x,y)=39x2+64y22496=0.

When cosθ,sinθ=0.8,0.6, f(x,y)=64x2+39y22496=0.

Template:RoundBoxTop In this context, f(x,y) is not the derivative of f(x,y).

Expression f(x,y) means f(x,y) relative to primed system OX,OY (red system.) Template:RoundBoxBottom Template:RoundBoxBottom Template:RoundBoxBottom Template:RoundBoxBottom Template:RoundBoxBottom