Maple 2018 Questions and Posts

These are Posts and Questions associated with the product, Maple 2018

Let be given a cylinder with radius of the base circle is equal to 3 and the altitude of the cylinder is equal to 2. How can I draw square ABCD so that A, B and C, D lie on two base circles. How can I get one option of all vetices A, B, C, D ?

I would like to draw an ellipse by orthonal affinity of a circle. Thank you.

i want to solve the systems of diff equation what's the problem   0.mw

I calculate volume of tetrahedron SABC by this way. Now, I want to find one option  of coordinates of all vertices of this tetrahedron. How can I get the coordinates of the points S, A, B, C so that coordinates  center of circumcircle of the triangle ABC is (0,0,0)?

 

restart:
SA := 3: 
SB := 5: 
SC := 7:
AB := 3:
BC := 4: 
AC := 5:
V := (1/12)*sqrt(SA^2*BC^2*(AB^2+AC^2-BC^2-SA^2+SB^2+SC^2)+SB^2*AC^2*(AB^2-AC^2+BC^2+SA^2-SB^2+SC^2)+SC^2*AB^2*(-AB^2+AC^2+BC^2+SA^2+SB^2-SC^2)-SA^2*AB^2*SB^2-SB^2*BC^2*SC^2-SA^2*AC^2*SC^2-AB^2*BC^2*AC^2);

From here https://www.mapleprimes.com/questions/227573-How-To-Get-Coordinates-Of-Triangle-ABC
I find coordinates of the point A, B, C. Now I tried
 

with(geom3d):
point(A, -3/2, -2, 0):
point(B, 3/2, -2, 0):
point(C, -3/2, 2, 0):
point(S, x, y, z):
solve([distance(S, A) = 3, distance(S, B) = 5, distance(S, C) = 7], [x, y, z], explicit);
with(geom3d):
point(A, -3/2, -2, 0):
point(B, 3/2, -2, 0):
point(C, -3/2, 2, 0):
point(S, x, y, z):
solve([distance(S, A) = 5, distance(S, B) = 3, distance(S, C) = 7], [x, y, z], explicit);

Use the above code, I obtain the result.

Lang_2_output_as_tswitch_varies.mw

^ in this worksheet I have made a graph of a variable in a simple ODE against time (shown below), at t=150 a switch condition, in the worksheet called tswitch, changes the rates of change of the ODE.

I am thinking about afunction that maps tswitch->solution of the ODE and would like to visualise it as a 3d surface, but couldn't work it out in Maple

 

How to get correct result this equation
restart; with(Student:-MultivariateCalculus);
A := [0, 0, 0];
B := [c, 0, 0];
S := [x, 0, z];
solve([Distance(S, A) = a, Distance(S, B) = b], [x, z]) assuming and(a > 0, b > 0, c > 0);

I have just made a bar graph in Visualising_numerous_derivatives_of_the_L2_model.mw

and i would like to set it to be logscaled, but could not find an option in the documentation, or a way of using a logplot to get similar functionality

This post is closely related to the previous one  https://www.mapleprimes.com/posts/210930-Numbrix-Puzzle-By-The-Branch-And-Bound-Method  which presents the procedure  NumbrixPuzzle   that allows you to effectively solve these puzzles (the text of this procedure is also available in the worksheet below).  
This post is about generating these puzzles. To do this, we need the procedure  SerpentinePaths  (see below) , which allows us to generate a large number of serpentine paths in a matrix of a specified size, starting with a specified matrix element. Note that for a square matrix of the order  n , the number of such paths starting from [1,1] - position is the sequence  https://oeis.org/search?q=1%2C2%2C8%2C52%2C824&language=english&go=Search .

The required parameter of  SerpentinePaths procedure is the list  S , which defines the dimensions of the matrix. The optional parameter is the list  P  - this is the position of the number 1 (by default P=[1,1] ).
As an example below, we generate 20 puzzles of size 6 by 6. In exactly the same way, we can generate the desired number of puzzles for matrices of other sizes.


 

restart;

SerpentinePaths:=proc(S::list, P::list:=[1,1])
local OneStep, A, m, F, B, T, a;

OneStep:=proc(A::listlist)
local s, L, B, T, k, l;

s:=max[index](A);
L:=[[s[1]-1,s[2]],[s[1]+1,s[2]],[s[1],s[2]-1],[s[1],s[2]+1]];
T:=table(); k:=0;
for l in L do
if l[1]>=1 and l[1]<=S[1] and l[2]>=1 and l[2]<=S[2] and A[op(l)]=0 then k:=k+1; B:=subsop(l=a+1,A);
T[k]:=B fi;
od;
convert(T, list);
end proc;
A:=convert(Matrix(S[], {(P[])=1}), listlist);
m:=S[1]*S[2]-1;
B:=[$ 1..m];
F:=LM->ListTools:-FlattenOnce(map(OneStep, `if`(nops(LM)<=30000,LM,LM[-30000..-1])));
T:=[A];
for a in B do
T:=F(T);
od;
map(convert, T, Matrix);

end proc:
 

NumbrixPuzzle:=proc(A::Matrix)
local A1, L, N, S, MS, OneStepLeft, OneStepRight, F1, F2, m, L1, p, q, a, b, T, k, s1, s, H, n, L2, i, j, i1, j1, R;
uses ListTools;
S:=upperbound(A); N:=nops(op(A)[3]); MS:=`*`(S);
A1:=convert(A, listlist);
for i from 1 to S[1] do
for j from 1 to S[2] do
for i1 from i to S[1] do
for j1 from 1 to S[2] do
if A1[i,j]<>0 and A1[i1,j1]<>0 and abs(A1[i,j]-A1[i1,j1])<abs(i-i1)+abs(j-j1) then return `no solutions` fi;
od; od; od; od;
L:=sort(select(e->e<>0, Flatten(A1)));
L1:=[`if`(L[1]>1,seq(L[1]-k, k=0..L[1]-2),NULL)];
L2:=[seq(seq(`if`(L[i+1]-L[i]>1,L[i]+k,NULL),k=0..L[i+1]-L[i]-2), i=1..nops(L)-1), `if`(L[-1]<MS,seq(L[-1]+k,k=0..MS-L[-1]-1),NULL)];
OneStepLeft:=proc(A1::listlist)
local s, M, m, k, T;
uses ListTools;
s:=Search(a, Matrix(A1));   
M:=[[s[1]-1,s[2]],[s[1]+1,s[2]],[s[1],s[2]-1],[s[1],s[2]+1]];
T:=table(); k:=0;
for m in M do
if m[1]>=1 and m[1]<=S[1] and m[2]>=1 and m[2]<=S[2] and A1[op(m)]=0 then k:=k+1; T[k]:=subsop(m=a-1,A1);
fi;
od;
convert(T, list);
end proc;
OneStepRight:=proc(A1::listlist)
local s, M, m, k, T, s1;
uses ListTools;
s:=Search(a, Matrix(A1));  s1:=Search(a+2, Matrix(A1));  
M:=[[s[1]-1,s[2]],[s[1]+1,s[2]],[s[1],s[2]-1],[s[1],s[2]+1]];
T:=table(); k:=0;
for m in M do
if m[1]>=1 and m[1]<=S[1] and m[2]>=1 and m[2]<=S[2] and A1[op(m)]=0 and `if`(a+2 in L, `if`(is(abs(s1[1]-m[1])+abs(s1[2]-m[2])>1),false,true),true) then k:=k+1; T[k]:=subsop(m=a+1,A1);
fi;
od;
convert(T, list);   
end proc;
F1:=LM->ListTools:-FlattenOnce(map(OneStepLeft, LM));
F2:=LM->ListTools:-FlattenOnce(map(OneStepRight, LM));
T:=[A1];
for a in L1 do
T:=F1(T);
od;
for a in L2 do
T:=F2(T);
od;
R:=map(t->convert(t,Matrix), T);
if nops(R)=0 then return `no solutions` else R fi;
end proc:


Simple examples

SerpentinePaths([3,3]);  # All the serpentine paths for the matrix  3x3, starting with [1,1]-position
SerpentinePaths([3,3],[1,2]);  # No solutions if the start with [1,2]-position
SerpentinePaths([4,4]):  # All the serpentine paths for the matrix  4x4, starting with [1,1]-position
nops(%);
nops(SerpentinePaths([4,4],[1,2]));  # The number of all the serpentine paths for the matrix  4x4, starting with [1,2]-position
nops(SerpentinePaths([4,4],[2,2]));  # The number of all the serpentine paths for the matrix  4x4, starting with [2,2]-position

[Matrix(3, 3, {(1, 1) = 1, (1, 2) = 6, (1, 3) = 7, (2, 1) = 2, (2, 2) = 5, (2, 3) = 8, (3, 1) = 3, (3, 2) = 4, (3, 3) = 9}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 8, (1, 3) = 7, (2, 1) = 2, (2, 2) = 9, (2, 3) = 6, (3, 1) = 3, (3, 2) = 4, (3, 3) = 5}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 8, (1, 3) = 9, (2, 1) = 2, (2, 2) = 7, (2, 3) = 6, (3, 1) = 3, (3, 2) = 4, (3, 3) = 5}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 4, (1, 3) = 5, (2, 1) = 2, (2, 2) = 3, (2, 3) = 6, (3, 1) = 9, (3, 2) = 8, (3, 3) = 7}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 9, (2, 1) = 4, (2, 2) = 3, (2, 3) = 8, (3, 1) = 5, (3, 2) = 6, (3, 3) = 7}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (2, 1) = 8, (2, 2) = 7, (2, 3) = 4, (3, 1) = 9, (3, 2) = 6, (3, 3) = 5}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (2, 1) = 8, (2, 2) = 9, (2, 3) = 4, (3, 1) = 7, (3, 2) = 6, (3, 3) = 5}), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 3, (2, 1) = 6, (2, 2) = 5, (2, 3) = 4, (3, 1) = 7, (3, 2) = 8, (3, 3) = 9})]

 

[]

 

52

 

25

 

36

(1)


Below we find 12,440 serpentine paths in the matrix  6x6 starting from various positions (the set  L )

k:=0:  n:=6:
for i from 1 to n do
for j from i to n do
k:=k+1; S[k]:=SerpentinePaths([n,n],[i,j])[];
od: od:
L1:={seq(S[i][], i=1..k)}:
L2:=map(A->A^%T, L1):
L:=L1 union L2:
nops(L);

12440

(2)


Further, using the list  L, we generate 20 examples of Numbrix puzzles with the unique solutions

T:='T':
N:=20:
M:=[seq(L[i], i=combinat:-randcomb(nops(L),N))]:
for i from 1 to N do
for k from floor(n^2/4) do
T[i]:=Matrix(n,{seq(op(M[i])[3][j], j=combinat:-randcomb(n^2,k))});
if nops(NumbrixPuzzle(T[i]))=1 then break; fi;
od:  od:
T:=convert(T,list):
T1:=[seq([seq(T[i+j],i=1..5)],j=[0,5,10,15])]:
DocumentTools:-Tabulate(Matrix(4,5, (i,j)->T1[i,j]), fillcolor = "LightYellow", width=95):


The solutions of these puzzles

DocumentTools:-Tabulate(Matrix(4,5, (i,j)->NumbrixPuzzle(T1[i,j])[]), fillcolor = "LightYellow", width=95):

 


For some reason, these 20 examples and their solutions did not load here.

 Edit. I separately inserted these generated 20 puzzles as a picture:

 

Download SerpPathsinMatrix.mw

 

Hello,

My question is mathematical in nature, so it might be a little out of place but I though I would give it a shot. 

You have a series of chebyshev coefficients in two connecting subdomains lets say S1 = [0,0.5] and S2=[0.5,1]. So far you are still in the spectral space. If you want to compute the solution in real space you can sum the coefficients with the Chebyshev polynomials. 

Now imagine you change the interval to S1 = [0,0.6] and S2 = [0.6,1]. Is there a way to manipulate the Chebyshev coefficients from both initial subdomains to create a new set of Chebyshev coefficients that fit the solution in the new subdomains. 

The brute force method would be to create the real solution of Chebyshev polynomials and then use that to form a new set of Chebyshev coefficients. Or you can use Clenshaw to compute the solution at several points, and then use the points to create new Chebyshev coefficients.

But what if we can stay in spectral space and create the new chebyshev coefficients. Is that possible? If so, how?

P; Q; lma; [3 -42] [-, ---] [2 25 ] [22649 -2304] [-----, -----] [5523 1841 ] 1.627112258 with(geometry); point(Pp, P[1], P[2]); point(Qp, Q[1], Q[2]); ellipse(p, ['foci' = [Pp, Qp], 'MajorAxis' = lma]); Error, (in geometry:-ellipse) the given polynomial/equation is not an algebraic representation of a ellipse; I can't understand this error

I want to find one option of coodiantes of vertices A, B, C of the triangle ABC, knowing that coordinates centre of circumcircle is O(0,0) and length of sides are 3, 5, 7. 
How can I get the result?

In this post, the Numbrix Puzzle is solved by the branch and bound method (see the details of this puzzle in  https://www.mapleprimes.com/posts/210643-Solving-A-Numbrix-Puzzle-With-Logic). The main difference from the solution using the  Logic  package is that here we get not one but all possible solutions. In the case of a unique solution, the  NumbrixPuzzle procedure is faster than the  Numbrix  one (for convenience, I inserted the code for Numbrix procedure into the worksheet below). In the case of many solutions, the  Numbrix  procedure is usually faster (see all the examples below).

 

restart;

NumbrixPuzzle:=proc(A::Matrix)
local A1, L, N, S, MS, OneStepLeft, OneStepRight, F1, F2, m, L1, p, q, a, b, T, k, s1, s, H, n, L2, i, j, i1, j1, R;
uses ListTools;
S:=upperbound(A); N:=nops(op(A)[3]); MS:=`*`(S);
A1:=convert(A, listlist);
for i from 1 to S[1] do
for j from 1 to S[2] do
for i1 from i to S[1] do
for j1 from 1 to S[2] do
if A1[i,j]<>0 and A1[i1,j1]<>0 and abs(A1[i,j]-A1[i1,j1])<abs(i-i1)+abs(j-j1) then return `no solutions` fi;
od; od; od; od;
L:=sort(select(e->e<>0, Flatten(A1)));
L1:=[`if`(L[1]>1,seq(L[1]-k, k=0..L[1]-2),NULL)];
L2:=[seq(seq(`if`(L[i+1]-L[i]>1,L[i]+k,NULL),k=0..L[i+1]-L[i]-2), i=1..nops(L)-1), `if`(L[-1]<MS,seq(L[-1]+k,k=0..MS-L[-1]-1),NULL)];
  

OneStepLeft:=proc(A1::listlist)
local s, M, m, k, T;
uses ListTools;
s:=Search(a, Matrix(A1));   
M:=[[s[1]-1,s[2]],[s[1]+1,s[2]],[s[1],s[2]-1],[s[1],s[2]+1]];
T:=table(); k:=0;
for m in M do
if m[1]>=1 and m[1]<=S[1] and m[2]>=1 and m[2]<=S[2] and A1[op(m)]=0 then k:=k+1; T[k]:=subsop(m=a-1,A1);
fi;
od;
convert(T, list);
end proc;

 
OneStepRight:=proc(A1::listlist)
local s, M, m, k, T, s1;
uses ListTools;
s:=Search(a, Matrix(A1));  s1:=Search(a+2, Matrix(A1));  
M:=[[s[1]-1,s[2]],[s[1]+1,s[2]],[s[1],s[2]-1],[s[1],s[2]+1]];
T:=table(); k:=0;
for m in M do
if m[1]>=1 and m[1]<=S[1] and m[2]>=1 and m[2]<=S[2] and A1[op(m)]=0 and `if`(a+2 in L, `if`(is(abs(s1[1]-m[1])+abs(s1[2]-m[2])>1),false,true),true) then k:=k+1; T[k]:=subsop(m=a+1,A1);
fi;
od;
convert(T, list);   
end proc;

F1:=LM->ListTools:-FlattenOnce(map(OneStepLeft, LM));
F2:=LM->ListTools:-FlattenOnce(map(OneStepRight, LM));

T:=[A1];
for a in L1 do
T:=F1(T);
od;

for a in L2 do
T:=F2(T);
od;

R:=map(t->convert(t,Matrix), T);
if nops(R)=0 then return `no solutions` else R[] fi;

end proc:

Numbrix := proc( M :: ~Matrix, { inline :: truefalse := false } )

local S, adjacent, eq, i, initial, j, k, kk, m, n, one, single, sol, unique, val, var, x;

    (m,n) := upperbound(M);

    initial := &and(seq(seq(ifelse(M[i,j] = 0
                                   , NULL
                                   , x[i,j,M[i,j]]
                                  )
                            , i = 1..m)
                        , j = 1..n));

    adjacent := &and(seq(seq(seq(x[i,j,k] &implies &or(NULL
                                                       , ifelse(i>1, x[i-1, j, k+1], NULL)
                                                       , ifelse(i<m, x[i+1, j, k+1], NULL)
                                                       , ifelse(j>1, x[i, j-1, k+1], NULL)
                                                       , ifelse(j<n, x[i, j+1, k+1], NULL)
                                                      )
                                 , i = 1..m)
                             , j = 1..n)
                         , k = 1 .. m*n-1));

    one := &or(seq(seq(x[i,j,1], i=1..m), j=1..n));   


    single := &not(&or(seq(seq(seq(seq(x[i,j,k] &and x[i,j,kk], kk = k+1..m*n), k = 1..m*n-1)
                                , i = 1..m), j = 1..n)));

    sol := Logic:-Satisfy(&and(initial, adjacent, one, single));
    
    if sol = NULL then
        error "no solution";
    end if;
if inline then
        S := M;
     else
        S := Matrix(m,n);
    end if;

    for eq in sol do
        (var, val) := op(eq);
        if val then
            S[op(1..2, var)] := op(3,var);
        end if;
    end do;
    S;
end proc:

           Two simple examples

A:=<0,0,5; 0,0,0; 0,0,9>;
# The unique solution
NumbrixPuzzle(A);

A:=<0,0,5; 0,0,0; 0,8,0>;
# 4 solutions
NumbrixPuzzle(A);

Matrix(3, 3, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 5, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 9})

 

Matrix(3, 3, {(1, 1) = 3, (1, 2) = 4, (1, 3) = 5, (2, 1) = 2, (2, 2) = 7, (2, 3) = 6, (3, 1) = 1, (3, 2) = 8, (3, 3) = 9})

 

Matrix(3, 3, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 5, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 8, (3, 3) = 0})

 

Matrix(%id = 18446746210121682686), Matrix(%id = 18446746210121682806), Matrix(%id = 18446746210121674750), Matrix(%id = 18446746210121674870)

(1)


Comparison with Numbrix procedure. The example is taken from
http://rosettacode.org/wiki/Solve_a_Numbrix_puzzle 

 A:=<0, 0, 0, 0, 0, 0, 0, 0, 0;
 0, 0, 46, 45, 0, 55, 74, 0, 0;
 0, 38, 0, 0, 43, 0, 0, 78, 0;
 0, 35, 0, 0, 0, 0, 0, 71, 0;
 0, 0, 33, 0, 0, 0, 59, 0, 0;
 0, 17, 0, 0, 0, 0, 0, 67, 0;
 0, 18, 0, 0, 11, 0, 0, 64, 0;
 0, 0, 24, 21, 0, 1, 2, 0, 0;
 0, 0, 0, 0, 0, 0, 0, 0, 0>;
CodeTools:-Usage(NumbrixPuzzle(A));
CodeTools:-Usage(Numbrix(A));

Matrix(9, 9, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 46, (2, 4) = 45, (2, 5) = 0, (2, 6) = 55, (2, 7) = 74, (2, 8) = 0, (2, 9) = 0, (3, 1) = 0, (3, 2) = 38, (3, 3) = 0, (3, 4) = 0, (3, 5) = 43, (3, 6) = 0, (3, 7) = 0, (3, 8) = 78, (3, 9) = 0, (4, 1) = 0, (4, 2) = 35, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = 71, (4, 9) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 33, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (5, 7) = 59, (5, 8) = 0, (5, 9) = 0, (6, 1) = 0, (6, 2) = 17, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0, (6, 7) = 0, (6, 8) = 67, (6, 9) = 0, (7, 1) = 0, (7, 2) = 18, (7, 3) = 0, (7, 4) = 0, (7, 5) = 11, (7, 6) = 0, (7, 7) = 0, (7, 8) = 64, (7, 9) = 0, (8, 1) = 0, (8, 2) = 0, (8, 3) = 24, (8, 4) = 21, (8, 5) = 0, (8, 6) = 1, (8, 7) = 2, (8, 8) = 0, (8, 9) = 0, (9, 1) = 0, (9, 2) = 0, (9, 3) = 0, (9, 4) = 0, (9, 5) = 0, (9, 6) = 0, (9, 7) = 0, (9, 8) = 0, (9, 9) = 0})

 

memory used=7.85MiB, alloc change=-3.01MiB, cpu time=172.00ms, real time=212.00ms, gc time=93.75ms

 

Matrix(9, 9, {(1, 1) = 49, (1, 2) = 50, (1, 3) = 51, (1, 4) = 52, (1, 5) = 53, (1, 6) = 54, (1, 7) = 75, (1, 8) = 76, (1, 9) = 81, (2, 1) = 48, (2, 2) = 47, (2, 3) = 46, (2, 4) = 45, (2, 5) = 44, (2, 6) = 55, (2, 7) = 74, (2, 8) = 77, (2, 9) = 80, (3, 1) = 37, (3, 2) = 38, (3, 3) = 39, (3, 4) = 40, (3, 5) = 43, (3, 6) = 56, (3, 7) = 73, (3, 8) = 78, (3, 9) = 79, (4, 1) = 36, (4, 2) = 35, (4, 3) = 34, (4, 4) = 41, (4, 5) = 42, (4, 6) = 57, (4, 7) = 72, (4, 8) = 71, (4, 9) = 70, (5, 1) = 31, (5, 2) = 32, (5, 3) = 33, (5, 4) = 14, (5, 5) = 13, (5, 6) = 58, (5, 7) = 59, (5, 8) = 68, (5, 9) = 69, (6, 1) = 30, (6, 2) = 17, (6, 3) = 16, (6, 4) = 15, (6, 5) = 12, (6, 6) = 61, (6, 7) = 60, (6, 8) = 67, (6, 9) = 66, (7, 1) = 29, (7, 2) = 18, (7, 3) = 19, (7, 4) = 20, (7, 5) = 11, (7, 6) = 62, (7, 7) = 63, (7, 8) = 64, (7, 9) = 65, (8, 1) = 28, (8, 2) = 25, (8, 3) = 24, (8, 4) = 21, (8, 5) = 10, (8, 6) = 1, (8, 7) = 2, (8, 8) = 3, (8, 9) = 4, (9, 1) = 27, (9, 2) = 26, (9, 3) = 23, (9, 4) = 22, (9, 5) = 9, (9, 6) = 8, (9, 7) = 7, (9, 8) = 6, (9, 9) = 5})

 

memory used=1.21GiB, alloc change=307.02MiB, cpu time=37.00s, real time=31.88s, gc time=9.30s

 

Matrix(%id = 18446746210094669942)

(2)


In the example below, which has 104 solutions, the  Numbrix  procedure is faster.

C:=Matrix(5,{(1,1)=1,(5,5)=25});
CodeTools:-Usage(NumbrixPuzzle(C)):
nops([%]);
CodeTools:-Usage(Numbrix(C)):

Matrix(5, 5, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 25})

 

memory used=0.94GiB, alloc change=-22.96MiB, cpu time=12.72s, real time=11.42s, gc time=2.28s

 

104

 

memory used=34.74MiB, alloc change=0 bytes, cpu time=781.00ms, real time=783.00ms, gc time=0ns

 

 


 

Download NumbrixPuzzle.mw

Dears, greeting for all

I have a problem, I try to explain it by a figure

This formula does not work.

I need to substitute n=0 to give G_n+1 as a function of the parameter s, then find the limit. 

.where G_n is a function in s.

this is the result

 

Hello!

I want to calculate Eigenvalues. Depending on values for digits and which datatype I choose Maple sometimes returns zero as Eigenvalues. Maybe there is a problem with the used routines: CLAPACK sw_dgeevx_, CLAPACK sw_zgeevx_.

Thank you for your suggestions!
 

``

 

Problems LinearAlgebra:-Eigenvalues, Digits, ':-datatype' = ':-sfloat', ':-datatype' = ':-complex'( ':-sfloat' )

 

restart;

interface( ':-displayprecision' = 5 ):
 

infolevel['LinearAlgebra'] := 5;
myPlatform := kernelopts( ':-platform' );
myVersion := kernelopts( ':-version' );

5

 

"windows"

 

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`

(1.1)

Example 1

 

A1 := Matrix( 5, 5, [[0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [-10201/1000, 30199/10000, -5049/250, 97/50, -48/5]] );

Matrix(5, 5, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = 0, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 1, (3, 5) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 1, (5, 1) = -10201/1000, (5, 2) = 30199/10000, (5, 3) = -5049/250, (5, 4) = 97/50, (5, 5) = -48/5})

(1.1.1)

LinearAlgebra:-Eigenvalues( A1 );

CharacteristicPolynomial: working on determinant of minor 2
CharacteristicPolynomial: working on determinant of minor 3
CharacteristicPolynomial: working on determinant of minor 4
CharacteristicPolynomial: working on determinant of minor 5

 

Vector(5, {(1) = -10, (2) = 1/10+I, (3) = 1/10-I, (4) = 1/10+I, (5) = 1/10-I})

(1.1.2)

A11 := Matrix( op( 1, A1 ),( i,j ) -> evalf( A1[i,j] ), ':-datatype' = ':-sfloat' );

Matrix(5, 5, {(1, 1) = 0., (1, 2) = 1.00000, (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 1.00000, (2, 4) = 0., (2, 5) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0., (3, 4) = 1.00000, (3, 5) = 0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 0., (4, 5) = 1.00000, (5, 1) = -10.20100, (5, 2) = 3.01990, (5, 3) = -20.19600, (5, 4) = 1.94000, (5, 5) = -9.60000})

(1.1.3)

Digits := 89;
LinearAlgebra:-Eigenvalues( A11 );

Digits := 89

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881249354686)

(1.1.4)

Digits := 90;
LinearAlgebra:-Eigenvalues( A11 );

Digits := 90

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881249352150)

(1.1.5)

A12 := Matrix( op( 1, A1 ),( i,j ) -> evalf( A1[i,j] ), ':-datatype' = ':-complex'( ':-sfloat' ) );

Matrix(5, 5, {(1, 1) = 0.+0.*I, (1, 2) = 1.00000+0.*I, (1, 3) = 0.+0.*I, (1, 4) = 0.+0.*I, (1, 5) = 0.+0.*I, (2, 1) = 0.+0.*I, (2, 2) = 0.+0.*I, (2, 3) = 1.00000+0.*I, (2, 4) = 0.+0.*I, (2, 5) = 0.+0.*I, (3, 1) = 0.+0.*I, (3, 2) = 0.+0.*I, (3, 3) = 0.+0.*I, (3, 4) = 1.00000+0.*I, (3, 5) = 0.+0.*I, (4, 1) = 0.+0.*I, (4, 2) = 0.+0.*I, (4, 3) = 0.+0.*I, (4, 4) = 0.+0.*I, (4, 5) = 1.00000+0.*I, (5, 1) = -10.20100+0.*I, (5, 2) = 3.01990+0.*I, (5, 3) = -20.19600+0.*I, (5, 4) = 1.94000+0.*I, (5, 5) = -9.60000+0.*I})

(1.1.6)

Digits := 100;
LinearAlgebra:-Eigenvalues( A12 );

Digits := 100

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881249345038)

(1.1.7)

Digits := 250;
LinearAlgebra:-Eigenvalues( A12 );

Digits := 250

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881342643606)

(1.1.8)

 

 

Example 2

 

A2 := Matrix(3, 3, [[0, 1, 0], [0, 0, 1], [3375, -675, 45]]);

Matrix(3, 3, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (3, 1) = 3375, (3, 2) = -675, (3, 3) = 45})

(1.2.1)

LinearAlgebra:-Eigenvalues( A2 );

IntegerCharacteristicPolynomial: Computing characteristic polynomial for a 3 x 3 matrix

IntegerCharacteristicPolynomial: Using prime 33554393
IntegerCharacteristicPolynomial: Using prime 33554383
IntegerCharacteristicPolynomial: Used total of  2  prime(s)

 

Vector(3, {(1) = 15, (2) = 15, (3) = 15})

(1.2.2)

A21 := Matrix( op( 1, A2 ),( i,j ) -> evalf( A2[i,j] ), ':-datatype' = ':-sfloat' );

Matrix(3, 3, {(1, 1) = 0., (1, 2) = 1.00000, (1, 3) = 0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 1.00000, (3, 1) = 3375.00000, (3, 2) = -675.00000, (3, 3) = 45.00000})

(1.2.3)

Digits := 77;
LinearAlgebra:-Eigenvalues( A21 );

Digits := 77

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881342621686)

(1.2.4)

Digits := 78;
LinearAlgebra:-Eigenvalues( A21 );

Digits := 78

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881342617230)

(1.2.5)

A22 := Matrix( op( 1, A2 ),( i,j ) -> evalf( A2[i,j] ), ':-datatype' = ':-complex'( ':-sfloat' ) );

Matrix(3, 3, {(1, 1) = 0.+0.*I, (1, 2) = 1.00000+0.*I, (1, 3) = 0.+0.*I, (2, 1) = 0.+0.*I, (2, 2) = 0.+0.*I, (2, 3) = 1.00000+0.*I, (3, 1) = 3375.00000+0.*I, (3, 2) = -675.00000+0.*I, (3, 3) = 45.00000+0.*I})

(1.2.6)

Digits := 58;
LinearAlgebra:-Eigenvalues( A22 );

Digits := 58

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881342614934)

(1.2.7)

Digits := 59;
LinearAlgebra:-Eigenvalues( A22 );

Digits := 59

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881325525942)

(1.2.8)

 

 

Example 3

 

A3 := Matrix(4, 4, [[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [-48841, 8840, -842, 40]]);

Matrix(4, 4, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 1, (4, 1) = -48841, (4, 2) = 8840, (4, 3) = -842, (4, 4) = 40})

(1.3.1)

LinearAlgebra:-Eigenvalues( A3 );

IntegerCharacteristicPolynomial: Computing characteristic polynomial for a 4 x 4 matrix
IntegerCharacteristicPolynomial: Using prime 33554393

IntegerCharacteristicPolynomial: Using prime 33554383
IntegerCharacteristicPolynomial: Used total of  2  prime(s)

 

Vector(4, {(1) = 10+11*I, (2) = 10-11*I, (3) = 10+11*I, (4) = 10-11*I})

(1.3.2)

A31 := Matrix( op( 1, A3 ),( i,j ) -> evalf( A3[i,j] ), ':-datatype' = ':-sfloat' );

Matrix(4, 4, {(1, 1) = 0., (1, 2) = 1.00000, (1, 3) = 0., (1, 4) = 0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 1.00000, (2, 4) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0., (3, 4) = 1.00000, (4, 1) = -48841.00000, (4, 2) = 8840.00000, (4, 3) = -842.00000, (4, 4) = 40.00000})

(1.3.3)

Digits := 75;
LinearAlgebra:-Eigenvalues( A31 );

Digits := 75

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881324662046)

(1.3.4)

Digits := 76;
LinearAlgebra:-Eigenvalues( A31 );

Digits := 76

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881324657710)

(1.3.5)

A32 := Matrix( op( 1, A3 ),( i,j ) -> evalf( A3[i,j] ), ':-datatype' = ':-complex'( ':-sfloat' ) );

Matrix(4, 4, {(1, 1) = 0.+0.*I, (1, 2) = 1.00000+0.*I, (1, 3) = 0.+0.*I, (1, 4) = 0.+0.*I, (2, 1) = 0.+0.*I, (2, 2) = 0.+0.*I, (2, 3) = 1.00000+0.*I, (2, 4) = 0.+0.*I, (3, 1) = 0.+0.*I, (3, 2) = 0.+0.*I, (3, 3) = 0.+0.*I, (3, 4) = 1.00000+0.*I, (4, 1) = -48841.00000+0.*I, (4, 2) = 8840.00000+0.*I, (4, 3) = -842.00000+0.*I, (4, 4) = 40.00000+0.*I})

(1.3.6)

Digits := 100;
LinearAlgebra:-Eigenvalues( A32 );

Digits := 100

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881324648198)

(1.3.7)

Digits := 250;
LinearAlgebra:-Eigenvalues( A32 );

Digits := 250

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881327288182)

(1.3.8)

 

 

Example 4

 

A4 := Matrix(8, 8, [[0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1], [-1050625/20736, 529925/1296, -15417673/10368, 3622249/1296, -55468465/20736, 93265/108, -1345/8, 52/3]]);

Matrix(8, 8, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (1, 8) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 1, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 1, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0, (5, 6) = 1, (5, 7) = 0, (5, 8) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0, (6, 7) = 1, (6, 8) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = 0, (7, 7) = 0, (7, 8) = 1, (8, 1) = -1050625/20736, (8, 2) = 529925/1296, (8, 3) = -15417673/10368, (8, 4) = 3622249/1296, (8, 5) = -55468465/20736, (8, 6) = 93265/108, (8, 7) = -1345/8, (8, 8) = 52/3})

(1.4.1)

LinearAlgebra:-Eigenvalues( A4 );

CharacteristicPolynomial: working on determinant of minor 2
CharacteristicPolynomial: working on determinant of minor 3

CharacteristicPolynomial: working on determinant of minor 4
CharacteristicPolynomial: working on determinant of minor 5
CharacteristicPolynomial: working on determinant of minor 6
CharacteristicPolynomial: working on determinant of minor 7
CharacteristicPolynomial: working on determinant of minor 8

 

Vector(8, {(1) = 1/3-(1/4)*I, (2) = 1/3+(1/4)*I, (3) = 4-5*I, (4) = 4+5*I, (5) = 1/3-(1/4)*I, (6) = 1/3+(1/4)*I, (7) = 4-5*I, (8) = 4+5*I})

(1.4.2)

A41 := Matrix( op( 1, A4 ),( i,j ) -> evalf( A4[i,j] ), ':-datatype' = ':-sfloat' );

Matrix(8, 8, {(1, 1) = 0., (1, 2) = 1.00000, (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (1, 6) = 0., (1, 7) = 0., (1, 8) = 0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 1.00000, (2, 4) = 0., (2, 5) = 0., (2, 6) = 0., (2, 7) = 0., (2, 8) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0., (3, 4) = 1.00000, (3, 5) = 0., (3, 6) = 0., (3, 7) = 0., (3, 8) = 0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 0., (4, 5) = 1.00000, (4, 6) = 0., (4, 7) = 0., (4, 8) = 0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = 0., (5, 5) = 0., (5, 6) = 1.00000, (5, 7) = 0., (5, 8) = 0., (6, 1) = 0., (6, 2) = 0., (6, 3) = 0., (6, 4) = 0., (6, 5) = 0., (6, 6) = 0., (6, 7) = 1.00000, (6, 8) = 0., (7, 1) = 0., (7, 2) = 0., (7, 3) = 0., (7, 4) = 0., (7, 5) = 0., (7, 6) = 0., (7, 7) = 0., (7, 8) = 1.00000, (8, 1) = -50.66671, (8, 2) = 408.89275, (8, 3) = -1487.04408, (8, 4) = 2794.94522, (8, 5) = -2674.98384, (8, 6) = 863.56481, (8, 7) = -168.12500, (8, 8) = 17.33333})

(1.4.3)

Digits := 74;
LinearAlgebra:-Eigenvalues( A41 );

Digits := 74

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881317242630)

(1.4.4)

Digits := 75;
LinearAlgebra:-Eigenvalues( A41 );

Digits := 75

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_dgeevx_

 

Vector[column](%id = 18446745881317239134)

(1.4.5)

A42 := Matrix( op( 1, A4 ),( i,j ) -> evalf( A4[i,j] ), ':-datatype' = ':-complex'( ':-sfloat' ) );

Matrix(8, 8, {(1, 1) = 0.+0.*I, (1, 2) = 1.00000+0.*I, (1, 3) = 0.+0.*I, (1, 4) = 0.+0.*I, (1, 5) = 0.+0.*I, (1, 6) = 0.+0.*I, (1, 7) = 0.+0.*I, (1, 8) = 0.+0.*I, (2, 1) = 0.+0.*I, (2, 2) = 0.+0.*I, (2, 3) = 1.00000+0.*I, (2, 4) = 0.+0.*I, (2, 5) = 0.+0.*I, (2, 6) = 0.+0.*I, (2, 7) = 0.+0.*I, (2, 8) = 0.+0.*I, (3, 1) = 0.+0.*I, (3, 2) = 0.+0.*I, (3, 3) = 0.+0.*I, (3, 4) = 1.00000+0.*I, (3, 5) = 0.+0.*I, (3, 6) = 0.+0.*I, (3, 7) = 0.+0.*I, (3, 8) = 0.+0.*I, (4, 1) = 0.+0.*I, (4, 2) = 0.+0.*I, (4, 3) = 0.+0.*I, (4, 4) = 0.+0.*I, (4, 5) = 1.00000+0.*I, (4, 6) = 0.+0.*I, (4, 7) = 0.+0.*I, (4, 8) = 0.+0.*I, (5, 1) = 0.+0.*I, (5, 2) = 0.+0.*I, (5, 3) = 0.+0.*I, (5, 4) = 0.+0.*I, (5, 5) = 0.+0.*I, (5, 6) = 1.00000+0.*I, (5, 7) = 0.+0.*I, (5, 8) = 0.+0.*I, (6, 1) = 0.+0.*I, (6, 2) = 0.+0.*I, (6, 3) = 0.+0.*I, (6, 4) = 0.+0.*I, (6, 5) = 0.+0.*I, (6, 6) = 0.+0.*I, (6, 7) = 1.00000+0.*I, (6, 8) = 0.+0.*I, (7, 1) = 0.+0.*I, (7, 2) = 0.+0.*I, (7, 3) = 0.+0.*I, (7, 4) = 0.+0.*I, (7, 5) = 0.+0.*I, (7, 6) = 0.+0.*I, (7, 7) = 0.+0.*I, (7, 8) = 1.00000+0.*I, (8, 1) = -50.66671+0.*I, (8, 2) = 408.89275+0.*I, (8, 3) = -1487.04408+0.*I, (8, 4) = 2794.94522+0.*I, (8, 5) = -2674.98384+0.*I, (8, 6) = 863.56481+0.*I, (8, 7) = -168.12500+0.*I, (8, 8) = 17.33333+0.*I})

(1.4.6)

Digits := 100;
LinearAlgebra:-Eigenvalues( A42 );

Digits := 100

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881317227806)

(1.4.7)

Digits := 250;
LinearAlgebra:-Eigenvalues( A42 );

Digits := 250

 

Eigenvalues: calling external function
Eigenvalues: initializing the output object
Eigenvalues: using software external library
Eigenvalues: CLAPACK sw_zgeevx_

 

Vector[column](%id = 18446745881356880102)

(1.4.8)

 

 

 

 

 

 

 

 

 

 

``


 

Download Problems_LinearAlgebra_Eigenvalues.mw

hi 

i want to plot this equations , i want to show that step by step and remind previous . i plot with animte plot but it do not show the previous

 

restart;
with(plottools);
co := blue;
with(plots);

t := 1;
for i from 20 by -1 to 0 do t := t+1; a[i] := -i*x/t+i; p[i] := plot(a[i], x = 0 .. 20, y = 0 .. 20, color = co, thickness = 3) end do;

plots[animate](plot, [a[k], x = 0 .. 20, y = 0 .. 20], k = [seq(i, i = 1 .. 20)]);

First 21 22 23 24 25 26 27 Last Page 23 of 61