Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13595
| From | Fred Simons <f.h.simons@tue.nl> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Hold & Evaluate |
| Date | 2013-02-25 07:18 +0000 |
| Message-ID | <kgf390$mia$1@smc.vnet.net> (permalink) |
| References | <20130224043140.94A9B6873@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Actually, you formulated the solution already yourself. Since Hold does
not evaluate its argument, you have to evaluate the numerators and
denominators outside Hold and then substitute them into the Hold
expression. I use HoldForm because of I do not want to see the Hold.
Table[ With[{num = n, den = 0.1 (n + 1)}, HoldForm[num/den]], {n, 1, 5}]
Fred Simons
Eindhoven University of Technology
Op 24-2-2013 5:31, Šerých Jakub schreef:
> 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
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Hold & Evaluate Fred Simons <f.h.simons@tue.nl> - 2013-02-25 07:18 +0000
csiph-web