   Learning Calculus
  I've spent quite a bit of time searching the interweb looking for a good beginning to calculus, I suppose I should say practical calculus, in that I don't really care about formulae for the sake of formulae.I did learn this stuff in high school (um, 15 odd years ago *cough*) but of course I barely remember any of it, except that it dealt a lot with curves, parabola and hyperbola.I asked a while back for some help on determining target leading, and Oliii was so kinda to give me a very detailed and I'm sure, quite clean and easy to understand answer, had I actually known enough about calculus to understand it. I persisted and tried to get it working in my own engine but I failed, thus started my quest to re-learn the math that I learnt in high school and of course improve on and understand it.But, I cannot find text anywhere that explains these concepts to a human rather than a scientist. Calculus for Dummies looked like it could be good, but the reviews I have seen say it goes down hill as soon as it hits the parts about derivatives, so I guess that one is a no go too.I've been holding off posting about this for a long time believing the internet would hold the answer, or maybe even a nice book, but alas they hide from me. Does anyone here have any suggestions?I am not totally clueless, but I really do need a refresher, and probably some refreshing linear algebra and trig wouldn't hurt too much either, though I'm not too bad with LA, it never hurts to read things you know just to refresh.   
  try purplemath.com   ;  Hi,I think for game programming only basic knowledge of calculus is needed if any, so any basic book on the subject should be good enough, otherwise try those for Engineering students...Things you really should get familiar with for game programming are Linear Algebra and Mechanics(Dyn. & Kin.).These should be enough for most engines, if you came to situation that you should get the integral/derivative of an equation and found it hard, just don't be upset and try to get somebody's help, as calculus may for some equations be a mind-twister problem.Well, I'm kinda sure you're not, but if you're for any unknown reason trying to make a realtime calculus engine for a game then consider numerical calculus, it'll save you much time...   ;  I basically want to learn enough to understand the quadratic equation, enough to understand what Oliii told me in this threadhttp://www.gamedev.net/community/forums/topic.asp?topic_id=457840and of course, anything of a similar nature.Last time I looked at purplemath it wasn't that helpful. I'll take another look though.Thanks.   ;  What Oliii has written isn't about calculus, it's to do with mechanics and algebra...Now I'll try to explain the idea of the post as a general concept...1)Now you have two moving objects:the ship and the bulletA moving object -> means it has a Direction and a speedDirection + speed = velocity 2)To make the bullet hits the moving ship they both(the ship and the bullet) should occupy the same point in space in a certain time(when the bullet hits the ship)So they'll hit Somewhere on a certain Sometime...Which both I don't know, but I'll try to figure them out..3)Here we need 'mechanics' to write an equation for every moving object, These equations describe the movement of the object depending on its velocity(as mentioned in point 1)(remember that we're dealing with these objects as particles)4)now I have got 2 equation, 1 equation for each object...Both equations have time and position...now as mentioned in point 2 they should have the position and time..So, the situation now is that I have two unknowns(position and time) and two equations(those of the moving ship and the bullet)Here you should now use Algebra to solve this system of equations, and you should also get yourself familiar with vectors and vectors equations.See ? we didn't even need calculus, but we've had to use it to derive the movement equations of the moving objects...fortunately they're readily available in most books dealing with the basic mechanics of particles.;  That's pretty helpful, I'll have a look over what he's told me and try to reinterpret it that way, thanks.;  There is actually very little calculus involved in determining line intersections,distances,etc in 3D space.The hardest part for most people including myself is visualizing the stuff.This might help you out some.   ;  My personal view of maths is that its only useful if applied to something. As a result, I did quite badly in maths classes back in the day. It wasn't until I started needing maths that I found it useful.Calculus is one of the things I did badly at. Mainly, because I never managed to think of a use for it. I mean sure, hypothetically I may need to fill a strangely shaped box with fluid, but that's unlikely, and if I did have to so such a thing, I would simply fill it with water first, measure how much water, and then fill it with the fluid, thereby getting a more accurate result than any approximation.As for the bullet and ship example, I used a variation of the binary search algorythm. (Dammit cant find my code, but here goes from memory)shipLinePoint = middle_of_ship_line.SHIP_BULLET_INTERSECTION_SEARCH(ship,bullet,shipLinePoint)IF(bullet and ship touch at that time slice)  return time slice.ELSE  IF bullet is closer to end of its travel path    shipLinePoint = halfway between current point and end  ELSE    shipLinePoint = halfway between current point and beginning.  END IF  RETURN SHIP_BULLET_INTERSECTION_SEARCH(ship,bullet,shipLinePoint)END IFThe algorithm requires that you can calculate the nth position of the bullet or the ship. I suppose that if the two objects weren't travelling at a constant speed, you would need a separate algorithm to do this. Would programming the software to do calculus be faster or slower than this algorithm?   ;Quote:Original post by daviangelThere is actually very little calculus involved in determining line intersections,distances,etc in 3D space.The hardest part for most people including myself is visualizing the stuff.This might help you out some.I hear what you're saying, my eyes glaze over when I see large formulas with lots of subscripts. I need to visualise things a lot, which is probably why I failed calculus at school. I had no clue what it was for or why I was doing it.Having said that, I started to look at the site you posted, but I'm not finding that terribly clear either, though I sort of get what its saying. I think my problem here is that I'm not trying to intersect 2 lines, I'm trying to find the vector that the bullet needs to travel on in order to intersect.   ;  You can use trigonometry to figure it out. I suggest you get some paper and draw this out. The distance between the two ships is your adjacent side. The path that the ship you want to hit is the opposite side. Using trigonometry the lines will always intersect but they may not necessarily intersect in the same time. If they do then its a hit(same time same place). I start with 10s for my argument to shipA because it takes at least 10s for the bullet to get to shipB on a straight line(10km * (speed of bullet)1km/s). So your variable is shipA --  input 10s into there as a first argument and you will get a distance of 1km(100m/s *10s). Using Pythagorean theorem you can compute the hypotenuse which is the distance the bullet traveled. (The square root of (1km squared + 10km squared)) Then multiply that distance by the speed of the bullet to get the time that the bullet takes to intersect the path of shipA). Results i got with argument 10s for skipABullet Reaches Point @ 10.049s -- 10(shipA) - 10.049(bulletTime) = -0.049 (The bullet is late)Distance off = 0.049 * 100m/s = 4.9m Results i got with argument 10.05s for skipABullet Reaches Point @ 10.005037s -- 10.05(shipA) - 10.05037(bulletTime) = -0.00037 (The bullet is late)Distance off = 37mm (basically a hit depending on ship size)Angle the bullet was fired at: 5.73 degreesYou will need some type of precision limit set or else the calculation could be infinite. The angle can be computed by arctan(shipA distance traveled(Opposite) / distance between ShipA and B intially (adjacent)  )heres a link to some trig that may be helpfulhttp://www.clarku.edu/~djoyce/trig/right.html-------------------I'm not sure if that works for you probably a better way... Maybe Maxima/Minima Calculus tricks could do that because it seems to form a hyperbola, Im not sure my calculus is very rusty.[Edited by - Ezra on December 28, 2007 10:33:13 PM]