RootKTSMM

RootKTSMM finds a root of equation k(x)=0 , x in [x0,x1]. Fast, reliable, does not use derivative.

You are now following this Submission

function [Root Ze] = RootKTSMM(k,x0,x1,epsm)
k is a function on Matlab path
(eg sin or funk where funk is user-defined in an M-file)
finds root of k(x)=0
requires k(x0)*k(x1)<0
eps is optional: horizontal precision
returns: Root - the root of the equation k(x)=0, if ZE == true (=1)
or Root = 0 if ZE == false (=0)
Ze – is 1 if the algorithms finds zero of k of abs. value less than epsm
and if subsequent approximations of zero are less than 2*eps (where eps is the machine eps)
Ze – is zero otherwise, e.g. if k at both input initial values x0 and x1 has the same sign

Call function k via its handle @k
examples of a call:
[Root, Ze] = RootKTSMM(@sin,-0.1,0.1,1e-8);
[Root, Ze] = RootKTSMM(@(u) sin(u+pi/4),-pi/4-0.1,-pi/40.1,1e-8);

(Copyright 2010-2012 A. Kozek)
The algorithm is based on
Kozek, A. and Trzmielak-Stanislawska, A. (1989)
On a class of omnibus algorithms for zero-finding
Journal of Complexity, 5(1) pp. 80-95
and
Kozek, Andrzej S. and Trzmielak-Stanislawska, Anna (1988)
On dependence of {MR}- and {MM}-algorithms upon the value of
switching control variable {CTR}},
J. Comput. Appl. Math. 23(1) pp. 109-115

RootKTSMM.m replaces the old KTSRoot.m file

RootKTSMM.m implements directly the algorithm described in
Kozek, A. and Trzmielak-Stanislawska, A. (1989)
On a class of omnibus algorithms for zero-finding
Journal of Complexity, 5(1) pp. 80-95

KTSRoot.m was a 'translation' from an earlier Pascal version of the same algorithm.

====================================
Test m-function test1.m :

function u=test1()

x0=-1;
x1=0.09;
epsm = 1e-6;
[Root Ze] = RootKTSMM(@try4kts1,x0,x1,epsm);

o=1;

function v = try4kts1(x)
v = sign(x).*(sin(x)./x-1);

function v = try4kts2(x)
v = sin(x);

function v = try4kts3(x)
v = x.^3;

Cite As

Andrzej Kozek (2026). RootKTSMM (https://www.mathworks.com/matlabcentral/fileexchange/29253-rootktsmm), MATLAB Central File Exchange. Retrieved .

Categories

Find more on Linear Algebra in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

RootKTSMM finds a root of equation k(x)=0 , x in [x0,x1].
Fast, reliable and does not require derivative. Requires non-equal signs at the initial values x0 and x1. Switching in an optimal way between fast Brent’s algorithm and reliable bisection.

1.0.0.0