Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2071 zjchen 1
!goto $wims_read_parm
2
 
3
:def
4
title=Triangle with given sides
5
synonyme=triangle with sides
6
input=triangsides
7
!exit
8
 
9
:proc
10
!distribute item $[-0.1*$s3],$[1.1*$s3],$[-0.2*$s3],$s3\
11
	into X1, X2, Y1, Y2
12
pari_precision=20
13
result=!exec pari s1=$S1;s2=$S2;s3=$S3; x=0.5*(s3^2+s2^2-s1^2)/s3;print(x);\
14
	y=sqrt(s2^2-x^2);print(y);\
15
	area=0.5*s3*y;print(area);\
16
	r1=atan(y/x);print(r1);\
17
	r2=atan(y/(s3-x));print(r2);\
18
	r3=pi-r1-r2;print(r3);\
19
	d1=r1*180/pi;print(d1);\
20
	d2=r2*180/pi;print(d2);\
21
	d3=r3*180/pi;print(d3);\
22
	h1=area/s1*2;print(h1);\
23
	h2=area/s2*2;print(h2);\
24
	h3=area/s3*2;print(h3);\
25
	ri=2*area/(s1+s2+s3);print(ri);\
26
	rc=(s1*s2*s3)/(4*area);print(rc);
27
!distribute lines $result into x,y,area,r1,r2,r3,d1,d2,d3,h1,h2,h3,ri,rc
28
result=$x,$y
29
insdraw_size=200,200
30
!exit
31
 
32
:output
33
Triangle with 3 sides
34
!htmlmath $formula
35
 :
36
<br><center>
37
!insdraw xrange $X1,$X2\
38
yrange $Y1,$Y2\
39
linewidth 2\
40
polygon blue,0,0,$s3,0,$x,$y\
41
fcircle 0,0,6,red\
42
fcircle $s3,0,6,red\
43
fcircle $x,$y,6,red\
44
text black,$s3*0.4,-0.05*$s3,small,$s3\
45
text black,0.55*$x,0.5*$y,small,$s2\
46
text black,0.53*($s3+$x),0.6*$y,small,$s1\
47
text red,-0.08*$s3,0,small,A\
48
text red,1.05*$s3,0,small,C\
49
text red,$x+0.05*$s3,$y+0.08*$s3,small,B
50
 
51
</center> <br>
52
Area = $[$area]<br>
53
Angle A = $[$d1]&deg; = $[$r1] radians<br>
54
Angle B = $[$d3]&deg; = $[$r3] radians<br>
55
Angle C = $[$d2]&deg; = $[$r2] radians<br>
56
Altitude to side AB = $[$h2]<br>
57
Altitude to side BC = $[$h1]<br>
58
Altitude to side AC = $[$h3]<br>
59
Incircle radius = $[$ri]<br>
60
Circumcircle radius = $[$rc]
61
!exit
62