Skip to main content
added 20 characters in body
Source Link
xyz
  • 655
  • 4
  • 38
  • 117

As ciao comments code facilitates answers rather than pictures. As the base list is small I post the following. There will almost certainly be better ways and I have not simplified Sqrt:

 dat = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}, {a4, b4, c4}, {a5, 
       b5, c5}}
    func[u_] := FoldList[Append, {u[[1]]}, u[[2 ;; -2]]]
    col1 = Accumulate[Most@dat[[All, 1]]];
    col2 = Sqrt[#.#] & /@ func[dat[[All, 2]]];
 col3 =
  col3 =MapThread[
 MapThread[#1   #1/#2 &,
    {Rest@dat[[All, 3]],
     MapThread[
   MapThread[#1   #1.#2/Plus @@ #2 &,
         {func[dat[[All, 3]]], func[dat[[All, 1]]]}]}];
    ];     
 Transpose[{col1, col2, col3}]

this yields:

(*{{a1, Sqrt[b1^2], c2/c1}, {a1 + a2, Sqrt[
  b1^2 + b2^2], ((a1 + a2) c3)/(a1 c1 + a2 c2)}, {a1 + a2 + a3, Sqrt[
  b1^2 + b2^2 + b3^2], ((a1 + a2 + a3) c4)/(
  a1 c1 + a2 c2 + a3 c3)}, {a1 + a2 + a3 + a4, Sqrt[
  b1^2 + b2^2 + b3^2 + b4^2], ((a1 + a2 + a3 + a4) c5)/(
  a1 c1 + a2 c2 + a3 c3 + a4 c4)}}*)

As ciao comments code facilitates answers rather than pictures. As the base list is small I post the following. There will almost certainly be better ways and I have not simplified Sqrt:

 dat = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}, {a4, b4, c4}, {a5, 
       b5, c5}}
    func[u_] := FoldList[Append, {u[[1]]}, u[[2 ;; -2]]]
    col1 = Accumulate[Most@dat[[All, 1]]];
    col2 = Sqrt[#.#] & /@ func[dat[[All, 2]]];
    col3 = MapThread[#1/#2 &, {Rest@dat[[All, 3]],
        MapThread[#1.#2/Plus @@ #2 &,
         {func[dat[[All, 3]]], func[dat[[All, 1]]]}]}];
    Transpose[{col1, col2, col3}]

this yields:

(*{{a1, Sqrt[b1^2], c2/c1}, {a1 + a2, Sqrt[
  b1^2 + b2^2], ((a1 + a2) c3)/(a1 c1 + a2 c2)}, {a1 + a2 + a3, Sqrt[
  b1^2 + b2^2 + b3^2], ((a1 + a2 + a3) c4)/(
  a1 c1 + a2 c2 + a3 c3)}, {a1 + a2 + a3 + a4, Sqrt[
  b1^2 + b2^2 + b3^2 + b4^2], ((a1 + a2 + a3 + a4) c5)/(
  a1 c1 + a2 c2 + a3 c3 + a4 c4)}}*)

As ciao comments code facilitates answers rather than pictures. As the base list is small I post the following. There will almost certainly be better ways and I have not simplified Sqrt:

 dat = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}, {a4, b4, c4}, {a5, b5, c5}}
 func[u_] := FoldList[Append, {u[[1]]}, u[[2 ;; -2]]]
 col1 = Accumulate[Most@dat[[All, 1]]];
 col2 = Sqrt[#.#] & /@ func[dat[[All, 2]]];
 col3 =
   MapThread[
    #1/#2 &,
    {Rest@dat[[All, 3]],
     MapThread[
      #1.#2/Plus @@ #2 &,
      {func[dat[[All, 3]]], func[dat[[All, 1]]]}]}
    ];     
 Transpose[{col1, col2, col3}]

this yields:

(*{{a1, Sqrt[b1^2], c2/c1}, {a1 + a2, Sqrt[
  b1^2 + b2^2], ((a1 + a2) c3)/(a1 c1 + a2 c2)}, {a1 + a2 + a3, Sqrt[
  b1^2 + b2^2 + b3^2], ((a1 + a2 + a3) c4)/(
  a1 c1 + a2 c2 + a3 c3)}, {a1 + a2 + a3 + a4, Sqrt[
  b1^2 + b2^2 + b3^2 + b4^2], ((a1 + a2 + a3 + a4) c5)/(
  a1 c1 + a2 c2 + a3 c3 + a4 c4)}}*)
Source Link
ubpdqn
  • 65k
  • 3
  • 65
  • 154

As ciao comments code facilitates answers rather than pictures. As the base list is small I post the following. There will almost certainly be better ways and I have not simplified Sqrt:

 dat = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}, {a4, b4, c4}, {a5, 
       b5, c5}}
    func[u_] := FoldList[Append, {u[[1]]}, u[[2 ;; -2]]]
    col1 = Accumulate[Most@dat[[All, 1]]];
    col2 = Sqrt[#.#] & /@ func[dat[[All, 2]]];
    col3 = MapThread[#1/#2 &, {Rest@dat[[All, 3]],
        MapThread[#1.#2/Plus @@ #2 &,
         {func[dat[[All, 3]]], func[dat[[All, 1]]]}]}];
    Transpose[{col1, col2, col3}]

this yields:

(*{{a1, Sqrt[b1^2], c2/c1}, {a1 + a2, Sqrt[
  b1^2 + b2^2], ((a1 + a2) c3)/(a1 c1 + a2 c2)}, {a1 + a2 + a3, Sqrt[
  b1^2 + b2^2 + b3^2], ((a1 + a2 + a3) c4)/(
  a1 c1 + a2 c2 + a3 c3)}, {a1 + a2 + a3 + a4, Sqrt[
  b1^2 + b2^2 + b3^2 + b4^2], ((a1 + a2 + a3 + a4) c5)/(
  a1 c1 + a2 c2 + a3 c3 + a4 c4)}}*)