For simple math, it is sufficient to present a demonstrative exhibit that uses data from already admitted evidence to show more or less step by step how something was calculated. And, courts can take judicial notice of pretty much any mathematical formula that could be found in an almanac or a middle school or elementary school textbook. Federal Rule of Evidence 201(b), which many states either copy directly or duplicate in a parallel rule of their own, states:
The court may judicially notice a fact that is not subject to
reasonable dispute because it:
(1) is generally known within the trial court’s territorial
(2) can be accurately and readily determined from sources whose
accuracy cannot reasonably be questioned.
Often this demonstrative would be entered into evidence through the testimony of a client or a client's employee.
For anything more complicated than that, you would typically endorse an expert witness, perhaps a mathematician or a surveyor or engineer or accountant, to present the evidence to the court.
For example, in a personal injury case I once had where someone was crushed by a falling heavy object, we hired an engineer to calculate the force of the object from its known height onto the person killed by it, even though it involved only first year physics and there are formulas in high school and university textbooks for that scenario. For what it is worth, hay bales are a lot heavier and inflict a lot more force when dropped from a height, than your intuition would suspect.
As a practical matter, a court is generally going to allow evidence of a compound interest calculation, or calculating an amount of tax due or an average. But a court generally wouldn't accept without expert testimony, anything that required calculus or anything but the most simple probability and statistics calculation. Calculating the angles in a triangle or trigonometry or other pre-calculus level math would be on a gray area and some judges might allow it, while others might not.
Part of the reason to use expert testimony is that some "obvious" mathematical question don't have the mathematically correct answer in the real world.
For example, the area of the base of a two by four plank of wood isn't actually eight square inches, because a modern "two by four" doesn't actually have dimensions of two inches by four inches.
Similarly, in commercial leasing, the rent per square foot is usually quoted in dollars per usable square foot per year, and not in dollars per exterior dimensions square feet per month, even though rent in a fixed dollar amount for a space is usually stated in dollars per month.