You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log(`Root not found (maximum iterations reached).\nRange: (${min}, ${max}).`);
99
+
100
+
console.log(`Remember, this algorithm will only work if:\n\t#1: The root is within the range.\n\t#2: The function changes sign once within the interval.`);
101
+
102
+
return[min,max];
103
+
}
104
+
105
+
/**
106
+
* Just testing if everything generally works.
107
+
* This is not an in-depth test (does not test all error scenarios).
108
+
*/
109
+
exportfunctiontestBisectionFunction()
110
+
{
111
+
console.log(`TESTING BISECTION FUNCTION!\n`);
112
+
113
+
/** Test linear function: (2x -19). */
114
+
constlinFunc=(x: number)=>{return2*x-19;}
115
+
116
+
/** Test linear function in string format. */
117
+
constlinFuncString='2*x-19';
118
+
119
+
/** Test polynomial function: (x^2 + x - 5). */
120
+
constpolyFunc=(x: number)=>{returnx**2+x-5;}
121
+
122
+
/** First test trigonometric function: sin(1/x). */
console.log(`Root not found (maximum iterations reached).\nRange: (${min}, ${max}).`);
99
-
100
-
console.log(`Remember, this algorithm will only work if:\n\t#1: The root is within the range.\n\t#2: The function changes sign once within the interval.`);
101
-
102
-
return[min,max];
103
-
}
104
-
105
-
/**
106
-
* Just testing if everything generally works.
107
-
* This is not an in-depth test (does not test all error scenarios).
108
-
*/
109
-
functiontestBisectionFunction()
110
-
{
111
-
console.log(`TESTING BISECTION FUNCTION!\n`);
112
-
113
-
/** Test linear function: (2x -19). */
114
-
constlinFunc=(x: number)=>{return2*x-19;}
115
-
116
-
/** Test linear function in string format. */
117
-
constlinFuncString='2*x-19';
118
-
119
-
/** Test polynomial function: (x^2 + x - 5). */
120
-
constpolyFunc=(x: number)=>{returnx**2+x-5;}
121
-
122
-
/** First test trigonometric function: sin(1/x). */
0 commit comments