1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

楕円曲線と超楕円曲線を描く

Posted at

楕円曲線

y^2=x^3+ax+b

 楕円曲線なるものがあります。しかし、全く楕円に見えません。RSA暗号とは異なる、暗号に使われているようですが、図形的に見てなにか面白い点があるでしょうか?

コード

ellipticCurve.gif

void setup() {
  size(800, 800);
  textSize(20);
}
int num=0;
void draw() {
  for (double a=-2; a<=2.1; a+=0.25) {
    for (double b=-2; b<=2.1; b+=0.25) {
      background(255);

      float x=-3f;
      float y=-3f;
      float dx=3f/400f;
      float dy=3f/400f;

      for (int yy=0; yy<800; yy++) {
        for (int xx=0; xx<800; xx++) {
          double s = x*x*x + a*x + b - y*y;
          if (s<0) {
            set(xx, yy, color(0));
          }
          x += dx;
        }
        x = -3f;
        y += dy;
      }

      text("a = "+nf((float)a,0,2), 10, 20);
      text("b = "+nf((float)b,0,2), 10, 40);
      saveFrame("frames/"+nf(num,4)+".png");
      num++;
    }
  }
  exit();
}

x^3+x-y^2をプロット,x=-3..3, y=-3..3

image.png

超楕円曲線

y^2 = x(x+1)(x-3)(x+2)(x-2)

 2つ次数が増えて「超」なんでしょうか。いろいろ数値を入れてはみたものの、興味深いものは見つかりませんでした。

コード

HyperEllipticCurve.gif

void setup() {
  size(800, 800);
  textSize(20);
}
int num=0;
void draw() {
  for (int n=0; n<500; n++) {
    double a=random(-5, 6);
    double b=random(-5, 6);
    double c=random(-5, 6);
    double d=random(-5, 6);

    background(255);

    float x=-8f;
    float y=-16f;
    float dx=8f/400f;
    float dy=16f/400f;

    for (int yy=0; yy<800; yy++) {
      for (int xx=0; xx<800; xx++) {
        double s = x*(x+a)*(x+b)*(x+c)*(x+d)-y*y;
        if (s<0) {
          set(xx, yy, color(0));
        }
        x += dx;
      }
      x = -8f;
      y += dy;
    }

    text("a = "+nf((float)a, 0, 2), 10, 20);
    text("b = "+nf((float)b, 0, 2), 10, 40);
    text("c = "+nf((float)c, 0, 2), 10, 60);
    text("d = "+nf((float)d, 0, 2), 10, 80);
    saveFrame("frames/"+nf(num, 4)+".png");
    num++;
  }

  exit();
}

x(x+1)(x-3)(x+2)(x-2)-y^2をプロット,x=-3..4, y=-15..15
image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?