MaplePrimes - Questions and Posts tagged with integer
http://www.mapleprimes.com/tags/integer
en-us2015 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemFri, 27 Feb 2015 06:01:07 GMTFri, 27 Feb 2015 06:01:07 GMTThe most recent questions and posts on MaplePrimes tagged with integerhttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Questions and Posts tagged with integer
http://www.mapleprimes.com/tags/integer
writing procedures
http://www.mapleprimes.com/questions/203585-Writing-Procedures-?ref=Feed:MaplePrimes:Tagged With integer
<p>1. a procedure quadsumstats whose input is an integer n. This procedure should return a list of length </p>
<p>n whose kth entry is the number of solutions to <br>x^2 + y^2 = k <br> for <br> 1 <= k and k <= n</p>
<p>I am sort of confused as to how to construct that list of length n and how to obtain integer solutions to the equation in maple.</p>
<p>2.</p>
<p>a procedure firstCount(k) that finds the first integer <br> n<br> with <br> k<br> representations as <br> "x^2+y^2= n." What does it mean for an integer to have k representations?</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p><p>1. a procedure quadsumstats whose input is an integer n. This procedure should return a list of length </p>
<p>n whose kth entry is the number of solutions to <br>x^2 + y^2 = k <br> for <br> 1 <= k and k <= n</p>
<p>I am sort of confused as to how to construct that list of length n and how to obtain integer solutions to the equation in maple.</p>
<p>2.</p>
<p>a procedure firstCount(k) that finds the first integer <br> n<br> with <br> k<br> representations as <br> "x^2+y^2= n." What does it mean for an integer to have k representations?</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>203585Fri, 27 Feb 2015 00:25:06 ZGPYGPYPartition of an integer with restrictions
http://www.mapleprimes.com/posts/200677-Partition-Of-An-Integer-With-Restrictions?ref=Feed:MaplePrimes:Tagged With integer
<p>The procedure <strong> Partition</strong> significantly generalizes the standard procedure <strong>combinat[partition]</strong> in several ways. The user specifies the number of parts of the partition, and can also set different limitations on parts partition.</p>
<p>Required parameters: <strong>n</strong> - a nonnegative integer, <strong>k </strong>- a positive integer or a range (<strong>k</strong> specifies the number of parts of the partition). The parameter <strong>res</strong> is the optional parameter (by default <strong>res</strong> is <strong>1 </strong>). If <strong>res</strong> is a number, all elements of <strong>k</strong>-tuples must be greater than or equal <strong> res </strong>. If <strong>res</strong> is a range <strong> a .. b</strong> , <strong> </strong>all elements of<strong> <strong>k</strong>-</strong>tuples must be greater than or equal<strong> <strong> a </strong></strong>and less than or equal<strong> <strong> b</strong></strong> . The optional parameter <strong>S</strong> - set, which includes elements of the partition. By default <strong> S = {$ 0.. n} </strong>.</p>
<p>The code of the procedure:</p>
<p><strong>Partition:=proc(n::nonnegint, k::{posint,range}, res::{range, nonnegint} := 1, S::set:={$0..n}) </strong># Generates a list of all partitions of an integer n into k parts</p>
<p><strong>local k_Partition, n1, k1, L;</strong></p>
<p><strong> </strong></p>
<p><strong>k_Partition := proc (n, k::posint, res, S)</strong></p>
<p><strong>local m, M, a, b, S1, It, L0;</strong></p>
<p><strong>m:=S[1]; M:=S[-1];</strong></p>
<p><strong>if res::nonnegint then a := max(res,m); b := min(n-(k-1)*a,M) else a := max(lhs(res),m); b := min(rhs(res),M) fi;</strong></p>
<p><strong>S1:={$a..b} intersect S;</strong></p>
<p><strong>if b < a or b*k < n or a*k > n then return [ ] fi;</strong></p>
<p><strong>It := proc (L)</strong></p>
<p><strong>local m, j, P, R, i, N;</strong></p>
<p><strong>m := nops(L[1]); j := k-m; N := 0;</strong></p>
<p><strong>for i to nops(L) do</strong></p>
<p><strong>R := n-`+`(op(L[i]));</strong></p>
<p><strong>if R <= b*j and a*j <= R then N := N+1;</strong></p>
<p><strong>P[N] := [seq([op(L[i]), s], s = {$ max(a, R-b*(j-1)) .. min(R, b)} intersect select(t->t>=L[i,-1],S1) )] fi;</strong></p>
<p><strong>od;</strong></p>
<p><strong>[seq(op(P[s]), s = 1 .. N)];</strong></p>
<p><strong>end proc;</strong></p>
<p><strong>if k=1 then [[b]] else (It@@(k-1))(map(t->[t],S1)) fi;</strong></p>
<p><strong>end proc;</strong></p>
<p><strong> </strong></p>
<p><strong>if k::posint then return k_Partition(n,k,res,S) else n1:=0;</strong></p>
<p><strong>for k1 from lhs(k) to rhs(k) do</strong></p>
<p><strong>n1:=n1+1; L[n1]:=k_Partition(n,k1,res,S)</strong></p>
<p><strong>od;</strong></p>
<p><strong>L:=convert(L,list);</strong></p>
<p><strong>[seq(op(L[i]), i=1..n1)] fi;</strong></p>
<p><strong> </strong></p>
<p><strong>end proc:</strong></p>
<p> </p>
<p>Examples of use:</p>
<p><strong>Partition(15, 3);</strong></p>
<p><strong><img src="/view.aspx?sf=200677_post/1.png" alt="" width="645" height="39"></strong></p>
<p> </p>
<p> </p>
<p><strong>Partition(15, 3..5, 1..5); </strong># The number of parts from 3 to 5, and each summand from 1 to 5</p>
<p><img src="/view.aspx?sf=200677_post/2.png" alt="" width="630" height="36"></p>
<p> </p>
<p> </p>
<p><strong>Partition(15, 5, {seq(2*n-1, n=1..8)}); </strong># 5 summands and all are odd numbers </p>
<p><img src="/view.aspx?sf=200677_post/3.png" alt="" width="579" height="26"><strong> </strong></p>
<p> </p>
<p>A more interesting example.<br>There are <strong>k</strong> banknotes in possible denominations of 5, 10, 20, 50, 100 dollars. At what number of banknotes <strong>k</strong> the number of variants of exchange <strong>$140</strong> will be maximum?</p>
<p><strong>n:=0:</strong></p>
<p><strong>for k from 3 to 28 do</strong></p>
<p><strong>n:=n+1: V[n]:=[k, nops(Partition(140, k, {5,10,20,50,100}))];</strong></p>
<p><strong>od:</strong></p>
<p><strong>V:=convert(V, list);</strong></p>
<p><strong>max(seq(V[i,2], i=1..nops(V)));</strong></p>
<p><strong>select(t->t[2]=8, V);</strong></p>
<p><strong><img src="/view.aspx?sf=200677_post/4.png" alt="" width="622" height="71"></strong></p>
<p> </p>
<p>Here are these variants:</p>
<p><strong>Partition(140, 10, {5,10,20,50,100});</strong></p>
<p><strong>Partition(140, 13, {5,10,20,50,100});</strong></p>
<p><strong><img src="/view.aspx?sf=200677_post/5.png" alt="" width="639" height="105"></strong></p>
<p> </p>
<p> <a href="/view.aspx?sf=200677_post/Partition.mws">Partition.mws</a><a href="/view.aspx?sf=200677_post/Partition.mws"><br></a></p>
<p> </p>
<p> </p>
<p> </p><p>The procedure <strong> Partition</strong> significantly generalizes the standard procedure <strong>combinat[partition]</strong> in several ways. The user specifies the number of parts of the partition, and can also set different limitations on parts partition.</p>
<p>Required parameters: <strong>n</strong> - a nonnegative integer, <strong>k </strong>- a positive integer or a range (<strong>k</strong> specifies the number of parts of the partition). The parameter <strong>res</strong> is the optional parameter (by default <strong>res</strong> is <strong>1 </strong>). If <strong>res</strong> is a number, all elements of <strong>k</strong>-tuples must be greater than or equal <strong> res </strong>. If <strong>res</strong> is a range <strong> a .. b</strong> , <strong> </strong>all elements of<strong> <strong>k</strong>-</strong>tuples must be greater than or equal<strong> <strong> a </strong></strong>and less than or equal<strong> <strong> b</strong></strong> . The optional parameter <strong>S</strong> - set, which includes elements of the partition. By default <strong> S = {$ 0.. n} </strong>.</p>
<p>The code of the procedure:</p>
<p><strong>Partition:=proc(n::nonnegint, k::{posint,range}, res::{range, nonnegint} := 1, S::set:={$0..n}) </strong># Generates a list of all partitions of an integer n into k parts</p>
<p><strong>local k_Partition, n1, k1, L;</strong></p>
<p><strong> </strong></p>
<p><strong>k_Partition := proc (n, k::posint, res, S)</strong></p>
<p><strong>local m, M, a, b, S1, It, L0;</strong></p>
<p><strong>m:=S[1]; M:=S[-1];</strong></p>
<p><strong>if res::nonnegint then a := max(res,m); b := min(n-(k-1)*a,M) else a := max(lhs(res),m); b := min(rhs(res),M) fi;</strong></p>
<p><strong>S1:={$a..b} intersect S;</strong></p>
<p><strong>if b < a or b*k < n or a*k > n then return [ ] fi;</strong></p>
<p><strong>It := proc (L)</strong></p>
<p><strong>local m, j, P, R, i, N;</strong></p>
<p><strong>m := nops(L[1]); j := k-m; N := 0;</strong></p>
<p><strong>for i to nops(L) do</strong></p>
<p><strong>R := n-`+`(op(L[i]));</strong></p>
<p><strong>if R <= b*j and a*j <= R then N := N+1;</strong></p>
<p><strong>P[N] := [seq([op(L[i]), s], s = {$ max(a, R-b*(j-1)) .. min(R, b)} intersect select(t->t>=L[i,-1],S1) )] fi;</strong></p>
<p><strong>od;</strong></p>
<p><strong>[seq(op(P[s]), s = 1 .. N)];</strong></p>
<p><strong>end proc;</strong></p>
<p><strong>if k=1 then [[b]] else (It@@(k-1))(map(t->[t],S1)) fi;</strong></p>
<p><strong>end proc;</strong></p>
<p><strong> </strong></p>
<p><strong>if k::posint then return k_Partition(n,k,res,S) else n1:=0;</strong></p>
<p><strong>for k1 from lhs(k) to rhs(k) do</strong></p>
<p><strong>n1:=n1+1; L[n1]:=k_Partition(n,k1,res,S)</strong></p>
<p><strong>od;</strong></p>
<p><strong>L:=convert(L,list);</strong></p>
<p><strong>[seq(op(L[i]), i=1..n1)] fi;</strong></p>
<p><strong> </strong></p>
<p><strong>end proc:</strong></p>
<p> </p>
<p>Examples of use:</p>
<p><strong>Partition(15, 3);</strong></p>
<p><strong><img src="/view.aspx?sf=200677_post/1.png" alt="" width="645" height="39"></strong></p>
<p> </p>
<p> </p>
<p><strong>Partition(15, 3..5, 1..5); </strong># The number of parts from 3 to 5, and each summand from 1 to 5</p>
<p><img src="/view.aspx?sf=200677_post/2.png" alt="" width="630" height="36"></p>
<p> </p>
<p> </p>
<p><strong>Partition(15, 5, {seq(2*n-1, n=1..8)}); </strong># 5 summands and all are odd numbers </p>
<p><img src="/view.aspx?sf=200677_post/3.png" alt="" width="579" height="26"><strong> </strong></p>
<p> </p>
<p>A more interesting example.<br>There are <strong>k</strong> banknotes in possible denominations of 5, 10, 20, 50, 100 dollars. At what number of banknotes <strong>k</strong> the number of variants of exchange <strong>$140</strong> will be maximum?</p>
<p><strong>n:=0:</strong></p>
<p><strong>for k from 3 to 28 do</strong></p>
<p><strong>n:=n+1: V[n]:=[k, nops(Partition(140, k, {5,10,20,50,100}))];</strong></p>
<p><strong>od:</strong></p>
<p><strong>V:=convert(V, list);</strong></p>
<p><strong>max(seq(V[i,2], i=1..nops(V)));</strong></p>
<p><strong>select(t->t[2]=8, V);</strong></p>
<p><strong><img src="/view.aspx?sf=200677_post/4.png" alt="" width="622" height="71"></strong></p>
<p> </p>
<p>Here are these variants:</p>
<p><strong>Partition(140, 10, {5,10,20,50,100});</strong></p>
<p><strong>Partition(140, 13, {5,10,20,50,100});</strong></p>
<p><strong><img src="/view.aspx?sf=200677_post/5.png" alt="" width="639" height="105"></strong></p>
<p> </p>
<p> <a href="/view.aspx?sf=200677_post/Partition.mws">Partition.mws</a><a href="/view.aspx?sf=200677_post/Partition.mws"><br></a></p>
<p> </p>
<p> </p>
<p> </p>200677Tue, 24 Feb 2015 16:55:51 ZKitonumKitonumPrime sum question
http://www.mapleprimes.com/questions/202342-Prime-Sum-Question-?ref=Feed:MaplePrimes:Tagged With integer
<p>According to this site,"It is known that every even number can be written as a sum of at most six primes". </p>
<p>http://www.theage.com.au/national/education/christians-goldbachs-magic-sum-20140903-3es2t.html</p>
<p>i wanted to test this using maple.</p>
<p>restart:<br>> PF := proc (a::integer)</p>
<p>> local cst,obj,res; <br>> cst := add(x[i], i = 1 .. numtheory:-pi(prevprime(a))) <= 6; <br>> obj := add(x[i]*ithprime(i), i = 1 .. numtheory:-pi(prevprime(a)))-a; <br>> res := Optimization:-LPSolve(obj, {cst ,obj>=0}, assume={nonnegative,integer}); end proc:<br>> PF(30);<br>[0, [x[1] = 0, x[2] = 0, x[3] = 6, x[4] = 0, x[5] = 0, x[6] = 0,x[7] = 0, x[8] = 0, x[9] = 0, x[10] = 0]]</p>
<p>the third prime is 5 and 6 of them make 30. as an aside, it would be nice to know how to get maple to output "30 = 6x5".</p>
<p>this is obviously pretty limited, because 30 can be written as the sum of two primes (7+23 and 11+19) [GOLDBACH], but using DS's GlobalSearch for all solutions takes a long time to compute. also I have to nominate the highest prime.</p>
<p>any suggestions?</p><p>According to this site,"It is known that every even number can be written as a sum of at most six primes". </p>
<p>http://www.theage.com.au/national/education/christians-goldbachs-magic-sum-20140903-3es2t.html</p>
<p>i wanted to test this using maple.</p>
<p>restart:<br>> PF := proc (a::integer)</p>
<p>> local cst,obj,res; <br>> cst := add(x[i], i = 1 .. numtheory:-pi(prevprime(a))) <= 6; <br>> obj := add(x[i]*ithprime(i), i = 1 .. numtheory:-pi(prevprime(a)))-a; <br>> res := Optimization:-LPSolve(obj, {cst ,obj>=0}, assume={nonnegative,integer}); end proc:<br>> PF(30);<br>[0, [x[1] = 0, x[2] = 0, x[3] = 6, x[4] = 0, x[5] = 0, x[6] = 0,x[7] = 0, x[8] = 0, x[9] = 0, x[10] = 0]]</p>
<p>the third prime is 5 and 6 of them make 30. as an aside, it would be nice to know how to get maple to output "30 = 6x5".</p>
<p>this is obviously pretty limited, because 30 can be written as the sum of two primes (7+23 and 11+19) [GOLDBACH], but using DS's GlobalSearch for all solutions takes a long time to compute. also I have to nominate the highest prime.</p>
<p>any suggestions?</p>202342Thu, 11 Sep 2014 14:44:03 Zbrian bovrilbrian bovrilWhich versions of Maple 18 (Personal, Academic, Commercial, etc) do Integer Relations(PSLQ)?
http://www.mapleprimes.com/questions/201900-Which-Versions-Of-Maple-18-Personal-Academic-Commercial-Etc?ref=Feed:MaplePrimes:Tagged With integer
<p>I'm interested in doing some experimental mathematics using the PSLQ integer relation algorithm. The only third-party program for doing PSLQ problems I've been able to find is a GNU C++ program with a less-than-user-friendly command-line interface. I've heard that Maple implements PSLQ and I like the symbolic input and presentation it offers as a CAS, but I can't find any information on which alternative types of Maple 18 make the PSLQ algorithm available.</p><p>I'm interested in doing some experimental mathematics using the PSLQ integer relation algorithm. The only third-party program for doing PSLQ problems I've been able to find is a GNU C++ program with a less-than-user-friendly command-line interface. I've heard that Maple implements PSLQ and I like the symbolic input and presentation it offers as a CAS, but I can't find any information on which alternative types of Maple 18 make the PSLQ algorithm available.</p>201900Tue, 01 Jul 2014 16:07:51 Zjhatc2jhatc2Write a function that takes an integer and a boolean function and returns a list containing all [i,j] such that F(i,j).
http://www.mapleprimes.com/questions/201088-Write-A-Function-That-Takes-An-Integer?ref=Feed:MaplePrimes:Tagged With integer
<p> </p>
<p> </p>
<p>so we have to Write a maple function with -> that takes an integer N and a boolean function</p>
<p>F: {(i,j) l 0<= i,j<= N} -> {true,false} </p>
<p><br>and returns a list containing all [i,j] such that F(i,j). A procedure that does this<br>would be</p>
<p><br>proc(N,F) local i, j, RV;<br>RV:=NULL;<br>for i from 1 to N do for j from 1 to N do<br>if F(i,j) then RV:=RV,[i,j] ; end if ;<br>end do ; end do ;<br>return RV ;<br>end proc ;</p>
<p><br>The problem is to do this inline, i.e. you have to write<br>(i,j)-> ...</p>
<p> </p>
<p>please help...</p><p> </p>
<p> </p>
<p>so we have to Write a maple function with -> that takes an integer N and a boolean function</p>
<p>F: {(i,j) l 0<= i,j<= N} -> {true,false} </p>
<p><br />and returns a list containing all [i,j] such that F(i,j). A procedure that does this<br />would be</p>
<p><br />proc(N,F) local i, j, RV;<br />RV:=NULL;<br />for i from 1 to N do for j from 1 to N do<br />if F(i,j) then RV:=RV,[i,j] ; end if ;<br />end do ; end do ;<br />return RV ;<br />end proc ;</p>
<p><br />The problem is to do this inline, i.e. you have to write<br />(i,j)-> ...</p>
<p> </p>
<p>please help...</p>201088Sat, 08 Mar 2014 22:50:47 Zlove mathslove maths"round" to 2 decimal places
http://www.mapleprimes.com/questions/200732-round-To-2-Decimal-Places?ref=Feed:MaplePrimes:Tagged With integer
<p>Hi</p>
<p>I have been trying to find a way to present results from engineering calcs to 2 decimal places (i.e.: 350.50) but the round function rounds to the nearest integer. Is there a specific statement for specifying the number of decimal places you want to present some results?</p>
<p>thanks</p><p>Hi</p>
<p>I have been trying to find a way to present results from engineering calcs to 2 decimal places (i.e.: 350.50) but the round function rounds to the nearest integer. Is there a specific statement for specifying the number of decimal places you want to present some results?</p>
<p>thanks</p>200732Fri, 10 Jan 2014 14:05:39 Zcesar torrescesar torresHow to find 2013th term in this sequence?
http://www.mapleprimes.com/questions/200600-How-To-Find-2013th-Term-In-This-Sequence?ref=Feed:MaplePrimes:Tagged With integer
<p>How to find 2013th term in the sequence </p>
<p><strong>1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...</strong>?</p>
<p>in which the n-th positive integer appears <em><strong>n</strong></em> times. </p>
<p>I don't know how to start.</p><p>How to find 2013th term in the sequence </p>
<p><strong>1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...</strong>?</p>
<p>in which the n-th positive integer appears <em><strong>n</strong></em> times. </p>
<p>I don't know how to start.</p>200600Sun, 22 Dec 2013 10:17:14 ZtoandhsptoandhspPerimeter and area of a triangle are integer numbers
http://www.mapleprimes.com/questions/200319-Perimeter-And-Area-Of-A-Triangle-Are?ref=Feed:MaplePrimes:Tagged With integer
<p>In geom3d. I want to find the vertices A(x1,y1,z1), B(x2,y2,z2), where x1, y1, z1, x2, y2, z2 are integer numbers so that the triangle OAB (O is origin) and perimeter and area are integer numbers. I tried</p>
<p>> <strong>resrart:</strong></p>
<p><strong>N:=5:</strong></p>
<p><strong>L:=[]:</strong></p>
<p><strong>for x1 from -N to N do</strong></p>
<p><strong>for y1 from x1 to N do</strong></p>
<p><strong>for z1 from y1 to N do</strong></p>
<p><strong>for x2 from -N to N do</strong></p>
<p><strong>for y2 from -N to N do</strong></p>
<p><strong>for z2 from -N to N do</strong></p>
<p><strong>a:=sqrt(x1^2+y1^2+z1^2):b:=sqrt(x2^2+y2^2+z2^2):c:=sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2):</strong></p>
<p><strong>p:=(a+b+c)/2:</strong></p>
<p><strong>S:=sqrt(p*(p-a)*(p-b)*(p-c)):</strong></p>
<p><strong>if type(2*p, integer) and type(S, posint)</strong></p>
<p><strong>then L:=[op(L), [[0, 0, 0], [x1, y1, z1], [x2, y2, z2]]]: fi:</strong></p>
<p><strong>od: od: od: od: od: od:</strong></p>
<p><strong>nops(L);</strong></p>
<p>But my computer runs too long. I can not receive the result. How to get the answer?</p>
<p>If I the length of the side are 6, 25, 29. I tried </p>
<p><strong>DirectSearch:-SolveEquations([(x2-x1)^2+(y2-y1)^2+(z2-z1)^2 = 6^2, (x3-x2)^2+(y3-y2)^2+(z3-z2)^2 = 25^2, (x3-x1)^2+(y3-y1)^2+(z3-z1)^2 = 29^2], {abs(x1) <= 30, abs(x2) <= 20, abs(x3) <= 20, abs(y1) <= 20, abs(y2) <= 20, abs(y3) <= 20, abs(z1) <= 20,abs(z2) <= 20, abs(z3) <= 20}, assume = integer, AllSolutions, solutions = 1);</strong></p>
<p><strong> </strong></p>
<p> </p><p>In geom3d. I want to find the vertices A(x1,y1,z1), B(x2,y2,z2), where x1, y1, z1, x2, y2, z2 are integer numbers so that the triangle OAB (O is origin) and perimeter and area are integer numbers. I tried</p>
<p>> <strong>resrart:</strong></p>
<p><strong>N:=5:</strong></p>
<p><strong>L:=[]:</strong></p>
<p><strong>for x1 from -N to N do</strong></p>
<p><strong>for y1 from x1 to N do</strong></p>
<p><strong>for z1 from y1 to N do</strong></p>
<p><strong>for x2 from -N to N do</strong></p>
<p><strong>for y2 from -N to N do</strong></p>
<p><strong>for z2 from -N to N do</strong></p>
<p><strong>a:=sqrt(x1^2+y1^2+z1^2):b:=sqrt(x2^2+y2^2+z2^2):c:=sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2):</strong></p>
<p><strong>p:=(a+b+c)/2:</strong></p>
<p><strong>S:=sqrt(p*(p-a)*(p-b)*(p-c)):</strong></p>
<p><strong>if type(2*p, integer) and type(S, posint)</strong></p>
<p><strong>then L:=[op(L), [[0, 0, 0], [x1, y1, z1], [x2, y2, z2]]]: fi:</strong></p>
<p><strong>od: od: od: od: od: od:</strong></p>
<p><strong>nops(L);</strong></p>
<p>But my computer runs too long. I can not receive the result. How to get the answer?</p>
<p>If I the length of the side are 6, 25, 29. I tried </p>
<p><strong>DirectSearch:-SolveEquations([(x2-x1)^2+(y2-y1)^2+(z2-z1)^2 = 6^2, (x3-x2)^2+(y3-y2)^2+(z3-z2)^2 = 25^2, (x3-x1)^2+(y3-y1)^2+(z3-z1)^2 = 29^2], {abs(x1) <= 30, abs(x2) <= 20, abs(x3) <= 20, abs(y1) <= 20, abs(y2) <= 20, abs(y3) <= 20, abs(z1) <= 20,abs(z2) <= 20, abs(z3) <= 20}, assume = integer, AllSolutions, solutions = 1);</strong></p>
<p><strong> </strong></p>
<p> </p>200319Tue, 26 Nov 2013 08:38:53 ZtoandhsptoandhspInputting summation of prime numbers in maple
http://www.mapleprimes.com/questions/200273-Inputting-Summation-Of-Prime-Numbers-In-Maple?ref=Feed:MaplePrimes:Tagged With integer
<p>I've been given a question:</p>
<p>Let pn denote the nth prime number. Then p1 = 2, p2 = 3, p3 = 5, p4 = 7, p5 = 11, . . . .</p>
<p>It is known that the infinite sum 1/p1 + 1/p2 + 1/p3 + · · · + 1/pn + · · · = infinity.</p>
<p>Find the smallest positive integer N so that 1/p1 + 1/p2 +1/p3 + · · · + 1/pN−1 + 1/pN > e. [Hint : ithprime(n) generates the nth prime number.]</p>
<p>How do I start off?</p>
<p>Many thanks!</p><p>I've been given a question:</p>
<p>Let pn denote the nth prime number. Then p1 = 2, p2 = 3, p3 = 5, p4 = 7, p5 = 11, . . . .</p>
<p>It is known that the infinite sum 1/p1 + 1/p2 + 1/p3 + · · · + 1/pn + · · · = infinity.</p>
<p>Find the smallest positive integer N so that 1/p1 + 1/p2 +1/p3 + · · · + 1/pN−1 + 1/pN > e. [Hint : ithprime(n) generates the nth prime number.]</p>
<p>How do I start off?</p>
<p>Many thanks!</p>200273Wed, 20 Nov 2013 03:33:42 Zxx50xxxx50xxHow do I force simplification of products of square roots of positive integers
http://www.mapleprimes.com/questions/147098-How-Do-I-Force-Simplification-Of-Products?ref=Feed:MaplePrimes:Tagged With integer
<p>In an atomic physics calculation involving the quantum theory of angular momentum, there appear polynomials whose coefficients involve square roots of positive integers, for example</p>
<p>sqrt(6)-sqrt(2)*sqrt(3) </p>
<p>Maple does not cancel such an expression to zero because the code allows for the possibility that a square root can be positive or negative. In the physics context all these square roots are positive. Is there some simple way to induce Maple...<p>In an atomic physics calculation involving the quantum theory of angular momentum, there appear polynomials whose coefficients involve square roots of positive integers, for example</p>
<p>sqrt(6)-sqrt(2)*sqrt(3) </p>
<p>Maple does not cancel such an expression to zero because the code allows for the possibility that a square root can be positive or negative. In the physics context all these square roots are positive. Is there some simple way to induce Maple to cancel such expressions by enforcing an assumption that the square roots of all integers are positive?</p>
<p>More generally, again making the assumption that all square roots of integers are positive, is there a simple way to to standarize products of square roots of positive integers, like</p>
<p>sqrt(2)*sqrt(3)*sqrt(5)*sqrt(7), or sqrt(6)*sqrt(35), or sqrt(10)*sqrt(21)</p>
<p>to a standard sqrt(210)?</p>147098Sat, 11 May 2013 03:25:49 Zcharlestmungerjrcharlestmungerjr"Is this matrix primitive?": just an idea
http://www.mapleprimes.com/posts/145555-Is-This-Matrix-Primitive-Just-An-Idea?ref=Feed:MaplePrimes:Tagged With integer
<p>Since it is not possible for me to reply directly in that new Maple Primes: <br>I branched. Feel free to re-join for a reasonable structure. What a mess.</p>
<p><a href="http://www.mapleprimes.com/questions/145527-Is-This-Matrix-Primitive">http://www.mapleprimes.com/questions/145527-Is-This-Matrix-Primitive</a></p>
<p> </p>
<p>I am rusty on such (may be it is 'obvious' via Lie theory). Your group is just the<br>group of invertible matrices over the integers (this follows from algebra). And as<p>Since it is not possible for me to reply directly in that new Maple Primes: <br>I branched. Feel free to re-join for a reasonable structure. What a mess.</p>
<p><a href="http://www.mapleprimes.com/questions/145527-Is-This-Matrix-Primitive">http://www.mapleprimes.com/questions/145527-Is-This-Matrix-Primitive</a></p>
<p> </p>
<p>I am rusty on such (may be it is 'obvious' via Lie theory). Your group is just the<br>group of invertible matrices over the integers (this follows from algebra). And as<br>det = -1 the possible 'root' K must be one for n=odd.<br><br>Looking at Eigenvalues of K they must be conjugated or purely real and different (dim=2)<br><br>conjugate(a)^n+a^n = 29, conjugate(a)^n*a^n = -1 should hold for the Eigenvalues of K.<br>which should follow from looking at the characteristic polynomials of products.<br><br>The last is abs(a)^(2*n) = - 1. So I would say: no, not possible.</p>145555Sat, 06 Apr 2013 00:34:37 ZAxel VogtAxel VogtIs this matrix primitive?
http://www.mapleprimes.com/questions/145527-Is-This-Matrix-Primitive?ref=Feed:MaplePrimes:Tagged With integer
<p> Let GL(2,Z) be the group of all the matrices of dimension 2 over the integers with the determinant equal to +/-1. <br> A matrix M in GL(2,Z) is called <em>primitive</em> if M is not equal to K^n for any K in GL(2,Z) and any positive integer n >= 2. <br> Is the matrix M:= Matrix([[27,5],[11,2]]) primitive? How to determine it in Maple?</p>
<p>Edit. GL(2,Z) instead of UL(2,Z).</p><p> Let GL(2,Z) be the group of all the matrices of dimension 2 over the integers with the determinant equal to +/-1. <br> A matrix M in GL(2,Z) is called <em>primitive</em> if M is not equal to K^n for any K in GL(2,Z) and any positive integer n >= 2. <br> Is the matrix M:= Matrix([[27,5],[11,2]]) primitive? How to determine it in Maple?</p>
<p>Edit. GL(2,Z) instead of UL(2,Z).</p>145527Fri, 05 Apr 2013 13:02:47 ZMarkiyan HirnykMarkiyan Hirnykbeta function vs. sine
http://www.mapleprimes.com/posts/144855-Beta-Function-Vs-Sine?ref=Feed:MaplePrimes:Tagged With integer
<p>Dear friends,</p>
<p>I am reporting with a brief comment concerning the integral int(1/(1+x^a), x=0..infinity) with a>=2 a real number. This was evaluated <a href="http://math.stackexchange.com/questions/335583/contour-integration-residue-theorem"> here.</a></p>
<p>Now Maple 15 (X86 64 LINUX) will quite happily compute this in its most simple form involving the sine when a is not a positive integer or a rational number. If it is, however, a beta function term results,...<p>Dear friends,</p>
<p>I am reporting with a brief comment concerning the integral int(1/(1+x^a), x=0..infinity) with a>=2 a real number. This was evaluated <a href="http://math.stackexchange.com/questions/335583/contour-integration-residue-theorem"> here.</a></p>
<p>Now Maple 15 (X86 64 LINUX) will quite happily compute this in its most simple form involving the sine when a is not a positive integer or a rational number. If it is, however, a beta function term results, which the simplifier does not know how to turn into a sine term even though the two arguments add up to one.</p>
<p>This is just to bring this to your attention. One might say that a beta function term is as good as a sine term, I would argue, though, that the sine term should be preferred. Maple will output the correct result when a is left unspecified (symbol), which I think is very nice.</p>
<p>Happy computing.</p>
<p>Marko Riedel</p>144855Thu, 21 Mar 2013 06:56:37 ZmriedelmriedelThe enumeration of non-isomorphic graphs.
http://www.mapleprimes.com/posts/144151-The-Enumeration-Of-Nonisomorphic-Graphs?ref=Feed:MaplePrimes:Tagged With integer
<p>Dear friends,</p>
<p>this is to share with you what a joy it was to work with Maple on the problem of enumerating non-isomorphic graphs. This problem goes back to Polya and Harary and it is a beautiful example of Polya counting, while also being of notable simplicity, so that a high school student or an undergraduate can follow it easily.</p>
<p>I have worked on this problem over the years, adapting my solutions in Cocoa and Lisp as I gained insights. My first attempt used...<p>Dear friends,</p>
<p>this is to share with you what a joy it was to work with Maple on the problem of enumerating non-isomorphic graphs. This problem goes back to Polya and Harary and it is a beautiful example of Polya counting, while also being of notable simplicity, so that a high school student or an undergraduate can follow it easily.</p>
<p>I have worked on this problem over the years, adapting my solutions in Cocoa and Lisp as I gained insights. My first attempt used GMP for large integers and can be found <a href="http://www.roard.com/docs/cookbook/cbsu5.html">here.</a> It was quite involved and while it computed results for very large values, there was a crucial oversight in that it did not use Lovasz' formula for the cycle index of the symmetric group. Thereafter I wrote another implementation in Lisp, taking advantage of the large integers provided by that language, but still not using said formula.</p>
<p>Most recently I was prompted by a post at math.stackexchange.com to revisit this problem and decided to implement the best algorithm, which is the one that uses Lovasz' formula. To my suprise it only needed a few lines of code to solve the problem even for large numbers of nodes. Imagine my amazement at the power of Maple especially taking into account the effort I had needed to program the solution with Objective C and GMP (which is not to say that this combination does not have its advantages under certain circumstances). I also enjoy working with a computer algebra system that keeps syntactic complexity to a minimum, enabling users to get started quickly.</p>
<p>I hope that with this motivational story I may give back some of the pleasure of my experience with Maple, and perhaps convince you that expanding the group theory package to include common cycle indices and routines to substitute at specific values of the variables would be a good thing to have, so that one day, counting non-isomorphic graphs will be as easy as saying give me the cycle index of the edge permutation group of the complete graph on n nodes and substitute the values of the edges into that index. Of course if you have such a package already do post the link.</p>
<p>Best regards,</p>
<p>Marko Riedel</p>
<p>PS: The Maple code for the enumeration can be found<a href="http://math.stackexchange.com/questions/314103/how-many-2-edge-colourings-of-k-n-are-there">here.</a></p>144151Mon, 04 Mar 2013 00:32:02 ZmriedelmriedelHow to find vertices of an equilateral triangle knowing coordinates of centroid?
http://www.mapleprimes.com/questions/142591-How-To-Find-Vertices-Of-An-Equilateral?ref=Feed:MaplePrimes:Tagged With integer
<p>I want to find a triangle with the vertices A(x1, y1, z1), B(x2, y2, z2), C(x3, y3, z3) knowing that the point G(1,1,1) is centroid of the triagle ABC and x1, y1, z1, x2, y2, z2, x3, y3, z3 are integer numbers, but I can not find. How do I tell <em>Maple</em> to do that? </p><p>I want to find a triangle with the vertices A(x1, y1, z1), B(x2, y2, z2), C(x3, y3, z3) knowing that the point G(1,1,1) is centroid of the triagle ABC and x1, y1, z1, x2, y2, z2, x3, y3, z3 are integer numbers, but I can not find. How do I tell <em>Maple</em> to do that? </p>142591Thu, 24 Jan 2013 20:57:10 Ztoandhsptoandhsp