ç¹ç·ã§æ¥åãæãã»ãã®2
[追è¨] ãã®è¨äºã«ã¯èª¤ããå«ã¾ãã¦ãã¾ããè¨æ£ããè¨äºã¯こちらã§ãã
昨日ã®è¨äºã®ç¶ãã§ãã
æ¨æ¥ã¯è¨ç®å¼ã¾ã§ã¯åºããã®ã§ãããå®éã«è¨ç®ããã«ã¯ããããªãã£ãã®ã§ãã£ã¦ã¿ã¾ããã
Numpy ã¨ãããã®ã¯ç¥ã£ã¦ãã®ã§ãããæ¨æºã® Python ã ãã§ã©ãã¾ã§ã§ããããã£ã¦ã¿ã¾ããã
æç»ã¯ gnuplot 使ã£ã¦ãã£ã¦ã¾ãã
ã½ã¼ã¹ã³ã¼ã
ã¡ãã¡ãã£ã¨æ¸ããã®ã§ãã³ã¡ã³ãã¨ãã¯çãã¦ã¾ãã
import sys import math def delta(phi, du, k2): return phi + du / math.sqrt(1 - k2 * math.sin(phi)**2) def draw(argv=None): if not argv: argv = sys.argv filename = argv[1] a = float(argv[2]) b = float(argv[3]) du = float(argv[4]) k2 = 1 - (b/a)**2 phi = 0 with open(filename, 'w') as out_file: print >> out_file, '#x\ty' i = 0 while phi <= 2 * math.pi: i += 1 i %= 10 if i < 5: print >> out_file, '{0}\t{1}'.format(a * math.cos(phi), b * math.sin(phi)) else: print >> out_file, '' phi = delta(phi, du, k2) if __name__ == '__main__': draw(sys.argv)
ã³ãã³ã
$ python ellipse.py ellipse.dat 1.0 0.5 0.01
gnuplot> plot "ellipse.dat" w l
ãã¨ãã
æã£ããã誤差ãçºæ£ããªãã£ãã®ã§æ¥½ã§ããã
ä»æ¥ã°ã£ããã¯ä¿ºã£ã¦ããã¼ã£ã¦æãã¾ãã :P
ããã§ã¯ã