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

MathGroup Archive 2013

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

Search the Archive

Re: Hold & Evaluate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129916] Re: Hold & Evaluate
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Mon, 25 Feb 2013 02:23:18 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20130224043140.94A9B6873@smc.vnet.net>

Sorry, I should have given the complete answer to your question. As I assume you only want to print the sequence in the fraction-like form, do as follows:
In[1]:= b=Rationalize/@Table[n/(n+0.1 (n+1)),{n,1,15}]Out[1]= {5/6,20/23,15/17,8/9,25/28,60/67,35/39,80/89,9/10,100/111,55/61,120/133,65/72,28/31,75/83}
In[2]:= d=Table[j,{j,1,15}]Out[2]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
In[3]:= c=(1./b)d Out[3]= {1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,10.,11.1,12.2,13.3,14.4,15.5,16.6}
In[4]:= Table[ToString[d[[j]]]<>"/"<>ToString[c[[j]]],{j,1,15}]Out[4]= {1/1.2,2/2.3,3/3.4,4/4.5,5/5.6,6/6.7,7/7.8,8/8.9,9/10=
.,10/11.1,11/12.2,12/13.3,13/14.4,14/15.5,15/16.6}
-Tomas

> From: Serych at panska.cz
> Subject: Hold & Evaluate
> To: mathgroup at smc.vnet.net
> Date: Sat, 23 Feb 2013 23:31:40 -0500
>
> 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
>


  • Prev by Date: Re: A nonconventional ListContourPlot
  • Next by Date: Re: i^2=1
  • Previous by thread: Re: Hold & Evaluate
  • Next by thread: Re: Hold & Evaluate