/[ascend]/trunk/models/testfunc.a4c
ViewVC logotype

Contents of /trunk/models/testfunc.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 832 - (show annotations) (download) (as text)
Wed Aug 23 07:06:47 2006 UTC (13 years, 5 months ago) by johnpye
File MIME type: text/x-ascend
File size: 2749 byte(s)
Renamed testTrig to testfunc.a4c.
Removed some buildtime messages.
Added self-test to testfunc model.
Some windows-specific changes to SConstruct (need testing?)
1 REQUIRE "atoms.a4l";
2
3 MODEL testfunc;
4 (* dependent variables *)
5 yArccosh,yArcsinh,yArctanh,
6 yCos,yCosh,
7 yExp,yLn,yLnm,
8 ySin,ySinh,
9 yTan,yTanh IS_A factor;
10
11 yArcsin,yArccos,
12 yArctan IS_A angle;
13
14 (* fixed variables *)
15 xArccos,xArccosh,
16 xArcsin,xArcsinh,
17 xArctan,xArctanh,
18 xCosh,
19 xExp,xLn,xLnm,
20 xSinh,
21 xTanh IS_A factor;
22
23 xCos,xSin,
24 xTan IS_A angle;
25
26 (* equations *)
27 arccosEqn: yArccos = arccos(xArccos);
28 arccoshEqn: yArccosh = arccosh(xArccosh);
29 arcsinEqn: yArcsin = arcsin(xArcsin);
30 arcsinhEqn: yArcsinh = arcsinh(xArcsinh);
31 arctanEqn: yArctan = arctan(xArctan);
32 arctanhEqn: yArctanh = arctanh(xArctanh);
33 cosEqn: yCos = cos(xCos);
34 coshEqn: yCosh = cosh(xCosh);
35 expEqn: yExp = exp(xExp);
36 lnEqn: yLn = ln(xLn);
37 lnmEqn: yLnm = lnm(xLnm);
38 sinEqn: ySin = sin(xSin);
39 sinhEqn: ySinh = sinh(xSinh);
40 tanEqn: yTan = tan(xTan);
41 tanhEqn: yTanh = tanh(xTanh);
42
43 METHODS
44
45 METHOD default_self;
46 END default_self;
47
48 METHOD specify;
49 FIX xExp,xLn;
50 FIX xSin,xCos,xTan;
51 FIX xArcsin,xArccos,xArctan;
52 FIX xSinh,xCosh,xTanh;
53 FIX xArccosh,xArcsinh,xArctanh;
54 FIX xLnm;
55 END specify;
56
57 METHOD on_load;
58 RUN default_self;
59 RUN reset;
60 RUN values;
61 END on_load;
62
63 METHOD self_test;
64 ASSERT abs(yArctan - 1.1441688{rad}) < 1.0e-7{rad};
65 ASSERT abs(yArctanh - 0.1205810) < 1.0e-7;
66 END self_test;
67
68 METHOD values;
69 xArccos := 0.10; (* magnitude must not exceed 1.0 *)
70 xArccosh := 2.0; (* value must be 1.0 or greater *)
71 xArcsin := 0.11; (* magnitude must not exceed 1.0 *)
72 xArcsinh := 2.1;
73 xArctan := 2.2;
74 xArctanh := 0.12; (* magnitude must not exceed 1.0 *)
75 xCos := 0.13 {radian};
76 xCosh := 0.14;
77 xExp := 0.15;
78 xLn := 0.16; (* value must be greater than 0 *)
79 xLnm := 0.16;
80 xSin := 0.17 {radian};
81 xSinh := 0.18;
82 xTan := 0.19 {radian};
83 xTanh := 0.2;
84 END values;
85
86
87 (* set up to recover original x values. Note mapping
88 after solving. *)
89
90 METHOD valuesRecover;
91 xArccos := yCos; (* yArccos becomes xCos orig value *)
92 xArccosh := yCosh; (* yArccosh becomes xCosh orig value *)
93 xArcsin := ySin; (* etc *)
94 xArcsinh := ySinh;
95 xArctan := yTan;
96 xArctanh := yTanh;
97 xCos := yArccos;
98 xCosh := yArccosh;
99 xExp := yLn;
100 xLn := yExp;
101 xLnm := yExp;
102 xSin := yArcsin;
103 xSinh := yArcsinh;
104 xTan := yArctan;
105 xTanh := yArctanh;
106 END valuesRecover;
107
108 END testfunc;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22