1
$\begingroup$

I got this formula

lns[ri_, rj_, kij_, yi_, phm_, ylm_, plm_, yhm_, si_, ss_, sf_, mi_, 
  tsi_, δi_, dri_, drj_, lij_] = 
 10 Log[10^(-1 - #15 - #16 - #3 - #1/2 - #2/2 - 10 Log[5/2] - 
    10 Log[#9/10] - 10 Log[10/#10] - 10 Log[#10/#17] + (
    10 Sqrt[#7/Sqrt[#6^2]] Log[(1000000000000 #5)/Sqrt[1/#8^2]])/
    Sqrt[#5/Sqrt[1/#8^2]] - 
    10 Log[(Sqrt[#7/
       Sqrt[#6^2]] (#4^2 + (#5 Sqrt[#6^2])/(#7 Sqrt[1/#8^2])))/(
      Sqrt[#5/Sqrt[1/#8^2]] Sqrt[#4^2])] - 
    10 Log[(0.03344973747377862` 10^(-1 - #1) #12)/(#13 #14)])]

Some values are frequency-dependent, so there are 21 different values ( 1 for each frequency ) I wrote them in Lists:

ri = {53, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
  19, 20, 21}
rj = {53, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
  19, 20, 21}
kij = {22, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
   19, 20, 21}
yi = {7, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
  19, 20, 21}
phm = {(10^-7), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
  17, 18, 19, 20, 21}
ylm = {(-7), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 
  18, 19, 20, 21}
plm = {(10^-7), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
  17, 18, 19, 20, 21}
yhm = {14, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
   19, 20, 21}

Δri = {0.008, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
  14, 15, 16, 17, 18, 19, 20, 21}
Δrj = {0.2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
  15, 16, 17, 18, 19, 20, 21}
Δkij = {0.2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
   15, 16, 17, 18, 19, 20, 21}
Δyi = {0.2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
  15, 16, 17, 18, 19, 20, 21}
Δphm = {(1 10^-9), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
  13, 14, 15, 16, 17, 18, 19, 20, 21}
Δylm = {0.08, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
  14, 15, 16, 17, 18, 19, 20, 21}
Δplm = {(1 10^-9), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
  13, 14, 15, 16, 17, 18, 19, 20, 21}
Δyhm = {0.2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
   15, 16, 17, 18, 19, 20, 21}

si = {7.37}
ss = {9.36}
sf = {7.52}
mi = {24}
tsi = {0.1, 1, 2, 3}
δi = {1}
dri = {1}
drj = {1}
lij = {1}

Δsi = {0.1}
Δss = {1}
Δsf = {1}
Δmi = {0.2}
Δtsi = {0.001}
Δδi = {0.01}
Δdri = {1}
Δdrj = {1}
Δlij = {0.01}

Last, there ist this calculation , which i want to do for every frequenz, (for every Part of the List)

How do I tell Mathematica to Put the Values of an exakt Spot in the List (here 1st) so ri=ri[[1]] and so on to the D[lns,phm] D[lns,ylm]... Funktions

Δlns50 = Sqrt[(
   (D[lns, ri] Δri[[1]])^2 + (D[lns, 
        rj] Δrj[[1]])^2
    + (D[lns, kij] Δkij[[1]])^2 + (D[lns, 
        yi] Δyi[[1]])^2
    + (D[lns, phm] Δphm[[1]])^2 + (D[lns, 
        ylm] Δylm[[1]])^2
    + (D[lns, plm] Δplm[[1]])^2 + (D[lns, 
        yhm] Δyhm[[1]])^2
    + (D[lns, si] Δsi[[1]])^2 + (D[lns, 
        mi] Δmi[[1]])^2
    + (D[lns, tsi] Δtsi[[1]])^2 + (D[
        lns, δi] Δδi[[1]])^2
    + (D[lns, lij] Δlij[[1]])^2)]

How do I tell Mathematica that all first Values of the List count, how do I tell Mathematica, to do the same calculation for the second, third,... 21st Part of teh List

so that I don't have to rewrite the calculation every time?

$\endgroup$
2
$\begingroup$

You should make a function:

rij=#1 /2 + dri + #2 /2 + drj + #3 + 10 Log[ss/(1 lij)]&

And further call it by rij[ri,rj,kij], substituting the desired values of ri, rj and kij which are associated with numbered slots for arguments (#1,#2,#3) of the function

$\endgroup$
0
2
$\begingroup$

If @Rom38's pure-function definition looks a bit esoteric, here's a more straightforward definition to the same effect:

rij[ri_, rj_, kij_] = ri/2 + dri + rj/2 + drj + kij + 10 Log[ss/(1 lij)];

Try it out:

rij[1, 2, 3]
(*    9/2 + dri + drj + 10 Log[ss/lij]    *)

Of course you'll have to define the other parameters (dri, drj, ss, lij) as well.

$\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.