2

I have a list of functions that I want to apply to a same argument. What I did is something like

{f[x],g[x],h[x]}/. x->N[10^6,300]

One of the functions is Precision. Clearly when I make the replace the precision is said to be infinity, because the argument is evaluated first. I tried some code with Hold to try that the argument would not be evaluated but it didnt work, by example

Precision[x]/. x->Hold@N[10^6,300]

Then my question is: how I can apply the same argument to a list of functions such that the argument remains completely unevaluated, such that functions like Precision works properly?

EDIT: I find an answer here but I want to know if its possible to do the same with the command ReplaceAll.

Masacroso
  • 1,107
  • 5
  • 13
  • 2
    you are holding a wrong thing: ReleaseHold[Hold@Precision[x] /. x -> N[10^6, 300]] – Kuba Nov 14 '17 at 15:16

2 Answers2

3

I think you need Inactive

Inactive[{f[x], g[x], h[x]}] /. x -> N[10^6, 300] // Activate
Coolwater
  • 20,257
  • 3
  • 35
  • 64
2

I think something like the following does what you want:

pInfo=Through @* {Precision, Accuracy, RealExponent};

Then:

pInfo[N[10^6, 100]]

{100., 94., 6.}

Another idea is:

Function[x, {Precision[x], Accuracy[x], RealExponent[x]}] @ N[10^6, 100]

{100., 94., 6.}

Carl Woll
  • 130,679
  • 6
  • 243
  • 355