Items tagged with integer integer Tagged Items Feed

 

 

so we have to Write a maple function with -> that takes an integer N and a boolean function

F: {(i,j) l 0<= i,j<= N} -> {true,false} 


and returns a list containing all [i,j] such that F(i,j). A procedure that does this
would be


proc(N,F) local i, j, RV;
RV:=NULL;
for i from 1 to N do for j from 1 to N do
if F(i,j) then RV:=RV,[i,j] ; end if ;
end do ; end do ;
return RV ;
end proc ;


The problem is to do this inline, i.e. you have to write
(i,j)-> ...

 

please help...

Hi

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?

thanks

How to find 2013th term in the sequence 

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...?

in which the n-th positive integer appears n times. 

I don't know how to start.

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

> resrart:

N:=5:

L:=[]:

for x1 from -N to N do

for y1 from x1 to N do

for z1 from y1 to N do

for x2 from -N to N do

for y2 from -N to N do

for z2 from -N to N do

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):

p:=(a+b+c)/2:

S:=sqrt(p*(p-a)*(p-b)*(p-c)):

if type(2*p, integer) and type(S, posint)

then L:=[op(L), [[0, 0, 0], [x1, y1, z1], [x2, y2, z2]]]: fi:

od: od: od: od: od: od:

nops(L);

But my computer runs too long. I can not receive the result. How to get the answer?

If I the length of the side are 6, 25, 29. I tried 

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);

 

 

I've been given a question:

Let pn denote the nth prime number. Then p1 = 2, p2 = 3, p3 = 5, p4 = 7, p5 = 11, . . . .

It is known that the infinite sum 1/p1 + 1/p2 + 1/p3 + · · · + 1/pn + · · · = infinity.

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.]

How do I start off?

Many thanks!

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

sqrt(6)-sqrt(2)*sqrt(3) 

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...

Since it is not possible for me to reply directly in that new Maple Primes:
I branched. Feel free to re-join for a reasonable structure. What a mess.

http://www.mapleprimes.com/questions/145527-Is-This-Matrix-Primitive

 

I am rusty on such (may be it is 'obvious' via Lie theory). Your group is just the
group of invertible matrices over the integers (this follows from algebra). And as

   Let GL(2,Z) be the  group of all the matrices of dimension 2 over the integers with the determinant equal to +/-1.
   A matrix M in GL(2,Z) is called primitive if M is not equal to K^n for any K in GL(2,Z) and any positive integer n >= 2.
   Is the matrix M:= Matrix([[27,5],[11,2]]) primitive? How to determine it in Maple?

Edit. GL(2,Z) instead of UL(2,Z).

Dear friends,

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 here.

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,...

Dear friends,

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.

I have worked on this problem over the years, adapting my solutions in Cocoa and Lisp as I gained insights. My first attempt used...

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 Maple to do that? 

Hello, I have a set of equations, and I want to solve it over the integers (mod 13). But msolve command fails. Here is my code:

eq:={a4*a1-11, a4*a2-12, a4*a3-6, a5*a1-3, a5*a2-8, a5*a3-4, a6*a1-2, a6*a2-1, a6*a3-7};
msolve(eq,13);

It fails, but I can solve it manually. Here is a solution:

a4*a1 = 11 => a4:=1 and a1:=11

a4*a2 = 12 => a2:=12

a4*a3 = 6 => a3:=6

a5*a1 = 3 => a5:=3/11 mod 13 = 5

a5*a2 = 8 => a2:=8/5 mod 13 = 12

Fine $a_{n}$ of sequence  2 , 3 , 6 , 7 , 10 , 11 , 14 , 15,...

Hi All, I have the following procedure to compute the gcd between two integers:

Egcd := proc(a, b)
while b != 0 do
temp := b;
b := a mod b;
a := temp;
od;
return a;  
end proc;

Why does it simply return the value of a when the function was called? (i.e my statements inside the procedure do nothing

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