You can purchase your tickets now. There are fast trains that can sell out- however that is unlikely-there are multiple trains all day long.
Mid October is basically a week away
https://www.trenitalia.com/en.html
I also want to travel from Amalfi to Florence in mid-October as well.
How far in advance should those tickets be purchased?
There is no train in Amalfi. Take the ferry to Salerno then fast train to Florence- you can buy that ticket now as well.
ETA-if you mean NEXT October it is way too soon- start looking next July.
There are discounted tickets available for fast trains but do read the restrictions.
Train travel in Italy
https://www.seat61.com/train-travel-in-italy.htm