MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

The expression (D[1]@D[2])(f) is equivalent to D[1,2](f). On grounds of that, I would naively have expected that (D[1]@D[1])(f) was equivalent to D[1,1](f). But it seems not to be, their lprint-versions being different:

expr1 := (D[1]@D[1])(f):
expr2 := D[1,1](f):
simplify(expr1 - expr2);
simplify(expr1 - expr2,`@`);
lprint(expr1);
lprint(expr2);

(D[1]@@2)(f)
D[1, 1](f)

I am curious to know why it has been implemented this way? Have I fundamentally misunderstood something?

I'm working in a tridimensional euclidean space, with vectorial functions of the type:

Fi(t)=<fix(t),fiy(t),fiz(t)>

Fi'(t)=<fix'(t),fiy'(t),fiz'(t)>

The two odes are of the type:

ode1:=K1*F1''(t)=K2*F2(t)&xF3(t)+...

While there are other non-differential vectorial equations like:

eq1:=K4*F4''(t)=(K5*F5(t)&x<0,1,0>)/Norm(F6(t))+..., etc

 

Is there a way i can input this system in dsolve with vectors instead of scalars? And without splitting everything into its 3 vectorial components? I can't make maple realize some of the Fi(t) functions are vectors, it counts them as scalars and says the number of functions and equations are not the same.

 

Thank you!

Hi

Hope a nice day for all

restart;

#  *%   define the product of between two operators, and q real number
a*%b = q*b*%a+1;

# First I would like to give a simple for

 a^n*%b;
# and                                    
a*%b^n;

them deduce a general for                                      

b^n*%a^k*%b^N*%a^K-q^(k*N-n*K)*b^N*%a^K*%b^n*%a^k;

 where n, k and k greater than 1 and  n geater than k

Simplification.mw

 

Thanks for your help


 


If I am in the Maple debugger, stopped in a routine, how can I navigate between stack frames, such as looking at the variables of the calling function?

"outfrom" is not sufficient for this purpose as that continues execution until return, which would change the variables of the routine I am in, and could potentially take a long time. And more importantly for my particular purpose, the routine I am stopped in is a package's "I found an error" routine which is (deliberately) throwing an exception, so there will not be any return.

I can use where or where? to look at the name of the calling routines. Unfortunately, for the code I am debugging, the calling routine is being dynamically loaded so I do not have a file name for it and I cannot put a persistent breakpoint in it: I need to climb the tree of dynamic calls with their various parameters in order to figure out how the error occured.

Hi all

Is Ising a package?

for i = 1:12000

%while (1),

% Choose a random value between 0 and 1 for the interaction strength

J = rand()+1e-10;

% Perform a simulation

[M, N, E] = ising2(n_grid, J);

% Records the results

Ms = [Ms M/(n_grid^2)];

Es = [Es E/(n_grid^2)];

Ns = [Ns N];

Js = [Js J];

i = i+1;

Is there an elegant way to plot the region between the surfaces z=-y^2 and z=x^2, only on the domain of the XY-plane bounded by the triangle with vertices (0,0), (1,0) and (1,1)?

I am trying to simplify the square of a parameterized polynomial mod 2. My parameters are intended to be either 0 or 1. How do I accomplish this?

For example:

 

alias(alpha = RootOf(x^4+x+1))

alpha

(1)

z := alpha^3*a[3]+alpha^2*a[2]+alpha*a[1]+a[0]``

a[3]*alpha^3+a[2]*alpha^2+a[1]*alpha+a[0]

(2)

z2 := collect(`mod`(Expand(z^2), 2), alpha)

a[3]^2*alpha^3+(a[1]^2+a[3]^2)*alpha^2+a[2]^2*alpha+a[0]^2+a[2]^2

(3)

``

``

 

Download Polynomial_Mod_2.mw

 

I would like to simplify the squared parameters modulo 2. a[3]^2=a[3], etc.

Any help would be appreciated. Elegant methods even more so!

Regards.

 

 

 

 

How can i over come convergence error, i am unable to apply approxsoln appropriately and continouation as well. regards

N := 5;

-(1/2)*Pr*n*x*(diff(f(x), x))*(diff(theta(x), x))-(1/2)*Pr*(n+1)*f(x)*(diff(theta(x), x))-(1/2)*(n+1)*(diff(diff(theta(x), x), x))+Pr*gamma*((1/4)*(n^2-3*n+3)*x^2*(diff(f(x), x))*(diff(diff(f(x), x), x))*(diff(theta(x), x))+(1/4)*(2*n^2+5*n+3)*f(x)*(diff(f(x), x))*(diff(theta(x), x))+(1/4)*n(n+1)*x*f(x)*(diff(diff(f(x), x), x))*(diff(theta(x), x))+(1/4)*(2*n^2+3*n-3)*x*(diff(f(x), x))^2*(diff(theta(x), x))+(1/4)*(n-1)*x^2*(diff(diff(f(x), x), x))*(diff(theta(x), x))+(1/2)*n*(n+1)*x*f(x)*(diff(f(x), x))*(diff(diff(theta(x), x), x))+(1/4)*(n^2-1)*(diff(f(x), x))^2*(diff(theta(x), x))+(1/4)*(n+1)^2*f(x)^2*(diff(diff(theta(x), x), x))+(1/4)*(n-1)^2*x^2*(diff(f(x), x))^2*(diff(diff(theta(x), x), x))) = 0

(1)

bc := (D(theta))(0) = -Bi*(1-theta(0)), theta(N) = 0, f(0) = 0, (D(f))(0) = 0, (D(f))(N) = 1;

(D(theta))(0) = -Bi*(1-theta(0)), theta(5) = 0, f(0) = 0, (D(f))(0) = 0, (D(f))(5) = 1

(2)

a1 := dsolve(subs(beta = .1, n = .5, Pr = 10, gamma = .1, Bi = 50, {bc, eq1, eq2}), numeric, method = bvp[midrich], abserr = 10^(-8), output = array([seq(.1*i, i = 0 .. 10*N)]))

Error, (in dsolve/numeric/BVPSolve) initial Newton iteration is not converging

 

``

 

Download ehtasham.mwehtasham.mw

This week I am participating in 19th Ising lectures. The Serguei Nechaev's talk inspired me to ask the question:
"How to simulate a random walk on an undirected and unweighted (and, of course, connected) graph
(All the paths from a vertex of degree k have the same probability 1/k.)?"
A Maple procedure to this end is welcome.

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 B and test)

MWE_matrix_of_matrices.mw

restart;
with(LinearAlgebra):

size_A := 2;
size_B := 3;

2

 

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)

A := Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = b, (2, 2) = a})

 

B := Matrix(3, 3, {(1, 1) = Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = b, (2, 2) = a}), (1, 2) = Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), (1, 3) = Matrix(2, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0}), (2, 1) = Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), (2, 2) = Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = b, (2, 2) = a}), (2, 3) = Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), (3, 1) = Matrix(2, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0}), (3, 2) = Matrix(2, 2, {(1, 1) = -1, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1}), (3, 3) = Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = b, (2, 2) = a})})

 

Error, (in Matrix) unable to store 'Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = b, (2, 2) = a})' when datatype=float[8]

 

Error, (in Matrix) unable to store 'Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = b, (2, 2) = a})' when datatype=float[8]

 

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

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

(2)


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.

Thanks In Advance


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

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 ?

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!

Please help me! Thanks so much.

 

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?

Please see following;

 

with(DifferentialGeometry); with(LieAlgebras)

DGsetup([x, y, t, u, v])

`frame name: Euc`

(1)
Euc > 

VectorFields := evalDG([D_v, D_v*x+D_y*t, 2*D_t*t-2*D_u*u-D_v*v+D_y*y, t*D_v, D_v*y+D_u, D_t, D_x, D_x*t+D_u, 2*D_v*x+D_x*y, -D_t*t+2*D_u*u+2*D_v*v+D_x*x, D_y])

[_DG([["vector", "Euc", []], [[[5], 1]]]), _DG([["vector", "Euc", []], [[[2], t], [[5], x]]]), _DG([["vector", "Euc", []], [[[2], y], [[3], 2*t], [[4], -2*u], [[5], -v]]]), _DG([["vector", "Euc", []], [[[5], t]]]), _DG([["vector", "Euc", []], [[[4], 1], [[5], y]]]), _DG([["vector", "Euc", []], [[[3], 1]]]), _DG([["vector", "Euc", []], [[[1], 1]]]), _DG([["vector", "Euc", []], [[[1], t], [[4], 1]]]), _DG([["vector", "Euc", []], [[[1], y], [[5], 2*x]]]), _DG([["vector", "Euc", []], [[[1], x], [[3], -t], [[4], 2*u], [[5], 2*v]]]), _DG([["vector", "Euc", []], [[[2], 1]]])]

(2)
Euc > 

L1 := LieAlgebraData(VectorFields)

_DG([["LieAlgebra", "L1", [11]], [[[1, 3, 1], -1], [[1, 10, 1], 2], [[2, 3, 2], -1], [[2, 5, 4], 1], [[2, 6, 11], -1], [[2, 7, 1], -1], [[2, 8, 4], -1], [[2, 9, 5], -1], [[2, 9, 8], 1], [[2, 10, 2], 1], [[3, 4, 4], 3], [[3, 5, 5], 2], [[3, 6, 6], -2], [[3, 8, 8], 2], [[3, 9, 9], 1], [[3, 11, 11], -1], [[4, 6, 1], -1], [[4, 10, 4], 3], [[5, 10, 5], 2], [[5, 11, 1], -1], [[6, 8, 7], 1], [[6, 10, 6], -1], [[7, 9, 1], 2], [[7, 10, 7], 1], [[8, 9, 4], 2], [[8, 10, 8], 2], [[9, 10, 9], 1], [[9, 11, 7], -1]]])

(3)
Euc > 

DGsetup(L1)

`Lie algebra: L1`

(4)
L1 > 

MultiplicationTable("LieTable"):

L1 > 

N := Nilradical(L1)

[_DG([["vector", "L1", []], [[[1], 1]]]), _DG([["vector", "L1", []], [[[2], 1]]]), _DG([["vector", "L1", []], [[[4], 1]]]), _DG([["vector", "L1", []], [[[5], 1]]]), _DG([["vector", "L1", []], [[[6], 1]]]), _DG([["vector", "L1", []], [[[7], 1]]]), _DG([["vector", "L1", []], [[[8], 1]]]), _DG([["vector", "L1", []], [[[9], 1]]]), _DG([["vector", "L1", []], [[[11], 1]]])]

(5)
L1 > 

Query(N, "Nilpotent")

true

(6)
L1 > 

Query(N, "Solvable")

true

(7)

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

 

Download [944]_Structure_of_Lie_algebra.mw

Regards

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)

1 2 3 4 5 6 7 Last Page 3 of 1312