Re: About the error message Indeterminate
- To: mathgroup at smc.vnet.net
- Subject: [mg91365] Re: About the error message Indeterminate
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Mon, 18 Aug 2008 03:37:36 -0400 (EDT)
- References: <g88v76$guj$1@smc.vnet.net>
Hi,
try ArcTan[x,y] instead of ArcTan[y/x]
Regards
Jens
MarvelousTau wrote:
> I think you all might have been check the example the bouncer in the
> entry Dynamic. But it is on a flat ground. So I want to make some
> change to let it bounce on hills, which formed by Sine function. The
> collisional consummation and reflection angle have been taken
> considered, but when the point touches the ground, it doesn't move any
> longer and the velocity shows indeterminate. I know indeterminate
> means such an issue like 0/0, but I replace my reflecting function
> with the colliding position and get a certain answer. I don't know if
> is there any other issues will cause indeterminate.
>
> Anyway, check the code first.
>
> function[x_] := Sin[x] + 0.5 Sin[6 x];
> Reflection[{{x_, y_}, {vx_, vy_}}] := {{x, y},
> 0.8 Sqrt[vx^2 + vy^2] {Cos[2 ArcTan[function'[x]] - ArcTan[vy/vx]],
> Sin[2 ArcTan[function'[x]] - ArcTan[vy/vx]]}}
>
> (* where function[] means the ground and Reflection[] shows how the
> ball bounces up, where x, y means position and vx, vy means velocity.
> 0.8 Is the consummation of collision, Sqrt is the norm of speed and
> the latter stuff is the new velocity in x and y direction. *)
>
> PointSet = {{4, 6}, {0, -0.01}};
> Plot[function[x], {x, -5, 5}, Axes -> None, Filling -> Bottom,
> PlotRange -> {{-5, 5}, {-2, 8}}, AspectRatio -> 1,
> Epilog ->
> Point[Dynamic[
> PointSet =
> If[PointSet[[1, 2]] >=
> function[PointSet[[1, 1]]], {PointSet[[1]] + PointSet[[2]],
> PointSet[[2]] + {0, -0.001}}, Reflection[PointSet]];
> PointSet[[1]]]]]
> Dynamic[PointSet]
>
> (*I used Epilog to draw the point. I didn't use Mouseclick because it
> will cause a dump*)
>
> I'll keep waiting here and thanks in advance.
>
> Tao Yue
>
>
>