Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I need matrix H. G is working, but H is just derivative?? How to obtain?

   g = Integrate[x^(p + q - 2*(m + n + 1)), {x, -1, 1}];
   h = Integrate[D[x^(p + q - 2*(m + n + 1)), {x, 2}], {x, -1, 1}];



   c[r_, n_] := ((-1)^n (2 r - 2 n - 7)!!)/(2^n n! (r - 2 n - 1)!);

   G = Table[Sum[c[p, n] c[q, m] (g), {m, 0, (q - 1)/2}, {n, 0, (p - 1)/2}], {p,
  5, 12}, {q, 5, 12}];


   H = Table[Sum[c[p, n] c[q, m] (h), {m, 0, (q - 1)/2}, {n, 0, (p - 1)/2}], {p,
  5, 12}, {q, 5, 12}];

   G // MatrixForm
   H // MatrixForm
share|improve this question
    
Can you do me a favor and give some details as to the mathematics problem you're trying to solve? If we can understand what it is you're trying to accomplish, we may be able to provide better answers. –  rcollyer Nov 16 '11 at 20:33

1 Answer 1

The problem lies with the upper limits on $m$ and $n$ in the definition of $H$. Going back to the integral,

$$\int^{1}_{-1} \frac{d^2}{dx^2} x^{p + q - 2(m + n + 1)} dx$$

which Mathematica returns as

(-1 - 2 (1 + m + n) + p + q) (-2 (1 + m + n) + p + q) 
* If[ Re[-2 m - 2 n + p + q] > 3, 
      ... , 
      Integrate[x^(-2 - 2 (1 + m + n) + p + q), {x, -1, 1}, 
        Assumptions -> Re[-2 m - 2 n + p + q] <= 3]
  ]

which I've abbreviated for readability. The key is the condition $\Re(-2(m+n) + (p+q))>3$, which is not true for $m = (q - 1)/2$ and $n = (p-1)/2$. So, at that point, the false branch of If is returned.

The difficulty is that you're trying to have Mathematica automatically do all the work for you, like in this similar question. When $m = (q - 1)/2$ and $n = (p-1)/2$, $p + q - 2(m + n + 1) = 0$ implying that the derivative should be zero. However, when the derivative was taken, Mathematica had no knowledge of this difficulty, so it gives the wrong result.

I'd do the following:

g = Piecewise[{
     {Integrate[x^(p + q - 2*(m + n + 1)), {x, -1, 1}, 
       Assumptions -> (-2 (m - n) + p + q) > 1], 
      -2 (m - n) + p + q > 1},
    {2,  -2 m - 2 n + p + q == 1}}]

h = Piecewise[{
     {Integrate[D[x^(p + q - 2*(m + n + 1)),{x,2}], {x, -1, 1}, 
       Assumptions -> (-2 (m - n) + p + q) > 3], 
      -2 (m - n) + p + q > 3} }]

where h does not require the second condition as it is zero anyway.

share|improve this answer
    
Doesn't work again h? –  George Nov 4 '11 at 18:10
    
@George, looking at the terms in H for all $p=q$ between $5$ and $12$, they add identically to zero. For a lot of the other values of $p$ and $q$, all of the terms are identically equal to zero. –  rcollyer Nov 4 '11 at 18:29
    
Why it is problem again with matrix H? It should be diagonal, not all elements zero??? –  George Nov 4 '11 at 18:30
    
The problem is the same and matrix G=X1 but matrix H is not equal with Y1. Y1 is right answer, but how to get it following your instructions? f[r_] := Sum[(((-1)^n*(2*r - 2*n - 7)!!)/(2^nn!*(r-2*n - 1)!)) x^(r - 2*n - 1), {n, 0, r/2}]; Nw := Transpose[Table[f[j], {i, 1}, {j, 5, 12, 1}]]; X1 = Integrate[Nw.Transpose[Nw], {x, -1, 1}]; Y1 = Integrate[D[Nw, {x, 2}].Transpose[D[Nw, {x, 2}]], {x, -1, 1}]; MatrixForm[X1] MatrixForm[Y1] –  George Nov 4 '11 at 18:46
    
@George, give me several hours to get back to this. I'll take a look at it then. –  rcollyer Nov 4 '11 at 18:47

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.