Przemek

35 Reputation

4 Badges

12 years, 306 days

MaplePrimes Activity


These are questions asked by Przemek

What method is implemented in the procedure int with option numeric? Does the method depend on the integrand? Where can I find this information? 

I wrote the following procedure that evaluates i-th B-spline basis function of degree n over the knot vector T:

N := proc(i, n, t, T)

if (n = 0) then
    if ((t >= T[i]) and (t < T[i+1])) then
        return 1.0:
    else
        return 0.0:
    fi:
fi:

return (evalf((t-T[i])/(T[i+n]-T[i]))*N(i, n-1, t, T) + evalf((T[i+n+1]-t)/(T[i+n+1]-T[i+1]))*N(i+1, n-1, t, T)):

end proc:

 

Now, I want to compute

int(N(i, n, t, T)*N(j, n, t, T), t=0..1, numeric),

where i, n and T are given. However, Maple evaluates N and, since t is unknown, I get the following error:

"Error, (in N) cannot determine if this expression is true or false: .1 <= t and t < .25"

In http://www.maplesoft.com/support/help/Maple/view.aspx?path=evalf/Int  I read that in order to integrate a procedure, one should write (see the example given there)

evalf(Int(N*N, 0..1));

however, in my case, It will not work because I must pass the known parameters i, n and T. Is there a way to solve my problem?

 

 

 

 

I have the following code of a plot:

plot(
[
add(BS(bb[4], t, i, 3)*bb[1](i+1), i = 0..n),
add(BS(bb[4], t, i, 3)*bb[2](i+1), i = 0..n),
t = 0..1
],
color=red, axes=normal, scaling=constrained, numpoints=100, thickness=2
):

and I get the following error:

Error, (in BS) cannot determine if this expression is true or false: 0 <= t and t < .54901960784313725490196078431373

The problem is that, in the definition of BS, there are some conditions that depend on the variable t. It seems that Maple does not use a specific value of t when executing BS. My solution is to plot specific points, i.e., 

plot(
[
seq([add(BS(bb[4], h/5000, i, 3)*bb[1](i+1), i = 0..n),
add(BS(bb[4], h/5000, i, 3)*bb[2](i+1), i = 0..n)], h=0..5000)
],
color=red, axes=normal, scaling=constrained, numpoints=100, thickness=2
):

Can this be done in a more elegant way?

 

 

I have several plots and I'm using the display procedure,

display(seq(p1[i], i = 1..3), pts1, pts2);

to draw them. I want them to be displayed in the specified order, i.e., pts1 and pts2 should be in the foreground. Unfortunately, the display procedure ignores the order. How to enforce the specified order?

I'm computing a matrix which is a hessian of a quadratic function and it should be symmetric.

Unfortunately, because of the numerical errors, the hessian matrix becomes unsymmetric. 

Then, I want to use this matrix as the input for the QPSolve procedure, and I get the error that the matrix is unsymmetric.  

To obtain the symmetric matrix, I'm doing the following redundant computation:

A := MTM[triu](B, 1) + Transpose(MTM[triu](B)):

Is there a better solution to this problem?

1 2 3 Page 1 of 3