annotate libinterp/corefcn/besselj.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents ed7b17c7ddf3
children aac27ad79be6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29961
diff changeset
3 // Copyright (C) 1997-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21547
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
27 # include "config.h"
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
28 #endif
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
29
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
30 #include "lo-specfun.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3810
diff changeset
31 #include "quit.h"
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
32
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
33 #include "defun.h"
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
34 #include "error.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20892
diff changeset
35 #include "ovl.h"
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
36 #include "utils.h"
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
37
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31549
diff changeset
38 OCTAVE_BEGIN_NAMESPACE(octave)
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
39
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
40 enum bessel_type
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
41 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
42 BESSEL_J,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
43 BESSEL_Y,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
44 BESSEL_I,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
45 BESSEL_K,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
46 BESSEL_H1,
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
47 BESSEL_H2
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
48 };
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
49
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
50 #define DO_BESSEL(type, alpha, x, scaled, ierr, result) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
51 do \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
52 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
53 switch (type) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
54 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
55 case BESSEL_J: \
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
56 result = math::besselj (alpha, x, scaled, ierr); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
57 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
58 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
59 case BESSEL_Y: \
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
60 result = math::bessely (alpha, x, scaled, ierr); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
61 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
62 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
63 case BESSEL_I: \
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
64 result = math::besseli (alpha, x, scaled, ierr); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
65 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
66 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
67 case BESSEL_K: \
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
68 result = math::besselk (alpha, x, scaled, ierr); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
69 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
70 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
71 case BESSEL_H1: \
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
72 result = math::besselh1 (alpha, x, scaled, ierr); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
73 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
74 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
75 case BESSEL_H2: \
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
76 result = math::besselh2 (alpha, x, scaled, ierr); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
77 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
78 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
79 default: \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
80 break; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
81 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
82 } \
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
83 while (0)
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
84
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
85 octave_value_list
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
86 do_bessel (enum bessel_type type, const char *fcn,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
87 const octave_value_list& args, int nargout)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
88 {
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
89 int nargin = args.length ();
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
90
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
91 if (nargin < 2 || nargin > 3)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
92 print_usage ();
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
93
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
94 octave_value_list retval (nargout > 1 ? 2 : 1);
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
95
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
96 bool scaled = false;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
97 if (nargin == 3)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
98 {
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
99 octave_value opt_arg = args(2);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
100 bool rpt_error = false;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
101
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
102 if (! opt_arg.is_scalar_type ())
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
103 rpt_error = true;
23586
f6c5db0a02e7 maint: Deprecate is_numeric_type and replace with isnumeric.
Rik <rik@octave.org>
parents: 23579
diff changeset
104 else if (opt_arg.isnumeric ())
20089
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
105 {
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
106 double opt_val = opt_arg.double_value ();
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
107 if (opt_val != 0.0 && opt_val != 1.0)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
108 rpt_error = true;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
109 scaled = (opt_val == 1.0);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
110 }
23579
c20a0fa91c0c maint: Deprecate is_bool_type and replace with islogical.
Rik <rik@octave.org>
parents: 23220
diff changeset
111 else if (opt_arg.islogical ())
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
112 scaled = opt_arg.bool_value ();
20089
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
113
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
114 if (rpt_error)
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
115 error ("%s: OPT must be 0 (or false) or 1 (or true)", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
116 }
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
117
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
118 octave_value alpha_arg = args(0);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
119 octave_value x_arg = args(1);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
120
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
121 if (alpha_arg.is_single_type () || x_arg.is_single_type ())
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
122 {
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
123 if (alpha_arg.is_scalar_type ())
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
124 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
125 float alpha = args(0).xfloat_value ("%s: ALPHA must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
126
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
127 if (x_arg.is_scalar_type ())
20089
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
128 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
129 FloatComplex x = x_arg.xfloat_complex_value ("%s: X must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
130
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
131 octave_idx_type ierr;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
132 octave_value result;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
133
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
134 DO_BESSEL (type, alpha, x, scaled, ierr, result);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
135
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
136 retval(0) = result;
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
137 if (nargout > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
138 retval(1) = static_cast<float> (ierr);
20089
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
139 }
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
140 else
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
141 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
142 FloatComplexNDArray x = x_arg.xfloat_complex_array_value ("%s: X must be a scalar or matrix", fcn);
20089
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
143
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
144 Array<octave_idx_type> ierr;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
145 octave_value result;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
146
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
147 DO_BESSEL (type, alpha, x, scaled, ierr, result);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
148
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
149 retval(0) = result;
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
150 if (nargout > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
151 retval(1) = NDArray (ierr);
20089
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
152 }
93b3757a9623 Use stricter input validation for OPT arg of bessel functions (bug #44867).
Rik <rik@octave.org>
parents: 19697
diff changeset
153 }
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
154 else
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
155 {
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
156 dim_vector dv0 = args(0).dims ();
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
157 dim_vector dv1 = args(1).dims ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
158
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
159 bool args0_is_row_vector = (dv0(1) == dv0.numel ());
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
160 bool args1_is_col_vector = (dv1(0) == dv1.numel ());
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
161
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
162 if (args0_is_row_vector && args1_is_col_vector)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
163 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
164 FloatRowVector ralpha = args(0).xfloat_row_vector_value ("%s: ALPHA must be a scalar or matrix", fcn);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
165
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
166 FloatComplexColumnVector cx
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
167 = x_arg.xfloat_complex_column_vector_value ("%s: X must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
168
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
169 Array<octave_idx_type> ierr;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
170 octave_value result;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
171
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
172 DO_BESSEL (type, ralpha, cx, scaled, ierr, result);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
173
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
174 retval(0) = result;
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
175 if (nargout > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
176 retval(1) = NDArray (ierr);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
177 }
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
178 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
179 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
180 FloatNDArray alpha = args(0).xfloat_array_value ("%s: ALPHA must be a scalar or matrix", fcn);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
181
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
182 if (x_arg.is_scalar_type ())
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
183 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
184 FloatComplex x = x_arg.xfloat_complex_value ("%s: X must be a scalar or matrix", fcn);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
185
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
186 Array<octave_idx_type> ierr;
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
187 octave_value result;
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
188
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
189 DO_BESSEL (type, alpha, x, scaled, ierr, result);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
190
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
191 retval(0) = result;
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
192 if (nargout > 1)
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
193 retval(1) = NDArray (ierr);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
194 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
195 else
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
196 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
197 FloatComplexNDArray x = x_arg.xfloat_complex_array_value ("%s: X must be a scalar or matrix", fcn);
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
198
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
199 Array<octave_idx_type> ierr;
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
200 octave_value result;
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
201
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
202 DO_BESSEL (type, alpha, x, scaled, ierr, result);
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
203
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
204 retval(0) = result;
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
205 if (nargout > 1)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
206 retval(1) = NDArray (ierr);
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
207 }
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
208 }
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
209 }
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
210 }
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
211 else
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
212 {
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
213 if (alpha_arg.is_scalar_type ())
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
214 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
215 double alpha = args(0).xdouble_value ("%s: ALPHA must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
216
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
217 if (x_arg.is_scalar_type ())
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
218 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
219 Complex x = x_arg.xcomplex_value ("%s: X must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
220
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
221 octave_idx_type ierr;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
222 octave_value result;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
223
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
224 DO_BESSEL (type, alpha, x, scaled, ierr, result);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
225
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
226 retval(0) = result;
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
227 if (nargout > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
228 retval(1) = static_cast<double> (ierr);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
229 }
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
230 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
231 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
232 ComplexNDArray x = x_arg.xcomplex_array_value ("%s: X must be a scalar or matrix", fcn);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
233
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
234 Array<octave_idx_type> ierr;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
235 octave_value result;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
236
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
237 DO_BESSEL (type, alpha, x, scaled, ierr, result);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
238
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
239 retval(0) = result;
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
240 if (nargout > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
241 retval(1) = NDArray (ierr);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
242 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
243 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
244 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
245 {
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
246 dim_vector dv0 = args(0).dims ();
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
247 dim_vector dv1 = args(1).dims ();
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
248
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
249 bool args0_is_row_vector = (dv0(1) == dv0.numel ());
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
250 bool args1_is_col_vector = (dv1(0) == dv1.numel ());
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
251
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
252 if (args0_is_row_vector && args1_is_col_vector)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
253 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
254 RowVector ralpha = args(0).xrow_vector_value ("%s: ALPHA must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
255
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
256 ComplexColumnVector cx
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
257 = x_arg.xcomplex_column_vector_value ("%s: X must be a scalar or matrix", fcn);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
258
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
259 Array<octave_idx_type> ierr;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
260 octave_value result;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
261
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
262 DO_BESSEL (type, ralpha, cx, scaled, ierr, result);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
263
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
264 retval(0) = result;
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
265 if (nargout > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
266 retval(1) = NDArray (ierr);
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
267 }
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
268 else
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
269 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
270 NDArray alpha = args(0).xarray_value ("%s: ALPHA must be a scalar or matrix", fcn);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
271
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
272 if (x_arg.is_scalar_type ())
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
273 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
274 Complex x = x_arg.xcomplex_value ("%s: X must be a scalar or matrix", fcn);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
275
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
276 Array<octave_idx_type> ierr;
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
277 octave_value result;
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
278
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
279 DO_BESSEL (type, alpha, x, scaled, ierr, result);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7031
diff changeset
280
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
281 retval(0) = result;
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
282 if (nargout > 1)
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
283 retval(1) = NDArray (ierr);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
284 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
285 else
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
286 {
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30564
diff changeset
287 ComplexNDArray x = x_arg.xcomplex_array_value ("%s: X must be a scalar or matrix", fcn);
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
288
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
289 Array<octave_idx_type> ierr;
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
290 octave_value result;
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
291
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
292 DO_BESSEL (type, alpha, x, scaled, ierr, result);
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
293
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
294 retval(0) = result;
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
295 if (nargout > 1)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
296 retval(1) = NDArray (ierr);
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
297 }
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
298 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
299 }
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
300 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
301
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
302 return retval;
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
303 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
304
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
305 DEFUN (besselj, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
306 doc: /* -*- texinfo -*-
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
307 @deftypefn {} {@var{J} =} besselj (@var{alpha}, @var{x})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
308 @deftypefnx {} {@var{J} =} besselj (@var{alpha}, @var{x}, @var{opt})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
309 @deftypefnx {} {[@var{J}, @var{ierr}] =} besselj (@dots{})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
310 Compute Bessel functions of the first kind.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
311
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
312 The order of the Bessel function @var{alpha} must be real. The points for
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
313 evaluation @var{x} may be complex.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
314
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
315 If the optional argument @var{opt} is 1 or true, the result @var{J} is
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
316 multiplied by @w{@code{exp (-abs (imag (@var{x})))}}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
317
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
318 If @var{alpha} is a scalar, the result is the same size as @var{x}. If @var{x}
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
319 is a scalar, the result is the same size as @var{alpha}. If @var{alpha} is a
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
320 row vector and @var{x} is a column vector, the result is a matrix with
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
321 @code{length (@var{x})} rows and @code{length (@var{alpha})} columns.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
322 Otherwise, @var{alpha} and @var{x} must conform and the result will be the same
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
323 size.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
324
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
325 If requested, @var{ierr} contains the following status information and is the
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
326 same size as the result.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
327
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
328 @enumerate 0
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
329 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
330 Normal return.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
331
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
332 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
333 Input error, return @code{NaN}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
334
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
335 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
336 Overflow, return @code{Inf}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
337
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
338 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
339 Loss of significance by argument reduction results in less than half of machine
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
340 accuracy.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
341
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
342 @item
24906
451f4f291f46 Modified Bessel functions to compute the output with any input
Michele Ginesi <michele.ginesi@gmail.com>
parents: 24594
diff changeset
343 Loss of significance by argument reduction, output may be inaccurate.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
344
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
345 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
346 Error---no computation, algorithm termination condition not met, return
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
347 @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
348 @end enumerate
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
349
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
350 @seealso{bessely, besseli, besselk, besselh}
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
351 @end deftypefn */)
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
352 {
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
353 return do_bessel (BESSEL_J, "besselj", args, nargout);
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
354 }
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
355
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
356 /*
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
357 %!# Function besselj is tested along with other bessels at the end of this file
30945
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
358
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
359 ## besselj specific BIST
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
360 %!assert <*48316> (! any (isnan (besselj (1, 10.^[5:12]))))
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
361
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
362 */
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
363
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
364 DEFUN (bessely, args, nargout,
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
365 doc: /* -*- texinfo -*-
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
366 @deftypefn {} {@var{Y} =} bessely (@var{alpha}, @var{x})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
367 @deftypefnx {} {@var{Y} =} bessely (@var{alpha}, @var{x}, @var{opt})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
368 @deftypefnx {} {[@var{Y}, @var{ierr}] =} bessely (@dots{})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
369 Compute Bessel functions of the second kind.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
370
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
371 The order of the Bessel function @var{alpha} must be real. The points for
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
372 evaluation @var{x} may be complex.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
373
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
374 If the optional argument @var{opt} is 1 or true, the result @var{Y} is
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
375 multiplied by @w{@code{exp (-abs (imag (@var{x})))}}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
376
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
377 If @var{alpha} is a scalar, the result is the same size as @var{x}. If @var{x}
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
378 is a scalar, the result is the same size as @var{alpha}. If @var{alpha} is a
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
379 row vector and @var{x} is a column vector, the result is a matrix with
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
380 @code{length (@var{x})} rows and @code{length (@var{alpha})} columns.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
381 Otherwise, @var{alpha} and @var{x} must conform and the result will be the same
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
382 size.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
383
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
384 If requested, @var{ierr} contains the following status information and is the
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
385 same size as the result.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
386
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
387 @enumerate 0
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
388 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
389 Normal return.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
390
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
391 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
392 Input error, return @code{NaN}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
393
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
394 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
395 Overflow, return @code{Inf}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
396
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
397 @item
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
398 Loss of significance by argument reduction results in less than half of machine
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
399 accuracy.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
400
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
401 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
402 Complete loss of significance by argument reduction, return @code{NaN}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
403
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
404 @item
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
405 Error---no computation, algorithm termination condition not met, return
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
406 @code{NaN}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
407 @end enumerate
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
408
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
409 @seealso{besselj, besseli, besselk, besselh}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
410 @end deftypefn */)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
411 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
412 return do_bessel (BESSEL_Y, "bessely", args, nargout);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
413 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
414
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
415 /*
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
416 %!# Function bessely is tested along with other bessels at the end of this file
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
417 */
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
418
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
419 DEFUN (besseli, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
420 doc: /* -*- texinfo -*-
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
421 @deftypefn {} {@var{I} =} besseli (@var{alpha}, @var{x})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
422 @deftypefnx {} {@var{I} =} besseli (@var{alpha}, @var{x}, @var{opt})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
423 @deftypefnx {} {[@var{I}, @var{ierr}] =} besseli (@dots{})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
424 Compute modified Bessel functions of the first kind.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
425
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
426 The order of the Bessel function @var{alpha} must be real. The points for
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
427 evaluation @var{x} may be complex.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
428
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
429 If the optional argument @var{opt} is 1 or true, the result @var{I} is
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
430 multiplied by @w{@code{exp (-abs (real (@var{x})))}}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
431
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
432 If @var{alpha} is a scalar, the result is the same size as @var{x}. If @var{x}
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
433 is a scalar, the result is the same size as @var{alpha}. If @var{alpha} is a
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
434 row vector and @var{x} is a column vector, the result is a matrix with
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
435 @code{length (@var{x})} rows and @code{length (@var{alpha})} columns.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
436 Otherwise, @var{alpha} and @var{x} must conform and the result will be the same
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
437 size.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
438
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
439 If requested, @var{ierr} contains the following status information and is the
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
440 same size as the result.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
441
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
442 @enumerate 0
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
443 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
444 Normal return.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
445
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
446 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
447 Input error, return @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
448
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
449 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
450 Overflow, return @code{Inf}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
451
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
452 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
453 Loss of significance by argument reduction results in less than half of machine
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
454 accuracy.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
455
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
456 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
457 Complete loss of significance by argument reduction, return @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
458
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
459 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
460 Error---no computation, algorithm termination condition not met, return
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
461 @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
462 @end enumerate
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
463
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
464 @seealso{besselk, besselj, bessely, besselh}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
465 @end deftypefn */)
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
466
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
467 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
468 return do_bessel (BESSEL_I, "besseli", args, nargout);
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
469 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
470
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
471 /*
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
472 %!# Function besseli is tested along with other bessels at the end of this file
30945
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
473
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
474 ## besseli specific BIST
31549
ed7b17c7ddf3 maint: Strip trailing spaces and add missing EOL to all files.
Rik <rik@octave.org>
parents: 31375
diff changeset
475 %!assert (! isinf (besseli (0, 700)))
30945
e0aabe59c1aa Add more BIST tests for bessel functions (Bug #62321)
Rik <rik@octave.org>
parents: 30944
diff changeset
476
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
477 */
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
478
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
479 DEFUN (besselk, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
480 doc: /* -*- texinfo -*-
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
481 @deftypefn {} {@var{K} =} besselk (@var{alpha}, @var{x})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
482 @deftypefnx {} {@var{K} =} besselk (@var{alpha}, @var{x}, @var{opt})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
483 @deftypefnx {} {[@var{K}, @var{ierr}] =} besselk (@dots{})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
484
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
485 Compute modified Bessel functions of the second kind.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
486
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
487 The order of the Bessel function @var{alpha} must be real. The points for
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
488 evaluation @var{x} may be complex.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
489
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
490 If the optional argument @var{opt} is 1 or true, the result @var{K} is
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
491 multiplied by @w{@code{exp (@var{x})}}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
492
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
493 If @var{alpha} is a scalar, the result is the same size as @var{x}. If @var{x}
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
494 is a scalar, the result is the same size as @var{alpha}. If @var{alpha} is a
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
495 row vector and @var{x} is a column vector, the result is a matrix with
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
496 @code{length (@var{x})} rows and @code{length (@var{alpha})} columns.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
497 Otherwise, @var{alpha} and @var{x} must conform and the result will be the same
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
498 size.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
499
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
500 If requested, @var{ierr} contains the following status information and is the
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
501 same size as the result.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
502
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
503 @enumerate 0
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
504 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
505 Normal return.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
506
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
507 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
508 Input error, return @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
509
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
510 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
511 Overflow, return @code{Inf}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
512
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
513 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
514 Loss of significance by argument reduction results in less than half of machine
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
515 accuracy.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
516
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
517 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
518 Complete loss of significance by argument reduction, return @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
519
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
520 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
521 Error---no computation, algorithm termination condition not met, return
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
522 @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
523 @end enumerate
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
524
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
525 @seealso{besseli, besselj, bessely, besselh}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
526 @end deftypefn */)
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
527 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
528 return do_bessel (BESSEL_K, "besselk", args, nargout);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
529 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
530
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
531 /*
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
532 %!# Function besselk is tested along with other bessels at the end of this file
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
533 */
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
534
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
535 DEFUN (besselh, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
536 doc: /* -*- texinfo -*-
24594
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
537 @deftypefn {} {@var{H} =} besselh (@var{alpha}, @var{x})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
538 @deftypefnx {} {@var{H} =} besselh (@var{alpha}, @var{k}, @var{x})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
539 @deftypefnx {} {@var{H} =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
540 @deftypefnx {} {[@var{H}, @var{ierr}] =} besselh (@dots{})
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
541 Compute Bessel functions of the third kind (Hankel functions).
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
542
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
543 The order of the Bessel function @var{alpha} must be real. The kind of Hankel
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
544 function is specified by @var{k} and may be either first (@var{k} = 1) or
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
545 second (@var{k} = 2). The default is Hankel functions of the first kind. The
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
546 points for evaluation @var{x} may be complex.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
547
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
548 If the optional argument @var{opt} is 1 or true, the result is multiplied
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
549 by @code{exp (-I*@var{x})} for @var{k} = 1 or @code{exp (I*@var{x})} for
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
550 @var{k} = 2.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
551
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
552 If @var{alpha} is a scalar, the result is the same size as @var{x}. If @var{x}
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
553 is a scalar, the result is the same size as @var{alpha}. If @var{alpha} is a
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
554 row vector and @var{x} is a column vector, the result is a matrix with
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
555 @code{length (@var{x})} rows and @code{length (@var{alpha})} columns.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
556 Otherwise, @var{alpha} and @var{x} must conform and the result will be the same
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
557 size.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
558
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
559 If requested, @var{ierr} contains the following status information and is the
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
560 same size as the result.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
561
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
562 @enumerate 0
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
563 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
564 Normal return.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
565
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
566 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
567 Input error, return @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
568
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
569 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
570 Overflow, return @code{Inf}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
571
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
572 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
573 Loss of significance by argument reduction results in less than half of machine
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
574 accuracy.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
575
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
576 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
577 Complete loss of significance by argument reduction, return @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
578
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
579 @item
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
580 Error---no computation, algorithm termination condition not met, return
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
581 @code{NaN}.
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
582 @end enumerate
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
583
a81af57f6144 doc: Redo documentation of Bessel functions.
Rik <rik@octave.org>
parents: 24534
diff changeset
584 @seealso{besselj, bessely, besseli, besselk}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
585 @end deftypefn */)
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
586 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
587 int nargin = args.length ();
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
588
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
589 if (nargin < 2 || nargin > 4)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
590 print_usage ();
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
591
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
592 octave_value_list retval;
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
593
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
594 if (nargin == 2)
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
595 {
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
596 retval = do_bessel (BESSEL_H1, "besselh", args, nargout);
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
597 }
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
598 else
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
599 {
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
600 octave_idx_type kind = args(1).xint_value ("besselh: invalid value of K");
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
601
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
602 octave_value_list tmp_args;
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
603
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
604 if (nargin == 4)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
605 tmp_args(2) = args(3);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
606
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
607 tmp_args(1) = args(2);
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
608 tmp_args(0) = args(0);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
609
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
610 if (kind == 1)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
611 retval = do_bessel (BESSEL_H1, "besselh", tmp_args, nargout);
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
612 else if (kind == 2)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20559
diff changeset
613 retval = do_bessel (BESSEL_H2, "besselh", tmp_args, nargout);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
614 else
20711
7b608fadc663 Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents: 20703
diff changeset
615 error ("besselh: K must be 1 or 2");
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
616 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
617
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
618 return retval;
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
619 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
620
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
621 /*
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
622 %!# Function besselh is tested along with other bessels at the end of this file
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
623 */
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
624
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14854
diff changeset
625 DEFUN (airy, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
626 doc: /* -*- texinfo -*-
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
627 @deftypefn {} {@var{a} =} airy (@var{z})
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
628 @deftypefnx {} {@var{a} =} airy (@var{k}, @var{z})
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
629 @deftypefnx {} {@var{a} =} airy (@var{k}, @var{z}, @var{scale})
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
630 @deftypefnx {} {[@var{a}, @var{ierr}] =} airy (@dots{})
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
631
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
632 Compute Airy functions of the first and second kind, and their derivatives.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
633
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
634 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
635 @group
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
636 K Function Scale factor (if @var{scale} is true)
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
637 --- -------- ---------------------------------------
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
638 0 Ai (Z) exp ((2/3) * Z * sqrt (Z))
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
639 1 dAi(Z)/dZ exp ((2/3) * Z * sqrt (Z))
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
640 2 Bi (Z) exp (-abs (real ((2/3) * Z * sqrt (Z))))
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
641 3 dBi(Z)/dZ exp (-abs (real ((2/3) * Z * sqrt (Z))))
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
642 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
643 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
644
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
645 The function call @code{airy (@var{z})} is equivalent to
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
646 @code{airy (0, @var{z})}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
647
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
648 The optional third input @var{scale} determines whether to
31375
96f751f8392c doc: grammar check documentation ahead of 8.1 release.
Rik <rik@octave.org>
parents: 30946
diff changeset
649 apply scaling as described above. It is false by default.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
650
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
651 The result @var{a} is the same size as @var{z}.
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
652
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
653 The optional output @var{ierr} contains the following status information and
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
654 is the same size as the result.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
655
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
656 @enumerate 0
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
657 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
658 Normal return.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
659
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
660 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
661 Input error, return @code{NaN}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
662
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
663 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
664 Overflow, return @code{Inf}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
665
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
666 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
667 Loss of significance by argument reduction results in less than half
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
668 of machine accuracy.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
669
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
670 @item
24906
451f4f291f46 Modified Bessel functions to compute the output with any input
Michele Ginesi <michele.ginesi@gmail.com>
parents: 24594
diff changeset
671 Loss of significance by argument reduction, output may be inaccurate.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
672
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
673 @item
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
674 Error---no computation, algorithm termination condition not met,
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
675 return @code{NaN}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
676 @end enumerate
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21786
diff changeset
677 @end deftypefn */)
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
678 {
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
679 int nargin = args.length ();
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
680
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
681 if (nargin < 1 || nargin > 3)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
682 print_usage ();
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
683
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
684 octave_value_list retval (nargout > 1 ? 2 : 1);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
685
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
686 int kind = 0;
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
687 if (nargin > 1)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
688 {
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
689 kind = args(0).xint_value ("airy: K must be an integer value");
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
690
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
691 if (kind < 0 || kind > 3)
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
692 error ("airy: K must be 0, 1, 2, or 3");
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
693 }
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
694
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
695 bool scale = (nargin == 3) && args(2).xbool_value ("airy: scale option must be a logical value");
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
696
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20872
diff changeset
697 int idx = (nargin == 1 ? 0 : 1);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
698
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
699 Array<octave_idx_type> ierr;
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
700 octave_value result;
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
701
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
702 if (args(idx).is_single_type ())
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
703 {
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
704 FloatComplexNDArray z = args(idx).xfloat_complex_array_value ("airy: Z must be a complex matrix");
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
705
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
706 if (kind > 1)
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
707 result = math::biry (z, kind == 3, scale, ierr);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
708 else
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
709 result = math::airy (z, kind == 1, scale, ierr);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
710 }
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
711 else
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
712 {
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
713 ComplexNDArray z = args(idx).xcomplex_array_value ("airy: Z must be a complex matrix");
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
714
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
715 if (kind > 1)
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
716 result = math::biry (z, kind == 3, scale, ierr);
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
717 else
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
718 result = math::airy (z, kind == 1, scale, ierr);
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
719 }
20803
c22206c1a88f eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
720
30937
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
721 retval(0) = result;
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
722 if (nargout > 1)
85a67c1a5712 besselj.cc: Improve input validation for function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30896
diff changeset
723 retval(1) = NDArray (ierr);
3220
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
724
3deb1105fbc1 [project @ 1998-11-19 00:06:30 by jwe]
jwe
parents: 3187
diff changeset
725 return retval;
3155
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
726 }
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
727
1016520a9d38 [project @ 1998-02-18 21:51:50 by jwe]
jwe
parents:
diff changeset
728 /*
30940
84944164799e besselj.cc: Add BISTs for the function airy, remove FIXME (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30937
diff changeset
729 %!test <*62321>
30944
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
730 %! assert (airy (0, +1, false), 0.1352924163128814, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
731 %! assert (airy (0, -1, false), 0.5355608832923521, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
732 %! assert (airy (0, +i, false), 0.3314933054321411 - 0.3174498589684437i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
733 %! assert (airy (0, -i, false), 0.3314933054321411 + 0.3174498589684437i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
734 %! assert (airy (0, +1, true), 0.2635136447491401, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
735 %! assert (airy (0, -1, true), 0.4208904755499093 - 0.3311746779333462i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
736 %! assert (airy (0, +i, true), 0.2743053542644657 - 0.0825606941400591i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
737 %! assert (airy (0, -i, true), 0.2743053542644657 + 0.0825606941400591i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
738 %! assert (airy (1, +1, false), -0.1591474412967932, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
739 %! assert (airy (1, -1, false), -0.0101605671166451, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
740 %! assert (airy (1, +i, false), -0.4324926598418070 + 0.0980478562292432i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
741 %! assert (airy (1, -i, false), -0.4324926598418070 - 0.0980478562292432i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
742 %! assert (airy (1, +1, true), -0.3099768889605148, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
743 %! assert (airy (1, -1, true), -0.0079850602592406 + 0.0062829878869967i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
744 %! assert (airy (1, +i, true), -0.2682792317254506 - 0.0680655016581369i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
745 %! assert (airy (1, -i, true), -0.2682792317254506 + 0.0680655016581369i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
746 %! assert (airy (2, +1, false), 1.2074235949528715, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
747 %! assert (airy (2, -1, false), 0.1039973894969446, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
748 %! assert (airy (2, +i, false), 0.6488582083303949 + 0.3449586347680484i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
749 %! assert (airy (2, -i, false), 0.6488582083303949 - 0.3449586347680484i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
750 %! assert (airy (2, +1, true), 0.6199119435726786, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
751 %! assert (airy (2, -1, true), 0.1039973894969446, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
752 %! assert (airy (2, +i, true), 0.4049686654663902 + 0.2152973271658010i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
753 %! assert (airy (2, -i, true), 0.4049686654663902 - 0.2152973271658010i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
754 %! assert (airy (3, +1, false), 0.9324359333927754, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
755 %! assert (airy (3, -1, false), 0.5923756264227923, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
756 %! assert (airy (3, +i, false), 0.1350266467108190 - 0.1288373867812549i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
757 %! assert (airy (3, -i, false), 0.1350266467108190 + 0.1288373867812549i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
758 %! assert (airy (3, +1, true), 0.4787285706049846, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
759 %! assert (airy (3, -1, true), 0.5923756264227923, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
760 %! assert (airy (3, +i, true), 0.0842735134099415 - 0.0804106412111761i, 1e-15);
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
761 %! assert (airy (3, -i, true), 0.0842735134099415 + 0.0804106412111761i, 1e-15);
30946
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
762 %! z = -1 - 1e-6i;
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
763 %! s1 = exp (2/3 * z * sqrt(z));
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
764 %! s2 = exp (-abs (real (2/3 * z * sqrt(z))));
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
765 %! assert (airy (0, z, true), s1 * airy (0, z, false), 1e-15);
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
766 %! assert (airy (1, z, true), s1 * airy (1, z, false), 1e-15);
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
767 %! assert (airy (2, z, true), s2 * airy (2, z, false), 1e-15);
e7032ef9a9c3 besselj.cc: Add some more BISTs to function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30945
diff changeset
768 %! assert (airy (3, z, true), s2 * airy (3, z, false), 1e-15);
30940
84944164799e besselj.cc: Add BISTs for the function airy, remove FIXME (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30937
diff changeset
769
30941
272614f05636 besselj.cc: Add more BISTs for the function airy (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30940
diff changeset
770 Input validation tests
30944
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
771 %!error airy ()
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
772 %!error airy (0, 1, 2, 3)
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
773 %!error <K must be an integer value> airy ("foo", 2, false)
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
774 %!error <K must be 0, 1, 2, or 3> airy (3743, 2, false)
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
775 %!error <scale option must be a logical value> airy (0, 2, "foo")
4727765dbc89 maint: Use Octave conventions for coding BIST tests in cset 84944164799e.
Rik <rik@octave.org>
parents: 30941
diff changeset
776 %!error <Z must be a complex matrix> airy (0, "foo", false)
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
777 */
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
778
30940
84944164799e besselj.cc: Add BISTs for the function airy, remove FIXME (bug #62321)
Arun Giridhar <arungiridhar@gmail.com>
parents: 30937
diff changeset
779
20872
ead410040418 2015 Code Sprint: mark bessel functions as tested
Mike Miller <mtmiller@octave.org>
parents: 20853
diff changeset
780 /*
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
781 ## Test values computed with GP/PARI version 2.3.3
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
782 %!shared alpha, x, jx, yx, ix, kx, nix
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
783 %!
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
784 %! ## Bessel functions, even order, positive and negative x
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
785 %! alpha = 2; x = 1.25;
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
786 %! jx = 0.1710911312405234823613091417;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
787 %! yx = -1.193199310178553861283790424;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
788 %! ix = 0.2220184483766341752692212604;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
789 %! kx = 0.9410016167388185767085460540;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
790 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
791 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
792 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
793 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
794 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
795 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
796 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
797 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
798 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
799 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
800 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
801 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
802 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
803 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
804 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
805 %!assert (besselj (-alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
806 %!assert (bessely (-alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
807 %!assert (besseli (-alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
808 %!assert (besselk (-alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
809 %!assert (besselh (-alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
810 %!assert (besselh (-alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
811 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
812 %!assert (besselj (-alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
813 %!assert (bessely (-alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
814 %!assert (besseli (-alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
815 %!assert (besselk (-alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
816 %!assert (besselh (-alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
817 %!assert (besselh (-alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
818 %!
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
819 %! x *= -1;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
820 %! yx = -1.193199310178553861283790424 + 0.3421822624810469647226182835*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
821 %! kx = 0.9410016167388185767085460540 - 0.6974915263814386815610060884*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
822 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
823 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
824 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
825 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
826 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
827 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
828 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
829 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
830 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
831 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
832 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
833 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
834 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
835 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
836 %!
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
837 %! ## Bessel functions, odd order, positive and negative x
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
838 %! alpha = 3; x = 2.5;
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
839 %! jx = 0.2166003910391135247666890035;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
840 %! yx = -0.7560554967536709968379029772;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
841 %! ix = 0.4743704087780355895548240179;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
842 %! kx = 0.2682271463934492027663765197;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
843 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
844 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
845 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
846 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
847 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
848 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
849 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
850 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
851 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
852 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
853 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
854 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
855 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
856 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
857 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
858 %!assert (besselj (-alpha,x), -jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
859 %!assert (bessely (-alpha,x), -yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
860 %!assert (besseli (-alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
861 %!assert (besselk (-alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
862 %!assert (besselh (-alpha,1,x), -(jx + I*yx), 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
863 %!assert (besselh (-alpha,2,x), -(jx - I*yx), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
864 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
865 %!assert (besselj (-alpha,x,1), -jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
866 %!assert (bessely (-alpha,x,1), -yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
867 %!assert (besseli (-alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
868 %!assert (besselk (-alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
869 %!assert (besselh (-alpha,1,x,1), -(jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
870 %!assert (besselh (-alpha,2,x,1), -(jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
871 %!
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
872 %! x *= -1;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
873 %! jx = -jx;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
874 %! yx = 0.7560554967536709968379029772 - 0.4332007820782270495333780070*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
875 %! ix = -ix;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
876 %! kx = -0.2682271463934492027663765197 - 1.490278591297463775542004240*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
877 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
878 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
879 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
880 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
881 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
882 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
883 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
884 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
885 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
886 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
887 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
888 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
889 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
890 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
891 %!
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
892 %! ## Bessel functions, fractional order, positive and negative x
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
893 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
894 %! alpha = 3.5; x = 2.75;
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
895 %! jx = 0.1691636439842384154644784389;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
896 %! yx = -0.8301381935499356070267953387;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
897 %! ix = 0.3930540878794826310979363668;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
898 %! kx = 0.2844099013460621170288192503;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
899 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
900 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
901 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
902 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
903 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
904 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
905 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
906 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
907 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
908 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
909 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
910 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
911 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
912 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
913 %!
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
914 %! nix = 0.2119931212254662995364461998;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
915 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
916 %!assert (besselj (-alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
917 %!assert (bessely (-alpha,x), -jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
918 %!assert (besseli (-alpha,x), nix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
919 %!assert (besselk (-alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
920 %!assert (besselh (-alpha,1,x), -I*(jx + I*yx), 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
921 %!assert (besselh (-alpha,2,x), I*(jx - I*yx), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
922 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
923 %!assert (besselj (-alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
924 %!assert (bessely (-alpha,x,1), -jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
925 %!assert (besseli (-alpha,x,1), nix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
926 %!assert (besselk (-alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
927 %!assert (besselh (-alpha,1,x,1), -I*(jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
928 %!assert (besselh (-alpha,2,x,1), I*(jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
929 %!
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
930 %! x *= -1;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
931 %! jx *= -I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
932 %! yx = -0.8301381935499356070267953387*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
933 %! ix *= -I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
934 %! kx = -0.9504059335995575096509874508*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
935 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
936 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
937 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
938 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
939 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
940 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
941 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
942 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
943 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
944 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
945 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
946 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
947 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
948 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
949 %!
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
950 %! ## Bessel functions, even order, complex x
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
951 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
952 %! alpha = 2; x = 1.25 + 3.625 * I;
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
953 %! jx = -1.299533366810794494030065917 + 4.370833116012278943267479589*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
954 %! yx = -4.370357232383223896393056727 - 1.283083391453582032688834041*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
955 %! ix = -0.6717801680341515541002273932 - 0.2314623443930774099910228553*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
956 %! kx = -0.01108009888623253515463783379 + 0.2245218229358191588208084197*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
957 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
958 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
959 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
960 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
961 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
962 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
963 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
964 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
965 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
966 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
967 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
968 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
969 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
970 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
971 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
972 %!assert (besselj (-alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
973 %!assert (bessely (-alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
974 %!assert (besseli (-alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
975 %!assert (besselk (-alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
976 %!assert (besselh (-alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
977 %!assert (besselh (-alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
978 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
979 %!assert (besselj (-alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
980 %!assert (bessely (-alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
981 %!assert (besseli (-alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
982 %!assert (besselk (-alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
983 %!assert (besselh (-alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
984 %!assert (besselh (-alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
985 %!
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
986 %! ## Bessel functions, odd order, complex x
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
987 %!
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
988 %! alpha = 3; x = 2.5 + 1.875 * I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
989 %! jx = 0.1330721523048277493333458596 + 0.5386295217249660078754395597*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
990 %! yx = -0.6485072392105829901122401551 + 0.2608129289785456797046996987*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
991 %! ix = -0.6182064685486998097516365709 + 0.4677561094683470065767989920*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
992 %! kx = -0.1568585587733540007867882337 - 0.05185853709490846050505141321*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
993 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
994 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
995 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
996 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
997 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
998 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
999 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1000 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1001 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1002 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1003 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1004 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1005 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1006 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1007 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1008 %!assert (besselj (-alpha,x), -jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1009 %!assert (bessely (-alpha,x), -yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1010 %!assert (besseli (-alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1011 %!assert (besselk (-alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1012 %!assert (besselh (-alpha,1,x), -(jx + I*yx), 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1013 %!assert (besselh (-alpha,2,x), -(jx - I*yx), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1014 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1015 %!assert (besselj (-alpha,x,1), -jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1016 %!assert (bessely (-alpha,x,1), -yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1017 %!assert (besseli (-alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1018 %!assert (besselk (-alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1019 %!assert (besselh (-alpha,1,x,1), -(jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1020 %!assert (besselh (-alpha,2,x,1), -(jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1021 %!
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 15195
diff changeset
1022 %! ## Bessel functions, fractional order, complex x
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1023 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1024 %! alpha = 3.5; x = 1.75 + 4.125 * I;
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1025 %! jx = -3.018566131370455929707009100 - 0.7585648436793900607704057611*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1026 %! yx = 0.7772278839106298215614791107 - 3.018518722313849782683792010*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1027 %! ix = 0.2100873577220057189038160913 - 0.6551765604618246531254970926*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1028 %! kx = 0.1757147290513239935341488069 + 0.08772348296883849205562558311*I;
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1029 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1030 %!assert (besselj (alpha,x), jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1031 %!assert (bessely (alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1032 %!assert (besseli (alpha,x), ix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1033 %!assert (besselk (alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1034 %!assert (besselh (alpha,1,x), jx + I*yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1035 %!assert (besselh (alpha,2,x), jx - I*yx, 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1036 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1037 %!assert (besselj (alpha,x,1), jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1038 %!assert (bessely (alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1039 %!assert (besseli (alpha,x,1), ix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1040 %!assert (besselk (alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1041 %!assert (besselh (alpha,1,x,1), (jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1042 %!assert (besselh (alpha,2,x,1), (jx - I*yx)*exp (I*x), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1043 %!
17337
a31b54b5f84a Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents: 17336
diff changeset
1044 %! nix = 0.09822388691172060573913739253 - 0.7110230642207380127317227407*I;
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1045 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1046 %!assert (besselj (-alpha,x), yx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1047 %!assert (bessely (-alpha,x), -jx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1048 %!assert (besseli (-alpha,x), nix, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1049 %!assert (besselk (-alpha,x), kx, 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1050 %!assert (besselh (-alpha,1,x), -I*(jx + I*yx), 100*eps)
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1051 %!assert (besselh (-alpha,2,x), I*(jx - I*yx), 100*eps)
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1052 %!
28915
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1053 %!assert (besselj (-alpha,x,1), yx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1054 %!assert (bessely (-alpha,x,1), -jx*exp (-abs (imag (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1055 %!assert (besseli (-alpha,x,1), nix*exp (-abs (real (x))), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1056 %!assert (besselk (-alpha,x,1), kx*exp (x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1057 %!assert (besselh (-alpha,1,x,1), -I*(jx + I*yx)*exp (-I*x), 100*eps)
c40a367a84c0 maint: Use Octave convention of space after function name in libinterp/.
Rik <rik@octave.org>
parents: 27923
diff changeset
1058 %!assert (besselh (-alpha,2,x,1), I*(jx - I*yx)*exp (I*x), 100*eps)
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1059
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1060 Tests contributed by Robert T. Short.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1061 Tests are based on the properties and tables in A&S:
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1062 Abramowitz and Stegun, "Handbook of Mathematical Functions",
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1063 1972.
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1064
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1065 For regular Bessel functions, there are 3 tests. These compare octave
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1066 results against Tables 9.1, 9.2, and 9.4 in A&S. Tables 9.1 and 9.2
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1067 are good to only a few decimal places, so any failures should be
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1068 considered a broken implementation. Table 9.4 is an extended table
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1069 for larger orders and arguments. There are some differences between
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1070 Octave and Table 9.4, mostly in the last decimal place but in a very
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1071 few instances the errors are in the last two places. The comparison
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1072 tolerance has been changed to reflect this.
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1073
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1074 Similarly for modified Bessel functions, there are 3 tests. These
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1075 compare octave results against Tables 9.8, 9.9, and 9.11 in A&S.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1076 Tables 9.8 and 9.9 are good to only a few decimal places, so any
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1077 failures should be considered a broken implementation. Table 9.11 is
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1078 an extended table for larger orders and arguments. There are some
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1079 differences between octave and Table 9.11, mostly in the last decimal
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1080 place but in a very few instances the errors are in the last two
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1081 places. The comparison tolerance has been changed to reflect this.
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1082
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1083 For spherical Bessel functions, there are also three tests, comparing
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1084 octave results to Tables 10.1, 10.2, and 10.4 in A&S. Very similar
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21724
diff changeset
1085 comments may be made here as in the previous lines. At this time,
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1086 modified spherical Bessel function tests are not included.
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1087
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1088 % Table 9.1 - J and Y for integer orders 0, 1, 2.
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1089 % Compare against excerpts of Table 9.1, Abramowitz and Stegun.
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1090 %!test
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1091 %! n = 0:2;
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1092 %! z = (0:2.5:17.5)';
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1093 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1094 %! Jt = [[ 1.000000000000000, 0.0000000000, 0.0000000000];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1095 %! [-0.048383776468198, 0.4970941025, 0.4460590584];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1096 %! [-0.177596771314338, -0.3275791376, 0.0465651163];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1097 %! [ 0.266339657880378, 0.1352484276, -0.2302734105];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1098 %! [-0.245935764451348, 0.0434727462, 0.2546303137];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1099 %! [ 0.146884054700421, -0.1654838046, -0.1733614634];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1100 %! [-0.014224472826781, 0.2051040386, 0.0415716780];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1101 %! [-0.103110398228686, -0.1634199694, 0.0844338303]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1102 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1103 %! Yt = [[-Inf, -Inf, -Inf ];
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1104 %! [ 0.4980703596, 0.1459181380, -0.38133585 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1105 %! [-0.3085176252, 0.1478631434, 0.36766288 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1106 %! [ 0.1173132861, -0.2591285105, -0.18641422 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1107 %! [ 0.0556711673, 0.2490154242, -0.00586808 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1108 %! [-0.1712143068, -0.1538382565, 0.14660019 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1109 %! [ 0.2054642960, 0.0210736280, -0.20265448 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1110 %! [-0.1604111925, 0.0985727987, 0.17167666 ]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1111 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1112 %! J = besselj (n,z);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1113 %! Y = bessely (n,z);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1114 %! assert (Jt(:,1), J(:,1), 0.5e-10);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1115 %! assert (Yt(:,1), Y(:,1), 0.5e-10);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1116 %! assert (Jt(:,2:3), J(:,2:3), 0.5e-10);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1117
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1118 Table 9.2 - J and Y for integer orders 3-9.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1119
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1120 %!test
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1121 %! n = (3:9);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1122 %! z = (0:2:20).';
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1123 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1124 %! Jt = [[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1125 %! [ 1.2894e-01, 3.3996e-02, 7.0396e-03, 1.2024e-03, 1.7494e-04, 2.2180e-05, 2.4923e-06];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1126 %! [ 4.3017e-01, 2.8113e-01, 1.3209e-01, 4.9088e-02, 1.5176e-02, 4.0287e-03, 9.3860e-04];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1127 %! [ 1.1477e-01, 3.5764e-01, 3.6209e-01, 2.4584e-01, 1.2959e-01, 5.6532e-02, 2.1165e-02];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1128 %! [-2.9113e-01,-1.0536e-01, 1.8577e-01, 3.3758e-01, 3.2059e-01, 2.2345e-01, 1.2632e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1129 %! [ 5.8379e-02,-2.1960e-01,-2.3406e-01,-1.4459e-02, 2.1671e-01, 3.1785e-01, 2.9186e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1130 %! [ 1.9514e-01, 1.8250e-01,-7.3471e-02,-2.4372e-01,-1.7025e-01, 4.5095e-02, 2.3038e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1131 %! [-1.7681e-01, 7.6244e-02, 2.2038e-01, 8.1168e-02,-1.5080e-01,-2.3197e-01,-1.1431e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1132 %! [-4.3847e-02,-2.0264e-01,-5.7473e-02, 1.6672e-01, 1.8251e-01,-7.0211e-03,-1.8953e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1133 %! [ 1.8632e-01, 6.9640e-02,-1.5537e-01,-1.5596e-01, 5.1399e-02, 1.9593e-01, 1.2276e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1134 %! [-9.8901e-02, 1.3067e-01, 1.5117e-01,-5.5086e-02,-1.8422e-01,-7.3869e-02, 1.2513e-01]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1135 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1136 %! Yt = [[ -Inf, -Inf, -Inf, -Inf, -Inf, -Inf, -Inf];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1137 %! [-1.1278e+00,-2.7659e+00,-9.9360e+00,-4.6914e+01,-2.7155e+02,-1.8539e+03,-1.4560e+04];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1138 %! [-1.8202e-01,-4.8894e-01,-7.9585e-01,-1.5007e+00,-3.7062e+00,-1.1471e+01,-4.2178e+01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1139 %! [ 3.2825e-01, 9.8391e-02,-1.9706e-01,-4.2683e-01,-6.5659e-01,-1.1052e+00,-2.2907e+00];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1140 %! [ 2.6542e-02, 2.8294e-01, 2.5640e-01, 3.7558e-02,-2.0006e-01,-3.8767e-01,-5.7528e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1141 %! [-2.5136e-01,-1.4495e-01, 1.3540e-01, 2.8035e-01, 2.0102e-01, 1.0755e-03,-1.9930e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1142 %! [ 1.2901e-01,-1.5122e-01,-2.2982e-01,-4.0297e-02, 1.8952e-01, 2.6140e-01, 1.5902e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1143 %! [ 1.2350e-01, 2.0393e-01,-6.9717e-03,-2.0891e-01,-1.7209e-01, 3.6816e-02, 2.1417e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1144 %! [-1.9637e-01,-7.3222e-05, 1.9633e-01, 1.2278e-01,-1.0425e-01,-2.1399e-01,-1.0975e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1145 %! [ 3.3724e-02,-1.7722e-01,-1.1249e-01, 1.1472e-01, 1.8897e-01, 3.2253e-02,-1.6030e-01];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1146 %! [ 1.4967e-01, 1.2409e-01,-1.0004e-01,-1.7411e-01,-4.4312e-03, 1.7101e-01, 1.4124e-01]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1147 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1148 %! n = (3:9);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1149 %! z = (0:2:20).';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1150 %! J = besselj (n,z);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1151 %! Y = bessely (n,z);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1152 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1153 %! assert (J(1,:), zeros (1, columns (J)));
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1154 %! assert (J(2:end,:), Jt(2:end,:), -5e-5);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1155 %! assert (Yt(1,:), Y(1,:));
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1156 %! assert (Y(2:end,:), Yt(2:end,:), -5e-5);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1157
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1158 Table 9.4 - J and Y for various integer orders and arguments.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1159
14450
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1160 %!test
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1161 %! Jt = [[ 7.651976866e-01, 2.238907791e-01, -1.775967713e-01, -2.459357645e-01, 5.581232767e-02, 1.998585030e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1162 %! [ 2.497577302e-04, 7.039629756e-03, 2.611405461e-01, -2.340615282e-01, -8.140024770e-02, -7.419573696e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1163 %! [ 2.630615124e-10, 2.515386283e-07, 1.467802647e-03, 2.074861066e-01, -1.138478491e-01, -5.473217694e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1164 %! [ 2.297531532e-17, 7.183016356e-13, 4.796743278e-07, 4.507973144e-03, -1.082255990e-01, 1.519812122e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1165 %! [ 3.873503009e-25, 3.918972805e-19, 2.770330052e-11, 1.151336925e-05, -1.167043528e-01, 6.221745850e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1166 %! [ 3.482869794e-42, 3.650256266e-33, 2.671177278e-21, 1.551096078e-12, 4.843425725e-02, 8.146012958e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1167 %! [ 1.107915851e-60, 1.196077458e-48, 8.702241617e-33, 6.030895312e-21, -1.381762812e-01, 7.270175482e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1168 %! [ 2.906004948e-80, 3.224095839e-65, 2.294247616e-45, 1.784513608e-30, 1.214090219e-01, -3.869833973e-02];
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1169 %! [ 8.431828790e-189, 1.060953112e-158, 6.267789396e-119, 6.597316064e-89, 1.115927368e-21, 9.636667330e-02]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1170 %!
14450
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1171 %! Yt = [[ 8.825696420e-02, 5.103756726e-01, -3.085176252e-01, 5.567116730e-02, -9.806499547e-02, -7.724431337e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1172 %! [-2.604058666e+02, -9.935989128e+00, -4.536948225e-01, 1.354030477e-01, -7.854841391e-02, -2.948019628e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1173 %! [-1.216180143e+08, -1.291845422e+05, -2.512911010e+01, -3.598141522e-01, 5.723897182e-03, 5.833157424e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1174 %! [-9.256973276e+14, -2.981023646e+10, -4.694049564e+04, -6.364745877e+00, 4.041280205e-02, 7.879068695e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1175 %! [-4.113970315e+22, -4.081651389e+16, -5.933965297e+08, -1.597483848e+03, 1.644263395e-02, 5.124797308e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1176 %! [-3.048128783e+39, -2.913223848e+30, -4.028568418e+18, -7.256142316e+09, -1.164572349e-01, 6.138839212e-03]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1177 %! [-7.184874797e+57, -6.661541235e+45, -9.216816571e+29, -1.362803297e+18, -4.530801120e-02, 4.074685217e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1178 %! [-2.191142813e+77, -1.976150576e+62, -2.788837017e+42, -3.641066502e+27, -2.103165546e-01, 7.650526394e-02]
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1179 %! [-3.775287810e+185, -3.000826049e+155, -5.084863915e+115, -4.849148271e+85, -3.293800188e+18, -1.669214114e-01]];
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1180 %!
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1181 %! n = [(0:5:20).';30;40;50;100];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1182 %! z = [1,2,5,10,50,100];
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1183 %! J = besselj (n.', z.').';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1184 %! Y = bessely (n.', z.').';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1185 %! assert (J, Jt, -1e-9);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1186 %! assert (Y, Yt, -1e-9);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1187
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1188 Table 9.8 - I and K for integer orders 0, 1, 2.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1189
14450
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1190 %!test
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1191 %! n = 0:2;
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1192 %! z1 = [0.1;2.5;5.0];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1193 %! z2 = [7.5;10.0;15.0;20.0];
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1194 %! rtbl = [[ 0.9071009258 0.0452984468 0.1251041992 2.6823261023 10.890182683 1.995039646 ];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1195 %! [ 0.2700464416 0.2065846495 0.2042345837 0.7595486903 0.9001744239 0.759126289 ];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1196 %! [ 0.1835408126 0.1639722669 0.7002245988 0.5478075643 0.6002738588 0.132723593 ];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1197 %! [ 0.1483158301 0.1380412115 0.111504840 0.4505236991 0.4796689336 0.57843541 ];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1198 %! [ 0.1278333372 0.1212626814 0.103580801 0.3916319344 0.4107665704 0.47378525 ];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1199 %! [ 0.1038995314 0.1003741751 0.090516308 0.3210023535 0.3315348950 0.36520701 ];
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1200 %! [ 0.0897803119 0.0875062222 0.081029690 0.2785448768 0.2854254970 0.30708743 ]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1201 %!
14450
ab4676288414 Fix typos and errors in new bessel function tests
Mike Miller <mtmiller@ieee.org>
parents: 14426
diff changeset
1202 %! tbl = [besseli(n,z1,1), besselk(n,z1,1)];
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1203 %! tbl(:,3) = tbl(:,3) .* (exp (z1) .* z1.^(-2));
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1204 %! tbl(:,6) = tbl(:,6) .* (exp (-z1) .* z1.^(2));
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1205 %! tbl = [tbl;[besseli(n,z2,1),besselk(n,z2,1)]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1206 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1207 %! assert (tbl, rtbl, -2e-8);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1208
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1209 Table 9.9 - I and K for orders 3-9.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1210
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1211 %!test
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1212 %! It = [[ 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1213 %! [ 2.8791e-02 6.8654e-03 1.3298e-03 2.1656e-04 3.0402e-05 3.7487e-06 4.1199e-07];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1214 %! [ 6.1124e-02 2.5940e-02 9.2443e-03 2.8291e-03 7.5698e-04 1.7968e-04 3.8284e-05];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1215 %! [ 7.4736e-02 4.1238e-02 1.9752e-02 8.3181e-03 3.1156e-03 1.0484e-03 3.1978e-04];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1216 %! [ 7.9194e-02 5.0500e-02 2.8694e-02 1.4633e-02 6.7449e-03 2.8292e-03 1.0866e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1217 %! [ 7.9830e-02 5.5683e-02 3.5284e-02 2.0398e-02 1.0806e-02 5.2694e-03 2.3753e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1218 %! [ 7.8848e-02 5.8425e-02 3.9898e-02 2.5176e-02 1.4722e-02 8.0010e-03 4.0537e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1219 %! [ 7.7183e-02 5.9723e-02 4.3056e-02 2.8969e-02 1.8225e-02 1.0744e-02 5.9469e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1220 %! [ 7.5256e-02 6.0155e-02 4.5179e-02 3.1918e-02 2.1240e-02 1.3333e-02 7.9071e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1221 %! [ 7.3263e-02 6.0059e-02 4.6571e-02 3.4186e-02 2.3780e-02 1.5691e-02 9.8324e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1222 %! [ 7.1300e-02 5.9640e-02 4.7444e-02 3.5917e-02 2.5894e-02 1.7792e-02 1.1661e-02]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1223 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1224 %! Kt = [[ Inf Inf Inf Inf Inf Inf Inf];
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1225 %! [ 4.7836e+00 1.6226e+01 6.9687e+01 3.6466e+02 2.2576e+03 1.6168e+04 1.3160e+05];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1226 %! [ 1.6317e+00 3.3976e+00 8.4268e+00 2.4465e+01 8.1821e+01 3.1084e+02 1.3252e+03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1227 %! [ 9.9723e-01 1.6798e+00 3.2370e+00 7.0748e+00 1.7387e+01 4.7644e+01 1.4444e+02];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1228 %! [ 7.3935e-01 1.1069e+00 1.8463e+00 3.4148e+00 6.9684e+00 1.5610e+01 3.8188e+01];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1229 %! [ 6.0028e-01 8.3395e-01 1.2674e+00 2.1014e+00 3.7891e+00 7.4062e+00 1.5639e+01];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1230 %! [ 5.1294e-01 6.7680e-01 9.6415e-01 1.4803e+00 2.4444e+00 4.3321e+00 8.2205e+00];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1231 %! [ 4.5266e-01 5.7519e-01 7.8133e-01 1.1333e+00 1.7527e+00 2.8860e+00 5.0510e+00];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1232 %! [ 4.0829e-01 5.0414e-01 6.6036e-01 9.1686e-01 1.3480e+00 2.0964e+00 3.4444e+00];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1233 %! [ 3.7411e-01 4.5162e-01 5.7483e-01 7.7097e-01 1.0888e+00 1.6178e+00 2.5269e+00];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1234 %! [ 3.4684e-01 4.1114e-01 5.1130e-01 6.6679e-01 9.1137e-01 1.3048e+00 1.9552e+00]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1235 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1236 %! n = (3:9);
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1237 %! z = (0:2:20).';
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1238 %! I = besseli (n,z,1);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1239 %! K = besselk (n,z,1);
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1240 %!
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1241 %! assert (abs (I(1,:)), zeros (1, columns (I)));
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1242 %! assert (I(2:end,:), It(2:end,:), -5e-5);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1243 %! assert (Kt(1,:), K(1,:));
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1244 %! assert (K(2:end,:), Kt(2:end,:), -5e-5);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1245
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1246 Table 9.11 - I and K for various integer orders and arguments.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1247
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1248 %!test
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1249 %! It = [[ 1.266065878e+00 2.279585302e+00 2.723987182e+01 2.815716628e+03 2.93255378e+20 1.07375171e+42 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1250 %! [ 2.714631560e-04 9.825679323e-03 2.157974547e+00 7.771882864e+02 2.27854831e+20 9.47009387e+41 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1251 %! [ 2.752948040e-10 3.016963879e-07 4.580044419e-03 2.189170616e+01 1.07159716e+20 6.49897552e+41 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1252 %! [ 2.370463051e-17 8.139432531e-13 1.047977675e-06 1.043714907e-01 3.07376455e+19 3.47368638e+41 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1253 %! [ 3.966835986e-25 4.310560576e-19 5.024239358e-11 1.250799736e-04 5.44200840e+18 1.44834613e+41 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1254 %! [ 3.539500588e-42 3.893519664e-33 3.997844971e-21 7.787569783e-12 4.27499365e+16 1.20615487e+40 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1255 %! [ 1.121509741e-60 1.255869192e-48 1.180426980e-32 2.042123274e-20 6.00717897e+13 3.84170550e+38 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1256 %! [ 2.934635309e-80 3.353042830e-65 2.931469647e-45 4.756894561e-30 1.76508024e+10 4.82195809e+36 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1257 %! [ 8.473674008e-189 1.082171475e-158 7.093551489e-119 1.082344202e-88 2.72788795e-16 4.64153494e+21 ]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1258 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1259 %! Kt = [[ 4.210244382e-01 1.138938727e-01 3.691098334e-03 1.778006232e-05 3.41016774e-23 4.65662823e-45 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1260 %! [ 3.609605896e+02 9.431049101e+00 3.270627371e-02 5.754184999e-05 4.36718224e-23 5.27325611e-45 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1261 %! [ 1.807132899e+08 1.624824040e+05 9.758562829e+00 1.614255300e-03 9.15098819e-23 7.65542797e-45 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1262 %! [ 1.403066801e+15 4.059213332e+10 3.016976630e+04 2.656563849e-01 3.11621117e-22 1.42348325e-44 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1263 %! [ 6.294369360e+22 5.770856853e+16 4.827000521e+08 1.787442782e+02 1.70614838e-21 3.38520541e-44 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1264 %! [ 4.706145527e+39 4.271125755e+30 4.112132063e+18 2.030247813e+09 2.00581681e-19 3.97060205e-43 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1265 %! [ 1.114220651e+58 9.940839886e+45 1.050756722e+30 5.938224681e+17 1.29986971e-16 1.20842080e-41 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1266 %! [ 3.406896854e+77 2.979981740e+62 3.394322243e+42 2.061373775e+27 4.00601349e-13 9.27452265e-40 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1267 %! [ 5.900333184e+185 4.619415978e+155 7.039860193e+115 4.596674084e+85 1.63940352e+13 7.61712963e-25 ]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1268 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1269 %! n = [(0:5:20).';30;40;50;100];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1270 %! z = [1,2,5,10,50,100];
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1271 %! I = besseli (n.', z.').';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1272 %! K = besselk (n.', z.').';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1273 %! assert (I, It, -5e-9);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1274 %! assert (K, Kt, -5e-9);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1275
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1276 The next section checks that negative integer orders and positive
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1277 integer orders are appropriately related.
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1278
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1279 %!test
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1280 %! n = (0:2:20);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1281 %! assert (besselj (n,1), besselj (-n,1), 1e-8);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1282 %! assert (-besselj (n+1,1), besselj (-n-1,1), 1e-8);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1283
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1284 besseli (n,z) = besseli (-n,z);
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1285
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1286 %!test
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1287 %! n = (0:2:20);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1288 %! assert (besseli (n,1), besseli (-n,1), 1e-8);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1289
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1290 Table 10.1 - j and y for integer orders 0, 1, 2.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1291 Compare against excerpts of Table 10.1, Abramowitz and Stegun.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1292
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1293 %!test
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1294 %! n = (0:2);
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1295 %! z = [0.1;(2.5:2.5:10.0).'];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1296 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1297 %! jt = [[ 9.9833417e-01 3.33000119e-02 6.6619061e-04 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1298 %! [ 2.3938886e-01 4.16212989e-01 2.6006673e-01 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1299 %! [-1.9178485e-01 -9.50894081e-02 1.3473121e-01 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1300 %! [ 1.2507e-01 -2.9542e-02 -1.3688e-01 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1301 %! [ -5.4402e-02 7.8467e-02 7.7942e-02 ]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1302 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1303 %! yt = [[-9.9500417e+00 -1.0049875e+02 -3.0050125e+03 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1304 %! [ 3.2045745e-01 -1.1120588e-01 -4.5390450e-01 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1305 %! [-5.6732437e-02 1.8043837e-01 1.6499546e-01 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1306 %! [ -4.6218e-02 -1.3123e-01 -6.2736e-03 ];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1307 %! [ 8.3907e-02 6.2793e-02 -6.5069e-02 ]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1308 %!
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1309 %! j = sqrt ((pi/2)./z) .* besselj (n+1/2,z);
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1310 %! y = sqrt ((pi/2)./z) .* bessely (n+1/2,z);
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1311 %! assert (jt, j, -5e-5);
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1312 %! assert (yt, y, -5e-5);
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1313
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1314 Table 10.2 - j and y for orders 3-8.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1315 Compare against excerpts of Table 10.2, Abramowitzh and Stegun.
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1316
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1317 Important note: In A&S, y_4(0.1) = -1.0507e+7, but Octave returns
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1318 y_4(0.1) = -1.0508e+07 (-10507503.75). If I compute the same term using
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1319 a series, the difference is in the eighth significant digit so I left
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1320 the Octave results in place.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1321
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1322 %!test
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1323 %! n = (3:8);
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14501
diff changeset
1324 %! z = (0:2.5:10).'; z(1) = 0.1;
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1325 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1326 %! jt = [[ 9.5185e-06 1.0577e-07 9.6163e-10 7.3975e-12 4.9319e-14 2.9012e-16];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1327 %! [ 1.0392e-01 3.0911e-02 7.3576e-03 1.4630e-03 2.5009e-04 3.7516e-05];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1328 %! [ 2.2982e-01 1.8702e-01 1.0681e-01 4.7967e-02 1.7903e-02 5.7414e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1329 %! [-6.1713e-02 7.9285e-02 1.5685e-01 1.5077e-01 1.0448e-01 5.8188e-02];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1330 %! [-3.9496e-02 -1.0559e-01 -5.5535e-02 4.4501e-02 1.1339e-01 1.2558e-01]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1331 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1332 %! yt = [[-1.5015e+05 -1.0508e+07 -9.4553e+08 -1.0400e+11 -1.3519e+13 -2.0277e+15];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1333 %! [-7.9660e-01 -1.7766e+00 -5.5991e+00 -2.2859e+01 -1.1327e+02 -6.5676e+02];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1334 %! [-1.5443e-02 -1.8662e-01 -3.2047e-01 -5.1841e-01 -1.0274e+00 -2.5638e+00];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1335 %! [ 1.2705e-01 1.2485e-01 2.2774e-02 -9.1449e-02 -1.8129e-01 -2.7112e-01];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1336 %! [-9.5327e-02 -1.6599e-03 9.3834e-02 1.0488e-01 4.2506e-02 -4.1117e-02]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1337 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1338 %! j = sqrt ((pi/2)./z) .* besselj (n+1/2,z);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1339 %! y = sqrt ((pi/2)./z) .* bessely (n+1/2,z);
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1340 %!
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1341 %! assert (jt, j, -5e-5);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1342 %! assert (yt, y, -5e-5);
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1343
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1344 Table 10.4 - j and y for various integer orders and arguments.
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1345
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1346 %!test
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1347 %! jt = [[ 8.414709848e-01 4.546487134e-01 -1.917848549e-01 -5.440211109e-02 -5.247497074e-03 -5.063656411e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1348 %! [ 9.256115861e-05 2.635169770e-03 1.068111615e-01 -5.553451162e-02 -2.004830056e-02 -9.290148935e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1349 %! [ 7.116552640e-11 6.825300865e-08 4.073442442e-04 6.460515449e-02 -1.503922146e-02 -1.956578597e-04];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1350 %! [ 5.132686115e-18 1.606982166e-13 1.084280182e-07 1.063542715e-03 -1.129084539e-02 7.877261748e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1351 %! [ 7.537795722e-26 7.632641101e-20 5.427726761e-12 2.308371961e-06 -1.578502990e-02 1.010767128e-02];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1352 %! [ 5.566831267e-43 5.836617888e-34 4.282730217e-22 2.512057385e-13 -1.494673454e-03 8.700628514e-03];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1353 %! [ 1.538210374e-61 1.660978779e-49 1.210347583e-33 8.435671634e-22 -2.606336952e-02 1.043410851e-02];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1354 %! [ 3.615274717e-81 4.011575290e-66 2.857479350e-46 2.230696023e-31 1.882910737e-02 5.797140882e-04];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1355 %! [7.444727742e-190 9.367832591e-160 5.535650303e-120 5.832040182e-90 1.019012263e-22 1.088047701e-02]];
14426
e28a1723d5a2 besselj: Style fixes on new tests due to Robert T. Short
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14425
diff changeset
1356 %!
14425
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1357 %! yt = [[ -5.403023059e-01 2.080734183e-01 -5.673243709e-02 8.390715291e-02 -1.929932057e-02 -8.623188723e-03]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1358 %! [ -9.994403434e+02 -1.859144531e+01 -3.204650467e-01 9.383354168e-02 -6.971131965e-04 3.720678486e-03]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1359 %! [ -6.722150083e+08 -3.554147201e+05 -2.665611441e+01 -1.724536721e-01 1.352468751e-02 1.002577737e-02]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1360 %! [ -6.298007233e+15 -1.012182944e+11 -6.288146513e+04 -3.992071745e+00 1.712319725e-02 6.258641510e-03]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1361 %! [ -3.239592219e+23 -1.605436493e+17 -9.267951403e+08 -1.211210605e+03 1.375953130e-02 5.631729379e-05]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1362 %! [ -2.946428547e+40 -1.407393871e+31 -7.760717570e+18 -6.908318646e+09 -2.241226812e-02 -5.412929349e-03]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1363 %! [ -8.028450851e+58 -3.720929322e+46 -2.055758716e+30 -1.510304919e+18 4.978797221e-05 -7.048420407e-04]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1364 %! [ -2.739192285e+78 -1.235021944e+63 -6.964109188e+42 -4.528227272e+27 -4.190000150e-02 1.074782297e-02]
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1365 %! [-6.683079463e+186 -2.655955830e+156 -1.799713983e+116 -8.573226309e+85 -1.125692891e+18 -2.298385049e-02]];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1366 %!
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1367 %! n = [(0:5:20).';30;40;50;100];
6646031e2450 besselj.cc: Added tests to cover a broad range of arguments and orders.
Robert T. Short <octave@phaselockedsystems.com>
parents: 14360
diff changeset
1368 %! z = [1,2,5,10,50,100];
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1369 %! j = sqrt ((pi/2)./z) .* besselj ((n+1/2).', z.').';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1370 %! y = sqrt ((pi/2)./z) .* bessely ((n+1/2).', z.').';
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1371 %! assert (j, jt, -1e-9);
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14450
diff changeset
1372 %! assert (y, yt, -1e-9);
8278
ab0674a8b345 fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents: 7919
diff changeset
1373 */
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
1374
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31549
diff changeset
1375 OCTAVE_END_NAMESPACE(octave)