Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'eliminating power() from CForm output' topicStudent Support Forum > General > "eliminating power() from CForm output"

Next Comment >Help | Reply To Topic
Author Comment/Response
George S. Cowan
11/16/98 6:41pm

I need to put simplified formulas into CForm without using the Power function. I only have integer powers, so if I can evaluate transformations without having Mathematica apply its own evaluation to the result, I can eliminate them. Something like

CForm[Hold[1+Power[x,3]//.{Power[x,1]->x,Power[x,n]->x * Power[x,n-1]}]]

but that doesn't work because Hold[] prevents transformations, too.

Maybe I am approaching this from the wrong direction. Is there a way to cancel the standard evaluation part of the read/evaluate loop, then use Simplify[] explicitly when I want it?

I am a beginner in using Mathematica, so I don't have the big picture yet. I may be missing something very simple.

George

URL: ,

Subject (listing for 'eliminating power() from CForm output')
Author Date Posted
eliminating power() from CForm output George S. Co... 11/16/98 6:41pm
Re: eliminating power() from CForm output George S. Co... 11/25/98 09:03am
Next Comment >Help | Reply To Topic