acer

32358 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

LinearSolve uses a general (full rectangular dense) solver on tridiagonal linear floating-point systems. For real data, that means LAPACK dgetrf and dgetrs (NAG f07adf and f07aef). But LinearSolve could be taught to instead use dgttrf and dgttrs which are specialized.

> infolevel[LinearAlgebra]:=1:
> with(LinearAlgebra):

> f := n->Matrix(n,n,shape=band[1,1],scan=band[1,1],
>    [[1$(n-1)],[seq(i,i=1..n)],[1$(n-1)]],
>    storage=rectangular,datatype=float[8]):

> rtable_indfns(f(5)); # it's tridiagonal in structure...
                                  band[1, 1]
 
> rtable_options(f(5),storage); # ...and full storage, as dgttrf expects
                                  rectangular

> LinearSolve(evalf(f(5)),evalf(Vector(5,i->i)));
LinearSolve:   "using method"   LU
LinearSolve:   "calling external function"
LinearSolve:   "NAG"   hw_f07adf
LinearSolve:   "NAG"   hw_f07aef
                            [0.696969696969697017]
                            [                    ]
                            [0.303030303030302983]
                            [                    ]
                            [0.696969696969697017]
                            [                    ]
                            [0.606060606060606077]
                            [                    ]
                            [0.878787878787878896]

Moreover, if the (real) Matrix is symmetric positive-definite then dpttrf and dpttrs could be used.

> type(f(5),'Matrix'(symmetric));
                                     true

> IsDefinite(evalf(f(5)),query=positive_definite);
                                     true

acer

> h := n-> Matrix(n,n,scan=band[1,1],[[seq(x[i]^2,i=2..n)],
>            [seq(x[i],i=1..n)],[seq(2*x[i],i=1..n-1)]]):

> h(5);
                [x[1]     2 x[1]      0         0         0   ]
                [                                             ]
                [    2                                        ]
                [x[2]      x[2]     2 x[2]      0         0   ]
                [                                             ]
                [             2                               ]
                [  0      x[3]       x[3]     2 x[3]      0   ]
                [                                             ]
                [                       2                     ]
                [  0        0       x[4]       x[4]     2 x[4]]
                [                                             ]
                [                                 2           ]
                [  0        0         0       x[5]       x[5] ]

acer

> h := n-> Matrix(n,n,scan=band[1,1],[[seq(x[i]^2,i=2..n)],
>            [seq(x[i],i=1..n)],[seq(2*x[i],i=1..n-1)]]):

> h(5);
                [x[1]     2 x[1]      0         0         0   ]
                [                                             ]
                [    2                                        ]
                [x[2]      x[2]     2 x[2]      0         0   ]
                [                                             ]
                [             2                               ]
                [  0      x[3]       x[3]     2 x[3]      0   ]
                [                                             ]
                [                       2                     ]
                [  0        0       x[4]       x[4]     2 x[4]]
                [                                             ]
                [                                 2           ]
                [  0        0         0       x[5]       x[5] ]

acer

g:=n->LinearAlgebra:-ToeplitzMatrix([0$(n-1),c,b,a,0$(n-1)]);

g(7);

acer

g:=n->LinearAlgebra:-ToeplitzMatrix([0$(n-1),c,b,a,0$(n-1)]);

g(7);

acer

Apparently there's neat stuff known about this (here, here) and the condition might be simply that numbcomb(3*i,i) is odd.

> G:=n->map(x->[op(x),seq(0,i=1..n-nops(x))],
>           {seq(`if`(type(binomial(3*i,i),odd),convert(i,base,2),
>                     NULL),i=0..(2^n-1))}):


> G(6);
{[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0],
 
    [0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1], [0, 0, 1, 0, 0, 0],
 
    [0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0],
 
    [0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0],
 
    [0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1],
 
    [1, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1],
 
    [1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0]}

What I wonder about now is the OP's handle. Did the OP know of the connection to fibonacci numbers?

acer

Apparently there's neat stuff known about this (here, here) and the condition might be simply that numbcomb(3*i,i) is odd.

> G:=n->map(x->[op(x),seq(0,i=1..n-nops(x))],
>           {seq(`if`(type(binomial(3*i,i),odd),convert(i,base,2),
>                     NULL),i=0..(2^n-1))}):


> G(6);
{[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0],
 
    [0, 0, 0, 1, 0, 0], [0, 0, 0, 1, 0, 1], [0, 0, 1, 0, 0, 0],
 
    [0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0],
 
    [0, 1, 0, 0, 0, 1], [0, 1, 0, 0, 1, 0], [0, 1, 0, 1, 0, 0],
 
    [0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1],
 
    [1, 0, 0, 0, 1, 0], [1, 0, 0, 1, 0, 0], [1, 0, 0, 1, 0, 1],
 
    [1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 0]}

What I wonder about now is the OP's handle. Did the OP know of the connection to fibonacci numbers?

acer

I believe that it refers to Madam d'Urfe's use of a polyalphabetic (or Vignere) cipher, used to encrypt her document which explained the secret of transmuting base metals into gold.

Supposedly, the key was NABUCODONOSOR. That is Italian for Nebuchadnezzar, a name that I did not expect to write on mapleprimes.

acer

I believe that it refers to Madam d'Urfe's use of a polyalphabetic (or Vignere) cipher, used to encrypt her document which explained the secret of transmuting base metals into gold.

Supposedly, the key was NABUCODONOSOR. That is Italian for Nebuchadnezzar, a name that I did not expect to write on mapleprimes.

acer

It's difficult, without an example, to know what might be happening here. The problem could be how Maple's handling the example, or something to do with the fact that it's getting passed in from Matlab.

Could you post the example, or upload it here as a file?

acer

It's difficult, without an example, to know what might be happening here. The problem could be how Maple's handling the example, or something to do with the fact that it's getting passed in from Matlab.

Could you post the example, or upload it here as a file?

acer

I see, you were using the fact that sets "uniquify" their members and get rids of duplicates. You might use the {} as you had before, to eliminate duplicates. Then, before sorting, convert T to a list, ie. T:=convert(T,list);

Not to throw you off track, as you've been making progress, but I might have chosen a Maple table rather than a list of lists as structure to represent a roll. It's not a big deal -- you should be able to succeed with your own way.

acer

I see, you were using the fact that sets "uniquify" their members and get rids of duplicates. You might use the {} as you had before, to eliminate duplicates. Then, before sorting, convert T to a list, ie. T:=convert(T,list);

Not to throw you off track, as you've been making progress, but I might have chosen a Maple table rather than a list of lists as structure to represent a roll. It's not a big deal -- you should be able to succeed with your own way.

acer

The first thing I tried was D, naturally. But for some reason, I just forgot about VectorCalculus.

Now it makes me wonder, couldn't :-D sensibly apply VectorCalculus:-D to Vector-valued functions? Right now it just returns unevaluated, and even evalf (fdiff) doesn't do anything with it. Would it necessarily slow :-D down too much, to check?

acer

The first thing I tried was D, naturally. But for some reason, I just forgot about VectorCalculus.

Now it makes me wonder, couldn't :-D sensibly apply VectorCalculus:-D to Vector-valued functions? Right now it just returns unevaluated, and even evalf (fdiff) doesn't do anything with it. Would it necessarily slow :-D down too much, to check?

acer

First 513 514 515 516 517 518 519 Last Page 515 of 592