18 lines
279 B
Mathematica
18 lines
279 B
Mathematica
|
|
%*** BASIC HELPER FUNCTIONS ***
|
||
|
|
|
||
|
|
function judge = NearZero(near)
|
||
|
|
% Takes a scalar.
|
||
|
|
% Checks if the scalar is small enough to be neglected.
|
||
|
|
% Example Input:
|
||
|
|
%{
|
||
|
|
clear; clc;
|
||
|
|
near = -1e-7;
|
||
|
|
judge = NearZero(near)
|
||
|
|
%}
|
||
|
|
% Output:
|
||
|
|
% judge =
|
||
|
|
% 1
|
||
|
|
|
||
|
|
judge = norm(near) < 1e-6;
|
||
|
|
end
|