0
$\begingroup$

Here is my input:

EQN[t_, M_] := 3 M + 6 t^2/(30 M);
t0 = 50;
ff = EQN[t0, M];
i = {3, 7, 10, 16};
TableForm[Table[{ff, PaddedForm[N[EQN[t0, i]], {20, 10}]}, {ff, i}], 
 TableHeadings -> {{}, {"M", "EQN"}}, TableSpacing -> {1, 1}]

Output:

enter image description here

But i want the result of EQN and M in the same row, and able to specify how many digits of EQN with PaddedForm. Seems like i mistakenly put the whole result in one row and repeated on each row. Please help. Thanks in advance!

$\endgroup$
1
  • $\begingroup$ @Bill still don't understand (sorry). Now i get error "Non-list iterator N[EQN[t0, i]] at position 2 does not evaluate to a real numeric value". $\endgroup$
    – user516076
    Commented Mar 9, 2021 at 12:21

1 Answer 1

2
$\begingroup$

I think the bug is EQN[t0, i] Should it read EQN[t0, ff]? Then you get:

EQN[t_, M_] := 3 M + 6 t^2/(30 M);
t0 = 50;
ff = EQN[t0, M];
i = {3, 7, 10, 16};
TableForm[Table[{ff, PaddedForm[N[EQN[t0, ff]], {20, 10}]}, {ff, i}], 
 TableHeadings -> {{}, {"M", "EQN"}}, TableSpacing -> {1, 1}]

enter image description here

$\endgroup$

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.