I feel that Melville used the scientific descriptions (particularly biology and mathematics), not merely to be pedantic, but to provide the reader with the necessary tools to understand Captain Ahab.
Initially, at the beginning of the voyage , Ahab insisted on scientific rigor, in all of its forms, in himself and his crew, when he charted a course in search of the whale.
Queequeg even tattooed some scientific precepts onto to his body (as if they were “written in stone”)
As Ahab’s obsession with the whale grew, he then, by contrast, progressively abandoned science as he became more unhinged.
BTW, some recent research into whale pod behavior mimics the collective behavior of whales as described in the novel.
Melville, being an experienced sailor, and a keen observer, tried (and succeeded) to fully describe the scenes as they unfolded using actual description and metaphor.
He wished to tell an interesting tale (based on the true story of the sinking of the whaling ship Essex) and to provide a complete autobiographical account of his experiences aboard ship.
IMHO, everyone should read this book.