Items tagged with list list Tagged Items Feed

I currently have a function quadsum(n) that determines the [x,y] solutions of the above equation for an integer n. :

quadsum:= proc(n::nonnegint)
local
k:= 0, mylist:= table(),
x:= isqrt(iquo(n,2)), y:= x, x2:= x^2, y2:= y^2;
if 2*x2 <> n then x:= x+1; x2:= x2+2*x-1; y:= x; y2:= x2; end if;
while x2 <= n do
y:= isqrt(n-x2); y2:= y^2;
if x2+y2 = n then k:= k+1; mylist[k]:= [x,y] end if;
x:= x+1; x2:= x2+2*x-1;
end do;
convert(mylist, list)
end proc:

How would I alter this so that I get [x,y] for n= (5^a).(13^b).(17^c)(29^d) for non-negative integers a,b,c,d?

I am trying to take a list of prime numbers that I already generated with the following:

L4:=NULL:

for i from 2 to 50 do

if nops(ifactor(i))=1 then L4:=L4,i end if:

end do;

[L4]

This gives me the primes bewteen 2-50, [2,3,5,7,11,13,17,23,29,31,37,43,47].  I want to write something that takes the products of my list like this

2*3=6

2*3*5=30

2*3*5*7=210

and so on through the whole list.  Any ideas?  I figured out how to take the product of 2*3, 2*5, 2*7 and so on, but I cant figure how to make it do 2*3, 2*3*7 and so on.

I am doing a presentation on Euclids infinite prime proof and thought it would be cool to write a maple program that will show his proof for a certain amount of prime numbers.

 

Thanks,  Matt

 

 

 

I paste below a simple code illustrating what I want to create: two lists from a set with pairs. I wonder it is a very simple task but I my lists aren't create in the end. 

 

 

> restart;
>
> lista:=[[1,10],[2,20],[3,30]]:
> x:=[]:
> y:=[]:
>
> for i from 1 to nops(lista) do
>     for j from 1 to 2 do
>
>         if j = 1 then
>             x[i,j]:=op(1,op(i,lista));
>        fi;
>        if j = 2 then
>             y[i,j]:=op(2,op(i,lista));
>       fi;
>    od;
> od;
>
> x;
> y;

 

 

In resume then after the for loop is terminated I want to be left with two lists:

x:= [1,2,3] and y:=[10,20,30]. I'm sure it has a quick fix but I'm stuck and would appreciate any help/advice.  

Thanks in advance!

Following is the set of commands I performed.

> points := plots[implicitplot](t+sin(8*x^3*t)-x^3 = 0, t = -0.50e-1 .. 0.5e-1, x = -10/9 .. 10/9);
print(??); # input placeholder
> ptslist := convert([1, 1], points, listlist);

In an output I need the data at the specified values of t. It will be great favor, if someone can help me out.

Thanks

Hi there,

I've been trying to find an equivalent to MATLAB's unique command in Maple, but I had no success.

I've seen that Maple would return the elements that are either repeated (FindRepetitions) or not repeated (MakeUnique), but not the indices within the original list.

Is there way to do that?

Thanks,

jon

I am required to generate a list containing the square of numbers 1 through k where k is an arbitrary int,defined from 1 to n. To do this, I've currently got the following commands:

local k, mylist:=[];

for k from 1 to n do

mylist[k]=sumsquare(k);

end do;

where sumsquare() is a procedure I defined to compute the sum of the squares of 1 through a number passed as an argument

At present this gives me an out of bounds error. 

How can I initialize mylist to be of size n, like in other languages such as C++?

 

Page 1 of 1