Print out a Fraction in textbook style

06192018, 11:33 AM
Post: #1




Print out a Fraction in textbook style
Hello
Im new to the HP Prime and im new to the Programming of this calculator. But im not new to programming at all. I have played around a bit and find the ability to do own stuff really nice. Unfortunatley i have not figured out, how to print nice looking fractions out on the terminal. Could somenone explain me how to write a fraction as an example: 2/7 with this style: 2  7 Keep in mind, im talking about the PRINT, or any other, Output function for own apps. Thank you. 

06192018, 11:51 AM
(This post was last modified: 06192018 12:36 PM by StephenG1CMZ.)
Post: #2




RE: Print out a Fraction in textbook style
The Prime terminal does not support prettyprinting.
So if you want a fraction to appear on the terminal its PRINT(NUM+"/"+DEN) Or LF="\n" SEPRSIZE=MAX(DIM(STRING(NUM)),DIM(STRING(DEN)) SEPR= "" repeated SEPRSIZE times (TBD) PRINT(NUM+LF+SEPR+LF+DEN) If it doesn't have to be on the terminal, you could try writing it as a Note, which allows more formatting. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz 

06192018, 12:03 PM
Post: #3




RE: Print out a Fraction in textbook style
Thank you for your answer.
The Background behind my question is, that i want to programm an quadratic equation solver. This solver should output x1, x2 the discriminant and the vertex of the function. For the vertex i would like to have the equation in the form of: (x+y)^2z I would like to show the y part as a fraction and the z part also if possible. Therefore i think its not that easy to use your suggestion. The best way would be to just return the answer. But then i only can return one answer or some coma seperated values which doesnt look very good. 

06192018, 12:17 PM
Post: #4




RE: Print out a Fraction in textbook style
Here is an example.


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)