Calling Custom math formula

Is there a way to call calculated text inputs like a function and use in another custom formula.

price = 10
discount = 2%
tax = 0.5
discount price = 10 x 2/100
total price = 10 x 2/100 x 0.5

instead of all this can i just call -

total price = price x discount price x tax ?

I am struggling to get the format of my custom formula to get the right result.