Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to solve an electrodynamics problem numerically by using B-splines a basis function. Please don't ask me why, but if you really wanna know, here is the assignment.

Using the following code, I have successfully plotted the B-spline basis functions in two dimensions, given the specific knot sequence and the respective x and y intervals.

knots = {0, 0, 0, 0, 0.2, 1, 1, 1, 1}
Plot3D[Evaluate[Table[BSplineBasis[{4, knots}, i, x], {i, 0, 3}]] Evaluate[
Table[BSplineBasis[{4, knots}, i, y], {i, 0, 3}]], {x, 0, 1}, {y, 0, 1}]

The corresponding plot looks like this:

enter image description here

Now I am trying to do the same for the second derivatives of the B-splines, using the following code:

knots = {0, 0, 0, 0, 0.2, 1, 1, 1, 1}
Plot3D[Evaluate[Table[D[BSplineBasis[{4, knots}, i, x], {x, 2}], {i, 0, 3}]] 
Evaluate[Table[D[BSplineBasis[{4, knots}, i, y], {y, 2}], {i, 0, 3}]],
{x, 0, 1}, {y, 0, 1}]

However, it does not work and produces an empty graph and lots of red error messages. I have tried several combinations of the D, Table and Evaluate operators, but nothing seems to work. What am I doing wrong?

share|improve this question
    
Why not doing the multiplication inside one Table ? –  b.gatessucks Apr 30 '13 at 14:53
    
Is this what you want? knots = {0, 0, 0, 0, 0.2, 1, 1, 1, 1}; e1 = Evaluate[ Table[D[BSplineBasis[{4, knots}, i, x], {x, 2}], {i, 0, 3}]]; e2 = Evaluate[ Table[D[BSplineBasis[{4, knots}, i, y], {y, 2}], {i, 0, 3}]]; Plot3D[ e1*e2, {x, 0, 1}, {y, 0, 1}] –  MaTECmatica Apr 30 '13 at 14:58
    
@b.gatessucks: yes, both your answers solve my problem and give me the result I want! –  lomppi Apr 30 '13 at 15:01
    
@QuantumMathematica: yes, both your answers solve my problem and give me the result I want! –  lomppi Apr 30 '13 at 15:02
    
Plot3D[Evaluate[Table[D[BSplineBasis[{4, knots}, i, \[FormalX]], {\[FormalX], 2}] D[BSplineBasis[{4, knots}, i, \[FormalY]], {\[FormalY], 2}] /. {\[FormalX] -> x, \[FormalY] -> y}, {i, 0, 3}]], {x, 0, 1}, {y, 0, 1}] –  J. M. Apr 30 '13 at 15:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.