Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13599 > unrolled thread

Re: Hold & Evaluate

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-02-25 07:19 +0000
Last post2013-02-25 07:19 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Hold & Evaluate Bob Hanlon <hanlonr357@gmail.com> - 2013-02-25 07:19 +0000

#13599 — Re: Hold & Evaluate

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-02-25 07:19 +0000
SubjectRe: Hold & Evaluate
Message-ID<kgf39l$min$1@smc.vnet.net>
m = 5;

seq = Table[
  ToString[n] <> "/" <> ToString[1.1 n + 0.1],
  {n, m}]

{"1/1.2", "2/2.3", "3/3.4", "4/4.5", "5/5.6"}

seq // ToExpression

{0.833333, 0.869565, 0.882353, 0.888889, 0.892857}


Bob Hanlon


On Sat, Feb 23, 2013 at 11:31 PM, =C5 er=C3=BDch Jakub <Serych@panska.cz> wrote:
> Dear mathgroup,
> I would like to generate sequence in the form:
>
> 1/1.2, 2/2.3, 3/3.4, 4/4.5, etc.
>
> It is very simple by a Table function:
>
> Table[n/(n + 0.1 (n + 1)), {n, 1, 15}]
>
> but as there are real numbers in denominators, Mathematica evaluates all and generates something like:
>
> {0.833333, 0.869565, 0.882353, 0.888889, 0.892857, 0.895522, etc.}
>
> How to evaluate numerators and denominators separately and print the sequence in that "fraction like" form?
>
> I tested:
>
> #[[1]]/#[[2]] & /@ Table[{n, n + 0.1 (n + 1)}, {n, 1, 15}] and than used Hold[] and Evaluate[]:
>
> Hold[Evaluate[#[[1]]]/Evaluate[#[[2]]]] & /@
>  Table[{n, n + 0.1 (n + 1)}, {n, 1, 15}]
>
> But it doesn't work as the Hold has "veto" power over any evaluation.
>
> Thanks in advance for any idea, how to do it
>
> Jakub
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web