From a97ba371f257ffcb29467142d00c59c4fe7205df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Thu, 23 Dec 2021 22:52:31 +0100 Subject: more trigo stuff --- buch/chapters/030-geometrie/trigo/1.m | 33 +++++++++++++++++++++++++++++++++ buch/chapters/030-geometrie/trigo/3.m | 13 +++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 buch/chapters/030-geometrie/trigo/1.m create mode 100644 buch/chapters/030-geometrie/trigo/3.m (limited to 'buch/chapters/030-geometrie/trigo') diff --git a/buch/chapters/030-geometrie/trigo/1.m b/buch/chapters/030-geometrie/trigo/1.m new file mode 100644 index 0000000..3eea249 --- /dev/null +++ b/buch/chapters/030-geometrie/trigo/1.m @@ -0,0 +1,33 @@ +# +# 1.m +# +# +n = 10; +format long; + +function retval = snewtonstep(x, s) + corr = (-4*x*x*x+3*x-s) / (-12*x*x + 3); + retval = x - corr; +end + +function retval = cnewtonstep(x, c) + corr = (4*x*x*x-3*x-c) / (12*x*x - 3); + retval = x - corr; +end + +s0 = pi / 180; + +s3 = sind(3) +c3 = cosd(3) + +r = zeros(n+1,2) +r(1,1) = pi / 180; +r(1,2) = sqrt(1-r(1,1)^2); + +for i = (1:n) + r(i+1,1) = snewtonstep(r(i,1), s3); + r(i+1,2) = cnewtonstep(r(i,2), c3); +endfor + +r + diff --git a/buch/chapters/030-geometrie/trigo/3.m b/buch/chapters/030-geometrie/trigo/3.m new file mode 100644 index 0000000..a1f8ed1 --- /dev/null +++ b/buch/chapters/030-geometrie/trigo/3.m @@ -0,0 +1,13 @@ +format long + +s15 = sqrt((2-sqrt(3))/4) +c15 = sqrt((2+sqrt(3))/4) + +s36 = sqrt((5-sqrt(5))/8) +c36 = sqrt((3+sqrt(5))/8) + +s18 = sqrt(1/2-c36/2) +c18 = sqrt(1/2+c36/2) + +s3 = s18 * c15 - c18 * s15 +c3 = c18 * c15 + s18 * s15 -- cgit v1.2.1