| 
									
										
										
										
											2007-06-12 10:39:47 +00:00
										 |  |  | ================================================================ | 
					
						
							|  |  |  | Logtalk - Open source object-oriented logic programming language | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | Release 2.30.7 | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-01-10 12:46:10 +00:00
										 |  |  | Copyright (c) 1998-2007 Paulo Moura.  All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2007-06-12 10:39:47 +00:00
										 |  |  | ================================================================ | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | % start by loading the loading the example: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | | ?- logtalk_load(functions(loader)). | 
					
						
							|  |  |  | ... | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | % find the roots of some functions using each one of provided methods: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- bisection::find_root(f1, 1.0, 2.3, 1.0e-15, Zero). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 2.0 | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- newton::find_root(f1, 1.0, 2.3, 1.0e-15, Zero). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 2.0 | 
					
						
							|  |  |  | yes | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- muller::find_root(f1, 1.0, 2.3, 1.0e-15, Zero). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 2.0 | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- bisection::find_root(f2, 1.0, 1.3, 1.0e-15, Zero). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 1.25809265664599 | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- newton::find_root(f2, 1.0, 1.3, 1.0e-15, Zero). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 1.25809265664599 | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- muller::find_root(f2, 1.0, 1.3, 1.0e-15, Zero). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 1.25809265664599 | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | % find the roots of some functions running all methods at once using multi-threading: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- function_root::find_root(f1, 1.0, 2.3, 1.0e-15, Zero, Method). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 2.0 | 
					
						
							|  |  |  | Method = bisection  | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- function_root::find_root(f2, 1.0, 1.3, 1.0e-15, Zero, Method). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 1.25809265664599 | 
					
						
							|  |  |  | Method = newton  | 
					
						
							|  |  |  | yes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | | ?- function_root::find_root(f3, 0.0, 3.0, 1.0e-15, Zero, Method). | 
					
						
							| 
									
										
										
										
											2006-11-07 18:47:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | Zero = 1.4142135623731 | 
					
						
							|  |  |  | Method = newton  | 
					
						
							|  |  |  | yes | 
					
						
							| 
									
										
										
										
											2007-11-06 01:50:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | | ?- function_root::find_root(f4, -1.0, 2.0, 1.0e-15, Zero, Method). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Zero = -8.88178419700125e-16 | 
					
						
							|  |  |  | Method = bisection  | 
					
						
							|  |  |  | yes |