2
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ you are holding a wrong thing: ReleaseHold[Hold@Precision[x] /. x -> N[10^6, 300]] $\endgroup$ – Kuba Nov 14 '17 at 15:16
3
$\begingroup$

I think you need Inactive

Inactive[{f[x], g[x], h[x]}] /. x -> N[10^6, 300] // Activate
$\endgroup$
2
$\begingroup$

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.}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.