Re: Log[]//TraditionalForm
- To: mathgroup at smc.vnet.net
- Subject: [mg96531] Re: Log[]//TraditionalForm
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Mon, 16 Feb 2009 06:53:39 -0500 (EST)
- References: <200902031132.GAA00303@smc.vnet.net> <gmrm45$9m4$1@smc.vnet.net> <200902111016.FAA16824@smc.vnet.net> <gn3btj$q33$1@smc.vnet.net> <gn5u8f$goo$1@smc.vnet.net>
Hi, > It is very very simple, Lui, you should practise yourself. :) > > 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 > Out[2]//CForm= > SeriesData(x,0,List(1,0,-0.16666666666666666,0,0.008333333333333333),1, > 6,1) > In[3]:= Series[Sin[x],{x,0,5}]//FortranForm > Out[3]//FortranForm= > SeriesData(x,0,List(1,0,-0.16666666666666666,0, > - 0.008333333333333333),1,6,1) > > Neither C/C++ nor Fortran (II/IV/77/95) have got "List" or "SeriesData". If you want something not to work, there are many possibilities to make it fail. The documentation states clearly that only some standard stuff will be translated and you might need some additional definitions. This will work with most compilers I know, provided x is defined as float or double and you include mdefs.h for the C code: Series[Sin[x], {x, 0, 5}] // Normal // CForm Series[Sin[x], {x, 0, 5}] // Normal // FortranForm albert PS: I found that Mathematicas performance in general increases a lot when using the option Brain -> On for $User. I'm not sure whether the user installed on your system supports that option, but most users do, so I would give it a try.
- Follow-Ups:
- Re: Re: Log[]//TraditionalForm
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Log[]//TraditionalForm
- References:
- Log[x]//TraditionalForm
- From: "slawek" <human@site.pl>
- Re: Log[x]//TraditionalForm
- From: "slawek" <human@site.pl>
- Log[x]//TraditionalForm