## Name:

composepolynomials computes an approximation to the composition of two polynomials and bounds the error

## Library name:

sollya_obj_t sollya_lib_composepolynomials(sollya_obj_t, sollya_obj_t)

## Usage:

composepolynomials(p,q) : (function, function) -> structure

## Parameters:

• p and q are polynomials

## Description:

• Given two polynomials p and q, composepolynomials(p, q) computes an approximation r to the polynomial (p o q) and bounds the error polynomial r - (p o q) using interval arithmetic.
• composepolynomials always returns a structure containing two elements, poly and radii. The element poly is contains the approximate composed polynomial r. The element radii contains a list of n + 1 intervals ai bounding the coefficients of the error polynomial, which is of the same degree n as is the composed polynomial (p o q). This is, there exist alphai in ai such that sum_i alphai * x^i = r(x) - (p o q)(x).
• In the case when either of p or q is not a polynomial, composepolynomials behaves like substitute used in a literate structure. The list of intervals bounding the coefficients of the error polynomial is returned empty.

## Example 1:

> composepolynomials(1 + 2 * x + 3 * x^2 + 4 * x^3, 5 + 6 * x + 7 * x^2);
{ .radii = [|[0;0], [0;0], [0;0], [0;0], [0;0], [0;0], [0;0]|], .poly = 586 + x * (1992 + x * (4592 + x * (6156 + x * (6111 + x * (3528 + x * 1372))))) }

## Example 2:

> print(composepolynomials(1/5 * x + exp(17) + log(2) * x^2, x^4 + 1/3 * x^2));
{ .radii = [|[-3.5873240686715317015647477332221852960774705712039e-43;3.5873240686715317015647477332221852960774705712039e-43], [0;0], [-2.672764710092195646140536467151481878815196880105e-51;2.672764710092195646140536467151481878815196880105e-51], [0;0], [-1.069105884036878258456214586860592751526078752042e-50;1.069105884036878258456214586860592751526078752042e-50], [0;0], [-2.138211768073756516912429173721185503052157504084e-50;2.138211768073756516912429173721185503052157504084e-50], [0;0], [-1.069105884036878258456214586860592751526078752042e-50;1.069105884036878258456214586860592751526078752042e-50]|], .poly = 2.41549527535752982147754351803858238798675673527228e7 + x^2 * (6.6666666666666666666666666666666666666666666666666e-2 + x^2 * (0.2770163533955494788241369023842418408972777927067 + x^2 * (0.46209812037329687294482141430545104538366675624017 + x^2 * 0.69314718055994530941723212145817656807550013436026))) }

## Example 3:

> composepolynomials(sin(x),x + x^2);
{ .radii = [| |], .poly = sin(x * (1 + x)) }