Message Boards Message Boards

Goal-seek of a large sum equation?

GROUPS:

I'm looking to take a sum program that I've written and add up a series of terms to get to a specific mass that I can arbitrarily decide. I've written the code up to a multiple sum equation, but what I want to know is if there is a simple way of picking out parts of the sum that are, say, within 5% of a target value? I will paste the code below if that helps.

Clear["Global'*"];
h1 = 1.007825; h1p = 100; li7 = 7.016004; li7p = 92.41; b10 = \
10.01294; b10p = 19.9; b11 = 11.00931; b11p = 80.1; c12 = 12.01; c12p \
= 98.93; c13 = 13.00336; c13p = 1.07; n14 = 14.00307; n14p = 99.632; \
o16 = 15.99492; o16p = 99.757; f19 = 18.9984; f19p = 100; na23 = \
22.98977; na23p = 100; mg24 = 23.98584; mg24p = 78.99; mg25 = \
24.98584; mg25p = 10; mg26 = 25.98259; mg26p = 11.01; p31 = 30.97376; \
p31p = 100; s32 = 31.97207; s32p = 94.93; s34 = 33.96787; s34p = \
4.29; cl35 = 34.96885; cl35p = 75.78; cl37 = 36.9659; cl37p = 24.22; \
k39 = 38.96371; k39p = 93.2581; k41 = 40.96183; k41p = 6.7302; ca40 = \
39.96259; ca40p = 96.941; ca44 = 43.95548; ca44p = 2.086; mn55 = \
54.93805; mn55p = 100; fe54 = 53.93962;
fe54p = 5.845; fe56 = 55.93494; fe56p = 91.754; fe57 = 56.9354; fe57p \
= 2.119; se76 = 75.91921; se76p = 9.37; se77 = 76.91992; se77p = \
7.63; se78 = 77.91731; se78p = 23.77; se80 = 79.91652; se80p = 49.61; \
se82 = 81.9167; se82p = 8.73; br79 = 78.91834; br79p = 50.69; br81 = \
80.91629; br81p = 49.31; suspect = 
 nh1 h1 + nli7 li7 + nb10 b10 + nb11 b11 + nc12 c12 + nc13 c13 + 
  nn14 n14 + no16 o16 + nf19 f19 + nna23 na23 + nmg24 mg24 + 
  nmg25 mg25 + nmg26 mg26 + np31 p31 + ns32 s32 + ns34 s34 + 
  ncl35 cl35 + ncl37 cl37 + nk39 k39 + nk41 k41 + nca40 ca40 + 
  nca44 ca44 + nmn55 mn55 + nfe54 fe54 + nfe56 fe56 + nfe57 fe57 + 
  nse76 se76 + nse77 se77 + nse78 se78 + nse80 se80 nse82 se82 + 
  nbr79 br79 + nbr81 br81;
sniffer = 
 Sum[suspect, {nh1, 0, 5, 1}, {nli7, 0, 5, 1}, {nb10, 0, 5, 1}, {nb11,
    0, 5, 1}, {nc12, 0, 5, 1}, {nc13, 0, 5, 1}, {nn14, 0, 5, 
   1}, {no16, 0, 5, 1}, {nf19, 0, 5, 1}, {nna23, 0, 5, 1}, {nmg24, 0, 
   2, 1}, {nmg25, 0, 2, 1}, {nmg26, 0, 2, 1}, {np31, 0, 2, 1}, {ns32, 
   0, 2, 1}, {ns34, 0, 2, 1}, {ncl35, 0, 2, 1}, {ncl37, 0, 2, 
   1}, {nk39, 0, 2, 1}, {nk41, 0, 2, 1}, {nca40, 0, 2, 1}, {nca44, 0, 
   2, 1}, {nmn55, 0, 2, 1}, {nfe54, 0, 2, 1}, {nhfe56, 0, 2, 
   1}, {nhfe57, 0, 2, 1}, {nse76, 0, 2, 1}, {nse77, 0, 2, 1}, {nse78, 
   0, 2, 1}, {nse80, 0, 2, 1}, {nse82, 0, 2, 1}, {nse79, 0, 2, 
   1}, {nse81, 0, 2, 1}]
POSTED BY: Josh Wofford
Answer
6 months ago

Group Abstract Group Abstract