Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
499b84c
tests on DAE sensitivities
Apr 23, 2026
022961c
Added explicit Euler solutions in DAE examples and function explicitE…
Apr 23, 2026
cce1727
Changes in daeExample_main.m
Apr 23, 2026
93b1bdb
more work on sensitivities for DAEs
May 4, 2026
fee1c43
more tests on DAE sensitivities
May 12, 2026
35e773b
Reworked DAE example with non-linear constraint
May 27, 2026
ef3d236
Reworked DAE example with non-linear constraint
May 27, 2026
e9ef514
restructured folders for DAE examples
May 28, 2026
53b0b0c
rename in bounceball example and canonical example
May 28, 2026
9811d4b
rename in bounceball
May 28, 2026
9583453
rename in coulomb example and dae Examples, added comments in explici…
May 28, 2026
20eb956
rename in White Cabbage and Predator Prey Filippov
May 28, 2026
645a3c5
Refactor bounceball and predatorprey
Jun 9, 2026
f324f7d
removed funfun from examples (already integrated in testsuite)
Jun 9, 2026
085f1d2
refactored spiral, sign
Jun 9, 2026
4cd24c3
refactor statejump, subway; removed func2str from datahandle call
Jun 9, 2026
60a6498
more work for example rename
Aug 20, 2026
412e21a
Added CI computation for WhiteCabbage and further rename in Live Exam…
Aug 27, 2026
d10e6bd
Rename in live examples and respective helpers; changes in state jump…
Aug 30, 2026
95cace9
changed comment in computeCI
Aug 31, 2026
56ad5ce
Renames in helpers for CI computation
Aug 31, 2026
b6cd1ae
hotfix sensitivity computation
Aug 31, 2026
f8cc373
integrated step size fix in FDstep computation from public
Sep 2, 2026
6b665fd
Rename in Live Scripts and respective helpers
Sep 7, 2026
ecbb632
Modified generateSensitivityFunction calls with new FDStep syntax (op…
Sep 7, 2026
dbdeae9
set seed in runCabbage.m
Sep 14, 2026
74cd597
minor running time related changes in computeCI.m
Sep 14, 2026
c50abf7
Changed name for analytical solution of Canonical Examples; namechang…
Sep 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/TestHelperFunctions.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function helperFunctionInElseBlock(this)

datahandle = prepareDatahandleForIntegration( ...
'funinelse_RHS', ...
'integrator', func2str(integrator), ...
'integrator', integrator, ...
'options', odeoptions);
tEnd = 20;
tspan = [0 tEnd];
Expand All @@ -44,7 +44,7 @@ function manyFunctions(this)

datahandle = prepareDatahandleForIntegration( ...
'manyFunctions', ...
'integrator', func2str(integrator), ...
'integrator', integrator, ...
'options', odeoptions);
tEnd = 30;
tspan = [0 tEnd];
Expand Down
12 changes: 6 additions & 6 deletions tests/TestIgnore.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function testIgnoreSimple(testCase)
p = 0;

datahandle = prepareDatahandleForIntegration('simpleIgnoreRHS', ...
'solver', func2str(solver), ...
'solver', solver, ...
'options', options);
data = datahandle.getData();
% ensure only one of the two ifs got turned into a ctrlif
Expand All @@ -42,7 +42,7 @@ function testIgnoreNested(testCase)
p = 0;

datahandle = prepareDatahandleForIntegration('nestedIgnoreRHS', ...
'solver', func2str(solver), ...
'solver', solver, ...
'options', options);
data = datahandle.getData();
% ensure only one of the two ifs got turned into a ctrlif
Expand All @@ -63,7 +63,7 @@ function testIgnoredIfInNonIgnoredIf(testCase)
p = 0;

datahandle = prepareDatahandleForIntegration('ignoredIfInNonIgnoredIfRHS', ...
'solver', func2str(solver), ...
'solver', solver, ...
'options', options);
data = datahandle.getData();
% ensure only the outer if got turned into a ctrlif
Expand All @@ -84,7 +84,7 @@ function testIgnoredIfInHelper(testCase)
p = 0;

datahandle = prepareDatahandleForIntegration('ignoreInHelperRHS', ...
'solver', func2str(solver), ...
'solver', solver, ...
'options', options);
data = datahandle.getData();
% ensure only one of the two ifs got turned into a ctrlif
Expand All @@ -108,7 +108,7 @@ function testHelperInIgnore(testCase)
p = 0;

datahandle = prepareDatahandleForIntegration('helperInIgnoreRHS', ...
'solver', func2str(solver), ...
'solver', solver, ...
'options', options);
data = datahandle.getData();

Expand All @@ -131,7 +131,7 @@ function testIgnoreAndNotIgnore(testCase)
p = 0;

datahandle = prepareDatahandleForIntegration('ignoreAndNotIgnoreRHS', ...
'solver', func2str(solver), ...
'solver', solver, ...
'options', options);
data = datahandle.getData();

Expand Down
12 changes: 6 additions & 6 deletions tests/TestSensitivities.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
function testCanonexDirectional(testCase, method)
[integrator, options, t0, tEnd, p, x0] = getOdeDataForCanonex(testCase);
datahandle = prepareDatahandleForIntegration( ...
'canonicalExampleRHS', ...
'solver', func2str(integrator), ...
'rhsCanonicalExample', ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);

Expand All @@ -34,8 +34,8 @@ function testCanonexVde(testCase)
% Test the sensitivities generated with the VDE method on the canonical example.
[integrator, options, t0, tEnd, p, x0] = getOdeDataForCanonex(testCase);
datahandle = prepareDatahandleForIntegration( ...
'canonicalExampleRHS', ...
'solver', func2str(integrator), ...
'rhsCanonicalExample', ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);

Expand Down Expand Up @@ -80,7 +80,7 @@ function testCanonexEndPiecewise(testCase)
% Test the sensitivities generated with the END_piecewise method on the canonical example.
[integrator, options, t0, tEnd, p, x0] = getOdeDataForCanonex(testCase);
datahandle = prepareDatahandleForIntegration( ...
'canonicalExampleRHS', ...
'rhsCanonicalExample', ...
'solver', func2str(integrator), ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);
Expand Down Expand Up @@ -129,7 +129,7 @@ function testCanonexEndFull(testCase)
% instead of ts+eps(ts).
[integrator, options, t0, tEnd, p, x0] = getOdeDataForCanonex(testCase);
datahandle = prepareDatahandleForIntegration( ...
'canonicalExampleRHS', ...
'rhsCanonicalExample', ...
'solver', func2str(integrator), ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);
Expand Down
20 changes: 10 additions & 10 deletions tests/TestSolverCompatibility.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ function setTimer(testCase)
canonex_tspan = [0 20];
canonex_x0 = [1;0];
canonex_p = 5.437;
canonex_rhsFunction = 'canonicalExampleRHS';
canonex_rhsFunction = 'rhsCanonicalExample';
canonex_odeoptions = odeset('AbsTol', 1e-12, 'RelTol', 1e-10);
canonex_xEnd = [49.255067; 1.348824];
canonex_SWPs = [11.000275475 11.27004032];

subway_tspan = [0 65];
subway_x0 = [0; 0; 0];
% subway_p initialized later because we need to initIFDIFF() before
subway_rhsFunction = 'newYorkCitySubwayModelRhs';
subway_rhsFunction = 'rhsNewYorkCitySubwayModel.m';
subway_odeoptions = odeset( 'AbsTol', 1e-20, 'RelTol', 1e-10);
subway_xEnd = [2112.07361577; 0.00124794; 4124.77885608];
subway_SWPs = [0.63166061, 2.43955402, 3.64338000, 5.60010643, 12.60705000, 45.78275000, 57.16005000];

% DAE example: input parameters and expected results
dae_tspan = [0 5];
dae_tspan = [0 3];
dae_p = -0.3
dae_x0 = [1; -1];
dae_p = -0.2
dae_rhsFunction = 'daeExampleRHS';
dae_odeoptions = odeset('Mass', [1 0; 0 0], 'MassSingular', 'yes', 'AbsTol', 1e-9,'RelTol', 1e-6);
dae_xEnd = [0.199999951200446; -0.199999951200446]
dae_SWPs = [1.609435443361949];
dae_rhsFunction = 'rhsDaeExampleWorkshop';
dae_odeoptions = odeset('Mass', [1 0; 0 0], 'MassSingular', 'yes', 'AbsTol', 1e-9,'RelTol', 1e-5);
dae_xEnd = [0.427392826365841; -0.299999535808094]
dae_SWPs = [1.068023313185268];

end
properties (Access = private)
Expand Down Expand Up @@ -185,8 +185,8 @@ function testOde23tDAE(testCase)

% lower tolerance since ode23t is an order 2 method
% (uses trapezoidal rule)
testCase.verifyEqual(sol.y(:, end), testCase.expected_xEnd, "RelTol", 1e-5);
testCase.verifyEqual(sol.switches, testCase.expected_SWPs, "RelTol", 1e-4);
testCase.verifyEqual(sol.y(:, end), testCase.expected_xEnd, "RelTol", 1e-3);
testCase.verifyEqual(sol.switches, testCase.expected_SWPs, "RelTol", 1e-3);
end
function testOde23tbCanonex(testCase)
setCanonexParameters(testCase);
Expand Down
40 changes: 20 additions & 20 deletions tests/TestStateJumps.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function testIdenticalIfs(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'identicalIfRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
t0 = 0;
tEnd = 3;
Expand Down Expand Up @@ -57,7 +57,7 @@ function testTwoJumpsOppositeDirections(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'twoJumpsGoodRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
t0 = 0;
tEnd = 4.1; % switches at tEnd exactly unfortunately aren't handled too gracefully
Expand Down Expand Up @@ -88,7 +88,7 @@ function testTwoJumpsSameDirection(testCase)

datahandle = prepareDatahandleForIntegration( ...
'twoJumpsBadRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);

testCase.verifyError(@() solveODE(datahandle, [t0 tF], x0, p), '');
Expand All @@ -100,7 +100,7 @@ function testJumpChangesModel(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'jumpChangesModelRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
t0 = 0;
tEnd = 4;
Expand All @@ -118,7 +118,7 @@ function testJumpInHelper(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'jumpInHelperRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
t0 = 0;
tEnd = 25;
Expand Down Expand Up @@ -146,7 +146,7 @@ function testJumpInHelperWithJumpsDisabled(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'jumpInHelperRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
t0 = 0;
tEnd = 25;
Expand All @@ -171,8 +171,8 @@ function testBounceball(testCase)
integrator = TestStateJumps.defaultIntegrator;
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'bounceballRHS', ...
'solver', func2str(integrator), ...
'rhsBounceball', ...
'solver', integrator, ...
'options', options);
g = 9.807;
gamma = 0.9;
Expand Down Expand Up @@ -230,7 +230,7 @@ function testTwoUpdates(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'twoUpdatesRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [0 7], 0, 0);
testCase.verifyEqual(length(sol.switches), 2);
Expand All @@ -241,13 +241,13 @@ function testTwoUpdates(testCase)

end
function testSensitivitiesSimpleVDE(testCase)
% Test sensitivity computation across jumps using the simple, one-dimensional jumpSensitivityRHS.
% Test sensitivity computation across jumps using the simple, one-dimensional rhsJumpSensitivity.
integrator = TestStateJumps.defaultIntegrator;
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
[t0, tEnd, p, x0] = jumpSensitivityInitdata();
datahandle = prepareDatahandleForIntegration( ...
'jumpSensitivityRHS', ...
'solver', func2str(integrator), ...
'rhsJumpSensitivity', ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);
testCase.verifyEqual(length(sol.switches), 1);
Expand Down Expand Up @@ -277,13 +277,13 @@ function testSensitivitiesSimpleVDE(testCase)
testCase.verifyEqual(Gp{4}, Gy2(tEnd) * (Uy1 * Gp1(t1Minus) + Up1) + Gp2(tEnd), 'RelTol', rtol2);
end
function testSensitivitiesSimpleEND_piecewise(testCase)
% Test sensitivity computation across jumps using the simple, one-dimensional jumpSensitivityRHS.
% Test sensitivity computation across jumps using the simple, one-dimensional rhsJumpSensitivity.
integrator = TestStateJumps.defaultIntegrator;
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
[t0, tEnd, p, x0] = jumpSensitivityInitdata();
datahandle = prepareDatahandleForIntegration( ...
'jumpSensitivityRHS', ...
'solver', func2str(integrator), ...
'rhsJumpSensitivity', ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);
testCase.verifyEqual(length(sol.switches), 1);
Expand Down Expand Up @@ -314,13 +314,13 @@ function testSensitivitiesSimpleEND_piecewise(testCase)
testCase.verifyEqual(Gp{4}, Gy2(tEnd) * (Uy1 * Gp1(t1Minus) + Up1) + Gp2(tEnd), 'RelTol', rtol2);
end
function testSensitivitiesSimpleEND_full(testCase)
% Test sensitivity computation across jumps using the simple, one-dimensional jumpSensitivityRHS.
% Test sensitivity computation across jumps using the simple, one-dimensional rhsJumpSensitivity.
integrator = TestStateJumps.defaultIntegrator;
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
[t0, tEnd, p, x0] = jumpSensitivityInitdata();
datahandle = prepareDatahandleForIntegration( ...
'jumpSensitivityRHS', ...
'solver', func2str(integrator), ...
'rhsJumpSensitivity', ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [t0 tEnd], x0, p);
testCase.verifyEqual(length(sol.switches), 1);
Expand Down Expand Up @@ -367,7 +367,7 @@ function testHelperInJump(testCase)

datahandle = prepareDatahandleForIntegration( ...
'helperInJumpRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
sol = solveODE(datahandle, [t0 tF], x0, p);

Expand All @@ -386,7 +386,7 @@ function testHelperInJumpInHelper(testCase)
options = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration( ...
'helperInJumpInHelperRHS', ...
'solver', func2str(integrator), ...
'solver', integrator, ...
'options', options);
t0 = 0;
tEnd = 3;
Expand Down
28 changes: 0 additions & 28 deletions toolbox/examples/bounceball/bounceball_rhs.m

This file was deleted.

36 changes: 0 additions & 36 deletions toolbox/examples/bounceball/bounceball_test.m

This file was deleted.

Loading