5
$\begingroup$

I have the following list (3D data) and would like to apply the RootMeanSquare function on the fourth elements of each sublist. In fact, I am looking for RootMeanSquar[{67,69,87,98,45,67,87,33,75}], RootMeanSquar[{66,43,443,23,54}] and RootMeanSquar[{76,65,65,32,22,665,65,543,89,999}].

data3D={{{116.78, -290.14, -1757.55, 67}, {117.024, -290.15, -1757.86, 
   69}, {-83.7714, -286.992, -1901.55, 
   87}, {-82.8433, -281.52, -1900.81, 
   98}, {-97.3191, -273.23, -1892.02, 
   45}, {6.94247, -279.69, -1733.99, 
   67}, {120.195, -284.195, -1767.62, 
   87}, {-154.166, -283.542, -1851.78, 
   33}, {-149.813, -261.681, -1848.62, 
   75}}, {{-73.3052, -262.238, -1901.01, 
   66}, {-155.831, -261.886, -1834.57, 
   43}, {42.6028, -265.302, -1739., 
   443}, {-107.499, -270.669, -1886.43, 
   23}, {118.076, -270.128, -1778.35, 
   54}}, {{-138.659, -260.069, -1766.41, 
   76}, {-129.386, -285.284, -1741.13, 
   65}, {-128.958, -285.286, -1740.88, 
   65}, {98.259, -269.162, -1865.58, 
   32}, {108.071, -260.557, -1769.63, 22}, {110.842, -272.986, -1763.,
    665}, {-50.2524, -276.088, -1913.44, 
   65}, {-73.7019, -257.021, -1899.68, 
   543}, {-63.8887, -273.999, -1907.87, 
   89}, {-97.2162, -255.713, -1888.67, 999}}}
$\endgroup$

1 Answer 1

5
$\begingroup$
rms = RootMeanSquare /@ (#[[All, -1]] & /@ data3D)

(* {2 Sqrt[3935/3], Sqrt[205899/5], Sqrt[352591/2]} *)

Check

rms === {RootMeanSquare[{67, 69, 87, 98, 45, 67, 87, 33, 75}], 
  RootMeanSquare[{66, 43, 443, 23, 54}], 
  RootMeanSquare[{76, 65, 65, 32, 22, 665, 65, 543, 89, 999}]}

(* True *)
$\endgroup$
1
  • 4
    $\begingroup$ Or just RootMeanSquare /@ data3D[[All, All, -1]] $\endgroup$
    – C. E.
    Jul 9, 2020 at 18:44

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.