MathGroup Archive 2006

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

Search the Archive

Re: pretty output with HoldForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70482] Re: pretty output with HoldForm
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 17 Oct 2006 02:59:30 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <egva7f$rgs$1@smc.vnet.net>

Hi,



kl[n_] := HoldForm[ 1/(2n + 1) - 1/(4n + 2) - 
1/(4n + 4)];

reihe = Sum[kl[n], {n, 1, 5}];

(reihe + Hold[] //.
HoldForm[a_] + b_. + Hold[c___] :> (d = 
Evaluate[a];
Append[Hold[c], d] + b)) /. Hold[c___] :> 
HoldForm[Plus[c]]

Regards

  Jens

"Peter Breitfeld" <phbrf at t-online.de> schrieb im 
Newsbeitrag news:egva7f$rgs$1 at smc.vnet.net...
|
| I want to get the following output for the 
series:
|
| (1 - 1/2 - 1/4) + (1/3 - 1/6 - 1/8) + (1/5 - 
1/10 - 1/12) +
|  (1/7 - 1/14 - 1/16) . . .
|
| What I did was
|
| kl[n_]:=HoldForm[ 1/(2n+1)-1/(4n+2)-1/(4n+4)]
|
| then I enter eg:
|
| reihe= Sum[kl[n],{n,1,5}]
|
| This works quite good, but the fractions are 
completely unevaluated
| (because of HoldForm, I know) and display as
|
|     1
| ----------
| 4 2 + 2
|
| But I want them displayed as
|
| 1
| --
| 10
|
| Is there a way to evaluate parts inside a 
HoldForm, so that the
| fractions are evaluated but not the sums?
|
| Gruss Peter
| -- 
| 
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
| Peter Breitfeld, Bad Saulgau, Germany --  
http://www.pBreitfeld.de
| 



  • Prev by Date: RE: How to make an inline cell (inside a Text cell) to be a centered equation?
  • Next by Date: Re: pretty output with HoldForm
  • Previous by thread: RE: pretty output with HoldForm
  • Next by thread: Re: pretty output with HoldForm