Oh I forgot to say how to use it. If c are your coefficients for a degree n 
interpolant on [a, b] then the coefficients of the derivative of that 
interpolant are der_matrix(n, a, b) * c

On Saturday, April 4, 2015 at 11:39:49 PM UTC-4, Spencer Lyon wrote:

I have a function that will compute the derivative matrix operator that 
> transforms coefficients of a Chebyshev interpolant on interval [a, b] of 
> degree n (so n+1 total Chebyshev basis functions T_0, T_1, … T_n) into the 
> coefficients of a degree n-1 chebyshev interpolant on [a, b] that is the 
> exact derivative of the first interpolant. Maybe it could help you:
>
> # derivative matrix
> function der_matrix(deg::Int, a::Real=-1, b::Real=1)
>     N = deg
>     D = zeros(Float64, N, N+1)
>     for i=1:N, j=1:N+1
>         if i == 1
>             if iseven(i + j)
>                 continue
>             end
>             D[i, j] = 2*(j-1)/(b-a)
>         else
>             if j < i || iseven(i+j)
>                 continue
>             end
>             D[i, j] = 4*(j-1)/(b-a)
>         end
>     end
>
>     D
> end
>
> On Thursday, April 2, 2015 at 10:38:48 AM UTC-4, Tamas Papp wrote:
>
> Hi, 
>>
>> Can someone point me to some Julia code that calculates a matrix for the 
>> derivatives of the Chebyshev polynomials T_j, at given values, ie 
>>
>> d^k T_i(x_j) / dx^k    for i=1,..n, j for some and vector x. 
>>
>> The Chebyshev polynomials themselves are very easy to calculate using 
>> the recurrence relation, but derivatives are not. Alternatively, maybe 
>> this can be extracted from ApproxFun but I have not found a way. 
>>
>> Best, 
>>
>> Tamas 
>>
> ​
>
​

Reply via email to