MaplePrimes - Newest Questions and Posts
http://www.mapleprimes.com
en-us2017 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemSat, 25 Nov 2017 07:23:59 GMTSat, 25 Nov 2017 07:23:59 GMTThe latest questions and posts added to MaplePrimeshttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Newest Questions and Posts
http://www.mapleprimes.com
Draw a set of points in 3D and want surface style
https://www.mapleprimes.com/questions/223351-Draw-A-Set-Of-Points-In-3D-And-Want-Surface-Style?ref=Feed:MaplePrimes:New%20Questions%20&%20Posts
<p>Dear </p>
<p>I want to graw following points (u[i,j], i=0..M,j=0..N) obtained in Sol[i] in 3D where i takes along x-axes, j y-axis and u along z axes. I also want the style of point plot as surface. Same do for v and w. I am waiting your response, Thanks</p>
<p><a href="/view.aspx?sf=223351_question/3D_plots.mw">3D_plots.mw</a></p>
<p>Dear </p>
<p>I want to graw following points (u[i,j], i=0..M,j=0..N) obtained in Sol[i] in 3D where i takes along x-axes, j y-axis and u along z axes. I also want the style of point plot as surface. Same do for v and w. I am waiting your response, Thanks</p>
<p><a href="/view.aspx?sf=223351_question/3D_plots.mw">3D_plots.mw</a></p>
223351Sat, 25 Nov 2017 06:45:25 ZMuhammad UsmanMuhammad UsmanHow to work with polynomials over Finite Fields?
https://www.mapleprimes.com/questions/223350-How-To-Work-With-Polynomials-Over-Finite-Fields?ref=Feed:MaplePrimes:New%20Questions%20&%20Posts
<p><em><strong>TL;DR </strong>I'm having problems with the Finite Fields, polynomials over them and related operations. I saw it has been asked but questions were asked long time ago. Any advice would be appreciated.</em></p>
<p>I'm trying to develop some algorithms in Maple using Finite Fields. I'm finding it difficult to learn Maple as I find the information on the internet either basic (guides on making sums and so) or too advanced (most of the times Maple Help feels like swimming in the abyss).</p>
<p>At first I started using the Domains package but it's documentation is quite ambiguous and I felt it was too low-level. I switched then to using the Galois Field package making statements like these:</p>
<pre class="prettyprint">
#Example of EUCLIDES algorithm in F7
p:=7:
G7:=GF(p,1);
a:=G7:-ConvertIn(6);
b:=G7:-ConvertIn(5);
gcd:=EUCLIDES(a, b, G7, p);</pre>
<p>At this moment, things get very confusing as a and b were elements of F7 but whattype returned they were zppolys. The problem arises when I try to use polynomials in F7[x]. Intuitively, I coded this:</p>
<pre class="prettyprint">
a := modp1(ConvertIn(3*x^6+2*x^2+x+5, x), 7);
b := modp1(ConvertIn(6*x^4+x^3+2*x+4, x), 7);
mcd:=EUCLIDES(a,b,G7, 7);</pre>
<p>as I found the modp1 functions diving in Maple Help. The strange thing is that a and b also claim to be zppolys. Is this normal? Do the elements and the polynomials over the elements have the same type? It's a bit odd.</p>
<p>Also, my implementation of EUCLIDES is as follows:</p>
<pre class="prettyprint">
proc(a::zppoly, b::zppoly, g::symbol, p::integer)
local r0, r1, r2;
r0, r1 := a, b;
while r1 <> g:-ConvertIn(0) do
r2 := modp1(Rem(r0,r1),p);
r0 := r1;
r1 := r2
end do;
return r0
end proc:</pre>
<p>Which syntax I find a bit annoying.</p>
<p>The problem gets even worse as I try to implement the Rabin test of irreducibility <a href="https://en.wikipedia.org/wiki/Factorization_of_polynomials_over_finite_fields#Rabin.27s_test_of_irreducibility">https://en.wikipedia.org/wiki/Factorization_of_polynomials_over_finite_fields#Rabin.27s_test_of_irreducibility</a></p>
<p>Which uses the modular composition algorithm, implemented as follows:</p>
<pre class="prettyprint">
modcomp := proc(f::zppoly, g::zppoly, h::zppoly, p::integer)
local n, m, A, B, i, pol, grad, k, j, BA, b, ri;
n := modp1(Degree(f));
m := ceil(n^(1/2));
A := Matrix(m,n);
B := Matrix(m,m);
for i from 1 to m do
pol := repsqua(h, i-1, f, p);
grad := modp1(Degree(pol));
for k from 0 to grad do
A[i, k+1] := modp1(Coeff(pol, k));
end do;
for j from 1 to m do
B[i, j] := modp1(Coeff(g, (j-1)+(i-1)*m));
end do;
end do;
BA := B.A;
b := modp1(ConvertIn(0,x),p);
for i from 1 to m do
ri := modp1(ConvertIn(0,x),p);
pol := 0;
for j from 1 to m do
ri := modp1(Add(ri,modp1(ConvertIn(BA[i,j]*x^(j-1), x),p)));
if j <= numelems(A[i]) then
pol := pol + A[i, j]*x^(j-1);
end if;
end do;
pol := modp1(ConvertIn(pol,x),p);
pol := repsqua(pol, i-1, f, p);
b := modp1(Add(b, modp1(Rem(modp1(Multiply(pol, ri)), f))));
end do;
return b;
end proc:</pre>
<p>That ceirtainly is an annoying syntax plus the fact that the whole implementation of the algorithm doesn't work. I upload a file in case someone has some time to have a look. <a href="/view.aspx?sf=223350_question/testIrrFq.mw">testIrrFq.mw</a></p>
<p>I'm quite lost in all that goes about Polynomials and Finite Fields and so in Maple, so any help is appreciated.</p>
<p><em><strong>TL;DR </strong>I'm having problems with the Finite Fields, polynomials over them and related operations. I saw it has been asked but questions were asked long time ago. Any advice would be appreciated.</em></p>
<p>I'm trying to develop some algorithms in Maple using Finite Fields. I'm finding it difficult to learn Maple as I find the information on the internet either basic (guides on making sums and so) or too advanced (most of the times Maple Help feels like swimming in the abyss).</p>
<p>At first I started using the Domains package but it's documentation is quite ambiguous and I felt it was too low-level. I switched then to using the Galois Field package making statements like these:</p>
<pre class="prettyprint">
#Example of EUCLIDES algorithm in F7
p:=7:
G7:=GF(p,1);
a:=G7:-ConvertIn(6);
b:=G7:-ConvertIn(5);
gcd:=EUCLIDES(a, b, G7, p);</pre>
<p>At this moment, things get very confusing as a and b were elements of F7 but whattype returned they were zppolys. The problem arises when I try to use polynomials in F7[x]. Intuitively, I coded this:</p>
<pre class="prettyprint">
a := modp1(ConvertIn(3*x^6+2*x^2+x+5, x), 7);
b := modp1(ConvertIn(6*x^4+x^3+2*x+4, x), 7);
mcd:=EUCLIDES(a,b,G7, 7);</pre>
<p>as I found the modp1 functions diving in Maple Help. The strange thing is that a and b also claim to be zppolys. Is this normal? Do the elements and the polynomials over the elements have the same type? It's a bit odd.</p>
<p>Also, my implementation of EUCLIDES is as follows:</p>
<pre class="prettyprint">
proc(a::zppoly, b::zppoly, g::symbol, p::integer)
local r0, r1, r2;
r0, r1 := a, b;
while r1 <> g:-ConvertIn(0) do
r2 := modp1(Rem(r0,r1),p);
r0 := r1;
r1 := r2
end do;
return r0
end proc:</pre>
<p>Which syntax I find a bit annoying.</p>
<p>The problem gets even worse as I try to implement the Rabin test of irreducibility <a href="https://en.wikipedia.org/wiki/Factorization_of_polynomials_over_finite_fields#Rabin.27s_test_of_irreducibility">https://en.wikipedia.org/wiki/Factorization_of_polynomials_over_finite_fields#Rabin.27s_test_of_irreducibility</a></p>
<p>Which uses the modular composition algorithm, implemented as follows:</p>
<pre class="prettyprint">
modcomp := proc(f::zppoly, g::zppoly, h::zppoly, p::integer)
local n, m, A, B, i, pol, grad, k, j, BA, b, ri;
n := modp1(Degree(f));
m := ceil(n^(1/2));
A := Matrix(m,n);
B := Matrix(m,m);
for i from 1 to m do
pol := repsqua(h, i-1, f, p);
grad := modp1(Degree(pol));
for k from 0 to grad do
A[i, k+1] := modp1(Coeff(pol, k));
end do;
for j from 1 to m do
B[i, j] := modp1(Coeff(g, (j-1)+(i-1)*m));
end do;
end do;
BA := B.A;
b := modp1(ConvertIn(0,x),p);
for i from 1 to m do
ri := modp1(ConvertIn(0,x),p);
pol := 0;
for j from 1 to m do
ri := modp1(Add(ri,modp1(ConvertIn(BA[i,j]*x^(j-1), x),p)));
if j <= numelems(A[i]) then
pol := pol + A[i, j]*x^(j-1);
end if;
end do;
pol := modp1(ConvertIn(pol,x),p);
pol := repsqua(pol, i-1, f, p);
b := modp1(Add(b, modp1(Rem(modp1(Multiply(pol, ri)), f))));
end do;
return b;
end proc:</pre>
<p>That ceirtainly is an annoying syntax plus the fact that the whole implementation of the algorithm doesn't work. I upload a file in case someone has some time to have a look. <a href="/view.aspx?sf=223350_question/testIrrFq.mw">testIrrFq.mw</a></p>
<p>I'm quite lost in all that goes about Polynomials and Finite Fields and so in Maple, so any help is appreciated.</p>
223350Fri, 24 Nov 2017 18:44:35 ZJasagredoJasagredoApplying array/list to all elements
https://www.mapleprimes.com/questions/223349-Applying-Arraylist-To-All-Elements?ref=Feed:MaplePrimes:New%20Questions%20&%20Posts
<p>I have written the following code; </p>
<p> </p>
<p>Do := proc( F::list , Q::list )<br>
local q , n;<br>
<br>
q := Array( 1..Size( Q , 2 ) ):<br>
</p>
<p> for n from 1 to Size( Q , 2 ) do:</p>
<p><br>
q( n ) := F( Q[ n ] ):</p>
<p> end do:</p>
<p><br>
return q</p>
<p><br>
end proc:</p>
<p><br>
do( [ x -> x , y -> y^2] , [0,1,2,3] , [4,5,6,7]);<br>
</p>
<p>Which gives me [0,0]. [1,1] [2,4] [3,9]<br>
</p>
<p> </p>
<p>The problem i am having is that it only seems to apply the first array to both functions. What i want it to do is to apply the first array to the first function, the second array to the second function and so on for n functions. </p>
<p> </p>
<p>How can i go about doing this?</p>
<p>I have written the following code; </p>
<p> </p>
<p>Do := proc( F::list , Q::list )<br />
local q , n;<br />
<br />
q := Array( 1..Size( Q , 2 ) ):<br />
</p>
<p> for n from 1 to Size( Q , 2 ) do:</p>
<p><br />
q( n ) := F( Q[ n ] ):</p>
<p> end do:</p>
<p><br />
return q</p>
<p><br />
end proc:</p>
<p><br />
do( [ x -> x , y -> y^2] , [0,1,2,3] , [4,5,6,7]);<br />
</p>
<p>Which gives me [0,0]. [1,1] [2,4] [3,9]<br />
</p>
<p> </p>
<p>The problem i am having is that it only seems to apply the first array to both functions. What i want it to do is to apply the first array to the first function, the second array to the second function and so on for n functions. </p>
<p> </p>
<p>How can i go about doing this?</p>
223349Fri, 24 Nov 2017 18:05:19 ZHoovernentHoovernentWant to draw the graph of PDEs in 3D
https://www.mapleprimes.com/questions/223348-Want-To-Draw-The-Graph-Of-PDEs-In-3D?ref=Feed:MaplePrimes:New%20Questions%20&%20Posts
<p>Dear</p>
<p>I want to draw the graphs of the attached system of PDEs for different values of M in 3D please fix my problem. I am waiting your positive response.</p>
<p><a href="/view.aspx?sf=223348_question/graphs_for_pde.mw">graphs_for_pde.mw</a></p>
<p>Dear</p>
<p>I want to draw the graphs of the attached system of PDEs for different values of M in 3D please fix my problem. I am waiting your positive response.</p>
<p><a href="/view.aspx?sf=223348_question/graphs_for_pde.mw">graphs_for_pde.mw</a></p>
223348Fri, 24 Nov 2017 17:42:35 ZMuhammad UsmanMuhammad UsmanStatements inside functions
https://www.mapleprimes.com/questions/223347-Statements-Inside-Functions?ref=Feed:MaplePrimes:New%20Questions%20&%20Posts
<p>It seems rather arbitrary that proc..end proc is allowed inside functions, but none of the other statements from <a href='http://www.maplesoft.com/support/help/search.aspx?term=index,statement' target='_new'>?index,statement</a> are:</p>
<pre class="prettyprint">
seq(try ln(i) catch: -infinity end try, i=0..2)
seq(proc() try ln(i) catch: -infinity end try end proc(), i=0..2)</pre>
<p>Only the second one works, even though syntactically it doesn't seem to be different from the first one.</p>
<p>It would be really convenient to have any statement allowed inside a function, including assignments (as :=, not as assign()) and compound statements:</p>
<pre class="prettyprint">
s:=0: seq(s:=s+i, i=1..10)
s:=0: seq(proc() global s:=s+i end proc(), i=1..10)</pre>
<p>This is more compact than using a loop.</p>
<p>It seems rather arbitrary that proc..end proc is allowed inside functions, but none of the other statements from ?index,statement are:</p>
<pre class="prettyprint">
seq(try ln(i) catch: -infinity end try, i=0..2)
seq(proc() try ln(i) catch: -infinity end try end proc(), i=0..2)</pre>
<p>Only the second one works, even though syntactically it doesn't seem to be different from the first one.</p>
<p>It would be really convenient to have any statement allowed inside a function, including assignments (as :=, not as assign()) and compound statements:</p>
<pre class="prettyprint">
s:=0: seq(s:=s+i, i=1..10)
s:=0: seq(proc() global s:=s+i end proc(), i=1..10)</pre>
<p>This is more compact than using a loop.</p>
223347Fri, 24 Nov 2017 15:40:58 Z_Maxim__Maxim_how I can select 2D function (sigma) that these boundary conditions are satisfied?
https://www.mapleprimes.com/questions/223346-How-I-Can-select-2D-Function-sigma?ref=Feed:MaplePrimes:New%20Questions%20&%20Posts
<p>how I can select 2D function (sigma) that these boundary conditions are satisfied?</p>
<p>thanks</p>
<p>sigma(1, z) = 0, sigma(r, 0) = 1, diff(sigma(0, z), r) = 0, diff(sigma(r, 1), z) = 0</p>
<p>how I can select 2D function (sigma) that these boundary conditions are satisfied?</p>
<p>thanks</p>
<p>sigma(1, z) = 0, sigma(r, 0) = 1, diff(sigma(0, z), r) = 0, diff(sigma(r, 1), z) = 0</p>
223346Fri, 24 Nov 2017 14:00:27 Ztorabitorabi