Mercurial > octave-nkf
annotate src/DLD-FUNCTIONS/besselj.cc @ 11904:059fadc0cbc3 release-3-0-x
fix scaling factor for negative alpha in zbesi,cbesi
add bessel function tests
add all scaling factors to bessel documentation
author | Brian Gough <bjg@gnu.org> |
---|---|
date | Mon, 12 Jan 2009 10:42:03 +0100 |
parents | 120f3135952f |
children |
rev | line source |
---|---|
3155 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, |
4 2007 John W. Eaton | |
3155 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3155 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3155 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include "lo-specfun.h" | |
4153 | 29 #include "quit.h" |
3155 | 30 |
31 #include "defun-dld.h" | |
32 #include "error.h" | |
33 #include "gripes.h" | |
34 #include "oct-obj.h" | |
35 #include "utils.h" | |
36 | |
3220 | 37 enum bessel_type |
38 { | |
39 BESSEL_J, | |
40 BESSEL_Y, | |
41 BESSEL_I, | |
42 BESSEL_K, | |
43 BESSEL_H1, | |
44 BESSEL_H2 | |
45 }; | |
46 | |
47 #define DO_BESSEL(type, alpha, x, scaled, ierr, result) \ | |
3155 | 48 do \ |
49 { \ | |
50 switch (type) \ | |
51 { \ | |
3220 | 52 case BESSEL_J: \ |
53 result = besselj (alpha, x, scaled, ierr); \ | |
54 break; \ | |
55 \ | |
56 case BESSEL_Y: \ | |
57 result = bessely (alpha, x, scaled, ierr); \ | |
3155 | 58 break; \ |
59 \ | |
3220 | 60 case BESSEL_I: \ |
61 result = besseli (alpha, x, scaled, ierr); \ | |
3155 | 62 break; \ |
63 \ | |
3220 | 64 case BESSEL_K: \ |
65 result = besselk (alpha, x, scaled, ierr); \ | |
3155 | 66 break; \ |
67 \ | |
3220 | 68 case BESSEL_H1: \ |
69 result = besselh1 (alpha, x, scaled, ierr); \ | |
70 break; \ | |
71 \ | |
72 case BESSEL_H2: \ | |
73 result = besselh2 (alpha, x, scaled, ierr); \ | |
3155 | 74 break; \ |
75 \ | |
76 default: \ | |
77 break; \ | |
78 } \ | |
79 } \ | |
80 while (0) | |
81 | |
3220 | 82 static inline Matrix |
5275 | 83 int_array2_to_matrix (const Array2<octave_idx_type>& a) |
3220 | 84 { |
5275 | 85 octave_idx_type nr = a.rows (); |
86 octave_idx_type nc = a.cols (); | |
3220 | 87 |
88 Matrix retval (nr, nc); | |
89 | |
5275 | 90 for (octave_idx_type j = 0; j < nc; j++) |
91 for (octave_idx_type i = 0; i < nr; i++) | |
4153 | 92 { |
93 OCTAVE_QUIT; | |
94 | |
5760 | 95 retval(i,j) = static_cast<double> (a(i,j)); |
4153 | 96 } |
3220 | 97 |
98 return retval; | |
99 } | |
100 | |
4844 | 101 static inline NDArray |
5760 | 102 int_arrayN_to_array (const ArrayN<octave_idx_type>& a) |
4844 | 103 { |
104 dim_vector dv = a.dims (); | |
105 int nel = dv.numel (); | |
106 | |
107 NDArray retval (dv); | |
108 | |
109 for (int i = 0; i < nel; i++) | |
110 { | |
111 OCTAVE_QUIT; | |
112 | |
5760 | 113 retval(i) = static_cast<double> (a(i)); |
4844 | 114 } |
115 | |
116 return retval; | |
117 } | |
118 | |
3155 | 119 static void |
3220 | 120 gripe_bessel_arg (const char *fn, const char *arg) |
3155 | 121 { |
3220 | 122 error ("%s: expecting scalar or matrix as %s argument", fn, arg); |
3155 | 123 } |
124 | |
125 octave_value_list | |
3220 | 126 do_bessel (enum bessel_type type, const char *fn, |
127 const octave_value_list& args, int nargout) | |
3155 | 128 { |
3220 | 129 octave_value_list retval; |
3155 | 130 |
131 int nargin = args.length (); | |
132 | |
3220 | 133 if (nargin == 2 || nargin == 3) |
3155 | 134 { |
3220 | 135 bool scaled = (nargin == 3); |
136 | |
3155 | 137 octave_value alpha_arg = args(0); |
3220 | 138 octave_value x_arg = args(1); |
3155 | 139 |
140 if (alpha_arg.is_scalar_type ()) | |
141 { | |
3220 | 142 double alpha = args(0).double_value (); |
3155 | 143 |
144 if (! error_state) | |
145 { | |
3220 | 146 if (x_arg.is_scalar_type ()) |
147 { | |
148 Complex x = x_arg.complex_value (); | |
149 | |
150 if (! error_state) | |
151 { | |
5275 | 152 octave_idx_type ierr; |
3220 | 153 octave_value result; |
154 | |
155 DO_BESSEL (type, alpha, x, scaled, ierr, result); | |
156 | |
157 if (nargout > 1) | |
5760 | 158 retval(1) = static_cast<double> (ierr); |
3155 | 159 |
3220 | 160 retval(0) = result; |
161 } | |
162 else | |
163 gripe_bessel_arg (fn, "second"); | |
164 } | |
3155 | 165 else |
3220 | 166 { |
4844 | 167 ComplexNDArray x = x_arg.complex_array_value (); |
3220 | 168 |
169 if (! error_state) | |
170 { | |
5275 | 171 ArrayN<octave_idx_type> ierr; |
3220 | 172 octave_value result; |
173 | |
174 DO_BESSEL (type, alpha, x, scaled, ierr, result); | |
175 | |
176 if (nargout > 1) | |
4844 | 177 retval(1) = int_arrayN_to_array (ierr); |
3220 | 178 |
179 retval(0) = result; | |
180 } | |
181 else | |
182 gripe_bessel_arg (fn, "second"); | |
183 } | |
3155 | 184 } |
185 else | |
3220 | 186 gripe_bessel_arg (fn, "first"); |
3155 | 187 } |
188 else | |
189 { | |
4844 | 190 dim_vector dv0 = args(0).dims (); |
191 dim_vector dv1 = args(1).dims (); | |
192 | |
193 bool args0_is_row_vector = (dv0 (1) == dv0.numel ()); | |
194 bool args1_is_col_vector = (dv1 (0) == dv1.numel ()); | |
3155 | 195 |
4844 | 196 if (args0_is_row_vector && args1_is_col_vector) |
3155 | 197 { |
4844 | 198 RowVector ralpha = args(0).row_vector_value (); |
199 | |
200 if (! error_state) | |
3220 | 201 { |
4844 | 202 ComplexColumnVector cx = |
203 x_arg.complex_column_vector_value (); | |
3220 | 204 |
205 if (! error_state) | |
206 { | |
5275 | 207 Array2<octave_idx_type> ierr; |
3220 | 208 octave_value result; |
3155 | 209 |
4844 | 210 DO_BESSEL (type, ralpha, cx, scaled, ierr, result); |
211 | |
3220 | 212 if (nargout > 1) |
213 retval(1) = int_array2_to_matrix (ierr); | |
214 | |
215 retval(0) = result; | |
216 } | |
217 else | |
218 gripe_bessel_arg (fn, "second"); | |
219 } | |
220 else | |
4844 | 221 gripe_bessel_arg (fn, "first"); |
222 } | |
223 else | |
224 { | |
225 NDArray alpha = args(0).array_value (); | |
3220 | 226 |
4844 | 227 if (! error_state) |
228 { | |
229 if (x_arg.is_scalar_type ()) | |
230 { | |
231 Complex x = x_arg.complex_value (); | |
3155 | 232 |
4844 | 233 if (! error_state) |
3155 | 234 { |
5275 | 235 ArrayN<octave_idx_type> ierr; |
3220 | 236 octave_value result; |
237 | |
238 DO_BESSEL (type, alpha, x, scaled, ierr, result); | |
239 | |
240 if (nargout > 1) | |
4844 | 241 retval(1) = int_arrayN_to_array (ierr); |
3220 | 242 |
243 retval(0) = result; | |
3155 | 244 } |
4844 | 245 else |
246 gripe_bessel_arg (fn, "second"); | |
3155 | 247 } |
3220 | 248 else |
4844 | 249 { |
250 ComplexNDArray x = x_arg.complex_array_value (); | |
251 | |
252 if (! error_state) | |
253 { | |
5275 | 254 ArrayN<octave_idx_type> ierr; |
4844 | 255 octave_value result; |
256 | |
257 DO_BESSEL (type, alpha, x, scaled, ierr, result); | |
258 | |
259 if (nargout > 1) | |
260 retval(1) = int_arrayN_to_array (ierr); | |
261 | |
262 retval(0) = result; | |
263 } | |
264 else | |
265 gripe_bessel_arg (fn, "second"); | |
266 } | |
3155 | 267 } |
4844 | 268 else |
269 gripe_bessel_arg (fn, "first"); | |
3155 | 270 } |
271 } | |
272 } | |
273 else | |
5823 | 274 print_usage (); |
3155 | 275 |
276 return retval; | |
277 } | |
278 | |
3220 | 279 DEFUN_DLD (besselj, args, nargout, |
3459 | 280 "-*- texinfo -*-\n\ |
281 @deftypefn {Loadable Function} {[@var{j}, @var{ierr}] =} besselj (@var{alpha}, @var{x}, @var{opt})\n\ | |
282 @deftypefnx {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\ | |
283 @deftypefnx {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\ | |
284 @deftypefnx {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\ | |
285 @deftypefnx {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\ | |
286 Compute Bessel or Hankel functions of various kinds:\n\ | |
3155 | 287 \n\ |
3459 | 288 @table @code\n\ |
289 @item besselj\n\ | |
11904
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
290 Bessel functions of the first kind. If the argument @var{opt} is supplied, \n\ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
291 the result is multiplied by @code{exp(-abs(imag(x)))}.\n\ |
3459 | 292 @item bessely\n\ |
11904
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
293 Bessel functions of the second kind. If the argument @var{opt} is supplied,\n\ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
294 the result is multiplied by @code{exp(-abs(imag(x)))}.\n\ |
3459 | 295 @item besseli\n\ |
11904
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
296 Modified Bessel functions of the first kind. If the argument @var{opt} is supplied,\n\ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
297 the result is multiplied by @code{exp(-abs(real(x)))}.\n\ |
3459 | 298 @item besselk\n\ |
11904
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
299 Modified Bessel functions of the second kind. If the argument @var{opt} is supplied,\n\ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
300 the result is multiplied by @code{exp(x)}.\n\ |
3459 | 301 @item besselh\n\ |
302 Compute Hankel functions of the first (@var{k} = 1) or second (@var{k}\n\ | |
11904
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
303 = 2) kind. If the argument @var{opt} is supplied, the result is multiplied by\n\ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
304 @code{exp (-I*@var{x})} for @var{k} = 1 or @code{exp (I*@var{x})} for\n\ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
305 @var{k} = 2.\n\ |
3459 | 306 @end table\n\ |
3220 | 307 \n\ |
3459 | 308 If @var{alpha} is a scalar, the result is the same size as @var{x}.\n\ |
309 If @var{x} is a scalar, the result is the same size as @var{alpha}.\n\ | |
310 If @var{alpha} is a row vector and @var{x} is a column vector, the\n\ | |
311 result is a matrix with @code{length (@var{x})} rows and\n\ | |
312 @code{length (@var{alpha})} columns. Otherwise, @var{alpha} and\n\ | |
313 @var{x} must conform and the result will be the same size.\n\ | |
3155 | 314 \n\ |
3459 | 315 The value of @var{alpha} must be real. The value of @var{x} may be\n\ |
316 complex.\n\ | |
317 \n\ | |
318 If requested, @var{ierr} contains the following status information\n\ | |
319 and is the same size as the result.\n\ | |
3548 | 320 \n\ |
3459 | 321 @enumerate 0\n\ |
322 @item\n\ | |
323 Normal return.\n\ | |
324 @item\n\ | |
325 Input error, return @code{NaN}.\n\ | |
326 @item\n\ | |
327 Overflow, return @code{Inf}.\n\ | |
328 @item\n\ | |
329 Loss of significance by argument reduction results in less than\n\ | |
330 half of machine accuracy.\n\ | |
331 @item\n\ | |
332 Complete loss of significance by argument reduction, return @code{NaN}.\n\ | |
333 @item\n\ | |
334 Error---no computation, algorithm termination condition not met,\n\ | |
335 return @code{NaN}.\n\ | |
336 @end enumerate\n\ | |
337 @end deftypefn") | |
3155 | 338 { |
3220 | 339 return do_bessel (BESSEL_J, "besselj", args, nargout); |
3155 | 340 } |
341 | |
3220 | 342 DEFUN_DLD (bessely, args, nargout, |
3459 | 343 "-*- texinfo -*-\n\ |
344 @deftypefn {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\ | |
345 See besselj.\n\ | |
346 @end deftypefn") | |
3155 | 347 { |
3220 | 348 return do_bessel (BESSEL_Y, "bessely", args, nargout); |
3155 | 349 } |
350 | |
3220 | 351 DEFUN_DLD (besseli, args, nargout, |
3459 | 352 "-*- texinfo -*-\n\ |
353 @deftypefn {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\ | |
354 See besselj.\n\ | |
355 @end deftypefn") | |
3155 | 356 { |
3220 | 357 return do_bessel (BESSEL_I, "besseli", args, nargout); |
3155 | 358 } |
359 | |
3220 | 360 DEFUN_DLD (besselk, args, nargout, |
3459 | 361 "-*- texinfo -*-\n\ |
362 @deftypefn {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\ | |
363 See besselj.\n\ | |
364 @end deftypefn") | |
3220 | 365 { |
366 return do_bessel (BESSEL_K, "besselk", args, nargout); | |
367 } | |
368 | |
369 DEFUN_DLD (besselh, args, nargout, | |
3459 | 370 "-*- texinfo -*-\n\ |
371 @deftypefn {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\ | |
372 See besselj.\n\ | |
373 @end deftypefn") | |
3220 | 374 { |
375 octave_value_list retval; | |
376 | |
377 int nargin = args.length (); | |
378 | |
379 if (nargin == 2) | |
380 { | |
381 retval = do_bessel (BESSEL_H1, "besselh", args, nargout); | |
382 } | |
383 else if (nargin == 3 || nargin == 4) | |
384 { | |
5275 | 385 octave_idx_type kind = args(1).int_value (); |
3220 | 386 |
3810 | 387 if (! error_state) |
3220 | 388 { |
389 octave_value_list tmp_args; | |
390 | |
391 if (nargin == 4) | |
392 tmp_args(2) = args(3); | |
393 | |
394 tmp_args(1) = args(2); | |
395 tmp_args(0) = args(0); | |
396 | |
397 if (kind == 1) | |
398 retval = do_bessel (BESSEL_H1, "besselh", tmp_args, nargout); | |
399 else if (kind == 2) | |
400 retval = do_bessel (BESSEL_H2, "besselh", tmp_args, nargout); | |
401 else | |
402 error ("besselh: expecting K = 1 or 2"); | |
403 } | |
404 else | |
405 error ("besselh: invalid value of K"); | |
406 } | |
407 else | |
5823 | 408 print_usage (); |
3220 | 409 |
410 return retval; | |
411 } | |
412 | |
413 DEFUN_DLD (airy, args, nargout, | |
3459 | 414 "-*- texinfo -*-\n\ |
415 @deftypefn {Loadable Function} {[@var{a}, @var{ierr}] =} airy (@var{k}, @var{z}, @var{opt})\n\ | |
3220 | 416 Compute Airy functions of the first and second kind, and their\n\ |
417 derivatives.\n\ | |
418 \n\ | |
3459 | 419 @example\n\ |
7031 | 420 K Function Scale factor (if 'opt' is supplied)\n\ |
421 --- -------- ---------------------------------------\n\ | |
422 0 Ai (Z) exp ((2/3) * Z * sqrt (Z))\n\ | |
423 1 dAi(Z)/dZ exp ((2/3) * Z * sqrt (Z))\n\ | |
424 2 Bi (Z) exp (-abs (real ((2/3) * Z *sqrt (Z))))\n\ | |
425 3 dBi(Z)/dZ exp (-abs (real ((2/3) * Z *sqrt (Z))))\n\ | |
3459 | 426 @end example\n\ |
3220 | 427 \n\ |
3549 | 428 The function call @code{airy (@var{z})} is equivalent to\n\ |
3459 | 429 @code{airy (0, @var{z})}.\n\ |
3155 | 430 \n\ |
3549 | 431 The result is the same size as @var{z}.\n\ |
3220 | 432 \n\ |
3459 | 433 If requested, @var{ierr} contains the following status information and\n\ |
434 is the same size as the result.\n\ | |
3548 | 435 \n\ |
3459 | 436 @enumerate 0\n\ |
437 @item\n\ | |
438 Normal return.\n\ | |
439 @item\n\ | |
440 Input error, return @code{NaN}.\n\ | |
441 @item\n\ | |
442 Overflow, return @code{Inf}.\n\ | |
443 @item\n\ | |
444 Loss of significance by argument reduction results in less than half\n\ | |
445 of machine accuracy.\n\ | |
446 @item\n\ | |
447 Complete loss of significance by argument reduction, return @code{NaN}.\n\ | |
448 @item\n\ | |
449 Error---no computation, algorithm termination condition not met,\n\ | |
5448 | 450 return @code{NaN}.\n\ |
3459 | 451 @end enumerate\n\ |
452 @end deftypefn") | |
3155 | 453 { |
3220 | 454 octave_value_list retval; |
455 | |
456 int nargin = args.length (); | |
457 | |
458 if (nargin > 0 && nargin < 4) | |
459 { | |
460 bool scale = (nargin == 3); | |
461 | |
462 int kind = 0; | |
463 | |
4844 | 464 ComplexNDArray z; |
3220 | 465 |
466 if (nargin > 1) | |
467 { | |
5760 | 468 kind = args(0).int_value (); |
3220 | 469 |
470 if (! error_state) | |
471 { | |
472 if (kind < 0 || kind > 3) | |
473 error ("airy: expecting K = 0, 1, 2, or 3"); | |
474 } | |
475 else | |
476 error ("airy: expecting integer value for K"); | |
477 } | |
478 | |
479 if (! error_state) | |
480 { | |
4844 | 481 z = args(nargin == 1 ? 0 : 1).complex_array_value (); |
3220 | 482 |
483 if (! error_state) | |
484 { | |
5275 | 485 ArrayN<octave_idx_type> ierr; |
3220 | 486 octave_value result; |
487 | |
488 if (kind > 1) | |
489 result = biry (z, kind == 3, scale, ierr); | |
490 else | |
491 result = airy (z, kind == 1, scale, ierr); | |
492 | |
493 if (nargout > 1) | |
4844 | 494 retval(1) = int_arrayN_to_array (ierr); |
3220 | 495 |
496 retval(0) = result; | |
497 } | |
498 else | |
499 error ("airy: expecting complex matrix for Z"); | |
500 } | |
501 } | |
502 else | |
5823 | 503 print_usage (); |
3220 | 504 |
505 return retval; | |
3155 | 506 } |
507 | |
508 /* | |
11904
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
509 %! # Test values computed with GP/PARI version 2.3.3 |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
510 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
511 %!shared alpha, x, jx, yx, ix, kx, nix |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
512 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
513 %! # Bessel functions, even order, positive and negative x |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
514 %! alpha = 2; x = 1.25; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
515 %! jx = 0.1710911312405234823613091417; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
516 %! yx = -1.193199310178553861283790424; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
517 %! ix = 0.2220184483766341752692212604; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
518 %! kx = 0.9410016167388185767085460540; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
519 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
520 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
521 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
522 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
523 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
524 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
525 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
526 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
527 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
528 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
529 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
530 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
531 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
532 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
533 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
534 %!assert(besselj(-alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
535 %!assert(bessely(-alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
536 %!assert(besseli(-alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
537 %!assert(besselk(-alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
538 %!assert(besselh(-alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
539 %!assert(besselh(-alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
540 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
541 %!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
542 %!assert(bessely(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
543 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
544 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
545 %!assert(besselh(-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
546 %!assert(besselh(-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
547 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
548 %! x *= -1; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
549 %! yx = -1.193199310178553861283790424 + 0.3421822624810469647226182835*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
550 %! kx = 0.9410016167388185767085460540 - 0.6974915263814386815610060884*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
551 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
552 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
553 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
554 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
555 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
556 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
557 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
558 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
559 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
560 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
561 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
562 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
563 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
564 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
565 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
566 %! # Bessel functions, odd order, positive and negative x |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
567 %! alpha = 3; x = 2.5; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
568 %! jx = 0.2166003910391135247666890035; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
569 %! yx = -0.7560554967536709968379029772; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
570 %! ix = 0.4743704087780355895548240179; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
571 %! kx = 0.2682271463934492027663765197; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
572 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
573 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
574 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
575 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
576 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
577 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
578 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
579 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
580 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
581 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
582 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
583 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
584 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
585 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
586 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
587 %!assert(besselj(-alpha,x), -jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
588 %!assert(bessely(-alpha,x), -yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
589 %!assert(besseli(-alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
590 %!assert(besselk(-alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
591 %!assert(besselh(-alpha,1,x), -(jx + I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
592 %!assert(besselh(-alpha,2,x), -(jx - I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
593 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
594 %!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
595 %!assert(bessely(-alpha,x,1), -yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
596 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
597 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
598 %!assert(besselh(-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
599 %!assert(besselh(-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
600 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
601 %! x *= -1; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
602 %! jx = -jx; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
603 %! yx = 0.7560554967536709968379029772 - 0.4332007820782270495333780070*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
604 %! ix = -ix; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
605 %! kx = -0.2682271463934492027663765197 - 1.490278591297463775542004240*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
606 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
607 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
608 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
609 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
610 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
611 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
612 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
613 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
614 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
615 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
616 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
617 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
618 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
619 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
620 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
621 %! # Bessel functions, fractional order, positive and negative x |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
622 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
623 %! alpha = 3.5; x = 2.75; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
624 %! jx = 0.1691636439842384154644784389; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
625 %! yx = -0.8301381935499356070267953387; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
626 %! ix = 0.3930540878794826310979363668; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
627 %! kx = 0.2844099013460621170288192503; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
628 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
629 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
630 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
631 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
632 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
633 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
634 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
635 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
636 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
637 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
638 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
639 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
640 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
641 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
642 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
643 %! nix = 0.2119931212254662995364461998; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
644 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
645 %!assert(besselj(-alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
646 %!assert(bessely(-alpha,x), -jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
647 %!assert(besseli(-alpha,x), nix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
648 %!assert(besselk(-alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
649 %!assert(besselh(-alpha,1,x), -I*(jx + I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
650 %!assert(besselh(-alpha,2,x), I*(jx - I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
651 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
652 %!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
653 %!assert(bessely(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
654 %!assert(besseli(-alpha,x,1), nix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
655 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
656 %!assert(besselh(-alpha,1,x,1), -I*(jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
657 %!assert(besselh(-alpha,2,x,1), I*(jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
658 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
659 %! x *= -1; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
660 %! jx *= -I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
661 %! yx = -0.8301381935499356070267953387*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
662 %! ix *= -I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
663 %! kx = -0.9504059335995575096509874508*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
664 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
665 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
666 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
667 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
668 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
669 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
670 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
671 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
672 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
673 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
674 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
675 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
676 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
677 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
678 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
679 %! # Bessel functions, even order, complex x |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
680 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
681 %! alpha = 2; x = 1.25 + 3.625 * I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
682 %! jx = -1.299533366810794494030065917 + 4.370833116012278943267479589*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
683 %! yx = -4.370357232383223896393056727 - 1.283083391453582032688834041*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
684 %! ix = -0.6717801680341515541002273932 - 0.2314623443930774099910228553*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
685 %! kx = -0.01108009888623253515463783379 + 0.2245218229358191588208084197*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
686 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
687 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
688 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
689 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
690 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
691 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
692 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
693 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
694 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
695 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
696 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
697 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
698 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
699 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
700 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
701 %!assert(besselj(-alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
702 %!assert(bessely(-alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
703 %!assert(besseli(-alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
704 %!assert(besselk(-alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
705 %!assert(besselh(-alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
706 %!assert(besselh(-alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
707 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
708 %!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
709 %!assert(bessely(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
710 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
711 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
712 %!assert(besselh(-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
713 %!assert(besselh(-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
714 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
715 %! # Bessel functions, odd order, complex x |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
716 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
717 %! alpha = 3; x = 2.5 + 1.875 * I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
718 %! jx = 0.1330721523048277493333458596 + 0.5386295217249660078754395597*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
719 %! yx = -0.6485072392105829901122401551 + 0.2608129289785456797046996987*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
720 %! ix = -0.6182064685486998097516365709 + 0.4677561094683470065767989920*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
721 %! kx = -0.1568585587733540007867882337 - 0.05185853709490846050505141321*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
722 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
723 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
724 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
725 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
726 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
727 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
728 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
729 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
730 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
731 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
732 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
733 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
734 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
735 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
736 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
737 %!assert(besselj(-alpha,x), -jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
738 %!assert(bessely(-alpha,x), -yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
739 %!assert(besseli(-alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
740 %!assert(besselk(-alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
741 %!assert(besselh(-alpha,1,x), -(jx + I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
742 %!assert(besselh(-alpha,2,x), -(jx - I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
743 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
744 %!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
745 %!assert(bessely(-alpha,x,1), -yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
746 %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
747 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
748 %!assert(besselh(-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
749 %!assert(besselh(-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
750 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
751 %! # Bessel functions, fractional order, complex x |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
752 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
753 %! alpha = 3.5; x = 1.75 + 4.125 * I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
754 %! jx = -3.018566131370455929707009100 - 0.7585648436793900607704057611*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
755 %! yx = 0.7772278839106298215614791107 - 3.018518722313849782683792010*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
756 %! ix = 0.2100873577220057189038160913 - 0.6551765604618246531254970926*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
757 %! kx = 0.1757147290513239935341488069 + 0.08772348296883849205562558311*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
758 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
759 %!assert(besselj(alpha,x), jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
760 %!assert(bessely(alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
761 %!assert(besseli(alpha,x), ix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
762 %!assert(besselk(alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
763 %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
764 %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
765 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
766 %!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
767 %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
768 %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
769 %!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
770 %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
771 %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
772 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
773 %! nix = 0.09822388691172060573913739253 - 0.7110230642207380127317227407*I; |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
774 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
775 %!assert(besselj(-alpha,x), yx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
776 %!assert(bessely(-alpha,x), -jx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
777 %!assert(besseli(-alpha,x), nix, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
778 %!assert(besselk(-alpha,x), kx, 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
779 %!assert(besselh(-alpha,1,x), -I*(jx + I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
780 %!assert(besselh(-alpha,2,x), I*(jx - I*yx), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
781 %! |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
782 %!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
783 %!assert(bessely(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
784 %!assert(besseli(-alpha,x,1), nix*exp(-abs(real(x))), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
785 %!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
786 %!assert(besselh(-alpha,1,x,1), -I*(jx + I*yx)*exp(-I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
787 %!assert(besselh(-alpha,2,x,1), I*(jx - I*yx)*exp(I*x), 100*eps) |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
788 */ |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
789 |
059fadc0cbc3
fix scaling factor for negative alpha in zbesi,cbesi
Brian Gough <bjg@gnu.org>
parents:
7031
diff
changeset
|
790 /* |
3155 | 791 ;;; Local Variables: *** |
792 ;;; mode: C++ *** | |
793 ;;; End: *** | |
794 */ |