User Sahil Chadha has already answered the question, but here's the math and a pretty picture for anyone who is unconvinced that you're right.

Since the train is accelerating, from the perspective of an observer on the train, the ball will experience a (fictitious) force in the direction opposite the train's travel having magnitude $ma$ where $m$ is the mass of the ball and $a$ is the magnitude of the acceleration of the train.  If we call the direction of travel the positive $x$-direction, and if we call the "up" direction the positive $y$-direction, then the equations of motion in the $x$- and $y$-directions will therefore be as follows:
\begin{align}
  \ddot x &amp;= -a \\ 
  \ddot y &amp;= -g.
\end{align}
The general solution is
\begin{align}
  x(t) &amp;= x_0 + v_{x,0} t - \frac{1}{2}a t^2 \\
  y(t) &amp;= y_0 + v_{y,0} t - \frac{1}{2}g t^2
\end{align}
Now, let's say that the origin of our coordinate system lies at the point from which the ball is thrown so that $x_0 = y_0 = 0$ and that the ball is thrown up at time $t=0$ with velocity $v_{y,0} = v$ and $v_{x,0} = 0$ in the positive $y$-direction, then the solutions becomes
\begin{align}
  x(t) &amp;= -\frac{1}{2}a t^2\\
  y(t) &amp;= vt - \frac{1}{2} gt^2
\end{align}
So what does this trajectory look like?  By solving the first equation for $t$, and plugging this back into the equation for $y$, we obtain the following expression for the $y$ coordinate of the particle as a function of its $x$ coordinate along the trajectory:
\begin{align}
  y(x) = v\sqrt{-\frac{2x}{a}} +\frac{g}{a} x
\end{align}
Here's a Mathematica plot of what this trajectory looks like for $v = 1.0\,\mathrm m/\mathrm s$ and the list $a = 9.8,5.0,2.5,1,0.1\,\mathrm m/\mathrm s^2$ of values for the train's acceleration



From the point of view of someone on the train, the ball flies backward in a sort of deformed parabola, but the smaller the acceleration is, the more it simply looks as it would if you were to throw a ball vertically in an un-accelerated train.

Throwing a ball upwards in an accelerating train
I recently upgraded (with apt-get dist-upgrade) my Kubuntu and Lubuntu Linux boxes, and now every time I log into one of these machines, I get this message:

tput: No value for $TERM and no -T specified


Here is a screenshot of the exact message:


This happened on both my Lubuntu machine and Kubuntu machine, and it wasn't a problem until after I upgraded; so I suspect that it was not user error.

How can I fix this?

UPDATE

I have tracked this down to my .bashrc file, which is getting called by my .profile file.  Though, the fact that my .bashrc file now runs when I do a GUI login whereas it didn't before I upgraded is a bit weird.  And no, I haven't modified my .bashrc file or my .profile recently.  Also, bash isn't my default shell.

The problem is that I am calling tput in my .bashrc file to set up variables for use in adding color to the prompt.  But at the (inappropriate) time when my .bashrc file now gets run, $TERM is not set.

fgRed=$(tput setaf 1)     ; fgGreen=$(tput setaf 2)  ; fgBlue=$(tput setaf 4)
fgMagenta=$(tput setaf 5) ; fgYellow=$(tput setaf 3) ; fgCyan=$(tput setaf 6)
fgWhite=$(tput setaf 7)   ; fgBlack=$(tput setaf 0)
bgRed=$(tput setab 1)     ; bgGreen=$(tput setab 2)  ; bgBlue=$(tput setab 4)
bgMagenta=$(tput setab 5) ; bgYellow=$(tput setab 3) ; bgCyan=$(tput setab 6)
bgWhite=$(tput setab 7)   ; bgBlack=$(tput setab 0)


Updated question: How should I fix this?  Should I set $TERM myself?  Or should I just not set these variables if $TERM is not set?

UPDATE 2

One solution I tried was to check whether $TERM was set. But this didn't seem to work; I still got the same error message.  Here's the code:

if [ ! "$TERM" = "" ]; then
  #Do stuff here
fi


So apparently $TERM was set, but tput still concluded it wasn't.
