Parent Directory | Revision Log

Revision **2649** -
(**show annotations**)
(**download**)
(**as text**)

*Wed Dec 12 12:39:25 2012 UTC*
(11 years, 6 months ago)
by *jpye*

File MIME type: text/x-ascend

File size: 1200 byte(s)

File MIME type: text/x-ascend

File size: 1200 byte(s)

Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)

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, see <http://www.gnu.org/licenses/>. |

16 | *) |

17 | REQUIRE "system.a4l"; |

18 | (* |

19 | Numeric root finding example, 5th order polynomial. |

20 | |

21 | This model is the first example in "Solved simple models with ASCEND" |

22 | @TODO citation needed |

23 | |

24 | by Arthur Westerberg, 1997 |

25 | *) |

26 | |

27 | MODEL roots_of_poly; |

28 | x IS_A generic_real; |

29 | (x-1)*(x-5)*(x+7)*(x^2+1) = 0; |

30 | |

31 | METHODS |

32 | (* test-case checks convergence to just one of these roots *) |

33 | METHOD on_load; |

34 | x := 7.0001; |

35 | END on_load; |

36 | |

37 | METHOD self_test; |

38 | ASSERT (x - 1.0) < 1e-5; |

39 | END self_test; |

40 | END roots_of_poly; |

41 | (* :ex: set ts=4: *) |

john.pye@anu.edu.au | ViewVC Help |

Powered by ViewVC 1.1.22 |