Christopher2222

MaplePrimes Activity


These are answers submitted by Christopher2222

How about this

display(seq(PointPlot(L[i]),i=1..nops(L)),insequence=true)

 

I've just stumbled upon something much simpler. It seems when I transform a bubble plot to 3d, the bubbles in the plot stay as 2-d shapes in 3d land.  They don't revert the sybol=circle to spheres, and it's easier to change the size of the bubble too!  Maple doesn't transform them like they do above. 

Hmm, this link seems like it should be in my blog or something.  I should start some blogs one day.  Anyways I've already started it in the question forum so I could just keep it here or move it to technical discussions.  Anyways, so using the original data in the first post.

Suppose pointset a has value 1
a:=[[1,2],[3,4],[5,6],[4,4]]

and suppose pointset b has value 2
b:=[[2,2],[3,3],[4,4],[2,3]]

We need to separate the x values and the y values then add a third value for BubblePlot

with(plots):
with(plottools):
with(Statistics):

x:=[op(map(a->a[1],a)),op(map(b->b[1],b))]  #  All the x values into one list - There might be a cleaner way to do this part
y:=[op(map(a->a[2],a)),op(map(b->b[2],b))] #  All the y values
z:=[1$(nops(a),2$nops(b)]  #  The values associated with each point

c:=BubblePlot(x,y,z):

to3d:=transform((x,y)->[x,y,0]):  # function to transform the 2d points to 3d, same as above

display(to3d(c),axes=boxed)

And there you have it.  I don't know wether it's less involved but it seems easier.  I did say pointplot originally didn't I?  This seems to be a neater solution.

 

 

 

 

a:=[ [ 6,3],[5,6],[6,6],[5,8],[4,7],[5.5,10],[6,12],[5,11],[5,13]]

b:=select(t->t[1]=max(map2(op,1,a)),a);
                                                                          b:=[[6,3],[6,6],[6,12]]

c:=select(t->t[2]=max(map2(op,2,a)),a);
                                                                          c:=[[6,12]]

Can I combine these two steps? 

I tried 

select(t->t[1]=max(map2(op,1,a)) and t[2]=max(map2(op,2,a)),a) 

But I know that won't work, because the max in the second position is not in the same set as the max in the first position and so it returns an empty list.  I can't think of a way to do it one step without first specifying a new list. 

 

So select the pair with the second value maximized and the first value specified.  Alec's 2nd example works the way I want.  So if I choose the second position and I want the matching pair with the maximum first position.  I would do...

[max(select(a->a[2]=8,a)[..,1]),8]       

                                                                   [5,8]

and if I choose one that doesn't exist I will get a -infinity in it's spot but I will still get a returning pair. 

I think I should be able to use map and member to select only from the list of pairs in the list.  If I select max for the second position Maple should return all the pairs in the list that satisfy [x,max]

 edit:  oops sorry, that's what roberts select does.  Thank you Robert. 

 

Nice and sweet.  Now I'm trying to figure out how to use max in that way but the only way I can get it to work is to drum it up using for loops it's a bit messy.  Can max be used in the fashion as above?

I can select a range

select(a->a[1]>5 and a[1]<=6,a)

Then I tried using max but I don't quite have it.

select(a->a[1]=6 and ........ max(seq(a[i,2],i=1..nops(a)) ........ ,a)  

but I get Error, invalid boolean expression or invalid supscript selector.   The max(seq part works by itself that's why I show it separated.  I thought there might be a much simpler version of that using the a-> somehow?

 

 

 

                   

Okay a few questions so here goes, this is a different format but same type of question as the original. I have 2871 points of data in the form a:= [ [ x1 , y1 , z1 ] , [ x2 , y2 , z2 ] , [ x3 , y3 , z3]  . . .  [ x2871 , y2871 , z2871] ]

What's the best way to surface plot that?

I managed to get it to work using your method.  But is it necessary to break up the x,y,z  into some number of rows and colums?  Here's my code.  If you need my data I can try to upload but I always have problems.  Maybe you can help without it?

a:=readdata(`c:/xyzdata.txt`,3):

aa:=[seq(a[i,1],i=1..2871)]:
bb:=[seq(a[i,2],i=1..2871)]:
cc:=[seq(a[i,3],i=1..2871)]:

so above I just separated the data into the format of the original post.  Not sure if I needed to do that maybe there was a better way?

Next I had to figure out some mxn = 2871 and found that if I break it up into 99 rows of 29 columns I can use Robert's method.  Do I really need to break it up like?  I guess really isn't there a direct command from the a:=[ [x,y,z],[x,y,z],[x,y,z]  ... ] format to the surface plot?  .. Anyways my last line of code goes like this.

plots[surfdata]([seq([seq([aa[i+29*j], bb[i+29*j], cc[i+29*j]], i = 1 .. 29)], j = 0 .. 98)])

Hope you caught all those questions I had.  Is my code to clunky?  Do I need to reformat the data?  Is there another way?

Using lists instead of arrays would slow things down. 

By the looks of his name I don't think English is his first language.

I mean timing during a Maple animation.  So what I mean is, for example, when the animation is started 1 point is physically plotted at time 0 then in realtime 5 seconds later point 2 is plotted and then 23 seconds later point 3 is plotted etc... etc... etc.. 

What I didn't want was to have points plotted at equal times one after the other.  How would I do that in realtime?  or how can I add a varied delay between the plotting of points?

Answering my own question here, but how about this way. 

for i from 1 to nops(a) do
  if a[i][1]=6 then
    c[i]:=[[a[i][1],a[i][2]]
  end if:
end do:
d:=convert(c,list)

However I don't think this is a good way of doing what I am doing.  Maybe it is.  What do you think?

display(seq(plo[i],i=1..n))

 

Yes, to sort them in an ascending order so plotting will be continuously increasing.

Thanks for those two variations.

Yes, similarily you could plot your two equations  x+3*y=200  and  2*x + 2*y=300

and again use solve on your equations to find the intersect point.  The procedure is very similar.  Hopefully I am answering your question properly. 

If you mean to add the intersect point as a text inserted into the graph then that's a little different, you can use textplot for that.  If you want the intersect point on the inequal graph, assign it a variable and use it with display and the pointplot of your intersect

Okay, so now you have the x and y points of the intersection, and now you want to display those intersection points.

b := allvalues(solve({y = 3*x+5, y = 2*x^2-2}, {x, y}))

         b := {x = 3/4+(1/4)*sqrt(65), y = 29/4+3*sqrt(65)*(1/4)}, {x = 3/4-(1/4)*sqrt(65), y = 29/4-3*sqrt(65)*(1/4)}

c := [[rhs(b[1, 1]), rhs(b[1, 2])], [rhs(b[2, 1]), rhs(b[2, 2])]]

        c := [[3/4+(1/4)*sqrt(65), 29/4+3*sqrt(65)*(1/4)], [3/4-(1/4)*sqrt(65), 29/4-3*sqrt(65)*(1/4)]]

with(plots):

d:=pointplot(c,symbol=circle, symbolsize=30, color=blue)

f := plot({3*x+5, 2*x^2-2})

display(d,f)

 

 

solve( { your equation1 , your equation 2 } , { x , y } )

Then use allvalues

 

First 34 35 36 37 38 39 40 Last Page 36 of 48