[Tugindia] formula and calculations
Ajay Shah
ajayshah at mayin.org
Thu Dec 4 01:16:10 CET 2008
On Thu, Dec 04, 2008 at 05:39:19AM +0530, E. Krishnan wrote:
> > If if have a=2 and b=4
> >
> > and LaTeX formula:
> >
> > c = a^2 + b^2
> >
> > should be used as such as used normaly in LaTeX to display formula and
> > then it should substitute values and do calculation automatically
> > like:
> >
> > c = 2^2 + 4^2
> > c = 20
>
> 1. Within LaTeX, we can use the "fp" package as in
>
> \usepackage{fp}
>
> \def\sumsquare#1#2{%
> \FPeval\sumsquarecalc{#1^2+#2^2}
> \FPround\sumsquareround\sumsquarecalc0
> \sumsquareround}
>
> Let $c=a^2+b^2$. For $a=2$ and $b=4$, we get
> $c=\sumsquare{2}{4}$
>
> 2. In a Linux system, we can shell-escape (pdflatex -shell-escape) to the
> commandline calculator "bc" as in
>
> Let $c=a^2+b^2$. For $a=2$ and $b=4$, we get
> $c=\immediate\write18{echo "2^2+4^2"|bc -l>answer.tex}\input{answer}$
No, what Krishnan's fantasising about is mathematics software that
uses TeX math notation. :-) It's a good thought. I have often thought
that it's not unreasonable to ask for software which can tell that
$\int e^x$ is $e^x$.
--
Ajay Shah http://www.mayin.org/ajayshah
ajayshah at mayin.org http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.
More information about the tugindia
mailing list