Recent

Author Topic: how to display math functions in correct form  (Read 8297 times)

cpalx

  • Hero Member
  • *****
  • Posts: 754
how to display math functions in correct form
« on: September 06, 2016, 08:27:33 pm »
Hello,

do you hay any idea how can display a math function like word equation?

thanks

J-G

  • Hero Member
  • *****
  • Posts: 1036
Re: how to display math functions in correct form
« Reply #1 on: September 06, 2016, 08:33:43 pm »
I would simply create the equation in a drawing program (I use CorelDRAW) and then export it to a .PNG image file.

I'm not aware of a way to get Laz to interpret LaTeX formatted text - which is what I suspect you would like  :)
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

cpalx

  • Hero Member
  • *****
  • Posts: 754
Re: how to display math functions in correct form
« Reply #2 on: September 06, 2016, 08:36:47 pm »
 ;D

cpalx

  • Hero Member
  • *****
  • Posts: 754
Re: how to display math functions in correct form
« Reply #3 on: September 06, 2016, 08:37:47 pm »
I want dinamically with lazarus

thanks

Edson

  • Hero Member
  • *****
  • Posts: 1328
Re: how to display math functions in correct form
« Reply #4 on: September 06, 2016, 10:12:23 pm »
If you want to graphic dinamically any function, first you will need some kind of expression evaluator. Then some graphic engine to plot the result.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

wp

  • Hero Member
  • *****
  • Posts: 13556
Re: how to display math functions in correct form
« Reply #5 on: September 06, 2016, 10:37:13 pm »
For expression evaluation you can use fpexprpars which is part of FPC, see the wiki tutorial http://wiki.lazarus.freepascal.org/How_To_Use_TFPExpressionParser. And for plotting the function you can use TAChart, see for example http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Getting_started or http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Function_Series. Unfortunately, TAChart cannot create a 3d plot.

A worked-out (2D) math plotter is on my sourceforge site: https://sourceforge.net/p/wp-laz/code/HEAD/tree/MathPlotter/trunk/
« Last Edit: September 06, 2016, 10:43:53 pm by wp »

J-G

  • Hero Member
  • *****
  • Posts: 1036
Re: how to display math functions in correct form
« Reply #6 on: September 07, 2016, 12:19:09 am »
I don't believe that cpalx has any problem with plotting the graph of the function but he does want to display the formula as it would appear in a text book or learned paper. For this he would need something like LaTeX which interprets

         pi * sqrt (2(a^2 + b^2 .... etc. 

and show the formula on screen as shown below.

Rather larger than I intended and under [edit] there doesn't appear to be a way of replacing it with a smaller version.
« Last Edit: September 07, 2016, 12:25:41 am by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

zamtmn

  • Hero Member
  • *****
  • Posts: 683
Re: how to display math functions in correct form
« Reply #7 on: September 07, 2016, 01:29:14 am »
J-G
There is one good component. It is for Delphi, but I don't think the porting will be very difficult
http://www.delphikingdom.com/asp/viewitem.asp?catalogid=718
« Last Edit: September 07, 2016, 01:34:25 am by zamtmn »

cpalx

  • Hero Member
  • *****
  • Posts: 754
Re: how to display math functions in correct form
« Reply #8 on: September 07, 2016, 04:50:21 pm »
i will try it. thank you

 

TinyPortal © 2005-2018