I'm wanting to create a basic physics engine for a Computing project, simulating the behaviour of a bouncing ball.   What equations and forces do I need to incorporate to calculate the height a ball will rebound to from the height that it is dropped?  If I drop a ball from 5m, what equation do I plug it into and what other factors will I need to include to calculate the height it will return to or how do I find the lost energy?
In my Computer science class I was given a problem where I have to simulate a bouncing ball using "real physics". I have been trying to find a equation that will simulate the height of the bounce given a gravity and an arbitrary mass. And I will need to calculate the next bounce and it's height. A lot of the equations I've found require a time. But I don't really care about a time, all I want is to get the next height after the previous bounce until it finally hits height of 0 or close to it. I haven't taken a physics class since high school( 5 years ago) and that was basic physics.
How does delete[] know it's an array? Manual font installation How do I use F3 to get my coordinates when my laptop makes F3 a special key? Because of the Rule of Two, is/was Sidious the strongest Sith ever? The Sith Rule of Two says: One to embody power, one to crave it. It's like a survival of the fittest.   If the apprentice must kill the master to be the master, that usually means the apprentice is stronger than the master. If this chain went on for many years, does this mean Sidious was the strongest Sith ever, just by the transitive property? Sauron knew that the One Ring could be destroyed only in Mount Doom, where it was forged. From Sauron's perspective, no one would think about destroying the One Ring. But if someone did, then Mount Doom would be the only place to do so.  Why did he keep Mount Doom active? Wasn't the risk too high? Given that$(3x-1)^7=a_7x^7+a_6x^6+a_5x^5+...+a_1x+a_0$, find $a_7+a_6+a_5+a_4+...+a_1+a_0$ Given that$$(3x-1)^7=a_7x^7+a_6x^6+a_5x^5+...+a_1x+a_0$$find $$a_7+a_6+a_5+a_4+...+a_1+a_0$$  Is there anyway to do the question without using binomial theorem and expanding the expression on the LHS?? ${!FOO} and zsh ${!FOO} performs a double substitution in bash, meaning it takes the (string) value of FOO and uses it as a variable name. zsh doesn’t support this feature.  Is there a way to make this work the same in bash and zsh?  Background:  I’ve got a list of environment variables, like  PATH MAIL EDITOR   and want to first print the variable names and afterwards their values.  This works in bash but not zsh:    for VAR in LIST do         echo $VAR         echo ${!VAR} done   It should be somehow possible “the old way” with eval, but I can’t get it to work:  for VAR in LIST do         echo $VAR         echo `eval \$$VAR` done   I’m never going to understand why I can’t simply do arbitrary deep substitutions like ${${VAR}} or even ${${${VAR}}} if need be, so an explanation for that would be nice, too. Cartesian Product of Two Countable Sets is Countable How can I prove that the Cartesian product of two countable sets is also countable? Properly bootstrap drupal for standalone PHP file? This is what I have right now:  &lt;?php     define('DRUPAL_ROOT', '/var/www/clients/client1/web15/web');     include_once(DRUPAL_ROOT . '/includes/bootstrap.inc');     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); //  drupal_flush_all_caches();        $users = views_get_view_result('userlist', 'uid_list');     $i = 0;     foreach ($users as $user) {         $filename = 'sites/default/files/generated_pdfs/individual_pdf_report_' . $user-&gt;uid . '.pdf';         generate_employee_pdf($user-&gt;uid, $filename);         error_log('Generated ' . $filepath);         $i++;     }     // create object     $zip = new ZipArchive();     // open archive     if ($zip-&gt;open("sites/default/files/generated_zips/individual-reports.zip", ZIPARCHIVE::CREATE) !== TRUE) {         die ("Could not open archive");     }     // initialize an iterator     // pass it the directory to be processed     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("sites/default/files/generated_pdfs/"));     // iterate over the directory     // add each file found to the archive     foreach ($iterator as $key=&gt;$value) {         $zip-&gt;addFile(realpath($key), $value-&gt;getFilename()) or die ("ERROR: Could not add file: $key");     }     // close and save archive     $zip-&gt;close(); ?&gt;   I'm getting a bunch of errors from the above when run standalone. Works fine in my module. Some of the errors are:  Warning: Invalid argument supplied for foreach() in drupal_depth_first_search() (line 56 of /var/www/clients/client1/web15/web/includes/graph.inc). Warning: Invalid argument supplied for foreach() in _module_build_dependencies() (line 229 of /var/www/clients/client1/web15/web/includes/module.inc). Warning: include_once(sites/all/modules/views_bulk_operations/actions/archive.action.inc): failed to open stream: No such file or directory in views_bulk_operations_load_action_includes() (line 56 of /var/www/clients/client1/web15/web/sites/all/modules/views_bulk_operations/views_bulk_operations.module). Assume the continuum hypothesis is false, and add that as an axiom to ZF set theory. How many cardinalities are between the rationals and the reals in this case? Only one? Infinitely many? Countably many? Uncountably many? What are the possibilities to the quantity of counterexamples? What if residuals are normally distributed, but y is not? I've got a weird question. Assume that you have a small sample where the dependent variable that you're going to analyze with a simple linear model is highly left skewed. Thus you assume that $u$ is not normally distributed, because this would result in normally distributed $y$. But when you compute the QQ-Normal plot there is evidence, that the residuals are normally distributed. Thus anyone can assume that the error term is normally distributed, although $y$ is not. So what does it mean, when the error term seems to be normally distributed, but $y$ does not? 3/4 circle with plus in it? After I recently updated my phone about a day ago, this strange sign showed up on the top left that I have never seen before. Does anyone know what it means? Or how to get rid of it? How to set up reverse tethering over USB? My HTC G2 phone is rooted and running Cyanogenmod 7 I don't have a data plan. Sometimes I want to connect the phone to the Internet when there isn't Wi-Fi, to update Market apps, backup SMS messages to Gmail, sync new contacts from Gmail, etc.  Things I can't do with USB mass storage mode. I have a Windows 7 Professional computer connected to the Internet, but I'm not allowed to set up an ad-hoc Wi-Fi network.  (If I do, they will notice and hunt me down.)   Is there a way for the phone to access the Internet through the USB connection to the computer?  If so, how do I set it up? How do I create a villager with custom trade offers? Line breaks in listings Is there a way like wrap the line after at most 60 letters but it should not break inside some commands like listings does?  Example:      \documentclass[a5paper]{article}     \usepackage[T1]{fontenc}     \usepackage[utf8]{inputenc}     \usepackage{listings}     \usepackage{xcolor}      \lstset{%       language=[LaTeX]TeX,       backgroundcolor=\color{gray!25},       basicstyle=\ttfamily,       breaklines=true,       columns=fullflexible     }      \begin{document}     \begin{lstlisting}     The roadrunner is the fastest running bird \remark{Check this again with a zoologist!}.     \end{lstlisting}     \end{document}   Output:      The roadrunner is the fastest running bird         remark{Check this again with a zoologist!}.   That should not happen! In my eyes this problem is not discussed in . How can I format to show text inside ""? I've posted a lot to StackOverflow, and I've noticed something kind of irritating with the formatting in writing questions and comments. If I need to put something inside a &lt; and a >, without spaces in the middle (like right there), it will think it's code and not show up, like this   (obviously it won't come up what I wrote there, or else this wouldn't be an issue, but if you open up the question to edit you can see what's written there.)  If I want it to show up, right now I have to add an extra set of brackets inside of the originals with a junk variable, like right &lt;here> (again, open in edit window to see).  This is really annoying when trying to show variables like lists that require those brackets, and I feel like the junk variables could confuse people looking at the edits. Is there a way to get around this formatting? Thanks! Is it possible to wipe an entire iCloud Photo Library? I've been using the beta iCloud Photo Library for a week and a bunch of photos got duplicated and I'd like to wipe all the photos out and start over.  I have backups of all the photos and have turned off iPhoto Cloud Library on all iOS devices. When I log into the web app - it still shows dozens of albums and I can delete all the photos, then go to deleted items and then purge them, but the ghost albums are still there messing things up.  I've turned off the library entirely and you can see there is a 30 day waiting period.     If I click on albums, there are pages of them and no delete button anywhere. If I turn on the library on an iOS device, data starts flooding back as if I wanted to recover the photos.  I don't want to recover anything, I want a clean wipe and clean slate.  Currently, there are 7807 photos in the deleted album and no way to mass delete them. I have 31 albums that show up in iCloud and no way to delete them.  Is there some way to accelerate this or must people wait a month for a corrupt library to eventually be purged to start over?  (I have tickets open with AppleCare after  and it's escalated to engineering, but I was informed that it might be a week or two before it gets seen :-( Perhaps someone has a better idea to clear things out or noticed something I've missed.) Should there always be a comma after "therefore","However" etc.? Batch files: How to read a file? How to get current CPU and RAM usage in Python? What's your preferred way of getting current system status (current CPU, RAM, free disk space, etc.) in Python? Bonus points for *nix and Windows platforms.  There seems to be a few possible ways of extracting that from my search:   Using a library such as  (that currently seems not actively developed and not supported on multiple platform) or something like  (again no activity since 2007 it seems and no support for Windows). Using platform specific code such as using a os.popen("ps") or similar for the *nix systems and MEMORYSTATUS in ctypes.windll.kernel32 (see ) for the Windows platform. One could put a Python class together with all those code snippets.   It's not that those methods are bad but is there already a well-supported, multi-platform way of doing the same thing?