File:Gunners’ equations.svg: Difference between revisions
From Elliptic Curve Crypto
Rational Point uploaded a new version of File:Gunners’ equations.svg |
update code example |
||
Line 25: | Line 25: | ||
svg(); plot(main=c("“gunners’ equations” solved to fit a parabolic trajectory", | svg(); plot(main=c("“gunners’ equations” solved to fit a parabolic trajectory", | ||
" | "over a quartic curve given one of two points of tangency"), | ||
x=c(rev(x_data),-x_data,-rev(x_data),x_data), | x=c(rev(x_data),-x_data,-rev(x_data),x_data), xlab="x", | ||
y=c(Y(rev(x_data)),Y(-x_data),-Y(-rev(x_data)),-Y(x_data)), | y=c(Y(rev(x_data)),Y(-x_data),-Y(-rev(x_data)),-Y(x_data)), ylab="y", | ||
type="l", lwd=3, col="brown", asp=1, ylim=c(-4.25,5.75)) | type="l", lwd=3, col="brown", asp=1, ylim=c(-4.25,5.75)) | ||
abline(0,0) | abline(0,0) | ||
Line 42: | Line 39: | ||
abline(v=(x + x1)/2, col="purple") | abline(v=(x + x1)/2, col="purple") | ||
abline(y1 - x1*(y - y1)/(x - x1), (y - y1)/(x - x1), col="purple") | abline(y1 - x1*(y - y1)/(x - x1), (y - y1)/(x - x1), col="purple") | ||
x_vals <- seq(-7,7,0.001) | x_vals <- seq(-7,7,0.001) | ||
Line 48: | Line 44: | ||
abline(y1 - x1*y1_, y1_, col="red") | abline(y1 - x1*y1_, y1_, col="red") | ||
abline(y - x*y_, y_, col="red") | abline(y - x*y_, y_, col="red") | ||
text(0,c(5.9, 5.5, 5.1, 4.7),labels=c("y = a*x^2 + b*x + c", | |||
paste("a = ", a),paste("b = ", b), paste("c = ", c)), col="green") | |||
text(0,-4.3,labels="y^2 = -10/51*x^4 - 40/357*x^3 + 8045/2499*x^2 + 220/119*x + 220/833", col="brown") | |||
text(x1,c(y1-0.2,y1-0.5),pos=1,labels=c(paste("x1 = ", x1),paste("y1 = ", y1))) | |||
text(x-0.9,c(y-0.3,y-0.6),pos=1,labels=c(paste("x = ", x),paste("y = ", y))) | |||
points(c(x1,x),c(y1,y)) | points(c(x1,x),c(y1,y)) |
Latest revision as of 00:26, 4 February 2025
#! /usr/bin/R -f
q4 <- -10/51; q3 <- -40/357; q2 <- 8045/2499; q1 <- 220/119; q0 <- 220/833
Q <- expression(q4*x^4 + q3*x^3 + q2*x^2 + q1*x + q0)
Y <- function(x) {eval(parse(text=paste("sqrt(",Q,")")),list(x=x))}
Y_ <- function(x) {eval(D(parse(text=paste("sqrt(",Q,")")),"x"),list(x=x))}
x1 <- -pi; y1 <- Y(x1); y1_ <- Y_(x1)
a3 <- -8*y1
a2 <- 4*y1_^2 + 12*q3*x1 + 24*q4*x1^2 - 4*y1_^2 + 4*q2
a1 <- -4*q3*y1_ - 16*q4*x1*y1_ + 8*q4*y1
a0 <- q3^2 - 4*q4*q3*x1 - 8*q4^2*x1^2 + 4*q4*y1_^2 - 4*q4*q2
a_roots <- polyroot(c(a0,a1,a2,a3))
a <- a_roots[1]
b <- y1_ - 2*a*x1
c <- y1 + a*x1^2 - x1*y1_
x <- -(2*a*b - q3 +2*a^2*x1 - 2*q4*x1) / (2*(a^2 - q4))
y <- Y(x)
y_ <- Y_(x)
x_data <- seq(0,sqrt(16.5),0.001)
svg(); plot(main=c("“gunners’ equations” solved to fit a parabolic trajectory",
"over a quartic curve given one of two points of tangency"),
x=c(rev(x_data),-x_data,-rev(x_data),x_data), xlab="x",
y=c(Y(rev(x_data)),Y(-x_data),-Y(-rev(x_data)),-Y(x_data)), ylab="y",
type="l", lwd=3, col="brown", asp=1, ylim=c(-4.25,5.75))
abline(0,0)
abline(v=c(x1, x, x1 + (x-x1)/4, x1 + (x-x1)/3, x1 + 2*(x-x1)/3, x1 + 3*(x-x1)/4), col="yellow")
abline(y1 - x1*(y - y1)/(x - x1) - (x - x1)^2*a/4, (y - y1)/(x - x1), col="yellow")
abline(y1 - x1*(y - y1)/(x - x1) - (x - x1)^2*a/3, (y - y1)/(x - x1), col="yellow")
abline(y1 - x1*(y - y1)/(x - x1) - (x - x1)^2*a/2, (y - y1)/(x - x1), col="yellow")
abline(y1 - x1*(y - y1)/(x - x1) - (x - x1)^2*a, (y - y1)/(x - x1), col="yellow")
abline(y1 - x1*(y1_+(y - y1)/(x - x1))/2, (y1_+(y - y1)/(x - x1))/2, col="orange")
abline(y - x*(y_+(y - y1)/(x - x1))/2, (y_+(y - y1)/(x - x1))/2, col="orange")
abline(v=(x + x1)/2, col="purple")
abline(y1 - x1*(y - y1)/(x - x1), (y - y1)/(x - x1), col="purple")
x_vals <- seq(-7,7,0.001)
lines(x_vals, a*x_vals^2 + b*x_vals +c, lwd=2, col="green")
abline(y1 - x1*y1_, y1_, col="red")
abline(y - x*y_, y_, col="red")
text(0,c(5.9, 5.5, 5.1, 4.7),labels=c("y = a*x^2 + b*x + c",
paste("a = ", a),paste("b = ", b), paste("c = ", c)), col="green")
text(0,-4.3,labels="y^2 = -10/51*x^4 - 40/357*x^3 + 8045/2499*x^2 + 220/119*x + 220/833", col="brown")
text(x1,c(y1-0.2,y1-0.5),pos=1,labels=c(paste("x1 = ", x1),paste("y1 = ", y1)))
text(x-0.9,c(y-0.3,y-0.6),pos=1,labels=c(paste("x = ", x),paste("y = ", y)))
points(c(x1,x),c(y1,y))
points(c((x + x1)/2, (x + x1)/2, (x + x1)/2),
c((y + y1)/2, (y + y1)/2 - (x - x1)^2*a/4 , (y + y1)/2 - (x - x1)^2*a/2))
c(a*x1^2 + b*x1 + c - y1, 2*a*x1 + b - y1_, a*x^2 + b*x + c - y, 2*a*x + b - y_)
c(a3*a^3 + a2*a^2 + a1*a + a0, a, b, c, x)
> c(a*x1^2 + b*x1 + c - y1, 2*a*x1 + b - y1_, a*x^2 + b*x + c - y, 2*a*x + b - y_)
[1] 0.000000e+00-4.701977e-38i 0.000000e+00+0.000000e+00i
[3] 0.000000e+00-6.009324e-22i 4.440892e-16-2.220166e-22i
> c(a3*a^3 + a2*a^2 + a1*a + a0, a, b, c, x)
[1] 0.00000000+1.053066e-22i -0.04593346-1.654361e-23i
[3] 0.11407143-1.039466e-22i 4.06801052-1.632789e-22i
[5] 2.88535800-1.260440e-23i
>
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 00:25, 4 February 2025 | ![]() | 504 × 504 (546 KB) | Rational Point (talk | contribs) | coördinates of points |
23:34, 3 February 2025 | ![]() | 504 × 504 (555 KB) | Rational Point (talk | contribs) | coefficients of resolvent | |
20:34, 3 February 2025 | ![]() | 504 × 504 (546 KB) | Rational Point (talk | contribs) |
You cannot overwrite this file.
File usage
The following page uses this file: