My site requires users to input a great deal of mathematical and scientific notation. Naturally, I need a way to store this server-side for future use. This is my ideal course of action: a user inputs a chunk of text, potentially with or without mathematical symbols, the input is submitted, it is then turned into a format that is suitable for a database, and finally, on every subsequent viewing of the inputted math, it should get converted to MathML. The MathML is converted to a readable format by MathJax.
I have never worked with storing math in a database before, and the fact that I want to allow users to be able to insert math inline with text creates a few implications. Any ideas?
The desire to normalize this kind of thing is understandable. It is also wrong.
The only thing you should "expand" into more semantic types for the use of a relational database is anything that would appear in a where
clause.
If it's reasonable for you to want to run a query that looks like (pseudocode:)
SELECT * FROM FORMULAE
WHERE "/theta" in free_vars(FORMULAE.FORMULA)
AND "bob" in FORMULAE.USERS;
Then you want to use a data type that makes such a query efficient. If, on the other hand, the database will not be doing any kind of processing on the stored formula, then don't try to convert it to or from anything except the most useful external representation, the markup that properly represents the formula.