## How to resolve a matrix of matrices?...

I want to create a matrix (B) from entries of other matrices (A) with a helper-function (helper). The helper function is defined such that it returns a certain matrix depending on the index variables. This is necessary because the inner matrices are constructed with another function.

Since the helper-function returns matrices, the big matrix is of datatype=matrix. Unfortunately, creating the big matrix with the correct size and forcing the datatype=float, does not yield the desired result. However, the manual definition using the constructor with a list of matrices does create the desired matrix.

How do I resolve a matrix of matrices?

Note: I know that I could write a convert function that copies the entries to a corresponding matrix, though this seems to be unnecessary effort to me.

This might not be minimal but shows the issue. (Compare and )

MWE_matrix_of_matrices.mw

 > restart; with(LinearAlgebra):
 > size_A := 2; size_B := 3;
 (1)
 > helper2 := proc(i::integer,j::integer);   if i=j then     a;   elif i=j-1 or i=j+1 then     b;   else     c;   end if; end proc: helper3 := proc(i::integer,j::integer);   if i=j then     Matrix(size_A,size_A,helper2);   elif i=j-1 or i=j+1 then     -IdentityMatrix(size_A);   else     Matrix(size_A);   end if; end proc: A := Matrix(size_A, size_A, helper2); B := Matrix(size_B, size_B, helper3); B := Matrix(size_B,size_B, helper3, datatype = float); B := Matrix(size_B*size_A, size_B*size_A,[Matrix(size_B,size_B,helper3)], datatype = float)
 > test := Matrix(4, 4, [                 [Matrix([[1,2],[0,9]]), Matrix([[3,6],[0,9]])],                 [Matrix([[3,4],[7,8]]), Matrix([[7,6],[5,5]])]                ]); # is converted to a matrix of floats
 (2)

## Memory inflation in computations...

Hi guys,

I have written a program in Maple 2016 (Windows 7) made of two parts :

1. An initialization step where a formal system of algebraic equations (some non linear) is built
Let S(U, P) this system, where U denotes a set of unknowns and P a set of parameters (see step 2 below)
2. An iterative step where this system is solved with respect to U for different values of parameters P
This loop has to be executed N times for values P1, ..., Pn, ... of P

I observe that the size of the memory (bottom right of the Maple window) inflates as the value of n increases.

I was able to isolate in the loop corresponding to step 2, the procedure MyProc I wrote which is responsible of this memory inflation.
Now I would like to manage this inflation (typically the memory size grows up to 3 GiB for n about one thousand) because of its very negative effects on the computational time (probably Maple does spend a lot of time in swapping operations).

Suspecting the remember process to be the source of this problem, I tried simple tricks such as

• systematically write   > quantity := 'quantity';   for fome intermediate quantities
• use forget  : for example MyProc contains a call to fsolve and,  after "local" declarations, I inserted  the command  forget(fsolve)
• in the the loop over n,  I even inserted the command forget(Myproc).

None of these tricks was to some extent efficient to contain the memory inflation.

I suppose it is a very common situation that people who use to develop code are familiar with. So maybe some of you could provide my some advices or move me towards "strategies" or "methodologies" to prevent this situation ?
My purpose here is not to ask you to solve my problem, but rather to ask youy to give me hints to be able to manage such kind of situations by myself.

Maybe this question is unorthodox and doesn't have its place here ?
It that case please let me know.

PS : it would be very difficult for me to provide you the code : if it is a necessary condition for you to help me, just forget it, I will understand

## How to give an answer a vote up ?...

I have a simple minded question :
How can I give an answer a Vote Up or select it as the Best Answer to a question ?

## How to compute an extension of finite field?...

Hi EveryOne!

In the answer of the question "How to find roót of polynomial in finite field and extension finite field ", @Carl Love helped me to find roots of polynimial in finite field and extension finite field (At URL http://www.mapleprimes.com/view.aspx?sf=215097_Answer/Primfield.mw OR http://www.mapleprimes.com/view.aspx?sf=215285_Answer/Matrix_powers_finite_field.mw)

However, with matrix M: =< x^4+x^3+x^6+x^7+x, 1+x^2+x^4+x^5+x^6, 1+x+x^2+x^3, x^7+x^6+x^5+x^4;

x^7+x^5+x^4+x^3, x^6+x^4+x^2+1, x^4+x^3+x^6+x^7+x^2+x+1, 1+x^2+x^3+x^4+x^5;

x^7+x^5+x^2, x^7+x^5+x^3+x^2+1, x^2+x+x^6, x^2+x^3+x^5;
x^4+x^3+x^6+1, 1+x^2+x^3+x^4, x^6+x^5+x^4+x^3, x^7+x^3 >;

and GF(2^8)/f(x)=x^8 + x^7 +x^6 + x +1 (i.e ext1:= Z^8+Z^7+Z^6+Z+1), then program Primfield.mw don't run!

## How to find all ideals in this?...

Dear All

Using Lie algebra package in Maple we can easily find nilradical for given abstract algebra, but how we can find all the ideal in lower central series by taking new basis as nilradical itself?

 >
 >
 (1)
 Euc >
 (2)
 Euc >
 (3)
 Euc >
 (4)
 L1 >
 L1 >
 (5)
 L1 >
 (6)
 L1 >
 (7)

Taking N as new basis , how we can find all ideals in lower central series of this solvable ideal N?

Regards

## Error, extra unknowns found: x ...

a := 18; b := 2; c := 1; d := 1; f := 1; DEtools[phaseportrait]({diff(x(t), t) = a*x-b*exp(x)*y/(1+exp(x))-f*x*x, diff(y(t), t) = -c*y+b*exp(x)*d*y/(1+exp(x))}, [x(t), y(t)], t = 0 .. 100, {[x(0) = .1, y(0) = 18], [x(0) = .1, y(0) = 27], [x(0) = .2, y(0) = 28], [x(0) = .5, y(0) = 16], [x(0) = .6, y(0) = 14], [x(0) = .7, y(0) = 8], [x(0) = .7, y(0) = 29], [x(0) = 1.0, y(0) = 18], [x(0) = 1.0, y(0) = 22], [x(0) = 1.2, y(0) = 20], [x(0) = 1.5, y(0) = 20], [x(0) = 1.5, y(0) = 24.0], [x(0) = 1.6, y(0) = 26.0], [x(0) = 1.7, y(0) = 28], [x(0) = 1.8, y(0) = 21], [x(0) = 2.0, y(0) = 9], [x(0) = 2.0, y(0) = 28]}, x = 0 .. 2, y = 0 .. 30, dirgrid = [13, 13], stepsize = 0.5e-1, arrows = SLIM, axes = BOXED, thickness = 2)

## Section of a 3d spherical plot function...

Is there an elegant way to plot in 3d only the portion of the function f(x,y)=sqrt(25-x^2-y^2) for which 9 <= x^2+y^2 <= 16 ? I'm looking for a nice plot that shows it against the whole sphere with radius 5, so that it's clear which part of the sphere is cut out.

## Replacing variable in ODE...

Hi,

It might be very silly question, but i dont know why it is not working out. So here is the question. In the attached maple shhet when i am trying to substitute eta(t)=epsilon*z(t) then it is not making that susbtitution for differential operator. Apart from that when i m collecting epsilon terms then also it not collecting it.quesiton.mw

Regards

Sunit

## Problem with procedure...

Dear Community,

I get this message

'EQU' is implicitly declared local to procedure 'Z_DAK_FSOLVE'Problem with procedurefor a procedure, and  cannot go further. How can I avoid it?

Tx for the help in advance,

best regards

Andras

Z_DAK_PROC.mw

## Problems with Units...

Below I try to use units for a simple expression, where "m" and "mm" is added on Windows using Ctrl-Shift-U.

Why does the value with unit "1 [[m]]" not show as "1 m" in (1), but simply as "m" ?

Why does the addition not result in "2 m" ?

## Fonts for X11 on Linux? ...

I have Maple 2016 on Ubuntu 16.04.  I get an error message when attempting to plot with an x11 device, that means I have missing fonts.

I do not get this error message on Ubuntu14.04, so, I think the difference is in fonts installed.

plotsetup(x11)

> plot([sin(x),cos(x)],x=-Pi..Pi);
> Maple X driver failure:BadName (named color or font does not exist)Warning: Cannot convert string "-adobe-helvetica-bold-r-normal--14-*" to type FontStruct
Warning: Cannot convert string "-adobe-helvetica-medium-r-normal--14-*" to type FontStruct

I have xfonts-100dpi and xfonts-75dpi installed.

Any idea what fonts I need to fix this?

Tom Dean

## How to make new line using printf?...

Hi Maple People,

I have this Maple command -

printf("%g",p)

where p is a variable I assign.  My problem is that I want to put a new line in the display.

What is the appropriate command?

Regards,

Matt

## How to fill a region between three lines?...

Hi all,

I have three points in 3d space say A1=[a11, a12, a13]; A2=[a21, a22, a23] and A3=[a31, a32, a33]. I want to fill the triangle formed by these points. How can I do that?

## Contour plots in a 3d graph...

Hi all,

I have a 3D graph and when I right click on the surface, under style, I can see the option of contour. When I click on that I can see some contour associated with the surface. I want maple to show the values for each contour when I observe it from the top . I want to copy and paste some surfaces in a same figure and campare the contours.

Thank you