NAG CL Interface
e02rbc (pade_​eval)

Settings help

CL Name Style:


1 Purpose

e02rbc evaluates a rational function at a user-supplied point, given the numerator and denominator coefficients.

2 Specification

#include <nag.h>
void  e02rbc (const double a[], Integer ia, const double b[], Integer ib, double x, double *ans, NagError *fail)
The function may be called by the names: e02rbc, nag_fit_pade_eval or nag_1d_pade_eval.

3 Description

Given a real value x and the coefficients aj, for j=0,1,,l and bk, for k=0,1,,m, e02rbc evaluates the rational function
j=0lajxj k=0mbkxk .  
using nested multiplication (see Conte and de Boor (1965)).
A particular use of e02rbc is to compute values of the Padé approximants determined by e02rac.

4 References

Conte S D and de Boor C (1965) Elementary Numerical Analysis McGraw–Hill
Peters G and Wilkinson J H (1971) Practical problems arising in the solution of polynomial equations J. Inst. Maths. Applics. 8 16–35

5 Arguments

1: a[ia] const double Input
On entry: a[j], for j=1,2,,l+1, must contain the value of the coefficient aj in the numerator of the rational function.
2: ia Integer Input
On entry: the value of l+1, where l is the degree of the numerator.
Constraint: ia1.
3: b[ib] const double Input
On entry: b[k], for k=1,2,,m+1, must contain the value of the coefficient bk in the denominator of the rational function.
Constraint: if ib=1, b[0]0.0.
4: ib Integer Input
On entry: the value of m+1, where m is the degree of the denominator.
Constraint: ib1.
5: x double Input
On entry: the point x at which the rational function is to be evaluated.
6: ans double * Output
On exit: the result of evaluating the rational function at the given point x.
7: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, ia=value.
Constraint: ia1.
On entry, ib=value.
Constraint: ib1.
NE_INT_ARRAY
The first ib entries in b are zero: ib=value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_POLE_PRESENT
Evaluation at or near a pole.

7 Accuracy

A running error analysis for polynomial evaluation by nested multiplication using the recurrence suggested by Kahan (see Peters and Wilkinson (1971)) is used to detect whether you are attempting to evaluate the approximant at or near a pole.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
e02rbc is not threaded in any implementation.

9 Further Comments

The time taken is approximately proportional to l+m.

10 Example

This example first calls e02rac to calculate the 4/4 Padé approximant to ex, and then uses e02rbc to evaluate the approximant at x=0.1,0.2,,1.0.

10.1 Program Text

Program Text (e02rbce.c)

10.2 Program Data

None.

10.3 Program Results

Program Results (e02rbce.r)
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 0 2 4 6 8 10 12 14 16 18 20 22 0 0.5 1 1.5 2 2.5 3 1e−14 1e−12 1e−10 1e−08 1e−06 0.0001 0.01 y(x) Error x Example Program The [4|4] Pade Approximant of exp(x) gnuplot_plot_1 Pade gnuplot_plot_2 exp(x) gnuplot_plot_3 Error