Skip to main content
1-Visitor
November 13, 2012
Solved

One Bouncing particle in a 2D box,

  • November 13, 2012
  • 4 replies
  • 15964 views

Attached is what I have, I just want to numerically calculate position of a bouncing particle (elastically) in a 2D box at constant speed. Anyone can let me know how to overcome the problem that prime does not allow unit in x and y axis in the 3D plot? And does anyone know how I can make an animation of the trajectory of the particle in the 3D plot?

And would anyone suggest how I can achieve what I have done in the file using different approach? such as a better way to write the program or something with less programing. Please enlighten my mind.

Thanks a lot

Best answer by AlanStevens

Might be easier just to treat the walls as if they were particles of infinite mass and zero radius - see attached.

Alan

Edited to replace the worksheet with a corrected one.

4 replies

19-Tanzanite
November 14, 2012

henry leung wrote:

Anyone can let me know how to overcome the problem that prime does not allow unit in x and y axis in the 3D plot?

For some reason Prime only allows units to be attached to the z-axis (you should get an error message that says this if you try to assign units to, say, the x-axis).

And does anyone know how I can make an animation of the trajectory of the particle in the 3D plot?

Use Mathcad 15 (animation not yet available in Prime).

And would anyone suggest how I can achieve what I have done in the file using different approach? such as a better way to write the program or something with less programing.

See http://communities.ptc.com/thread/39681 for example.

Alan

1-Visitor
November 14, 2012

I tried to make animation in mathcad 15 but it says "error initiating video stream"

What does that mean?

my FRAME setting is From: 0 To:9 At: 10 frames/second, tried different value but I still have the same error

Can someone tell me what is wrong with my file??

Thanks

25-Diamond I
November 15, 2012

I tried to make animation in mathcad 15 but it says "error initiating video stream"

What does that mean?

my FRAME setting is From: 0 To:9 At: 10 frames/second, tried different value but I still have the same error

Can someone tell me what is wrong with my file??

There is nothing wrong with you worksheet - it works as it should for me.

The problem you reported usually results from chosing a non existing or an inapproriate codec. You can change this in the record anomation window under options. Try "Microsoft Video 1" for a start which seems to be the default at least in my installation.

WE

1-Visitor
November 16, 2012

I have a new question. How to generate random number between 0 and 1 with a mean of 0.8 using the poisson distribution? the rpois function gives integer only. I want to use this number as a coefficient of restitution for each bounce from the wall

Thanks

19-Tanzanite
November 16, 2012

henry leung wrote:

I have a new question. How to generate random number between 0 and 1 with a mean of 0.8 using the poisson distribution? the rpois function gives integer only. I want to use this number as a coefficient of restitution for each bounce from the wall

Thanks

This is slightly odd, as Poisson is essentially discrete integers. However, you could generate a vector of, say 1000 Poisson integers, with a mean of 800; divide them by 1000, and then pick off the values one by one.i.e. construct vector, r = rpois(1000,800)/1000. This will give you 1000 numbers distributed between 0 and 1 (mostly, though not with certainty) with a mean of (approximately) 0.8.

Alan

1-Visitor
November 16, 2012

Thanks.. I think I should really use a normal distribution but not a poisson..I misunderstood the meaning of a poisson, what I need is a normal. But how can I limit the value to be greater than zero and less than 1?

And based on Alan program,

I build one with a normal distribution of coefficient of restitution... But I think the program keep recalculating the position that the particles already passed each time

I have also modified mine with a similar problem. I think what the animation tool box does is that it calculate my whole sheet at every new frame. but that makes my particle have a different history at each frame. what can i do ??

by the way

i used mod(rnorm(1,0.8,0.1),1) as a way to generate random number less than 1...but this is not certain, is there a better way?

Is there a function that can store all the calculated values or symbolic expression of a mother function then disconnect from the mother function, so all value become constant number of symbolic expression as if they were entered manually in a matrix/vector?

1-Visitor
December 6, 2012

I have question with doing this problem with odesolve,

It said I am dividing by zero.

I tried to trace the value of each variable but I dont see any problem. The iteration stopped at i=61...

Please help me

12-Amethyst
December 6, 2012

Hi Henry,

I suspect that you need to use the xxn[i-1 & yyn[i-1 values in the ODE calls rather than the Xn & Yn initial values as you are at the moment

Capture1.PNG

Capture.PNG

Regards

Andy

24-Ruby IV
December 7, 2012

It will be better to lacate this video (20-30MB!!!) here - http://communities.ptc.com/community/mathcad?view=video

1-Visitor
December 8, 2012

I am still stuck on the same problem. No interaction between the two particle in my odesolve program. Please see particle bouncing in a 2D box1_9_ode.xmcd.zip for the sheet. Hopefully someone can let me know what I did wrong. Thank you.

Besides, is there a way to simplify the program? In the program there are many "if" statement that are very similar. I want to replace all these check by referencing to another program or function but I dont know how to achieve that.

Henry

19-Tanzanite
December 9, 2012

Might be easier just to treat the walls as if they were particles of infinite mass and zero radius - see attached.

Alan

Edited to replace the worksheet with a corrected one.

1-Visitor
December 10, 2012

This is an excellent method. Truely learned something today. How come I did not think of this way..This is such a simple way to look at the problem. And I just love odesolve now. making it so much easier.

But I still do not know what is wrong with my program....really hope someone can identify the error...why does not the particle interact in my program....

attached is the final sheet, just added a trajectory to alan's sheet.

I found it quite interesting to look at the animation with my numerical program without ode and the one alan posted using ode. The two differ from each other due to how we model the wall interaction. But at least the two agree at small frames number

Henry