104 Reputation

5 Badges

16 years, 206 days

MaplePrimes Activity

These are answers submitted by boirac

Hi Joe, thanks for your prompt reply.

I'm under linux, with GNU Emacs. Indentation, hightlighting etc work very well.

> C-h w maplev-mint-buffer

says it is mapped to the right key (C-c <return> b) but it behaves as follows:

M-x maplev-mint-buffer


"Invalid argument 3"

or if I type (C-c <return> b) it just inputs the "b" in the buffer.

the mode seems to be (Maple R11 Fill) in case that plays a role. 

(I also tried to write a tiny easy procedure in a .mpl file, just to check it wasn't a problem of the code, but it gives the same error).

the directory where mint and maple are located is


with rwxr-xr-x, and one can run "mint" or "maple"  from a shell.

Thanks again if you have any other idea.



(otherwise, I'll just try to "read" it from xmaple and debug it there)

Hi Fubar, I'm not sure if this is what you are looking for but you could write a little procedure or an if statement. Something like: if x > 0 then print(x) ; elif x=0 then print("the solution is zero"); else print("no negative or trivial solution"); end if; Or a little procedure to check: CheckSolution:=proc(x) if x > 0 then return x ; elif x=0 then print("the solution is zero"); else print("no negative or trivial solution"); end if; end proc:
Hi Joe, Thanks for the comment :) I didn't know that structure and it will surely be helpful. Cheers, Al
Thanks for your comment Joe, What if I want to delete a Row following the same condition? Can something like: i:=1; while i "less or equal" RowDimension(M) do if M[i,2] = M[i,3] then M:=DeleteRow(M,i); else i:=i; fi; od; Work efficiently for large matrices. It seems to go very slow and I suspect each time I delete a row it declares the whole matrix again. It is so and is there a more efficient way around? Thank you again for reading and for your help, Alvaro
Hi Doug and J. Tarr, Thanks for your last comments, Doug, showstat only works for procedures (and returns an error when a module is the input), Mariner, I have no Output in my worksheet whatsoever, so the problem stems from the 2D Maple input. I guess I'll have to come back to the Maple Standard Input and rewrite the whole thing (copy pasting at least the output of eval(procedure) for each procedure). A negative point for Maple 10 :-( and the functionality of its 2D Maple input. Thank you all for your time, Al
Hi Doug, Georgios, Tarr and Roman, (and everyone) I am sorry to bother you with such futile questions, but it doesn't seem to work, and Java is very slow under Linux 8-\ What you propose, Doug, I'm afraid is the first thing I tried. But thanks for the suggestion. These are my Display Options (in the interactive Options console): Input display: 2-D Math Notation Output display: 2-D Math Notation Typesetting level: Maple Standard Here is what I tought of but doesn't work: 1. If I change the 2-D Math Input and open my file as "Maple Notation" then it opens the file with the execution group in 2D nevertheless. 2. If I choose to convert the execution group to "2-D Math" or "2-D Math Input" or "1-D Math Input" it looses its format. "Make Inert" doesn't change it, but a further copy paste into a .txt or .mpl does loose the format. 3. I have also tried to make a copy of my then rename it as File.txt or File.mpl, but then it becomes very unconprehensible and full of extra code. 4. Copy pasting the 2D-Math input into a .txt or .mpl file does it without format too. 3. I have tried to alter my Display Options and found the following: If I use Input display: 2-D Math Notation Output display: Character Notation Typesetting level: Maple Standard It allows to copy outputs to a text file WITH format. That is, if I have an input like this: trythis := proc(A) local i, j; for i to 10 do j := j + 1 end do; return j; print("this is something"); end proc; If I copy-paste this input into a .txt file it pastes, trythis := proc (A) local i, j; for i to 10 do j := j+1 end do; return j; print("this is something") end proc However, If I copy paste the output from > eval(trythis); It pastes: proc(A) local i, j; for i to 10 do j := j + 1 end do; return j; print("this is something"); end proc; (with some more spaces than appear here in my answer, but well formated). Do you know if there is a similar command like eval(trythis) for a MODULE instead of a procedure? Of course eval(Nameofmodule) returns a very brief description without the code in each procedure. Thank you all for your advice and help, Al
Thank you for your comment Georgios and J Tarr, however, when I export the file (as .txt or .mpl), and open it with a text editor I get something intractable that looks like this: ... DP := proc (A::Matrix, B::Matrix) local M, P, i, j; M := Matrix(RowDimension(A)*RowDimension(B), ColumnDimension(A)*ColumnDimension(B)); P := Matrix(RowDimension(B), ColumnDimension(B)); for i to RowDimension(A) do for j to ColumnDimension(A) do P := ScalarMultiply(B, A[i, j]); M[1+(i-1)*RowDimension(B) .. (i-1)*RowDimension(B)+RowDimension(B), 1+(j-1)*ColumnDimension(B) .. (j-1)*ColumnDimension(B)+ColumnDimension(B)] := P end do end do; M end proc; deltaK := proc (j, k) if not type(j-k, numeric) then RETURN('procname(args)') end if; if j = k then 1 else 0 end if end proc; NormalizeV := proc (V::Vector) local Nono, W; Nono := VectorNorm(V, 2, conjugate = true); W := V/Nono; return W end proc; NormalizeM := proc (M::Matrix) local Nono, H; Nono := Trace(M); H := M/Nono; return H end proc; multiplymatcol := proc (AA, BB) local i, j, dimiA, dimiB, A, B, V, M, s, halt; dimiA := RowDimension(AA); dimiB := RowDimension(BB); ... etc, etc... without any spaces, blank lines, or extra format. (it's Maple 10.03, both in Linux RedHat and Windows XP). I guess I can edit it again, and space the whole thing, but I wondered if it was possible to do it automatically. Thank you for your help, Al
Hi Roman, Thank you for your advice. Could you (someone) help me with the format? when I try to copy paste the execution group in the worksheet to a txt file it looses the format and becomes quite unreadable. I also tried to convert it to a 1D Maple input but the same thing occurs. Thank you again for your time Al
Hi JacquesC, Thank you very much for your answer. Unfortunately my example was a bad example for what I want to do. It is indeed a multiple variable polynomial and I want to do multiple substitutions each with a DIFFERENT POWERS. Something like: Poly:=a[1]^3+a[1]*a[3]^2*a[4]^3+a[2]*a[4]+a[1]*a[2]^2; And make substitutions of the kind: a[1]-> a[1]^2, a[4]^3 -> a[4]^2, a[2]^2 -> a[2], (so not only x::linear), to end up with: Poly2:=a[1]^3+a[1]^2*a[3]^2*a[4]^2+a[2]*a[4]+a[1]^2*a[2]; I have tried to understand and alter the code you proposed but without too much success... does anyone have any idea as how to do that? I have tried for instance, foldl((y, v)-> map((x)-> `if`(degree(x) = degree(lhs(v)), subs(lhs(v) = rhs(v), x), x), y), Poly, a[1] = a[1]^2, a[2]^2 = a[2]^7, a[4] = 2*a[4]) But I'm not sure I understand the role of `if` there. Thanks everyone for your help. Al
Inspired on one Alain Le Stang wrote, I wrote a little procedure that makes the Kronecker/Direct/Tensor product between any two matrices. As long as it is declared as a Matrix, it can also make the Kronecker product between Vectors and Matrices. The vector, however would have to be declared for example as V := Matrix([[1],[2], [0], [a]]); it uses the package LinearAlgebra, Kron:=proc(A::Matrix,B::Matrix) local M,P,i,j; M:=Matrix(RowDimension(A)*RowDimension(B),ColumnDimension(A)*ColumnDimension(B)): P:=Matrix(RowDimension(B),ColumnDimension(B)): for i to RowDimension(A) do for j to ColumnDimension(A) do P:=ScalarMultiply(B,A[i,j]): M[1+(i-1)*RowDimension(B)..(i-1)*RowDimension(B)+RowDimension(B),1+(j-1)*ColumnDimension(B)..(j-1)*ColumnDimension(B)+ColumnDimension(B)]:=P: od od: M; end proc: for example A := Matrix([[1, 0], [2, 1]]); and B := Matrix([[a, b], [c, d]]); returns for Kron(A, B); Matrix(4, 4, {(1, 1) = a, (1, 2) = b, (1, 3) = 0, (1, 4) = 0, (2, 1) = c, (2, 2) = d, (2, 3) = 0, (2, 4) = 0, (3, 1) = 2*a, (3, 2) = 2*b, (3, 3) = a, (3, 4) = b, (4, 1) = 2*c, (4, 2) = 2*d, (4, 3) = c, (4, 4) = d});
Hi J. Tarr, Thanks. I got it to work with your advice although I also needed to specify currentdir Regards, Al
Is this what you are trying to do? > P := 4*x*(x^5+1)*(7*x^2-6)*(x^3+2*x^2+9)-7: > expand(P); 28*x^11+56*x^10+204*x^8-24*x^9-188*x^6+56*x^5+204*x^3-24*x^4-216*x-7 > coeff(P, x^7); 0 Cheers, Al
Hi Klynos, Sorry if this is a stupid question, ... but, the input numbers you use for a, and b in your procedure are in the interval 5/10000000000 and 10/10000000000? This is the interval you have restricted your values to be in in the optimization, right? Does this help?
Hi, I found an answer to my own question with some help in the forum from You may find the answer in french here: Basically the key lies in changing the numeral basis. If you want to declare an object like: L[n1,n2,n3,..,nk,m1,m2,...,mk] := f(n1,n2,...,mk) where f is a scalar function and all indexes run from 0 to d, instead of doing 2k loops like: for n1 from 0 to d for n2 from 0 to d ... for mk from 0 to d L[n1,n2,n3,..,nk,m1,m2,...,mk] = f(n1,n2,...,mk) od:od:od:od:...od: you may do: Give a value to K and d and then: for i from 0 to d^K-1 do Indi := convert(i, base, d); while nops(Indi) <> K do Indi := [op(Indi), 0] end do; for j from 0 to d^K-1 do Jndi := convert(j, base, d); while nops(Jndi) <> K do Jndi := [op(Jndi), 0] end do; MS[op(Indi), op(Jndi)] := f(Indi[1],... Indi[K],..., Jndi[1],.., Jndi[K]) end do: end do;
Page 1 of 1