Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Converting Power terms to Times terms

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88026] Re: Converting Power terms to Times terms
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 22 Apr 2008 06:27:58 -0400 (EDT)
  • References: <fuin2e$9o8$1@smc.vnet.net>


Hi Reza,

we may prevent Power to gobble up terms by e.g. converting the terms 

into a string. If you then copy the resulting expression to the 

clipboard as "plain text" the quotes are not copied. Here is an example:

(1+a)^3+(1-a)^5/.Power[x_,n_Integer]:>Nest[#<>"*("<>ToString[x]<>")"&,"1",n]

there is an superfluous 1* that will not hurt.

hope this helps, Daniel



Reza Farrahi Moghaddam wrote:

> Hello,

>  

> I am using Dolfin/FFC for solving finite element problems. I want to use Mathematica for generating the linear and bilinear terms of the weak equation. After computing the terms, I use the "InputForm", and then give the results to FFC compiler. The problem is that FFC does not accept "power" function. Therefore, terms such as "a^2" must be written as "a*a". Because there are many terms in the weak form of my problem, manual conversion of power terms takes a long time (and probably is subject to errors).

>  

> Is there any way to disable "power" function, or stop "times" function to be simplified in the "power" form?

>  

> Any other solution?

>  

> Thanks,

> Reza

> 

> 




  • Prev by Date: Re: Column Product of a Matrix of zeros and 1's
  • Next by Date: Re: Re: axis alignment of 3D plots with ListContourPlot3D
  • Previous by thread: Re: Converting Power terms to Times terms
  • Next by thread: Re: Converting Power terms to Times terms