PDA

View Full Version : Math equations , where to look ?



Being friendzoned sucks
29th March 2014, 20:39
Hello..

I'm looking for something to help me render or take what the user is entering and then change it to a math form

e.g:

QLineEdit1: " 5/4sin^2x x "

then it should render it to a standard math form " like when you write it by yourself in a paper " , I don't know how to describe :D , hopefully you got the idea.

after that it saves it in an image or something ,

I'm lost " not sure if there's a class in qt that does this " , and I don't know where to look , please help.

ChrisW67
30th March 2014, 04:24
What does this have to do with Qwt?

There is no mathematical formula parsing or rendering support in Qt.

Parsing an equation of the sort in your example is going to be difficult unless you impose some rules. For example, is it 5/(4 sin2x x), (5/4sin2x) x, or (5/4) x sin2x?

You can do limited markup in HTML with <sup> and <sub> and perhaps a few of the Unicode math code points. MathML support is not present in Webkit so you cannot use that to get more advanced.

A common approach is to use LaTeX's math markup and have it generate an image for you. It's a lot to carry around for just a basic job though.

Uwe
30th March 2014, 08:43
At least rendering with MathML is supported by Qwt. The renderer used by Qwt has been taken from the former Qt solutions package - unfortunately its quality could be better. Some work has been done recently to improve it ( see https://github.com/uwerat/qwt-mml-dev ) but have not yet been merged to SVN trunk yet.

Uwe

Being friendzoned sucks
30th March 2014, 18:22
@ChrisW67 , thanks for your help and suggestion , I'll check LaTeX after MathML , but hopefully MathML will cover what I need.

@Uwe , thanks ^^ , I'm checking MathML right now hopefully I find something , but if there's a link that gives a great interdiction to MathML using qt that would be great ^^ ,