bipolyder


Untitled

Differentiate bipolynomials

Syntax

dF = bipolyder(P,d)

Description

dF = bipolyder(P,d), returns the partial derivative of the bipolynomial, P, with respect to dimension d ( = 1 or 2). The derivative is stored as a bivariate polynomial as described in the documentation of function bipolyval. (Note: Unlike the (univariate) polynomial case, in the bipolynomial case, the returned result is always the same size as the input bipolynomial coefficient matrix P.)

Examples

Example 1 Computing the Jacobian for mapping a square to a quadrilateral
Consider the set of bivariate polynomials,
which can be used to map the bi-unit square to a quadrilateral with vertices and via the mapping functions
The so-called Jacobian (determinant) of this mapping is given by
which in general is a function of x and y; however, in the case when is a parallelogram, the mapping is affine and J is constant and equal to of the area of .
This can be demonstrated by a simple example. First, consider the vertices of a given by
Xi = [ 0 3 3 0 ]; Yi = [ 0 0 1 1 ];
which defines a rectangle measuring 3 by 1. Next, the bipolynomials can be defined as products of the polynomial functions
e.g., . By defining these in MATLAB® polynomial form, i.e.,
pq1 = 1/2*[-1 1]; pq2 = 1/2*[ 1 1 ];
(note that and are identical in terms of their MATLAB® representations), the bipolynomial forms can then be easily constructed as
P1 = pq1’*pq1; P2 = pq1’*pq2;
P3 = pq2’*pq2; P4 = pq2’*pq1;
The mapping is thus given by
X = Xi(1)*P1 + Xi(2)*P2 + Xi(3)*P3 + Xi(4)*P4;
Y = Yi(1)*P1 + Yi(2)*P2 + Yi(3)*P3 + Yi(4)*P4;
Finally, the bipolyder function can be used to compute the necessary partial derivatives for the Jacobian calculation, i.e.,
dXdx = bipolyder(X,1); dXdy = bipolyder(X,2);
dYdx = bipolyder(Y,1); dYdy = bipolyder(Y,2);
and evaulating the Jacobian at any point, say the center of S , via the formula for the Jacobian given above, it is seen that
J = bipolyval(dXdx,[0 0])*bipolyval(dYdy,[0 0])
– bipolyval(dXdy,[0 0])*bipolyval(dYdx,[0 0])
J = 0.7500
which, indeed, is times the area of . This will be the case at any point (since the Jacobian is constant), for example, at the vertex of S , it is found
J = bipolyval(dXdx,[1 1])*bipolyval(dYdy,[1 1])
– bipolyval(dXdy,[1 1])*bipolyval(dYdx,[1 1])
J = 0.7500
The example below demonstrates a case where the Jacobian is not constant and in fact problematic.
Example 2 A negative Jacobian
Again, consider the set of bivariate polynomials of Example 1 above. One restriction on the use of general quadrilaterals in the finite element method is that the Jacobian of the mapping given above must be positive at every point in . A simple example shows this is not always the case for general quadrilaterals. For example, consider defined by the vertice
Xi = [ 0 3 1 0 ]; Yi = [ 0 0 1 2 ];
A plot reveals these vertices give rise to a rather poorly-shaped quadrilateral (in fact, a concave quadrilateral).
plot([Xi Xi(1)],[Yi Yi(1)],‘b-‘,‘LineWidth’,2);
Using the same set of functions from Example 1, the mapping is defined as
X = Xi(1)*P1 + Xi(2)*P2 + Xi(3)*P3 + Xi(4)*P4;
Y = Yi(1)*P1 + Yi(2)*P2 + Yi(3)*P3 + Yi(4)*P4;
and computing the partial derivatives using the bipolyder function
dXdx = bipolyder(X,1); dXdy = bipolyder(X,2);
dYdx = bipolyder(Y,1); dYdy = bipolyder(Y,2);
it is found, for example, that at point
J = bipolyval(dXdx,[0 0])*bipolyval(dYdy,[0 0])
– bipolyval(dXdy,[0 0])*bipolyval(dYdx,[0 0])
J = 0.6250
which is positive, but this time at the vertex , it is found
J = bipolyval(dXdx,[1 1])*bipolyval(dYdy,[1 1])
– bipolyval(dXdy,[1 1])*bipolyval(dYdx,[1 1])
J = -0.2500
which is negative! This type of quadrilateral could not be used in the finite element method.

This function is part of……..