Message Boards Message Boards

0
|
3251 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How do I Hold the computation for a list or table of fractions?

Posted 2 years ago

How do I create a table of fractions of numbers that are in scientific notation that suppresses the evaluation? I've tried using Hold and HoldForm but it always results in error.

particleclass = {10^-6, 10^-5, 10^-4, 10^-3, 10^-2, 10^-1};

alphaTESTwith = {5.261524149346547`*^-11, 5.261524149346548`*^-9, 
   5.261524149346547`*^-7, 0.000052615241493465474`, 
   0.005261524149346548`, 0.5261524149346547`};

alphaTESTwithout = {1.4251746149271436`*^-11, 
   1.4251746149271434`*^-10, 1.4251746149271435`*^-9, 
   1.4251746149271436`*^-8, 1.4251746149271436`*^-7, 
   1.4251746149271436`*^-6};

kappa = {1.32751827`*^8, 1.32751827`*^10, 1.32751827`*^12, 
   1.32751827`*^14, 1.3275182700000002`*^16, 1.32751827`*^18};

l = 1;

alphaKWith = Table[(alphaTESTwith*l)/kappa[[Mass]], {Mass, 1, 6}];
alphaKWithout = 
  Table[(alphaTESTwithout*l)/kappa[[Mass]], {Mass, 1, 6}];

gridWith = Grid[
  Insert[Transpose[
    Insert[Transpose[alphaKWith], N@particleclass, 1]]
   , Prepend[N@particleclass, "Table"], 1],
  Frame -> All]

gridWithout = Grid[
  Insert[Transpose[
    Insert[Transpose[alphaKWithout], N@particleclass, 1]]
   , Prepend[N@particleclass, "Table"], 1],
  Frame -> All]

Gives out Table Results

5 Replies
Posted 2 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi
Posted 2 years ago

You could try something like this:

alphaKWith2 = Outer[DisplayForm@*FractionBox, alphaTESTwith, kappa]

This is in a different order than your final table shows, so you would dispense with one Transpose:

gridWith2 = 
 Grid[Insert[Transpose[Insert[alphaKWith2, N@particleclass, 1]], 
   Prepend[N@particleclass, "Table"], 1], Frame -> All]

Now, I'm still not sure if this is quite what you want. Maybe you want all numerators to be in scientific notation:

alphaKWith2 = 
 Outer[DisplayForm@*FractionBox, ScientificForm /@ alphaTESTwith, 
  kappa]

But anyway, hopefully this points you in a useful direction.

POSTED BY: Eric Rimbey

Hi Lance

alphaKWith = 
  Table[(alphaTESTwith*l)/HoldForm[Evaluate@kappa[[Mass]]], {Mass, Length@kappa}];

Robert

POSTED BY: Robert Nowak
Posted 2 years ago

I'm not really sure what you mean by "suppress the evaluation", but if you want special display formatting for numbers, then you could try ScientificForm or EngineeringForm (or any of several others).

POSTED BY: Eric Rimbey

Sorry for the lack of clarity. What I mean is that I wanted it to not evaluate the division but display it as a fraction instead.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract