Math output

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2009
Posts: 3,242
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 577
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Math output

 
2
  #31
Oct 4th, 2009
The difficulty is you do not understand the solutions so its hard to provide you with code since it does what you want, you're just unable to implement it.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
2
  #32
Oct 4th, 2009
Mr.Sknake ,I was able to understand your code and also implemented it.
I found the output of your code in bracket form and not the fraction that we see in books.
The code which I am using is :
  1. C# Syntax (Toggle Plain Text)
  2. textBoxEquation.AppendText("()/()");
  3. this.textBoxEquation.Focus();
  4.  
  5.  
  6. const string matchNumerator = @"\((?<Numerator>[\d,]*(\.\d*))\)";
  7. const string matchDenominator = @"\((?<Denominator>[\d,]*(\.\d*))\)";
  8. const string matchBoth = matchNumerator + @"\/" + matchDenominator;
  9.  
  10. //const string txtBoxInput = @"()/()";
  11.  
  12. string txtBoxInput = textBoxEquation.Text;
  13. System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(txtBoxInput, matchBoth);
  14. if (m.Success)
  15. {
  16. decimal dNumerator, dDenominator;
  17. if (decimal.TryParse(m.Groups["Numerator"].Value, out dNumerator) && decimal.TryParse(m.Groups["Denominator"].Value, out dDenominator))
  18. {
  19. //and this right here is your string in latex format
  20. string latex = @"\frac {" + dNumerator.ToString() + "}{" + dDenominator.ToString() + "}";
  21. decimal valueOut = dNumerator / dDenominator;
  22. System.Diagnostics.Debugger.Break();
  23.  
  24. }
  25.  
  26. }
Since I have made for all mathematical symbols and the mathematical equation can be the combination of any symbol.So when we click on any of the math symbol ,it is appended in the textbox.
So the code which you gave me for fraction dispalys bracket and not the fraction format.
And I have made differently for divide sign and for fraction.
For fraction I want the way as seen in the thumbnail attached
and for division I am using simply divide sign i.e."÷" .
Last edited by vinnijain; Oct 4th, 2009 at 11:51 am.
Attached Thumbnails
fractions_Full.jpg  
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,964
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 285
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: Math output

 
2
  #33
Oct 4th, 2009
Did the effort reading through this thread. Do not understand it very well.
I think that Sknake and Ryshad did their best to tell you how to translate text to LaTeX format. (At least for division that is, if you want to do this full blown you need a text to LaTeX compiler, wish you all the luck with that )
But if I understand it well, what you want, is feed a textbox some latex text and expect it shows math formulas you see in textbooks.
Did you not try it for yourself to notice that this won't work?
Why not try this or try to incorporate Microsoft Equation Editor 3.0 into your application?
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
2
  #34
Oct 5th, 2009
Originally Posted by ddanbe View Post
But if I understand it well, what you want, is feed a textbox some latex text and expect it shows math formulas you see in textbooks.
Did you not try it for yourself to notice that this won't work?
Why not try this or try to incorporate Microsoft Equation Editor 3.0 into your application?
Actually after feeding in textbox I was able to display math formulae for many symbols.Also In textbox I am using such notations which the user can easily understand because donot know latex symbols and in background I am replacing those user friendly notations with actual latex symbols.
But the same replacement I was not able to do with fraction .In case of fraction it is not replacing with latex symbol rather its interpreting it is displaying it as user friendly notation only..........
I tried a lot but could not find any solution.....
The only solution which I could find is to make math dictionary from all latex types to user friendly symbols.I am working on that and hope that I may work....
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 210
Reputation: avirag is an unknown quantity at this point 
Solved Threads: 15
avirag avirag is offline Offline
Posting Whiz in Training

Re: Math output

 
0
  #35
Oct 5th, 2009
VinniJain
I think u can make a dictionary and use LINQ....
Hope it works for you........
Last edited by avirag; Oct 5th, 2009 at 3:24 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
1
  #36
Oct 5th, 2009
Originally Posted by avirag View Post
VinniJain
I think u can make a dictionary and use LINQ....
Hope it works for you........
Thanks for your reply avirag........i do not know how to use it...
Can you explain me in detail...........
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 210
Reputation: avirag is an unknown quantity at this point 
Solved Threads: 15
avirag avirag is offline Offline
Posting Whiz in Training

Re: Math output

 
0
  #37
Oct 5th, 2009
Well vinniJain.........
I don't have much knowledge related to this, may be other Brilliant coders of daniweb Can explain you in a better way............!!!
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 378
Reputation: Ryshad has a spectacular aura about Ryshad has a spectacular aura about 
Solved Threads: 68
Ryshad's Avatar
Ryshad Ryshad is offline Offline
Posting Whiz

Re: Math output

 
1
  #38
Oct 5th, 2009
We have done our best here to answer your question. You wanted to display a user friendly version of the equation in the textbox then convert that to latex in order to create the equation output. We have given you the code you need to parse a user friendly fraction using regular expressions to convert it into a latex format.

Your task now, having understood how our code works, is to adjust it to find the different symbols that the user friendly string might contain and convert those into latex format also.

If you decide to go the LINQ route I would recommend starting a new thread since that doesnt relate to this question. A thread titled "Help with LINQ Dictionary" or something similar is far more likely to attract the help you need than a 4 page thread on something losely related

Either way, please mark the thread as solved if you feel there is nothing more we can do for you.
Please don't take for granted the work that solvers do for you. Take the time to fully understand the code they give you so that you might adapt it to future problems.

"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
0
  #39
Oct 5th, 2009
Ryshad, thanks for helping me............But I don't understand why you all are not getting me.
I think ddnabe understood and even replied that it won't works.
And I want to ask one thing that did you not try it for yourself to notice that it was not giving the required result that was shown in thumbail?
Ryshad just tell me one thing that were you able to get the fraction form (like in books) on running the code ?
Last edited by vinnijain; Oct 5th, 2009 at 6:32 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,964
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 285
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: Math output

 
0
  #40
Oct 5th, 2009
A TextBox, well it says it, can only display text, characters. Some fonts have characters for square root etc. , but that's a poor substitute for the things you see in textbooks. The math formulas you see in textbooks are in fact pictures.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC