Re: Log[]//TraditionalForm
- To: mathgroup at smc.vnet.net
- Subject: [mg96515] Re: Log[]//TraditionalForm
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 15 Feb 2009 03:21:44 -0500 (EST)
On 2/14/09 at 3:09 AM, human at site.pl (slawek) wrote: >BTW, Log vs. ln is an aesthetic problem. The serious troubles are >caused by CForm and FortranForm. These "forms" produces output >unreadable by compilers. Therefore it is not possible to use >Mathematica to generate source code in C language. You need a proof? >Here is an example: >In[1]:= Series[Sin[x],{x,0,5}] Out[1]= x-x^3/6+x^5/120+O[x]^6 >In[2]:= Series[Sin[x],{x,0,5}]//CForm <snip> >Neither C/C++ nor Fortran (II/IV/77/95) have got "List" or >"SeriesData". Mathematica has a large number of built in functions that simply have no counterpart in C/C++ or Fortran. So, if you are expecting CForm or FortranForm to output something understandable to C/C++ or Fortran when given an arbitrary Mathematica expression you are doomed to disappointment. But this particular case is easily resolved with a bit of thought. That is: In[10]:= Series[Sin[x], {x, 0, 5}] // Normal // CForm Out[10]//CForm= x - Power(x,3)/6. + Power(x,5)/120. In[11]:= Series[Sin[x], {x, 0, 5}] // Normal // FortranForm Out[11]//FortranForm= x - x**3/6. + x**5/120.