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

Contents of /trunk/models/roots_of_poly.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1155 - (show annotations) (download) (as text)
Tue Jan 16 11:33:52 2007 UTC (13 years ago) by johnpye
File MIME type: text/x-ascend
File size: 1246 byte(s)
More tidying up of old models. Will add roots_of_poly to the list.
1 (* ASCEND modelling environment
2 Copyright (C) 2006 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *)
19 REQUIRE "system.a4l";
20 (*
21 Numeric root finding example, 5th order polynomial.
22
23 This model is the first example in "Solved simple models with ASCEND"
24 @TODO citation needed
25
26 by Arthur Westerberg, 1997
27 *)
28
29 MODEL roots_of_poly;
30 x IS_A generic_real;
31 (x-1)*(x-5)*(x+7)*(x^2+1) = 0;
32
33 METHODS
34 (* test-case checks convergence to just one of these roots *)
35 METHOD on_load;
36 x := 7.0001;
37 END on_load;
38
39 METHOD self_test;
40 ASSERT (x - 1.0) < 1e-5;
41 END self_test;
42 END roots_of_poly;

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