Is it possible to calculate the pH of a given solution knowing only the pKa (but not the structure of the acid, i. e. its molecular mass), its mass and the volume of the solution? E. g. What is the pH of a 400 ml solution with 9 g of mandelic acid (pKa = 3.39)? Suppose you don't know its structure or its molecular mass and you can't look it up online or someplace else. There's an online pH calculator that can do it (https://www.omnicalculator.com/chemistry/ph) where I only specified the pKa of the acid, the grams of acid in the solution and its volume but I don't know how the algorithm behind it works and I couldn't find anything else online.
Unfortunately knowing only the pKa, the mass of the acid in the solution and the volume of the entire aqueous mixture it's not enough, one will always end up with an equation with two variables, which is impossible to solve. E. g. Assuming acid A and B have the same pKa, acid A with the molar mass 1/2 of molar mass of acid B would have pH at the same mass concentration lower by 0.15. Using the "custom" option the online pH calculator assumes a molar mass of 36.45 g/mol (identical to HCl's). I would like to thank everybody who took their time to read and comment this question.