Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removing examples

  • Loading branch information...
commit 41f5c0ade37e2dae0ddeb3e7832efc34b70f10a7 1 parent c6e525a
Firman Wandayandi authored
View
68 docs/examples/Bisection.php
@@ -1,68 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * Bisection method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Math_Numerical_RootFinding class
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function fx($x)
-{
- return pow(M_E, -$x) - $x;
-}
-
-// Create new instance of Math_Numerical_RootFinding_Bisection.
-$mroot = Math_Numerical_RootFinding::factory('Bisection');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using Bisection's method.
-$root = $mroot->compute('fx', 0, 1);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::Bisection Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "f(x) = e<sup>-x</sup> - x<br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>Lower guest</b> = 0<br />\n";
-print "<b>Upper guest</b> = 1<br />\n";
-print "<b>True root</b> = 0,56714329...<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
View
68 docs/examples/FalsePosition.php
@@ -1,68 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * False Position method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Math_Numerical_RootFinding class
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function fx($x)
-{
- return pow(M_E, -$x) - $x;
-}
-
-// Create new instance of Math_Numerical_RootFinding_Falseposition.
-$mroot = Math_Numerical_RootFinding::factory('falseposition');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using False Position's method.
-$root = $mroot->compute('fx', 0, 1);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::False Position Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "f(x) = e<sup>-x</sup> - x<br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>First initial guest</b> = 0<br />\n";
-print "<b>Second initial guest</b> = 1<br />\n";
-print "<b>True root</b> = 0,56714329...<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
View
67 docs/examples/FixedPoint.php
@@ -1,67 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * Fixed Point method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Math_Numerical_RootFinding class.
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- */
-function gx($x)
-{
- return pow(M_E, -$x);
-}
-
-// Create new instance of Math_Numerical_RootFinding_Fixedpoint.
-$mroot = Math_Numerical_RootFinding::factory('fixedpoint');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using Fixed Point's method.
-$root = $mroot->compute('gx', 0);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::Fixed Point Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "f(x) = e<sup>-x</sup> - x<br />\n";
-print "g(x) = e<sup>-x</sup><br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>Initial guest</b> = 0<br />\n";
-print "<b>True root</b> = 0.56714329<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
View
81 docs/examples/Newton-Raphson.php
@@ -1,81 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * Newton-Raphson method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Require Math_Numerical_RootFinding class.
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function fx($x)
-{
- return pow(M_E, -$x) - $x;
-}
-
-/**
- * f'(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function dx($x)
-{
- return -pow(M_E, -$x) - 1;
-}
-
-// Create new instance of Math_Numerical_RootFinding_Newtonraphson.
-$mroot = Math_Numerical_RootFinding::factory('NewtonRaphson');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using Newton-Raphson's method.
-$root = $mroot->compute('fx', 'dx', 0);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::Newton-Raphson Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "f(x) = e<sup>-x</sup> - x<br />\n";
-print "f'(x) = -e<sup>-x</sup> - x<br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>Initial guest</b> = 0<br />\n";
-print "<b>True root</b> = 0,56714329...<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
View
93 docs/examples/Newton-Raphson2.php
@@ -1,93 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * Newton-Raphson 2 method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Math_Numerical_RootFinding class.
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function fx($x)
-{
- return pow($x, 3) - (5 * pow($x,2)) + (7 * $x) - 3;
-}
-
-/**
- * f'(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- */
-function d1x($x)
-{
- return 3 * pow($x, 2) - (10 * $x) + 7;
-}
-
-/**
- * f''(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- */
-function d2x($x)
-{
- return 6 * $x - 10;
-}
-
-// Create new instance of Math_Numerical_RootFinding_Newtonraphson2.
-$mroot = Math_Numerical_RootFinding::factory('NewtonRaphson2');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using Newton-Raphson 2 method.
-$root = $mroot->compute('fx', 'd1x', 'd2x', 0);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::Newton-Raphson 2 Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "f(x) = x<sup>3</sup> - 5x<sup>2</sup> + 7x - 3<br />\n";
-print "f'(x) = 3x<sup>2</sup> - 10x + 7<br />\n";
-print "f''(x) = 6x - 10<br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>Initial guest</b> = 0<br />\n";
-print "<b>True root</b> = 1<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
View
82 docs/examples/Ralston-Rabinowitz.php
@@ -1,82 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * Ralston and Rabinowitz method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Math_Numerical_RootFinding class
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function fx($x)
-{
- return pow($x, 3) - (5 * pow($x,2)) + (7 * $x) - 3;
-}
-
-/**
- * f'(x) callback function.
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function dx($x)
-{
- return 3 * pow($x, 2) - (10 * $x) + 7;
-}
-
-// Create new instance of Math_Numerical_RootFinding_Ralstonrabinowitz.
-$mroot = Math_Numerical_RootFinding::factory('RalstonRabinowitz');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using Ralston and Rabinowitz's method.
-$root = $mroot->compute('fx', 'dx', 0, 4);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::Ralston and Rabinowitz Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "f(x) = x<sup>3</sup> - 5x<sup>2</sup> + 7x - 3<br />\n";
-print "f'(x) = 3x<sup>2</sup> - 10x + 7<br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>First initial guest</b> (<u>\$xR0</u>) = 0<br />\n";
-print "<b>Second initial guest</b> (<u>\$xR1</u>) = 4<br />\n";
-print "<b>True root</b> = 1<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
View
69 docs/examples/Secant.php
@@ -1,69 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
-
-// $Id$
-
-/**
- * Secant method usage example.
- *
- * @author Firman Wandayandi <firman@php.net>
- * @package Math_Numerical_RootFinding
- * @subpackage Examples
- */
-
-/**
- * Math_Numerical_RootFinding class
- */
-require_once 'Math/Numerical/RootFinding.php';
-
-/**
- * f(x) callback function
- *
- * @param float $x Variable value.
- *
- * @return float
- * @ignore
- */
-function fx($x)
-{
- return pow(M_E, -$x) - $x;
-}
-
-// Create new instance of Math_Numerical_RootFinding_Secant.
-$mroot = Math_Numerical_RootFinding::factory('Secant');
-if (PEAR::isError($mroot)) {
- die($mroot->toString());
-}
-
-// Calculate the root using Secant's method.
-$root = $mroot->compute('fx', 0, 1);
-if (PEAR::isError($root)) {
- die($root->toString());
-}
-
-print "<h1>Root Finding::Secant Method</h1>\n";
-$mroot->infoCompute();
-
-print "<h2>Case</h2>\n";
-print "<b>Case:</b><br />\n";
-print "f(x) = e<sup>-x</sup> - x<br />\n";
-
-print "<h3>Parameters</h3>\n";
-print "<b>First initial guest</b> = 0<br />\n";
-print "<b>Second initial guest</b> = 1<br />\n";
-print "<b>True root</b> = 0,56714329...<br />\n";
-
-print "<h3>Result</h3>\n";
-print sprintf("<b>Iteration count</b> = %d<br />\n", $mroot->getIterationCount());
-print sprintf("<b>Root value</b> = %f<br />\n", $mroot->getRoot());
-print sprintf("<b>Estimate error</b> = %f<br />\n", $mroot->getEpsError());
-
-/*
- * Local variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
Please sign in to comment.
Something went wrong with that request. Please try again.