1
$\begingroup$

I want to calculate the value of a function for some particular values of the variable and put it in table. This is my code:

ClearAll["Global`*"]
M = 511000;
z = 1;
\[Alpha] = 1/137;
b[T_?NumericQ] := Sqrt[(T (T + 2 M))/(T + M)^2];

i[T_?NumericQ] := NIntegrate[ 1/w ((2 M T +  T^2)/(M + T)^2 + (2 M (T - w) + (T - w)^2)/(M + T - w)^2 +   2 ((-M^2 + T (T - w))/  M^2)) (((4 + b[T] + b[T]^2) z^2 \[Alpha])/(12 (1 +  b[T]) \[Pi])), {w, 4.3, 100}];

Table[{T, i[T]}, {T, {10^6, 5*10^6, 10^7, 5*10^7, 10^8}}] // TableForm // ScientificForm

It works, but I get the ScientificForm only on the second column: how can I make Mathematica to use ScientificForm also on the first column?

$\endgroup$
4
  • $\begingroup$ why can't you just do Table[{ScientificForm@T, i[T]}, {T, {10^6, 5*10^6, 10^7, 5*10^7, 10^8}}];? (btw, using i for function name is not very good choice) $\endgroup$
    – Nasser
    Jun 12, 2020 at 13:44
  • $\begingroup$ @Nasser because it doesn't work. I use version 10.0 if it may be a problem. $\endgroup$
    – mattiav27
    Jun 12, 2020 at 13:46
  • $\begingroup$ I see. I do not have V 10. Will try on V 11. $\endgroup$
    – Nasser
    Jun 12, 2020 at 13:47
  • 1
    $\begingroup$ ScientificForm applies only to non-arbitrary precision numbers. Try Table[{N[T], i[T]}, ...]. $\endgroup$
    – MarcoB
    Jun 12, 2020 at 13:53

1 Answer 1

2
$\begingroup$

Putting N in front of the first column will do the trick:

 Table[{T, i[T]}, {T, N@{10^6, 5*10^6, 10^7, 5*10^7, 10^8}}] // 
      TableForm // ScientificForm
$\endgroup$
1
  • $\begingroup$ Tank you it works! $\endgroup$
    – mattiav27
    Jun 12, 2020 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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