aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/030-geometrie/trigo/1.m
blob: 3eea249ae4802aee12b639914f353b1ff3c82799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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