love maths

love maths

85 Reputation

5 Badges

11 years, 285 days

MaplePrimes Activity


These are questions asked by love maths

hello, 

so i've been having trouble with this one for a while. I think i'm just missing something simple.. maybe yous could help.

all we have to do is to write a maple procedure that takes an integer N and a boolean function F as in14 as arguments, returns nothing, and plots a square N N lattice of points, coloring the points (i; j) with F(i; j) true in red and the other ones blue.

thaaaanks.

 

 

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

so we have to Write a function that diagonalises a complex (2x2) matrix if possible,  

we need the argument to be a (2x2) matrix say A.   and we need the return value to be a list [a1 ;a2 ;b1;b2] of two complex numbers followed by two 2-vectors such that {b1,b2} is a basis for C^2 and so that  

Ab1 =a1b1 , Ab2=a2b2  if these exist. if not then the function should return an empty list []

also, the thing is that we're not allowed to load any maple packages, we have to do it by hand :'(

thanks <3

 

okay so im quite confused, im trying to write a procedure that prints the orbit of a 2x2 matrix through a given list of points.  our arguments should be a a (2x2) matrix, a list L of points represented by 2 vectors, ie (2x1) matrices and a natural number N. Returnvalue : NULL

a side effect should be to 

A^i.L[j] for i = 0 ... N and j = 1 ... nops(L)

thus, an example, if the proc is called P, then 

P(Matrix([[0,-1],[1,0]]),[Matrix([[1],[1]]),Matrix([[1],[0]])],2) 

should plot the points  

(1,1) ,(-1,1) , (-1,-1)  for the 1st point  and 

(1,0)  ,(0,1) , (-1,0) for the second

thanks for any help in advance

 

we were given a function that counts the number of primes among the arguments after the
rst and returns the result in the rst argument. When calling this, you must make sure
that the rst argument is a name. 

this is it.

cp := proc (YY) local count, i ;
print("nargs=", nargs, "args=", args) ;
count := 0 ;
for i from 2 to nargs do
if isprime(args[i]) then
count := count+1 ;
end if ;
print("i=", i, "count=", count) ;
end do ;
print("count=", count) ;
YY := count ;
end proc ;

EX: cp('noprimes',2,4,5,6,7,9,19)

and this works grand, but then we were given this function with slight adjustments to it and asked to fix it. the hints we were given were to try and forve evaluation at the right places.

This is the function we have to fix...

xcp := proc (count) local i;
print("nargs=", nargs, "args=", args) ;
count := 0 ;
for i from 2 to nargs do
if isprime(args[i]) then
count := count+1 ;
end if ;
print("i=", i, "count=", count) ;
end do ;
print("count=", count) ;
end proc ;

 

any help is appreciated!

1 2 3 Page 2 of 3