Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation for @sym/heaviside.m #1102

Merged
merged 2 commits into from
Apr 9, 2022
Merged
Changes from all commits
Commits
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
36 changes: 22 additions & 14 deletions inst/@sym/heaviside.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%% Copyright (C) 2014-2016, 2018-2019 Colin B. Macdonald
%% Copyright (C) 2022 Chris Gorman
%%
%% This file is part of OctSymPy.
%%
Expand Down Expand Up @@ -32,34 +33,41 @@
%% @end group
%% @end example
%%
%% By default, the value at zero is undefined:
%% There are various conventions for 'heaviside(sym(0))'; this function
%% returns the midpoint by default.
%% @example
%% @group
%% @c doctest: +SKIP_UNLESS(pycall_sympy__ ('return Version(spver) > Version("1.4")'))
%% @c doctest: +SKIP_UNLESS(pycall_sympy__ ('return Version(spver) > Version("1.8")'))
%% heaviside(sym(0))
%% @result{} (sym) θ(0)
%% @result{} (sym) 1/2
%% @end group
%% @end example
%% This behaviour is different from the double-precision function:
%%
%% The optional second argument overrides the default. For example
%% to make the function right-continuous,
%% @example
%% @group
%% @c doctest: +SKIP_IF(compare_versions (OCTAVE_VERSION(), '6.0.0', '<'))
%% heaviside(0)
%% @result{} 0.5000
%% heaviside(0, sym(1))
%% @result{} (sym) 1
%% @end group
%% @end example
%% (@pxref{heaviside})
%%
%% The optional second argument overrides the default:
%% or left-continuous.
%% @example
%% @group
%% heaviside(0, sym(1)/2)
%% @result{} (sym) 1/2
%% heaviside(0, [0 sym(1)/2 10])
%% @result{} (sym) [0 1/2 10] (1×3 matrix)
%% heaviside(0, sym(0))
%% @result{} (sym) 0
%% @end group
%% @end example
%%
%% If passed a matrix, the heaviside function is computed for each
%% element.
%% @example
%% @group
%% @c doctest: +SKIP_UNLESS(pycall_sympy__ ('return Version(spver) > Version("1.8")'))
%% heaviside([sym(-1) sym(0) sym(1) sym(x)])
%% @result{} (sym) [0 1/2 1 θ(x)] (1×4 matrix)
%% @end group
%% @end example
%% @seealso{heaviside, @@sym/dirac}
%% @end defmethod

Expand Down