Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e735e53
tests on DAE sensitivities
Apr 23, 2026
a7dbc41
Added explicit Euler solutions in DAE examples and function explicitE…
Apr 23, 2026
a1ec8fe
Changes in daeExample_main.m
Apr 23, 2026
363337c
more work on sensitivities for DAEs
May 4, 2026
708022c
more tests on DAE sensitivities
May 12, 2026
879ab83
Reworked DAE example with non-linear constraint
May 27, 2026
bb766d6
Reworked DAE example with non-linear constraint
May 27, 2026
065b2fb
restructured folders for DAE examples
May 28, 2026
ee4bf5d
rename in bounceball example and canonical example
May 28, 2026
b55cd3d
rename in bounceball
May 28, 2026
d90fa9c
rename in coulomb example and dae Examples, added comments in explici…
May 28, 2026
5db58dc
rename in White Cabbage and Predator Prey Filippov
May 28, 2026
989b786
Refactor bounceball and predatorprey
Jun 9, 2026
cb44b5a
removed funfun from examples (already integrated in testsuite)
Jun 9, 2026
55ca65e
refactored spiral, sign
Jun 9, 2026
78bd17d
refactor statejump, subway; removed func2str from datahandle call
Jun 9, 2026
2fd8857
more work for example rename
Aug 20, 2026
3c2df5f
Added CI computation for WhiteCabbage and further rename in Live Exam…
Aug 27, 2026
da9e255
Rename in live examples and respective helpers; changes in state jump…
Aug 30, 2026
50cea57
changed comment in computeCI
Aug 31, 2026
1fbf5e0
Renames in helpers for CI computation
Aug 31, 2026
8fcee98
Rename in Live Scripts and respective helpers
Sep 7, 2026
ed55869
Modified generateSensitivityFunction calls with new FDStep syntax (op…
Sep 7, 2026
d73cbc6
set seed in runCabbage.m
Sep 14, 2026
0d707ad
minor running time related changes in computeCI.m
Sep 14, 2026
1ab2a9a
Changed name for analytical solution of Canonical Examples; namechang…
Sep 14, 2026
e34fe0f
Made sensitivity plots for white cabbage example pretty and fast. One…
Sep 21, 2026
d085d88
Removed unecessary files for pull request
Aug 24, 2026
48f3bb3
Renamed files to fit new naming scheme by Pilar
Aug 31, 2026
e71674d
rename in White Cabbage and Predator Prey Filippov
May 28, 2026
ce25f46
more work for example rename
Aug 20, 2026
19a2fa5
Refactor computeCI and tInv for confidence intervals in runCabbage
Sep 21, 2026
982412d
Rebased new sensitivities plot onto local; removed func2str in dataha…
Sep 21, 2026
ae481bc
Discussed changes in computeCI and tInv
Sep 21, 2026
c0c428b
Removed unecessary files for pull request
Aug 24, 2026
abb4234
Changed linestyle and thickness in sensitivity plot for pprEx
Aug 24, 2026
5fa92b2
Small change in plot
Aug 31, 2026
2a4db56
Renamed files to fit new naming scheme by Pilar
Aug 31, 2026
ed7ba48
rename in White Cabbage and Predator Prey Filippov
May 28, 2026
d3a50a5
Changed linestyle and thickness in sensitivity plot for pprEx
Aug 24, 2026
b18a160
Renamed files to fit new naming scheme by Pilar
Aug 31, 2026
5946fa3
rename in White Cabbage and Predator Prey Filippov
May 28, 2026
96a438e
Change in runPredatorPrey script
Sep 21, 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