File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 22Changes
33-------
44
5+ Version 0.0.3
6+ ~~~~~~~~~~~~~
7+
8+ Add new method for Bernoulli function evaluation in :ref: `sec_bernoulli_new `.
9+
510Version 0.0.2
611~~~~~~~~~~~~~
712
Original file line number Diff line number Diff line change 165165 Evaluate Bernoulli
166166~~~~~~~~~~~~~~~~~~
167167
168+ .. _sec_bernoulli_new :
169+
170+ New Method
171+ ^^^^^^^^^^
172+
173+ The C++ standard library provides the ``expm1 `` function
174+
175+ .. math ::
176+
177+ \text {expm1 }(x) = \exp (x) - 1
178+
179+ which is more accurate than subtracting ``1 `` from ``exp(x) ``.
180+
181+ A sample implementation is:
182+
183+ .. code ::
184+
185+ def B(x):
186+ y = expm1(x)
187+ if x != y:
188+ b = 1.0/y
189+ else:
190+ b = 1.0 / (1. + 0.5*x)
191+ return b
192+
193+ Note that the check for ``x != y `` prevents a bad result when ``x == 0 ``.
194+
195+ Old Method
196+ ^^^^^^^^^^
197+
168198This requires an expansion near :math: `0 ` and use of :eq: `hf4 `.
169199
170200.. math ::
You can’t perform that action at this time.
0 commit comments