Unnecessary dots in theorems and figure numbers

I know, that it is possible to add dot after the chapter / section / subsection number. But if I use

\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}


(as in this solution: How to add a dot after the section number?), then I have too many dots in the case of number of figure / theorem etc. For example, if I apply

\documentclass[10pt]{book}
\usepackage{amsmath,amssymb,amsthm}

\usepackage[chapter]{algorithm}

\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}

\newtheorem{defin}{Def.}[chapter]
\newtheorem{tw}[defin]{Th.}

\begin{document}

\chapter{New chapter}

\begin{defin}
Some definition
\end{defin}

\begin{algorithm}
\caption{Some algorithm}
\end{algorithm}

\begin{figure}[hptb]
\caption{Some caption}
\end{figure}

\section{New section}

\begin{defin}
Some definition
\end{defin}

\end{document}


then I have

How could I remove the unnecessary dots in 1..1 and similar numbers? Thank you in advance for your answer. Edit: I have realized, that my question can be put in other way. Is this possible to add dots, but only: 1. in the case of titles of chapters / sections etc. 2. and in the case of table of contents, but not for other references?

• You should really apply the period (dot) to the target counter, e.g., \renewcommand{\thealgorithm}{\thechapter.\arabic{algorithm}}. – barbara beeton Dec 16 '19 at 16:48

It seems, that instead of this code

\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}


I should use

\usepackage{titlesec}