Items tagged with list list Tagged Items Feed

how to merge two lists without repetitions?

input [x,y,z] [a,b,x]

return [x,y,z,a,b]

Greetings to all,

I want to make a "circular" list but I cannot find a way.

To be more precise, let K=[x1,x2,x3,x4], is any way to set K[0]:=K[4] and K[5]:=K[1]?

 

Thanx a lot,

Giorgos

Given a polynomial expression I would like to obtain a list whose entries are the positive entries of the polynomial with multiplicity given by the coefficients:

Example:

Given the polynomial expression: p:=x^2*y-2*y*z+3*x^2+2*y-z

The positive terms are: x^2*y, 3*x^2, 2*y

Thus I would like to obtain the list L:=[x^2*y , x^2 , x^2 , x^2, y , y].

Notice x^2*y appears once since the coefficient is 1.

x^2 appears three times since the coefficient is 3.

y appears two times since the coefficient is 2.

 

 

 

 

 

 

Given a list of numbers, is there a command that returns the list whose entries are the absolute values of the original list? is there also one from the signum?

Ex: Given L:=[1,-1,-5,2,-3], I would like to obtain for the absolute value [1,1,5,2,3] and for the signum [1,-1,-1,1,-1].

Given a list I would like to find the position of the positive numbers. Ex: Given L:=[3,8,-5,1,-3,-7], I would like to have as a result P:=[1,2,4].

I want to avoid using a loop for this. Any suggestion?

I want to paste a list of points generated by another program into a maple worksheet. 

However, when I paste the list of points into the Maple worksheet, I get a command prompt after each defined point in the list.  Whereby, the executable code will not run.

I need a way to paste the list of points into the worksheet without any command prompts.  Is there a special entry mode?  

 

Here's the list of points I want to paste into the worksheet:

[

[20,0,0],

[20,4,0],

[19,8,0],

[17,11,0],

[14,14,0],

[11,17,0]

],

 

Below is the worksheet code that I want to paste the list of points.

However, when I paste the list of points within the "pointPlot3D" function -- I get a command prompt after each defined point in the list of points.  (So 30 points gives 30 command prompts.)  Whereby, when this code is executed, there is an error.    What I need is a means to paste this list of points into the worksheet WITHOUT the command prompts showing up. 

 

> with(geom3d):

> with(plots):

> sphere1:=(x,y,z,R)->[x+R*cos(phi)*cos(theta),y+R*cos(phi)*sin(theta),z+R*sin(phi)]:

> Explore(display(        

       plot3d(sphere1(0,0,0,Rp),phi=-Pi/2..Pi/2,theta=0..2*Pi),  

               scaling = constrained, axes = boxed, style=wireframe, labels=[x,y,z],                

       pointplot3d(

> [
> [20,0,0],
> [20,4,0],
> [19,8,0],
> [17,11,0],
> [14,14,0],
> [11,17,0]

> ],

               symbol=circle,symbolsize=10)  ),        

       parameters=[Rp=3..20],         initialvalues=[Rp=20] );

 

I have a list L:={1,2,3,4,5,6,7,8}. I choose three elements from list L. How many different combinations of three numbers can be selected from L so that the numbers could represent the side lengths of a triangle?

I need to make a lot of similar calculations and wonder if it can be done in a smart way in Maple. Microsoft Excel is perfect for this kind of calculations, because you can downcopy cells. I would like to do everything in Maple, if possible, though. I have a number of points A, B, C, D, E, ... , which all lie on various circles in the plane. For every point radius and angle is given, so actually you can say that every point is delivered with polar coordinates. I want to have their rectangular coordinates. 

Maybe I could deliver their radii in a list and their angles in degrees in another list?

r:=[12,56,29,...., 78]:

v:=[15,45,75,..., 102]: 

......

I need to be able to refer to a certain point thorugh an index. At best it would be A, B, C, ... , but 1, 2, 3, ... will be acceptable. So in the end I need to be able to access say x_C and y_C or x_3 and y_3 (understood as index lowered). I hope someone can help me do the task in a nice a efefctive way.

NB! Maybe you have a solution, which involve transformation from polar to rectangular coordinates. That will be nice, but please also tell me how it can be done from scratch, because I want to be able to know about handling many points at once for other purposes, when the function is not r*cos(v), but an arbitrary function.

Regards,

Erik

eq:=[Vector[row](4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}), Vector[row](4, {(1) = -0.3381778526e-2, (2) = -.3381778526, (3) = -.3185010532, (4) = 0.}), Vector[row](4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}), Vector[row](4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}), Vector[row](4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.})]

how i can get a unique results:[Vector[row](4, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.}), Vector[row](4, {(1) = -0.3381778526e-2, (2) = -.3381778526, (3) = -.3185010532, (4) = 0.})]

 

I need a list version of Contourplot. I have a list in the format [[z1,x1,y1],[z2,x2,y2],...[zn,xn,yn],...]

where z represents some data value at coordinate (x,y). Basically I need a 2D figure with the x and y values shown on the axes and the z-value represented in a color code. Just like "contourplot" except in my case I cannot use it since I do not know the general function of two variables but only the list  with the data points. Is this possible with a built in Maple command?

 

Thanks

 

 

Hi, 

i have this:

and i don't want the letter to be strings.

I want something like:

[z,d,i,p,s,...,y]

Thank you a lot

So if i have a list of numbers X:=[1, 3, 8, 9, 10] for example, how do i calculate the Σx*ln(x) for each x in X ?

 

im certain it must be possible but i cant figure out how.

 

thanks for your time :)

I have the following procedure to do the above. It works but it returns [9,10],[10,9],[12,1] for n=1729(for example). How do I modify this to 

a) to count 9,10 and 10,9 as the same and hence only show one of them

b) get 1,12 to show as a solution?

cubesum:=proc(n::nonnegint)
global listcub:=table();
local k:=0, x:=iroot(iquo(n,3),3),y:=x,x3:=x^3,y3:=y^3;
if 3*x3 <> n then x=x+1; x3:=x^3;y:=x;y3:=x3 end if;
while x3<=n do
y:=iroot(n-x3,3); y3:=y^3;
if(x3+y3 = n) then k:=k+1; listcub[k]:=[x,y]end if;
x:=x+1; x3:=x^3;
end do;
convert(listcub,list);
end proc:

 

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

 

 

 

1 2 Page 1 of 2