R programming with tidyverse: arguments passed to glue

Question: I am working on a few functions in which the body contains magrittr pipes.
I am struggling with calling the arguments passed to the function inside the pipe.
The pipe works outside the function.
Here is my repex.
Just in case, I pasted the whole filtered data that I am working on:
timeseries <- structure(list(Date = structure(c(18631, 18632, 18633, 18634,
18635, 18638, 18639, 18640, 18641, 18642, 18646, 18647, 18648,
18649, 18652, 18653, 18654, 18655, 18656, 18659, 18660, 18661,
18662, 18663, 18666, 18667, 18668, 18669, 18670, 18674, 18675,
18676, 18677, 18680, 18681, 18682, 18683, 18684, 18687, 18688,
18689, 18690, 18691, 18694, 18695, 18696, 18697, 18698, 18701,
18702, 18703, 18704, 18705, 18708, 18709, 18710, 18711, 18712,
18715, 18716, 18631, 18632, 18633, 18634, 18635, 18638, 18639,
18640, 18641, 18642, 18646, 18647, 18648, 18649, 18652, 18653,
18654, 18655, 18656, 18659, 18660, 18661, 18662, 18663, 18666,
18667, 18668, 18669, 18670, 18674, 18675, 18676, 18677, 18680,
18681, 18682, 18683, 18684, 18687, 18688, 18689, 18690, 18691,
18694, 18695, 18696, 18697, 18698, 18701, 18702, 18703, 18704,
18705, 18708, 18709, 18710, 18711, 18712, 18715, 18716, 18631,
18632, 18633, 18634, 18635, 18638, 18639, 18640, 18641, 18642,
18645, 18646, 18647, 18648, 18649, 18652, 18653, 18654, 18655,
18656, 18659, 18660, 18661, 18662, 18663, 18666, 18667, 18668,
18669, 18674, 18675, 18676, 18677, 18680, 18681, 18682, 18683,
18684, 18687, 18688, 18689, 18690, 18691, 18694, 18695, 18696,
18697, 18698, 18701, 18702, 18703, 18704, 18705, 18708, 18709,
18710, 18711, 18712, 18715, 18716, 18631, 18632, 18633, 18634,
18635, 18638, 18639, 18640, 18641, 18642, 18646, 18647, 18648,
18649, 18652, 18653, 18654, 18655, 18656, 18659, 18660, 18661,
18662, 18663, 18666, 18667, 18668, 18669, 18670, 18674, 18675,
18676, 18677, 18680, 18681, 18682, 18683, 18684, 18687, 18688,
18689, 18690, 18691, 18694, 18695, 18696, 18697, 18698, 18701,
18702, 18703, 18704, 18705, 18708, 18709, 18710, 18711, 18712,
18715, 18716, 18631, 18632, 18633, 18634, 18635, 18638, 18639,
18640, 18641, 18642, 18646, 18647, 18648, 18649, 18652, 18653,
18654, 18655, 18656, 18659, 18660, 18661, 18662, 18663, 18666,
18667, 18668, 18669, 18670, 18674, 18675, 18676, 18677, 18680,
18681, 18682, 18683, 18684, 18687, 18688, 18689, 18690, 18691,
18694, 18695, 18696, 18697, 18698, 18701, 18702, 18703, 18704,
18705, 18708, 18709, 18710, 18711, 18712, 18715, 18716, 18631,
18632, 18633, 18634, 18635, 18638, 18639, 18640, 18641, 18642,
18645, 18646, 18647, 18648, 18649, 18652, 18653, 18654, 18655,
18656, 18659, 18660, 18661, 18662, 18663, 18675, 18676, 18677,
18680, 18681, 18682, 18683, 18684, 18688, 18689, 18690, 18691,
18694, 18695, 18696, 18697, 18698, 18701, 18702, 18703, 18704,
18705, 18708, 18709, 18710, 18711, 18712, 18715, 18716), class = "Date"),
    Key = c("AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "AAPL",
    "AAPL", "AAPL", "AAPL", "AAPL", "AAPL", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ", "HPQ",
    "HPQ", "HPQ", "HPQ", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK", "0992.HK",
    "0992.HK", "0992.HK", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL",
    "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "DELL", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER", "ACER",
    "ACER", "ACER", "ACER", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW", "2357.TW",
    "2357.TW", "2357.TW", "2357.TW"), Open = c(133.520004, 128.889999,
    127.720001, 128.360001, 132.429993, 129.190002, 128.5, 128.759995,
    130.800003, 128.779999, 127.779999, 128.660004, 133.800003,
    136.279999, 143.070007, 143.600006, 143.429993, 139.520004,
    135.830002, 133.75, 135.729996, 135.759995, 136.300003, 137.350006,
    136.029999, 136.619995, 136.479996, 135.899994, 134.350006,
    135.490005, 131.25, 129.199997, 130.240005, 128.009995, 123.760002,
    124.940002, 124.68, 122.589996, 123.75, 128.410004, 124.809998,
    121.75, 120.980003, 120.93, 119.029999, 121.690002, 122.540001,
    120.400002, 121.410004, 125.699997, 124.050003, 122.879997,
    119.900002, 120.330002, 123.330002, 122.82, 119.540001, 120.349998,
    121.650002, 120.110001, 24.700001, 24.08, 24.620001, 25.27,
    25.690001, 25.5, 25.83, 25.99, 25.58, 25.459999, 25.26, 25.219999,
    25.41, 25.110001, 25.219999, 25.190001, 24.18, 24.98, 24.77,
    24.48, 24.780001, 24.860001, 25.209999, 26, 26.370001, 27.33,
    27.209999, 27.299999, 27.379999, 27.530001, 27, 26.09, 26.700001,
    26.99, 27.030001, 27.299999, 27.9, 29.42, 29.370001, 29.42,
    29.940001, 29.459999, 28.299999, 29.610001, 30.040001, 30.059999,
    30.370001, 30.26, 30.26, 30.809999, 30.290001, 30.559999,
    30.040001, 30.110001, 30.34, 29.73, 29.110001, 30.02, 31.59,
    31, 7.18, 7.48, 7.5, 7.46, 7.56, 7.78, 7.51, 9.25, 8.75,
    8.65, 8.63, 9.25, 9.18, 9.14, 9.13, 9.35, 9.6, 9.9, 9.62,
    9.32, 9.04, 9.86, 9.74, 9.83, 9.6, 9.86, 9.7, 10.06, 10,
    10.22, 10.28, 10.7, 10.6, 10.72, 9.99, 10.3, 10.3, 9.94,
    10.04, 10.5, 10.3, 10.2, 9.77, 10.08, 9.79, 9.85, 9.86, 10.32,
    9.8, 9.15, 9.08, 9, 9.17, 9.27, 9.57, 9.61, 9.72, 9.74, 9.99,
    10.04, 37.450584, 36.441967, 37.161682, 38.01318, 38.824127,
    38.656868, 38.449062, 37.886467, 36.137859, 37.07552, 37.795235,
    38.489609, 39.310696, 38.423721, 38.692348, 38.52002, 37.81551,
    37.42524, 37.222504, 37.328941, 39.016727, 38.90015, 39.619869,
    40.293968, 40.54739, 40.1926, 40.461227, 40.466293, 40.314243,
    40.937656, 39.959454, 39.898632, 40.881905, 40.886974, 40.54739,
    40.947796, 41.054234, 40.892044, 41.09478, 42.067917, 42.108463,
    42.280792, 42.508869, 43.547897, 43.63406, 44.059807, 44.602131,
    44.865688, 44.977192, 45.362392, 44.997467, 45.848961, 44.460213,
    44.313229, 44.135834, 43.755703, 43.162697, 43.928028, 44.941711,
    44.439938, 2.64, 2.54, 2.57, 2.5, 2.51, 2.48, 2.49, 2.63,
    2.85, 3.01, 3.76, 4.23, 3.93, 3.59, 4.78, 4.43, 3.78, 3.64,
    3.85, 3.71, 3.64, 3.7, 3.96, 4.06, 4.05, 4.01, 4, 4.15, 4,
    3.88, 3.77, 3.74, 3.53, 3.55, 3.21, 3.19, 3.3, 3.21, 3.23,
    3.5, 3.29, 3.24, 2.83, 2.87, 2.87, 3.12, 3.2, 3.17, 5.3,
    3.84, 3.52, 3.55, 3.38, 4.14, 3.79, 3.63, 3.12, 3.16, 3.07,
    2.98, 250.5, 251, 254, 255, 265, 282.5, 285, 285, 289.5,
    289, 286, 283, 284, 278, 282, 284.5, 291, 287, 288, 289.5,
    285, 285, 288.5, 288.5, 289.5, 294, 289.5, 289.5, 291.5,
    290, 291, 308.5, 300.5, 310, 311, 315, 309, 312, 318.5, 316,
    315, 319, 322.5, 329.5, 331, 358, 368, 382, 373, 366.5, 367,
    366.5, 366.5, 377), High = c(133.610001, 131.740005, 131.050003,
    131.630005, 132.630005, 130.169998, 129.690002, 131.449997,
    131, 130.220001, 128.710007, 132.490005, 139.669998, 139.850006,
    145.089996, 144.300003, 144.300003, 141.990005, 136.740005,
    135.380005, 136.309998, 135.770004, 137.399994, 137.419998,
    136.960007, 137.880005, 136.990005, 136.389999, 135.529999,
    136.009995, 132.220001, 130, 130.710007, 129.720001, 126.709999,
    125.559998, 126.459999, 124.849998, 127.93, 128.720001, 125.709999,
    123.599998, 121.940002, 121, 122.059998, 122.169998, 123.209999,
    121.169998, 124, 127.220001, 125.860001, 123.18, 121.43,
    123.870003, 124.239998, 122.900002, 121.660004, 121.480003,
    122.580002, 120.400002, 24.940001, 24.719999, 25.379999,
    25.799999, 25.940001, 25.93, 26.15, 26.040001, 25.93, 25.57,
    25.379999, 25.32, 25.440001, 25.35, 25.27, 25.360001, 25.24,
    25.35, 24.99, 24.58, 25, 25.34, 25.959999, 26.58, 27.360001,
    27.549999, 27.530001, 27.48, 27.5, 27.68, 27.08, 26.450001,
    27.139999, 27.35, 27.440001, 28.26, 30, 30.25, 30.440001,
    30.290001, 30.280001, 29.85, 29.780001, 30.68, 30.559999,
    30.57, 30.48, 30.83, 30.809999, 30.98, 30.790001, 31.110001,
    30.32, 30.719999, 30.57, 30.26, 30.02, 31.690001, 31.940001,
    31.66, 7.68, 7.68, 7.67, 7.73, 7.95, 8.04, 8.12, 9.42, 9.09,
    8.94, 9.4, 9.49, 9.27, 9.56, 9.52, 9.87, 10.08, 10.04, 9.94,
    9.5, 9.79, 10.16, 10.5, 10, 10.04, 10.08, 10.18, 10.42, 10,
    10.4, 10.76, 11.12, 10.72, 10.72, 10.48, 10.34, 10.46, 10.1,
    10.4, 10.8, 10.54, 10.4, 10.06, 10.1, 10, 10.12, 10.5, 10.4,
    9.94, 9.26, 9.15, 9.31, 9.32, 9.56, 9.78, 9.83, 9.72, 10.16,
    10.16, 11.36, 37.450584, 37.496201, 38.129753, 38.697414,
    39.234669, 38.945766, 38.90522, 38.00304, 37.430309, 37.962494,
    38.028381, 39.118095, 39.391788, 38.611252, 38.71262, 38.768372,
    38.388241, 38.109478, 37.800304, 37.871262, 39.396858, 39.700962,
    40.212875, 40.587936, 40.907249, 40.511909, 40.54739, 40.608212,
    40.577801, 41.008617, 40.532185, 40.816017, 41.216423, 41.550938,
    40.993412, 41.520527, 41.358337, 42.164219, 42.290928, 42.356815,
    42.660923, 42.777496, 43.431324, 43.938164, 44.53117, 44.657883,
    45.347187, 45.027878, 45.27116, 45.509377, 46.381145, 45.848961,
    44.987328, 44.744045, 44.576786, 44.298023, 44.044601, 45.108971,
    45.428284, 45.134312, 2.65, 2.65, 2.64, 2.55, 2.52, 2.5,
    2.74, 3.5, 2.96, 4.44, 4.62, 4.3, 3.98, 3.81, 4.78, 4.43,
    3.97, 3.87, 3.91, 3.72, 3.74, 4.3, 4.08, 4.1, 4.37, 4.08,
    4.15, 4.59, 4.05, 3.97, 3.77, 3.79, 3.66, 3.57, 3.39, 3.41,
    3.32, 3.27, 3.29, 3.5, 3.45, 3.4, 2.9, 3.05, 3.09, 3.22,
    3.35, 3.45, 5.39, 3.93, 3.78, 3.59, 3.62, 4.4, 3.82, 3.63,
    3.21, 3.18, 3.26, 3.01, 252.5, 253, 255, 265.5, 280, 287.5,
    287, 295, 291.5, 291.5, 286, 285, 285, 282, 288.5, 291.5,
    292.5, 294, 291.5, 291, 285, 287.5, 291, 290, 290, 295, 290.5,
    292.5, 295, 291.5, 309.5, 311, 307.5, 315, 317.5, 316.5,
    311.5, 319.5, 318.5, 316.5, 319.5, 326.5, 328, 338, 332.5,
    358, 386, 382, 373, 377, 368.5, 368, 375, 379.5), Low = c(126.760002,
    128.429993, 126.379997, 127.860001, 130.229996, 128.5, 126.860001,
    128.490005, 128.759995, 127, 126.940002, 128.550003, 133.589996,
    135.020004, 136.539993, 141.369995, 140.410004, 136.699997,
    130.210007, 130.929993, 134.610001, 133.610001, 134.589996,
    135.860001, 134.919998, 135.850006, 134.399994, 133.770004,
    133.690002, 132.789993, 129.470001, 127.410004, 128.800003,
    125.599998, 118.389999, 122.230003, 120.540001, 121.199997,
    122.790001, 125.010002, 121.839996, 118.620003, 117.57, 116.209999,
    118.790001, 119.449997, 121.260002, 119.160004, 120.419998,
    124.720001, 122.339996, 120.32, 119.68, 120.260002, 122.139999,
    120.07, 119, 118.919998, 120.730003, 118.860001, 23.85, 24.08,
    24.620001, 25.059999, 25.389999, 25.34, 25.75, 25.700001,
    25.559999, 24.99, 24.99, 25.049999, 24.98, 24.969999, 24.41,
    24.389999, 24.16, 24.85, 24.07, 24.1, 24.67, 24.77, 25.110001,
    25.950001, 26.309999, 27.09, 26.940001, 26.93, 27.23, 27,
    26.23, 25.959999, 26.65, 26.799999, 26.49, 27.209999, 27.219999,
    28.83, 29.16, 29.33, 29.52, 27.85, 28.120001, 29.559999,
    29.85, 30.01, 29.969999, 30.120001, 30.08, 30.389999, 30.26,
    30.219999, 29.68, 29.860001, 29.440001, 29.360001, 28.969999,
    30.02, 31.01, 30.959999, 7.18, 7.33, 7.42, 7.3, 7.52, 7.28,
    7.51, 8.83, 8.41, 8.6, 8.63, 9.13, 8.91, 9, 9.11, 9.33, 9.6,
    9.35, 9.37, 8.94, 9.04, 9.7, 9.62, 9.41, 9.59, 9.57, 9.67,
    9.99, 10, 10.14, 10.14, 10.68, 10.28, 10.04, 9.9, 9.76, 10.04,
    9.72, 9.88, 10.24, 10.22, 9.94, 9.3, 9.67, 9.44, 9.7, 9.86,
    9.69, 9.08, 8.8, 8.65, 9, 9.02, 9.17, 9.47, 9.57, 9.3, 9.65,
    9.87, 10.02, 36.335529, 36.239231, 36.953876, 37.774963,
    38.393311, 38.332489, 38.307144, 35.570198, 36.117588, 36.933605,
    37.658386, 37.97263, 38.469337, 38.028381, 37.257984, 37.987835,
    37.10593, 36.938671, 36.680183, 36.847439, 38.732895, 38.90015,
    39.559048, 40.136848, 40.293968, 39.939178, 39.746578, 39.45768,
    39.96452, 39.771919, 39.84288, 39.619869, 40.567661, 40.314243,
    39.042068, 40.755196, 40.025341, 40.54739, 41.09478, 41.63203,
    41.83477, 41.277245, 42.255447, 43.051189, 43.588444, 43.968575,
    44.602131, 44.429802, 44.713634, 44.73391, 44.668018, 44.627472,
    44.37405, 44.059807, 42.985302, 43.507347, 43.030918, 43.694881,
    44.485554, 44.404461, 2.47, 2.49, 2.45, 2.47, 2.44, 2.4,
    2.44, 2.55, 2.7, 2.73, 3.33, 3.61, 3.61, 3.39, 4.05, 3.91,
    3.6, 3.57, 3.61, 3.45, 3.46, 3.69, 3.86, 3.89, 3.91, 3.7,
    3.82, 3.9, 3.75, 3.67, 3.58, 3.46, 3.48, 3.29, 2.9, 3.14,
    3.1, 3, 3.11, 3.16, 3.16, 2.75, 2.5, 2.8, 2.81, 2.97, 3.16,
    3.17, 4, 3.47, 3.48, 3.32, 3.35, 3.71, 3.46, 3.1, 3.02, 2.88,
    2.92, 2.83, 250, 250.5, 250, 252.5, 264.5, 279, 280, 283,
    284.5, 283.5, 279, 282, 275, 277.5, 280, 282, 284, 287, 285.5,
    284, 280.5, 283.5, 285, 287, 287, 289, 287, 288.5, 290, 288.5,
    291, 301, 299, 307, 306, 309, 307, 312, 309, 312, 314.5,
    316.5, 319, 329, 322, 355, 360, 368, 365, 365, 362, 363.5,
    364, 374), Close = c(129.410004, 131.009995, 126.599998,
    130.919998, 132.050003, 128.979996, 128.800003, 130.889999,
    128.910004, 127.139999, 127.830002, 132.029999, 136.869995,
    139.070007, 142.919998, 143.160004, 142.059998, 137.089996,
    131.960007, 134.139999, 134.990005, 133.940002, 137.389999,
    136.759995, 136.910004, 136.009995, 135.389999, 135.130005,
    135.369995, 133.190002, 130.839996, 129.710007, 129.869995,
    126, 125.860001, 125.349998, 120.989998, 121.260002, 127.790001,
    125.120003, 122.059998, 120.129997, 121.419998, 116.360001,
    121.089996, 119.980003, 121.959999, 121.029999, 123.989998,
    125.57, 124.760002, 120.529999, 119.989998, 123.389999, 122.540001,
    120.089996, 120.589996, 121.209999, 121.389999, 119.900002,
    24.110001, 24.459999, 24.959999, 25.75, 25.530001, 25.780001,
    25.91, 25.709999, 25.620001, 25.17, 25.139999, 25.200001,
    25.360001, 25.27, 25.02, 24.620001, 24.85, 24.870001, 24.34,
    24.48, 24.889999, 25.23, 25.950001, 26.15, 27.299999, 27.09,
    27.15, 27.379999, 27.49, 27.16, 26.280001, 26.41, 27.1, 27.120001,
    27.379999, 27.969999, 28.190001, 28.969999, 29.58, 30.040001,
    29.82, 28.07, 29.75, 30.16, 30.1, 30.26, 30.34, 30.280001,
    30.790001, 30.43, 30.74, 30.309999, 30.08, 30.469999, 29.58,
    29.370001, 29.889999, 31.66, 31.07, 31.559999, 7.62, 7.63,
    7.48, 7.56, 7.91, 7.39, 8.05, 8.83, 8.82, 8.8, 9.18, 9.31,
    9.05, 9.22, 9.27, 9.75, 9.9, 9.79, 9.44, 9.13, 9.68, 9.71,
    10.16, 9.84, 9.86, 9.75, 10.18, 10.06, 10, 10.3, 10.66, 10.68,
    10.72, 10.04, 10.18, 10.04, 10.26, 9.81, 10.28, 10.3, 10.42,
    9.96, 9.98, 9.77, 9.64, 9.97, 10.34, 9.81, 9.12, 9.08, 8.91,
    9.28, 9.27, 9.45, 9.7, 9.72, 9.67, 10.04, 10.04, 11.28, 36.741005,
    37.232639, 37.541813, 38.692348, 39.138367, 38.332489, 38.90015,
    36.102383, 37.126205, 37.638115, 37.942219, 39.052204, 38.976177,
    38.489609, 38.35783, 38.540295, 37.435379, 37.46579, 36.943741,
    37.480991, 39.113026, 39.406994, 40.19767, 40.34972, 40.516979,
    40.339584, 40.334515, 40.293968, 40.572731, 40.263557, 40.172325,
    40.39027, 40.937656, 40.937656, 40.831223, 41.403954, 40.385201,
    41.08971, 42.113533, 41.920933, 42.372021, 41.966549, 43.258995,
    43.137356, 43.836796, 44.439938, 44.91637, 45.017738, 45.261024,
    45.149517, 46.264572, 44.657883, 44.414597, 44.272682, 43.461735,
    43.765839, 43.583378, 45.103905, 44.708565, 44.901165, 2.54,
    2.56, 2.48, 2.53, 2.49, 2.47, 2.58, 2.88, 2.86, 3.85, 4.33,
    3.86, 3.72, 3.67, 4.39, 3.95, 3.68, 3.79, 3.65, 3.64, 3.73,
    3.89, 4.06, 3.99, 3.99, 3.87, 4.09, 3.99, 3.84, 3.81, 3.74,
    3.5, 3.58, 3.32, 3.16, 3.35, 3.17, 3.15, 3.25, 3.19, 3.38,
    2.85, 2.87, 2.83, 3.04, 3.13, 3.25, 3.41, 4.2, 3.6, 3.53,
    3.44, 3.46, 3.9, 3.48, 3.19, 3.14, 2.98, 3.02, 2.98, 251,
    253, 254, 261.5, 279.5, 283.5, 281, 288.5, 288, 287, 283,
    285, 276, 282, 284.5, 290, 284, 293, 288.5, 286.5, 283.5,
    285.5, 288.5, 287, 288.5, 289.5, 289, 290, 290, 290.5, 300.5,
    305.5, 304, 307.5, 316.5, 313.5, 311, 315.5, 313, 312.5,
    317.5, 323.5, 326, 331, 325.5, 358, 377.5, 368.5, 365.5,
    366, 365, 365, 374, 377), Volume = c(143301900, 97664900,
    155088000, 109578200, 105158200, 100384500, 91951100, 88636800,
    90221800, 111598500, 90757300, 104319500, 120150900, 114459400,
    157611700, 98390600, 140843800, 142621100, 177523800, 106239800,
    83305400, 89880900, 84183100, 75693800, 71297200, 76774200,
    73046600, 64280000, 60145100, 80576300, 97918500, 96856700,
    87668800, 103916400, 158273000, 111039900, 148199500, 164560400,
    116307900, 102260900, 112966300, 178155000, 153766600, 154376600,
    129525800, 111943300, 103026500, 88105100, 92403800, 115227900,
    111932600, 121229700, 185549500, 111912300, 95467100, 88530500,
    98844700, 94071200, 80819200, 85671900, 8041600, 7856500,
    8471800, 9288400, 7514100, 8907000, 7280700, 6596600, 8290500,
    8364600, 6794200, 6270500, 7160000, 6684500, 9953100, 11548300,
    12948600, 9292900, 14666900, 9353000, 5952800, 6300500, 6963400,
    7267500, 8426300, 7065500, 6267500, 6265600, 3941200, 6380700,
    9402800, 7345300, 8979600, 9524800, 11845500, 8275900, 18366000,
    26078200, 17327800, 10928600, 10059700, 14448400, 13688900,
    13142600, 10337000, 11820400, 10122500, 9478300, 12813700,
    10605200, 12590100, 11022700, 49810500, 14955000, 10313100,
    9073900, 9561200, 13195700, 9661500, 7219500, 83611650, 54929799,
    74271331, 84604245, 86075192, 102371633, 79414541, 197884127,
    109982524, 80422292, 91118563, 96550807, 94292124, 94477124,
    81654255, 73542509, 97691196, 85212478, 102037047, 152757640,
    89270360, 79700143, 185967050, 151264162, 95283438, 93966987,
    73408512, 112247074, 0, 48745087, 91993205, 107716602, 85765697,
    94476970, 88294485, 116854253, 60498562, 131866599, 59830565,
    56868864, 40605892, 68620795, 81049108, 100672551, 98591427,
    80373221, 84194484, 179149010, 120183953, 69550997, 146016633,
    132973809, 115768221, 68422263, 98604636, 75576844, 111896231,
    90423078, 87564925, 185333431, 6927203, 4051555, 5155844,
    4542635, 5304213, 2937402, 2739511, 15098974, 8655156, 6529052,
    4898170, 6958771, 4772095, 2249417, 2686437, 2520508, 5637650,
    5227858, 3720683, 3231379, 8058324, 2721754, 2943321, 3535616,
    9876049, 8452332, 9603578, 3077091, 3497340, 6170952, 3593819,
    3027174, 3269853, 5745968, 5043975, 3969676, 5594047, 6943776,
    4621753, 2937205, 5848564, 5422791, 6930557, 6884981, 4318897,
    4408866, 7447286, 2858088, 5621472, 5880329, 6162468, 6201731,
    7791772, 6212385, 5250745, 5446269, 3417039, 5169063, 4094567,
    4601036, 126200, 183800, 166900, 123100, 196500, 174800,
    1763100, 5231200, 720300, 19880400, 4989400, 1400500, 659500,
    591300, 2667100, 974400, 492600, 430200, 359800, 472700,
    330700, 446000, 253100, 224400, 958700, 410000, 428000, 1170000,
    359200, 436500, 197600, 220000, 104100, 160500, 339200, 133000,
    127200, 123900, 148900, 183200, 191800, 450900, 211200, 178600,
    166700, 108400, 172300, 1365000, 21941400, 1773600, 652700,
    640700, 438000, 7759900, 790000, 493900, 443800, 374900,
    457800, 271000, 1531749, 1951835, 2984653, 7274739, 11062445,
    6315052, 5002981, 6375090, 4895819, 4334120, 3271007, 2671114,
    4781170, 3610802, 4410983, 5231348, 3685064, 6288355, 3658600,
    3775896, 2111191, 3387713, 3497993, 2036209, 1343523, 5191787,
    3506596, 2980292, 4613852, 3589534, 9921364, 5578897, 6592137,
    7414500, 5360155, 4942528, 3721495, 3875339, 3400830, 3114473,
    4899739, 6153285, 3263518, 4816497, 4860266, 15912474, 24595161,
    10145606, 4882067, 5020497, 3602197, 3851223, 4463345, 4093079
    ), Adjusted = c(128.087051, 129.670715, 125.305794, 129.581619,
    130.700089, 127.661453, 127.483322, 129.551926, 127.592194,
    125.840279, 126.523224, 130.680298, 135.470795, 137.648331,
    141.458984, 141.696518, 140.607758, 135.688568, 130.611023,
    132.768723, 133.610031, 132.57077, 135.985504, 135.564209,
    135.712906, 134.820755, 134.206177, 133.948471, 134.18634,
    132.025421, 129.695953, 128.575867, 128.734451, 124.898293,
    124.759514, 124.253975, 119.932098, 120.19973, 126.672638,
    124.025993, 120.992737, 119.079613, 120.358337, 115.342583,
    120.031212, 118.930923, 120.893608, 119.971748, 122.905869,
    124.472054, 123.669128, 119.47612, 118.940826, 122.311119,
    121.468552, 119.039955, 119.535583, 120.150177, 120.32859,
    118.851631, 22.97263, 23.30612, 23.78253, 24.535265, 24.325645,
    24.563852, 24.687717, 24.497149, 24.4114, 23.982626, 23.954041,
    24.011209, 24.163662, 24.077909, 23.839703, 23.458572, 23.677723,
    23.696781, 23.19178, 23.325174, 23.715836, 24.039793, 24.725832,
    24.916397, 26.012144, 25.812054, 25.869221, 26.088369, 26.193184,
    25.878748, 25.040262, 25.164127, 25.821581, 25.840637, 26.088369,
    26.650537, 26.860161, 27.603363, 28.184587, 28.622889, 28.413265,
    26.745821, 28.346567, 28.737228, 28.865732, 29.019173, 29.095894,
    29.038353, 29.527437, 29.182199, 29.479488, 29.06712, 28.84655,
    29.22056, 28.367054, 28.165665, 28.664345, 30.361763, 29.795958,
    30.265865, 7.023958, 7.033176, 6.894909, 6.968651, 7.291274,
    6.811949, 7.420323, 8.13931, 8.130093, 8.111658, 8.461934,
    8.581765, 8.342102, 8.498805, 8.544894, 8.987349, 9.125615,
    9.024219, 8.701595, 8.415845, 8.922823, 8.950477, 9.365276,
    9.070309, 9.088743, 8.987349, 9.383713, 9.2731, 9.217793,
    9.494327, 9.826166, 9.844603, 9.881474, 9.254663, 9.383713,
    9.254663, 9.457456, 9.042655, 9.475891, 9.494327, 9.60494,
    9.180922, 9.199357, 9.005784, 8.885953, 9.19014, 9.531199,
    9.042655, 8.406627, 8.369755, 8.213053, 8.554111, 8.544894,
    8.710814, 8.941258, 8.959695, 8.913606, 9.254663, 9.254663,
    10.397669, 36.204769, 36.689232, 36.993893, 38.127636, 38.567142,
    37.773026, 38.332405, 35.57547, 36.584351, 37.088787, 37.388454,
    38.482239, 38.407318, 37.927856, 37.797997, 37.977798, 36.889011,
    36.91898, 36.404549, 36.933956, 38.542171, 38.831852, 39.610985,
    39.760818, 39.925636, 39.750828, 39.745831, 39.705875, 39.980572,
    39.675911, 39.58601, 39.800777, 40.340172, 40.340172, 40.235294,
    40.799664, 39.79578, 40.490005, 41.498886, 41.309097, 41.753601,
    41.354046, 42.627632, 42.507767, 43.196999, 43.791336, 44.260815,
    44.360703, 44.600441, 44.490559, 45.58934, 44.006104, 43.766365,
    43.626522, 42.827412, 43.127075, 42.947277, 44.445614, 44.056042,
    44.245834, 2.54, 2.56, 2.48, 2.53, 2.49, 2.47, 2.58, 2.88,
    2.86, 3.85, 4.33, 3.86, 3.72, 3.67, 4.39, 3.95, 3.68, 3.79,
    3.65, 3.64, 3.73, 3.89, 4.06, 3.99, 3.99, 3.87, 4.09, 3.99,
    3.84, 3.81, 3.74, 3.5, 3.58, 3.32, 3.16, 3.35, 3.17, 3.15,
    3.25, 3.19, 3.38, 2.85, 2.87, 2.83, 3.04, 3.13, 3.25, 3.41,
    4.2, 3.6, 3.53, 3.44, 3.46, 3.9, 3.48, 3.19, 3.14, 2.98,
    3.02, 2.98, 201.808319, 203.416351, 204.220367, 210.250504,
    224.722809, 227.938889, 225.928833, 231.958969, 231.556946,
    230.752945, 227.536865, 229.144897, 221.908752, 226.732849,
    228.742889, 233.164993, 228.340881, 235.577042, 231.958969,
    230.350922, 227.938889, 229.546906, 231.958969, 230.752945,
    231.958969, 232.76297, 232.360962, 233.164993, 233.164993,
    233.567001, 241.607147, 245.627258, 244.421219, 247.235306,
    254.471436, 252.059402, 250.049362, 253.667419, 251.657379,
    251.255371, 255.275467, 260.099548, 262.109589, 266.1297,
    261.707581, 287.838135, 303.51651, 296.280334, 293.868286,
    294.270294, 293.466278, 293.466278, 300.702423, 303.114471
    )), row.names = c(NA, -354L), class = c("tbl_df", "tbl",
"data.frame"))

The pipe that I am trying to make into a function:
timeseries_wide <- timeseries %>%
  as_tibble%>%
  pivot_wider(names_from = all_of(names_col), values_from = all_of(values_col),
              names_glue = "{names_col}.{.value}")

A typical call:
values_col = c("Open", "High", "Low", "Close", "Volume", "Adjusted")
names_col = "Key"

timeseries_wide <- timeseries %>%
  as_tibble%>%
  pivot_wider(names_from = all_of(names_col), values_from = all_of(values_col),
              names_glue = "{names_col}.{.value}")

The current function I have return an error about "names_col" not being unique (or absent).
pivot_prices_wider <- function(data, nameS, valueS){

    data <- data %>%
      tibble::as_tibble(.)%>%
      tidyr::pivot_wider(names_from = all_of(nameS),
                         values_from = all_of(valueS),
                         names_glue = "{{nameS}}.{.value}"
                         )

}

In some instances, names_col will contain several columns, values_col can contain 1 or more columns. I will expand this function to handle uniting two "name" columns, and work on the sister function for long pivots.
I want the final columns names as "AAPL.Open" which is not the default, thus need to use the glue_name argument.
However, I get an error when calling this pipe inside the function:
Error in `check_pivot_spec()`:
! The `.name` column of `spec` must be unique.
Backtrace:
 1. prices_ts %>% as_tibble %>% ...
 5. tidyr:::pivot_wider.data.frame(...)
 6. tidyr::pivot_wider_spec(...)
 7. tidyr::check_pivot_spec(spec)

I suspect it has something to do with the evaluation. I tried:
  vars_nameS <- rlang::enquo(nameS)

...

names_glue = "{!!vars_nameS}.{.value}"

I am following Programming with dplyr and the tidyeval cheatsheet but getting a bit confused about whether I should use the embrace operator {{ }} or rlang.
P.S. Any recommended resources on learning how to debug a pipe/function containing pipes?

It seems that using glue directly works for this particular example:
pivot_prices_wider2 <- function(data, nameS, valueS){

    data <- data %>%
      tibble::as_tibble(.data)%>%
      tidyr::pivot_wider(names_from = all_of(nameS),
                         values_from = all_of(valueS),
                         names_glue = glue::glue("{[nameS]}.{.value}", .open="[", .close = "]")
                         )

}

Answer: I think you're just needing
library(tidyverse)

pivot_prices_wider <- function(data, nameS, valueS){

  data %>%
    tibble::as_tibble() %>%
    tidyr::pivot_wider(names_from = all_of(nameS),
                       values_from = all_of(valueS),
                       names_glue = "{.name}") %>%
    rename_with(~sapply(strsplit(.x, "_"),
                        function(x) paste0(x[2:1], collapse = ".")))
}

Allowing
values_col = c("Open", "High", "Low", "Close", "Volume", "Adjusted")
names_col = "Key"

timeseries %>%
  pivot_prices_wider(names_col, values_col)
#> # A tibble: 61 x 37
#>    NA.Date    AAPL.Open HPQ.Open 0992.~1 DELL.~2 ACER.~3 2357.~4 AAPL.~5 HPQ.H~6
#>    <date>         <dbl>    <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
#>  1 2021-01-04      134.     24.7    7.18    37.5    2.64    250.    134.    24.9
#>  2 2021-01-05      129.     24.1    7.48    36.4    2.54    251     132.    24.7
#>  3 2021-01-06      128.     24.6    7.5     37.2    2.57    254     131.    25.4
#>  4 2021-01-07      128.     25.3    7.46    38.0    2.5     255     132.    25.8
#>  5 2021-01-08      132.     25.7    7.56    38.8    2.51    265     133.    25.9
#>  6 2021-01-11      129.     25.5    7.78    38.7    2.48    282.    130.    25.9
#>  7 2021-01-12      128.     25.8    7.51    38.4    2.49    285     130.    26.2
#>  8 2021-01-13      129.     26.0    9.25    37.9    2.63    285     131.    26.0
#>  9 2021-01-14      131.     25.6    8.75    36.1    2.85    290.    131     25.9
#> 10 2021-01-15      129.     25.5    8.65    37.1    3.01    289     130.    25.6
#> # ... with 51 more rows, 28 more variables: `0992.HK.High` <dbl>,
#> #   DELL.High <dbl>, ACER.High <dbl>, `2357.TW.High` <dbl>, AAPL.Low <dbl>,
#> #   HPQ.Low <dbl>, `0992.HK.Low` <dbl>, DELL.Low <dbl>, ACER.Low <dbl>,
#> #   `2357.TW.Low` <dbl>, AAPL.Close <dbl>, HPQ.Close <dbl>,
#> #   `0992.HK.Close` <dbl>, DELL.Close <dbl>, ACER.Close <dbl>,
#> #   `2357.TW.Close` <dbl>, AAPL.Volume <dbl>, HPQ.Volume <dbl>,
#> #   `0992.HK.Volume` <dbl>, DELL.Volume <dbl>, ACER.Volume <dbl>, ...

Created on 2022-09-25 with reprex v2.0.2
Comment: `names_glue` seems only to look for column names, ignoring external variables, since it works off `glue::glue_data` internally, which is passed the current data frame as the search environment.
Comment: I could get where you are, and tidyverse was loaded.
The issue is with the column names. You are showing the default "Value_Name".

I am trying to get to "Name.Value" using the names_glue argument of pivot.
Comment: @PierreO this is a simple fix using `rename_with` - see my update
Comment: That a solution for sure :) thanks
Anyway you could explain why the embracing operator did not work there?


Are these double note fingerings to avoid fingers 1 and 5 on black keys practical?

Question: I know there is a standard double note fingering for consecutive thirds like this...

2345 345
1123 123

But I have been experimenting with other double note fingerings for larger intervals and for repeated double notes.
Repeated thirds...

Consecutive sixths...

Considering the right hand, basically fingers 5 and 4 are treated as one group to move step-wise and fingers 2 and 1 being the second pair moving step-wise. 1 avoids black keys and 5 avoids black keys when the key below is white.
This seems like a good fingering principle. I've been practicing it for a while and my hands are starting to reach keys more reflexively.
I've shown only right hand examples, but I am doing the mirror-symmetrical fingerings in the left hand too.
Are there any hidden pitfalls with these fingerings?
Are they typical?
Answer: I think you're going to a lot of trouble to avoid using fingers 1 and 5 on black keys. Is that a rule? I studied piano for 14 years and learned that it's generally easier to play scales when 1 and 5 are kept for the white keys, but I don't think that necessarily applies to playing thirds and sixths. The pitfall is that you're stuck playing a lot of your chords staccato. It's really hard to move smoothly from 2 and 4 to 5 and 3 without taking your whole hand off the keyboard, so you won't have much room for expression. It would be better to have one or both fingers on the keyboard while moving between each chord, if at all possible.
With your thirds it seems most logical to leave your hand in place for two beats and the move it down to the next position. Especially since the pattern always repeats a third in the middle of each group of four eighth notes. It's much easier to play that repeated third with fingers 2 and 4, play the next up beat with 1 and 3, then move the whole hand to play the next two beats. Playing a third using 1 and 5 would be my last choice in almost every case, even with my small hand, although it works on two white notes moving to two black notes pretty well.
Your fingering for the sixths works if they are meant to be played staccato. If it were meant to be played legato I would use 5454 all the way down for the top notes, with 1 and 3 on the B-G interval to cross over in the D Major section.
Practically speaking, I think the best fingering is the one that works for your hand, taking the expression of the music into account. Do what's easiest. If you're practicing these fingerings and getting them, and they make sense to you, then there's no reason to change. Just don't spend too much time trying to learn a trick that doesn't help you improve your playing. The audience doesn't care what fingering you use.


Isn't this proof of what this professor calls the "Finite Models Theorem" flawed?

Question: Starting at 7:52 of this video, the professor presents a proof of the following theorem: for any infinite set of well-formed formulas $\Sigma$ such that $\Sigma \vDash \alpha$, where $\alpha$ is a w.f.f., there exists a finite subset $\Sigma_0 \subset \Sigma$ such that $\Sigma_0 \vDash \alpha$.
This is how I understood his proof (with comments of mine in bold):
Since $\alpha$ is a w.f.f., it involves only finitely many propositional variables, so there are only finitely many truth assignments in its truth table.
Isn't this already an issue? There are only finitely many truth assignments whose domains are the set of just those propositional variables that appear in $\alpha$. But in the larger context of an arbitrary infinite $\Sigma$, whose formulas could collectively involve infinitely many propositional variables, there could be infinitely many truth assignments for each combination fo truth values of those variables that appear in $\alpha$.
Let $V_i$ be a truth assignment for which $V_i(\alpha) = \mathrm{F}$. Therefore it cannot be the case that $\Sigma$ is satisfied under this assignment, since $\Sigma \vDash \alpha$, which implies there must be some $\alpha_{ij} \in \Sigma$ such that $V_i(\alpha_i) = \mathrm{F}$. For each $V_i$, pick one of these $\alpha_{ij}$ and rename it as $\alpha_i$. We claim that $\Sigma_0 = \{ \alpha_i: for all $i$ \}$ is a finite set such that $\Sigma_0 \vDash \alpha$. To see why, note that $\Sigma_0 \vDash \alpha$ if an only if $\Sigma_0 \cup \{ \neg \alpha \}$ is not satisfiable.
Assume by way of contradiction that $\Sigma_0 \cup \{ \neg \alpha \}$ is satisfiable. Then there exists a truth assignment $V$ such that $V(\neg \alpha) = \mathrm{F} \implies V(\alpha) = \mathrm{F}$. At this point, he asserts that any such $V$ is one of those $V_i$ referenced earlier (those $V_i$ for which $V_i(\alpha) = \mathrm{F}$
--- "we are in one of those rows of the truth table of $\alpha$ where $\alpha$ is false"). Since we constructed $\Sigma_0$ in such a way that for every $\alpha_i \in Sigma_0$ at least one $V_i$ is such that $V_i(\alpha_i) = \mathrm{F}$, so $\Sigma_0$ isn't satisfied by these $V_i$, which contradicts our assertion that $\Sigma_0 \cup \{ \alpha \}$ is satisfiable, proving the theorem.
What stands out as an issue to me: In the case that $\Sigma$ involves infinitely many different propositional variables, there would be infinitely many truth assignments. In particular, there would be infinitely many truth assignments for any combination of truth values of those variables that appear in $\alpha$. By looking at just one of them and then picking one $\alpha_i$ for $\Sigma_0$ in the way described, we can't be sure that the other truth assignments that assign the same truth values to the variables in $\alpha$ would assign $\mathrm{F}$ to $\alpha_i$, breaking the proof. If $\Sigma$, despite being infinite, involved only finitely many propositional variables, then it would be possible to look at every single truth assignment $V_i$ for which $V_i(\alpha) = \mathrm{F}$ --- since there would be only finitely many, but possibly more than just $2^n$, where $n$ is the number of propositional variables in $\alpha$ --- and include in $\Sigma_0$ an $\alpha_i \in \Sigma$ for which $V_i(\alpha_i) = \mathrm{F}$ for each of these $V_i$. This would ensure that we are in fact "in one of those rows of the truth table of $\alpha$ where $\alpha$ is false".
So it looks to me like what was really proved is a version of the theorem where $\Sigma$ involves finitely many different propositional variables. Is this really the case?
Answer: Here is a slightly easier way of thinking about this, in which we rely on the fact that propositional logic is deductively sound and complete.
Suppose $\Sigma$ is an infinite set of well-formed formulas of propositional logic such that $\Sigma \models \alpha$ for some propositional formula $\alpha$. By the completeness theorem for propositional logic, $\Sigma \vdash \alpha$. This is witnessed by a formal deduction $D$ in whatever formal system you've proved the completeness theorem for (say, a Hilbert system or a natural deduction system). Crucially, $D$ will be a finite object: a sequence or tree of formulas. Let $\Sigma_0$ be the set of all $\sigma \in \Sigma$ which appear as axioms in $D$. $\Sigma_0$ is a finite subset of $\Sigma$, and clearly $\Sigma_0 \vdash \alpha$. Finally, by the soundness theorem for propositional logic, $\Sigma_0 \models \alpha$.
Answer: I think you are correct, and the proof works only when $\Sigma$ involves finitely many variables (but then it's not very interesting, because there are only finitely many non-equivalent formulas in $\Sigma$). To see this, consider this version: let allow only assignments which assign T to finitely many variables. The compactness theorem fails in this case: for $\Sigma = \{x_0 \vee x_1, x_0 \vee x_2, \ldots\}$ and $\alpha = x_0$ we have that any allowed assignment that satisfies $\Sigma$ also satisfies $\alpha$ (because any assignment assigns F to some $x_n$, and as it has to satisfy $x_0 \vee x_n$, it has to assign T to $x_0$). But for any finite subset of $\Sigma$ there is an allowed assignment that satisfies this subset but not $\alpha$. However, I don't see any part in the proof that are affected by what is allowed set of assignments.
The strange part is that author talks about $V_i$ as an assignment for only variables of $\alpha$, but to apply it to formula from $\Sigma$, it has to be an assignment for all variables. And then it's possible to find assignment $V'$ s.t. $V'(\alpha) = F$, but $V'$ differs from all $V_i$ (on variables not in $\alpha$).
To prove this result, we need to somehow significantly use what assignments are allowed. See, for example, https://math.stackexchange.com/a/3393894/659499. In this prove, it's used that we can make set of all assignments into a compact topological space, s.t. for any formula, assignments that make it true, form a clopen set. In my example above, the set of allowed assignments isn't compact (under usual topology on assignments; and if we take different topology, s.t. it will become compact, then set of assignment satisfying formula will sometime fail to be clopen).


Como posso somar os valores idênticos da coluna de um data frame?

Question: A coluna possui valores como: 1, 2, 3, NA.
Preciso agrupar os que são iguais.
Por exemplo, se tiver 4(1)s, a nova tabela vai ter um linha com o valor 4 representando a quantidade de 1s.
Comment: Olá, Bruno. Você quer considerar na soma as linhas, as colunas ou o data.frame todo? No título você pede uma ação e na descrição pede outra. O que você precisa fazer? Edite sua pergunta para que possamos ajudar.
Comment: Tente `tbl <- table(x);tbl <- data.frame(value = names(tbl), count = unclass(tbl))`.
Answer: Você pode fazer algo assim:
<code>df <- data.frame(x = c(1,1,2,2,2,3,3,3,4,4, NA))

df
    x
1   1
2   1
3   2
4   2
5   2
6   3
7   3
8   3
9   4
10  4
11 NA

library(dplyr)

df %>%
   group_by(x) %>%
   summarise(sum(x))
# A tibble: 5 x 2
      x `sum(x)`
  <dbl>    <dbl>
1     1        2
2     2        6
3     3        9
4     4        8
5    NA       NA
</code>


Buscar e Extrair uma linha ou palavras de um código fonte com Python 3

Question: Eu preciso escrever um script que consiga extrair uma determinada linha em um código fonte com o Python, consegui ler o código fonte, mas não consigo filtrar, já li a documentação e fiquei meio perdido.
Até agora cheguei nesse resultado:
import urllib.request
url = "https://www.youtube.com/watch?v=2MpUj-Aua48"
f = urllib.request.urlopen(url)
print(f.read().decode('utf-8'))
keyword = f.search(r'<meta name="keywords"(.*)">')

Queria extrair as informações dentro da linha:
<meta name="keywords" content="4k video test, 4k video demo, ultra tv video, video 4k for shop mode, ultra video tv demo play, 2160p video test, hd sourround video test, samsung tv demo, s...">

E capturar apenas as palavras chaves do código fonte.
Answer: Você pode usar a biblioteca BeautifulSoup para fazer o parsing do HTML.
Basta instalar com:
pip install beautifulsoup4

Aí no seu código você pega o HTML como você já fez:
import urllib.request

url = "https://www.youtube.com/watch?v=2MpUj-Aua48"
f = urllib.request.urlopen(url)
html = f.read().decode('utf-8')

Agora o BeautifulSoup faz o trabalho mais complexo, que é ler o HTML e buscar as tags que você você precisa:
from bs4 import BeautifulSoup

soup = BeautifulSoup(html, 'html.parser')
meta_tag = soup.head.find('meta', attrs={'name': 'keywords'})
keywords = [keyword.strip() for keyword in meta_tag['content'].split(',')]

Explicando:

Criar objeto BeautifulSoup
soup = BeautifulSoup(html, 'html.parser')

Procurar pela primeira tag <meta> dentro do  que tenha o atributo name e este contenha o valor keywords
meta_tag = soup.head.find('meta', attrs={'name': 'keywords'})

O método soup.find() retorna a primeira tag que for encontrada ou None caso nenhuma tag case com os filtros passados. No exemplo acima estou pedindo ao BeautifulSoup que me retorne um elemento cuja tag seja <meta> e que contenha o atributo name com o valor keywords. Se este elemento não existir no HTML passado, meta_tag recebera None como valor.
Quebrar a string em uma lista com as keywords (eu uso o método str.split() e str.strip() para quebrar a string e remover os espaços excedentes)
keywords = [keyword.strip() for keyword in meta_tag['content'].split(',')]

Resultado:
[
    "4k video test",
    "4k video demo",
    "ultra tv video",
    "video 4k for shop mode",
    "ultra video tv demo play",
    "2160p video test",
    "hd sourround video test",
    "samsung tv demo",
    "s...",
]

Exemplo completo:
from bs4 import BeautifulSoup
import urllib.request

url = "https://www.youtube.com/watch?v=2MpUj-Aua48"
f = urllib.request.urlopen(url)
html = f.read().decode('utf-8')

soup = BeautifulSoup(html, 'html.parser')
meta_tag = soup.head.find('meta', attrs={'name': 'keywords'})
keywords = [keyword.strip() for keyword in meta_tag['content'].split(',')]

print('=== Keywords ===')
for k in keywords:
    print(f' - {k}')

Código funcionando no Repl.it
Resultado:
=== Keywords ===
 - 4k video test
 - 4k video demo
 - ultra tv video
 - video 4k for shop mode
 - ultra video tv demo play
 - 2160p video test
 - hd sourround video test
 - samsung tv demo
 - s...

Answer: Uma forma de conseguir o que vc quer:
import urllib.request
url = "https://www.youtube.com/watch?v=2MpUj-Aua48"
f = urllib.request.urlopen(url)

alvo = None
lines = f.readlines()
for line in lines:
   if '<meta name="keywords"' in str(line):
       alvo = line
       break

print('Alvo: ',alvo, sep='\n')

Saída:
b'      <meta name="keywords" content="4k video test, 4k video demo, ultra tv video, video4k for shop mode, ultra video tv demo play, 2160p video test, hd sourround video test, samsung tv demo, s...">\n'

Converta alvo para str e extraia o que precisar da forma q achar mais conveniente.
Usando o exemplo da sua tentativa:
import re
result = re.search(r'<meta name="keywords"(.*)">', str(l))
print(result.group(0))

Saída:
<meta name="keywords" content="4k video test, 4k video demo, ultra tv video, video 4k for shop mode, ultra video tv demo play, 2160p video test, hd sourround video test, samsung tv demo, s...">

Veja funcionando no repl.it.


Generalize the idea of $A^2 = I_2$ to find a $5 \times 5$ matrix such that $M^2 = 0$ and $C$ is a nonzero $2 \times 3$ matrix

Question:

I know how to solve part (a) and (b), but I'm having trouble understanding question (c). In part (a) the A matrix is $2 \times 2$ but in question (c) it is $3 \times 3$ to satisfy the $M$ matrix dimension.  Can anybody explain how I can approach (c)?
Answer: We must have $A \in M_{3 \times 3}(\mathbb{R}), C \in M_{2 \times 3}(\mathbb{R})$ and $D \in M_{2 \times 2}(\mathbb{R})$. You have
$$ M^2 = \begin{pmatrix} A & 0 \\ C & D \end{pmatrix} \begin{pmatrix} A & 0 \\ C & D \end{pmatrix} = \begin{pmatrix} A^2 & 0 \\ CA + DC & D^2 \end{pmatrix}. $$
I'm not sure what the author means by the hint, but if you take $A = D = 0$ and $C$ any non-zero matrix, you will have $M^2 = 0$.
Comment: The authors comment is suggestion that, as in part (a), a non-zero entry in the bottom right can be canceled by the remaining entries. In other words, they're gesturing towards the idea that a matrix with the potential to become zero after enough multiplication (nilpotent) can be non-zero when it is strictly lower diagonal; a similar idea is arising from the first example for idempotent matrices.
Comment: I tried and I came up with one example which was A (dimension) has a value of 1 in the 1st row, 2nd column entry. Matrix C(2x3 dimension) has all zero entries except the 2nd row, 3rd column entry with a value of 2. D (dimension 2x2) has a value of 1 on the lower left entry and the rest of the entries are zero. The 0 matrix (dimension 3x2) on the top right of matrix M is has zeroes for all entries. With that my M matrix satisfies M^2 = 0. Just wondering if there's a way to generalize for M that satisfies the condition, M^2 = 0.


Is a 1-D Kalman filter better than just averaging?

Question: I'm trying to estimate the state of a system that is changing linearly wrt time.
For a simple example, think of it as a car going at a constant speed: I want to measure both the distance traveled and the speed.   I have as inputs noisy(unreliable) signals of the car's position and speed.
It has been suggested that I build a Kalman filter for this processing.
But I am having a hard time seeing the benefit over just repeatedly averaging the speed and distance.
I understand that Kalman filter is good for complex paths with multiple inputs (velocity, acceleration, and further derivatives) (see An Explanation of the Kalman Filter).
But does this still apply to a simple model of constant speed?
Is my problem too simple for a Kalman filter, or are there still benefits to it I'm not seeing?
Comment: How do you know how much time to perform the averaging over?
Answer: The Kalman filter minimizes the mean square error. So, yes. The Kalman filter is "better" than averaging (at least in regards to the mean square error).
However, I am not sure how you would estimate the distance by averaging. The distance is changing, so you can't compute the average (or at least if you do, the result won't be accurate).


Definite Integral-What is the most efficient way to integrate this?

Question: What is the most efficient way to integrate this expression?
I couldn't find any way?![enter image description here][1]
$$\int_2^4 \frac{x^2+x}{\sqrt{2x+1}}\,dx$$
Comment: Please see http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference for help with formatting mathematics. There is an issue with this post, which is that it is an isolated problem statement. We look for questions that include *context*: where did you encounter the problem? What have you tried? You can edit the post to include this kind of information.
Answer: Set $x^2+x=(x/2)(2x+1)+(1/4)(2x+1)-1/4$:
So:
$$I=\int_2^4\left(\frac x2\sqrt{2x+1}+\frac14\sqrt{2x+1}-\frac14(2x+1)^{-1/2}\right)dx\\
=\int_2^4\left(\frac 12\sqrt{2(x+1/4)^2-1/8}+\frac14\sqrt{2x+1}-\frac14(2x+1)^{-1/2}\right)dx$$
Use standard formulae now.
Answer: HINT:
How about setting $\sqrt{2x+1}=u\implies\dfrac{2dx}{\sqrt{2x+1}}=du$
and $x=(u^2-1)/2$


Como copiar as regras de validação em vba?

Question: If Range("L9") > (Range("I9") + Range("J9")) Then
       Range("B8:O8").Interior.Color = RGB(255, 0, 0)

aqui eu quero copiar as regras de validação se este if acontecer
 End If

Answer: Olá,
Se eu entendi bem, você quer copiar a validação de dados, porém a validação de dados não pode ser copiada, mas você pode adicionar uma igual assim:
Range("B4").Validation.Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="0", Formula2:="10"

Esse exemplo só deixa números de 1 a 10 na célula, você pode utilizar variáveis para copiar a validação.
Espero ter ajudado.


Probability for a bin in a binned histogram

Question: This question is very basic, but I cannot figure the error in my thinking. According to the author of the book "Pattern Recognition and Machine Learning", we can get the Probability Distribution Function of a distribution in the form of histograms by
"simply divide $n$ (the number of observation for one bin) by the total number $N$ of observations and by the width $\Delta_i$ of the bins to
obtain probability values given by"
$p(x) = \frac{n_i}{N\Delta_i}$
I simply cannot get my head around how this give me the probability for a specific bin. $N\Delta_i$ is basically the sum of the area of every histogram. To calculate a relative frequency of one specific bin, why do we ignore the width $\Delta_i$ in the nominator, which would equal to the division of the area of one bin over the whole area.
Comment: By the very definition of a PDF, the $p$ are not "probability values:" they estimate probability *density,* which is probability per unit width.
Comment: See https://stats.stackexchange.com/a/296602/35989
Comment: I see, so basically as soon as I multiply $n_i$ by some width, I get the actual probability, which is the case I described.
Comment: @kklaw Yes. You can further understand this in terms of integration, if you are familiar with calculus.
Answer: One style of histogram of a sample has a vertical axis called Density, scaled so
that the total area of the histogram bars is unity $(1).$ Thus, suppose you have a large sample from a population with density function $f_X(x).$
Then the histogram will tend to imitate the shape of $f_X(x).$ That is, the area of a histogram bar with base $(a,b]$ of width $\Delta = b-a$ will
approximate $P(a < X \le b) = \int_a^b f_X(x)\, dx.$
For example, suppose x is a sample of size $n = 1000$ from
a population distributed $\mathsf{Gamma}(\mathrm{shape}=3, \mathrm{rate}=1/5).$ Then we might have one of the two histograms shown below, each along with the density function $f_X(x)$ of $\mathsf{Gamma}(3,1/5).$ In this example, the population mean is $\mu = 15, \sigma =
\sqrt{75} \approx 8.660.$ (Using R, where parameter prob=T of function
hist plots a density histogram, and parameter br suggests the number of bins.)
set.seed(2022)
x = rgamma(1000, 3, .2)
summary(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  1.236   8.673  13.495  15.013  19.939  53.914
sd(x)
[1] 8.488901

par(mfrow=c(1,2))
 hist(x, prob=T, br=5, ylim=c(0,.06), col="skyblue2")
  curve(dgamma(x, 3, .2), add=T, lwd=2, col="brown")
 hist(x, prob=T, ylim=c(0,.06), col="skyblue2")
  curve(dgamma(x, 3, .2), add=T, lwd=2, col="brown")
par(mfrow=c(1,1))

In the left panel, the bin with base $(10,20]$ of width $\Delta = 10$
contains $432$ observations, has height $.0432,$ and thus area $0.432.$
According to the density function, the probability within this interval
is $0.4386.$
diff(pgamma(c(10,20), 3,.2))
[1] 0.4385731

In the right panel, the bin with base $(5,10]$ of width $\Delta = 5$
contains $432$ observations, has height $.0496,$ and thus area $0.248.$
According to the density function, the probability within this interval
is $0.243.$
diff(pgamma(c(5,10), 3,.2))
[1] 0.2430222

Note: In R, some details of a particular histogram can be listed
by making a non-plotted histogram (parameter plot=F.) For the first
histogram above, we have the following partial printout:
hist(x, prob=T, br=5, ylim=c(0,.06), plot=F)

$breaks
[1]  0 10 20 30 40 50 60

$counts
[1] 321 432 196  37  12   2

$density
[1] 0.0321 0.0432 0.0196 0.0037 0.0012 0.0002

$mids
[1]  5 15 25 35 45 55

...


Can I reverse any hash algorithms to find a set of the possible orginals?

Question: If I map 1024 bits onto a 16 bit hash (just random numbers for conversation sake), I will have an average of 64 collisions per hash (assuming a good algorithm).
I wonder if anyone knows any hash algorithms around today in which I could take a hash and extrapolate the ~64 1024 bit original values?
I suppose that's not easy, but I don't know for sure.
My thought process is to see if I could tack an index number onto the end of the hash to enable me to extrapolate the original (perhaps at a significant cpu cost) later.
Comment: As Henning points out, this is significantly more difficult than your question makes it out to be. And I have to say.. this is a very good thing! If it wasn't, there would be very little point of cryptographic hashing! Now granted, cryptographic hashing is going to have much more than 16 bits, but even so, if the math in this post were correct, it would be devastating for the security community. Of course, if it were correct, and they'd gone the last 50 years without realizing it, I'd feel a little safer :-)
Answer: If your hash is only 16 bits, then on average there will be $2^{1008}$ different possible preimages for any hash value. It may be that you're only using 64 of those in practice, but you can't identify those from the hash alone, without using (very strong) additional information about the distribution of the actually occurring values.
Comment: I see the error in my logic now, thanks for pointing that out!
Answer: Theoretically, there is a set of values that get hashed to a particular hash value, so there is such a function taking hash values back to the unhashed $1024$ bit numbers.  However, if the hash is a good one, it should be as hard as generating the hash values for all the $1024$ bit originals and recording the mapping.  That is, it is possible, but should be impractical.
Comment: I don't think we're necessarily assuming that the hash is a cryptographically strong one (which would be a joke with only 16 bits anyway -- just hashing a few hundred thousand random inputs would be very likely to yield a first preimage).
Comment: @Henning: granted, $16$ bits is not a strong hash, but putting that aside, if it is a good $16$ bit hash, generating the list of possible sources should be as hard as generating all $1024$ bit patterns and correlating all the $16$ bit hashes with their source.


Is an ellipsoid a Riemannian manifold?

Question: I am trying to appeal to the Hopf-Rinow theorem to show that there exists a minimal geodesic connecting any two points $p,q$ on the ellipsoid, i.e. the set
$$  \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1$$
I do not any formal training in Differential Geometry, so I have been following Do Carmo's "Differential geometry of curves and surfaces".
In particular, his statement of Hopf-Rinow theorem in section 5.3 is that if $S$ is a complete surface, then given two points $p,q \in S$, there exists a minimal geodesic joining $p$ to $q$.
The corollary above the Hopf-Rinow theorem states that if a surface is compact then it is complete. I think that one can use the Heine-Borel theorem to prove that the ellipsoid is a compact surface and thus appeal to the Hopf-Rinow theorem.
However, when I consulted other resources, I read that there was an additional condition that the manifold $\mathcal{M}$ must be Riemannian. For example, on Wikipedia it states that the Clifton-Pohl torus is an example of a manifold that is compact but not complete.
This brings me to the following question, if we have that $a,b,c \in R \setminus \{0\}$, the ellipsoid is in general a Riemannian manifold?
Comment: It's a smooth manifold! So then…
Comment: The Riemannian metric is induced from the usual metric on $\Bbb R^3$.
Comment: @FedePoncio every smooth manifold has a Riemannian metric. Thank you to everyone that answered.
Answer: Answer: Yes.
A Riemannian manifold is a smooth manifold equiped with a Riemannian metric (a smooth "law of scalar products of tangent vectors"). Every smooth submanifold of any Euclidean space $\mathbb{R}^n$ can be equiped with a Riemannian metric induced by $\mathbb{R}^n$, hence, it can also be regarded as a Riemannian manifold. In particular, if you choose to use Euclidean distance to define your length-minimizing curve, then it is fine to suppose that your ellipsoid is a Riemannian submanifold of $\mathbb{R}^3$.
For Clifton-Pohl torus, it is a compact manifold whose metric is deliberately chosen to have pathological properties ( so the metric here is not necessarily a Riemannian metric).

Is an ellipsoid a Riemannian manifold?


accessing atributes of a service in angularjs

Question: I created a service to share some data between two controllers. The thing is that this controllers set and get some data from this service. But I don't know why when I try to get data, all this variables are not set.
My code is this one:
<code> var appModule = angular.module('app', ['mgcrea.ngStrap'])
            // custom service to share/collect data between controllers
            // this objects are populated by the controllers
            .service('sharedProperties', function () {
                    this.searchPattern = {
                                        basicFilters: {},
                                        advanceFilters: {}
                                    };

            });

    // controller for main section
    appModule.controller('parentController', function ($scope, $aside, sharedProperties) {
        $scope.basicFilters = {
                                category: 'undef',
                                masterbrand: {value:'undef', text: 'Any'},
                                page: 1,
                                perPage:10,
                                q:''
                            };

        // populate object in service
        $scope.updatePatternSearch = function(newValue, oldValue, scope) {
            sharedProperties.searchPattern.basicFilters = 'HI!, I have a value!';
        };
        $scope.$watch('basicFilters', 'updatePatternSearch', true);

        // get variables from service
        $scope.search = function() {
                // ** PROBLEM **
                // firebug says that is:basicFilters: {},
                //                      advanceFilters: {}
                // empties????, why??
                console.log(sharedProperties.searchPattern);
            }
        }
    });
</code>
Comment: can you put it in a plnkr of fiddle please
Comment: Pretty ugly code.  Try to structure it better.  Inject your service into your controller, create a "get" method on your service then from your controller call sharedProperties.get
Comment: yes, I'm doing it. I dont know why the variable from the controller in plnkr is not being printed correctly...
http://plnkr.co/edit/4e63PRF4KyLcvPvr36eJ?p=preview
Comment: I did it, this ugly code is just trying to simplify the code. The original has more stuff as you said. But this is the most basic I can get it and is not working.
Answer: There are lots of typos and erros in your plnkr code.
I have forked and updated it. It's working fine.
Have a look at this - http://plnkr.co/edit/BVFjufOQFFlhB2gTqIeB?p=preview
Comment: I saw it right now....I rewrote my code a little, and should be that because now is working. I'll have a look into that, I spent long time....Thanks.


Carregar fonte externa

Question: Tem como carregar uma fonte externa com jquery

$('div').on('click', function(){

       $('textarea').css({'font-family': 'fonte',
          "src": "url(https://fonts.gstatic.com/s/tangerine/v8/HGfsyCL5WASpHOFnouG-RFtXRa8TVwTICgirnJhmVJw.woff2)"
        });

     });

        <textarea>Depois de 10 anos o menino virou adulto.</textarea>

Clique para mudar a fonte

Answer: O código abaixo pode te ajudar. Para mais detalhes, dê uma olhada nesse link: AQUI
$('div').on('click', function(){
$("head").prepend("");
});

Carregar fonte externa


How many ways nine people can sit on these chairs if at least one of the chairs in row two must remain unoccupied?

Question:
Question: find how many ways nine people can sit on these chairs if at least one of the chairs in row two must remain unoccupied.
Attempt: $9!+(9!)(10C9)(6)+(9!)(11C9)(3)=82010880$
Reasoning: if three chairs are unoccupied, then there are $9!$ ways, if two chairs are unoccupied, there are $(9!)(10C9)(6)$ {the $6$ because the possible ways the unoccupied chairs are arranged}, $(9!)(11C9)(3)$ if one chair is $(9!)(11C9)(3)$
Correct answer: $59512320$
Could someone please help me understand what I am doing incorrectly?
Comment: The diagram is confusing, and makes the question ambiguous: what does _row_ mean here? The chairs appear to be facing left, so a row in a classroom, say, would contain three chairs. But it seems that the question is intending that a row contains four chairs. At least, that is what JMP's answer assumes, and it arrives at the correct answer. The use of "row two" also suggests this interpretation. (By the way, there are only $3$ possible ways to arrange two unoccupied chairs in a row of three, not $6$.)
Answer: Alternatively, you can use complimentary method.
Number of total arrangements $ = \displaystyle {12 \choose 9} \cdot 9! = 79833600$
Number of arrangements in which all four seats of the second row are occupied $ = \displaystyle {9 \choose 4} \cdot 4! \cdot {8 \choose 5} \cdot 5! = 20321280$
(You choose four people out of nine and arrange them in second row. Then you arrange the remaining people in eight seats from the first and third rows)
So number of arrangements where at least one of the seats in the second row is not occupied
$$ = 79833600 - 20321280 = 59512320$$
Comment: The is an alternative way to do it with the same concept (complimentary method): 12P9-(9C4*4!*8P5)=59512320
Comment: @123321123321 $nPm = \binom{n}{m} \cdot m!$
Answer: I take it that there are four chairs in each "row"
You can apply inclusion-exclusion to avoid double counting viz
$C(4,1)*P(11,9) -C(4,2)*P(10,9) + C(4,3)*P(9,9) = 59512320$
Another way
P(row $2$ not full)$\times$(All permutations)
$=\left(1- \frac9{12}\frac 8{11}\frac7{10}\frac69 \right)\times P(12,9) =\frac{41}{55}\times P(12,9) = 59512320$
Comment: The question asks us to find how many ways nine can sit on the $12$ chairs so that at least one chair in row 2 must remain unoccupied.  While you solution is valid, the way you described your first term makes it sound like that term is the answer to the question.  What you are actually doing is selecting $k$ chairs in row 2 to be empty and seating people in the remaining chairs.
Comment: @N.F. Taussig: Right, I've removed the wording.
Answer: It is a matter of arranging the unoccupied chairs for each case. First, line up the $9$ people in any of the $9!$ ways.
If there is only one occupied chair in row $2$, then there are $4$ ways to position it.
If there are $2$ occupied chairs, then there is $1$ space in either row $1$ or row $3$, and $6$ ways in row $2$.
If there are $3$ occupied chairs, there are $\binom{8}{2}=28$ ways for the spaces in rows $1$ and $3$, and $4$ in row $2$.
So the final answer is $9!(4+8\cdot6+28\cdot4)=59,512,320$.


Erro ao passar argumentos em JSON

Question: Estou tentando fazer uma inserção no MongoDB passando alguns argumentos em JSON:
{
    "name": "TESTE",
    "category": "B",
    "service": "Novo processo",
    "description": "Novo Teste",
    "active": false,
    "classmodels": [
        {"id": "5bbe37ef8eb26d0025624fcd", "amount": 10},
        {"id": "5bbe37ef8eb26d0025624fcd", "amount": 14}
    ]
}

Está retornando o seguinte erro:
Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters

Também está retornando o status code como 500(Internal Server Error), mas eu estou conseguindo usar outros endpoints sem problema nenhum.
As funções no NodeJS que eu estou usando são essas:
Primeira a ser chamada.
addStandardClassTemplate: function(req, res) {
        let name = req.body.name;
        let category = req.body.category;
        let service = req.body.service;
        let description = req.body.description;
        let active = req.body.active;
        let classmodels = req.body.classmodels;
        console.log('Entrou no método de Adicionar Template de Aula Padrão');
        classtemplatesMethods.add.addStandard(name, category, service, description, active, classmodels)
            .then((result) => {
                res.status(200).send(result);
            })
            .catch((error) => {
                res.status(404).send(error);
            });
    },

Segunda a ser chamada.
addStandard: function(name, category, service, description, active, classmodels) {
        classmodels.forEach((item, index) => classmodels[index] = ObjectId(item));

        let NewValues = {
            name: name,
            category: category,
            service: service,
            description: description,
            active: active,
            classmodels: classmodels,
        };
        console.log('QUERY Adicionar Template de Aula Padrão');
        return new Promise((resolve, reject) => {
            mongoMethods.add.insert(targetcollection, NewValues)
                .then((result) => resolve(result))
                .catch((error) => reject(error));
        });
    },

Comment: Olá Henrique, vi que na sua model você tem essa linha: classmodels.forEach((item, index) => classmodels[index] = ObjectId(item)); é realmente necessário você popular novamente o array classmodels com os mesmos valores?
Comment: Eu estou usando esse forEach para transformar o id que eu passo para ObjectId. Não consegui entender o que você disse sobre estar populando novamente o array.
Comment: Note que neste `classmodels[index]` voce esta reescrevendo todo o registro e não só o `.id`, mesma coisa com o `ObjectId(item)`, deveria ser `ObjectId(item.id)`
Answer: Através do bate-bola que rolou nos comentários da pergunta detectamos que faltava apenas um .id =)
//classmodels.forEach((item, index) => classmodels[index] = ObjectId(item));
classmodels.forEach((item, index) => classmodels[index].id = ObjectId(item.id));

Answer: Henrique, veja essa documentação do MongoDB sobre o ObjectID:
link da documentação oficial: Documentação Mongo DB

var Db = require('mongodb').Db,
    MongoClient = require('mongodb').MongoClient,
    Server = require('mongodb').Server,
    ReplSetServers = require('mongodb').ReplSetServers,
    ObjectID = require('mongodb').ObjectID,
    Binary = require('mongodb').Binary,
    GridStore = require('mongodb').GridStore,
    Grid = require('mongodb').Grid,
    Code = require('mongodb').Code,
    BSON = require('mongodb').pure().BSON,
    assert = require('assert');

// Create a new ObjectID
var objectId = new ObjectID();
// Convert the object id to a hex string
var originalHex = objectId.toHexString();
// Create a new ObjectID using the createFromHexString function
var newObjectId = new ObjectID.createFromHexString(originalHex)
// Convert the new ObjectID back into a hex string using the toHexString function
var newHex = newObjectId.toHexString();
// Compare the two hex strings
assert.equal(originalHex, newHex);

Erro ao passar argumentos em JSON


How to evaluate a histogram?

Question:
Let's say I have the histogram above which reports performances of some neural networks. The y axis is the bin size, while the x axis is the error, so low errors = high performance.
Out of these 15 networks, how would I go about selecting the best one? Looking at the mean or the median error comes to mind, but I can think of many cases where mean and the median could be misleading. Is there a way to pick the consistently high performing network?
Here it is obvious that MLP 10 has the best performance, but sometimes evaluating a network becomes much harder.
The data is not necessarily normally distributed.
Answer: Those histograms are not very useful for the task. Don't get me wrong, histograms of errors can be helpful to have a more in-depth look at the errors (e.g. are they all small, or do they have long tails?), but they themselves are usually not used for picking the best model.
One problem with histograms is that judging them is a bit subjective. For example, compare the models MLP_7 and MLP_8. Would you pick a model that has slightly fewer very small errors and a few small errors (MLP_7), or a model that has more very small errors but more errors that are larger than the previous model (MLP_8)? It is hard to say, especially if you don't know the exact readings of the bar heights on the $y$-axis and the size of the errors on the $x$-axis. To make it less subjective, you could calculate the expected value of the errors, which could be approximated by using the histogram to calculate the weighted mean
$$
E[x] = \int x \, p(x) \, dx \approx \frac{\sum_i x_i h(x_i)}{\sum_i h(x_i)}
$$
where $h(x)$ is the histogram height for $x$. But you don't need a histogram for this. Instead, as noticed by @boomkin in the other answer, just use some error metric, like mean squared error, that would tell you about the errors "on average".
When comparing the models you want to have an unambiguous criterion for model choice. As discussed in the Full Stack Deep Learning Course, having different metrics about the model performance is often useful for debugging it, gaining insights on it, etc, but for model choice and optimization, you need to pick a single metric that you optimize. If you need to use multiple metrics, you should collapse them into a single metric (similar as we could use expected value instead of histogram).
Finally, the histograms you have shown us are not useful because they don't let us compare the distributions with enough precision. Notice that most of the histograms look nearly the same. They collect the vast majority of the errors in the first bin. To compare them, you would need to use more bins so that you can easier differentiate between the small errors. Since the errors have long tails, it may be useful to plot the logarithm of errors. On another hand, it would "hide" the large errors and you most likely care about them.
Answer: In terms of evaluating the performance of your neural network, you typically want to use some kind of estimate for a generalisation error, like hold-out validation (testing on a separate dataset) or K-fold cross-validation.
Assuming you use a separate dataset for comparison, the reasonable thing to do is to use the loss function you have used for training your neural network as an evaluation metric.
The most common choices for loss functions are the mean squared error and cross-entropy.
Mean squared error is a typical choice for regression problems:
$$ MSE = \frac{1}{N} \sum_{i=1}^N (Y_i - \hat{Y}_i )^2  $$
where $Y_i$ is the true regression value and $\hat{Y_i}$ is your neural network's prediction.
While the cross-entropy is used for classification problems:
$$ C = - \sum_{i=1}^N y_{o,c} \log p_{o,c} $$
where $y_{o,c} $ is a binary indicator of correct classification, and $p_{o,c}$ is the predicted probability for that class.
If you used the above two as an error metric, I would take the average of the errors on each histogram and choose the minimum.
Otherwise, I would calculate the value the loss functions on your separate dataset, and choose the neural network which gives the minimal error.
Comment: Thank you. In this case, each network controls a robot performing a task, and the error is reported as above. If I sum up all the squared errors, this will give me a ranking of the networks, which is what I need. This will also inflate the large errors though. What if I think errors around 0-250 are acceptable, and an error of 2000 and an error of 10000 are both unacceptable, so there shouldn't be much difference in large errors. Does this mean the error I used for training is not quite good? Is there an error function with diminishing returns on high errors?
Comment: I think the penalising more heavily won't solve the large errors, in my experience, what typically works is taking a look at the erroneous examples and considering some kind of extension of the training set based on it. As far as I'm concerned there is no loss function with diminishing returns behaviour, but every week somebody finds out a new kind of loss function or metric or finds out some kind of heuristic for a previously intractable loss function. Try a few alternative loss functions and see if they change performance.
Comment: I like model selection criteria, like AICc, to select a model.

How to evaluate a histogram?


ng-change with value with leading zero - zero is gone controller

Question: I have an input field like this:
<input id="0900" type="radio" ng-model="formData.appointment_hour" ng-change="change(0900)" name="appointment" value="0900" class="ng-valid ng-dirty">

But when I look in the function in my controller:
$scope.change = function(key){
    console.log(key);
};

My console logs 900. The problem is that I don't want the leading zeros to be gone. How can I fix this?
Comment: It's also worth pointing out that the result of `900` from `0900` is only because Javascipt parses all values beginning with 0 under 777 as octal.
Answer: Handle the value as a string:
<input id="0900" type="radio" ng-model="formData.appointment_hour" ng-change="change('0900')" name="appointment" value="0900" class="ng-valid ng-dirty">


Determining if a curve is or is not a variety

Question: I feel a little confused about varieties.
If I am asked to determine whether V(cos(x),sin(x)) seen in R1 is a variety, would it be true to just say it is?, because the polynomial 0=1 has no solution (since we know that cos(x) and sin(x) don't coincide at their zeros), so V(cos(x),sin(x))=R.
But if I am now being asked to determine whether V((cos(x),sin(x))) seen in R2 is a variety (if this makes sense) what can I say?. I think it should not be a variety but when trying to see how may I integrate polynomials into my thinking, I get confused. What reasoning should I be using for this case?
Comment: What is your definition of a variety?
Comment: when T is a finite set of polynomials in R=K[x1,...xn], V(T) is equal to the set of n-tuples (a1,...,an) which make all the polynomials of T equal to 0. In this case, I believe we need to see if there's a match between the values for (cosx,sinx) in R2 and the zeros of a finite set of polynomials in R=K[x]. but I guess that I feel a little confused about it as well.
Answer: I think it would be clearer if you change the variable name.
$$
(\cos t , \sin t)
$$
So that you get
$$
x=\cos t\\
y=\sin t\\
x^2+y^2-1=0
$$
The t coordinate is not important for determining if your result is cut out by polynomials in the target space. It is the just the parameterization, but this question only depends on the underlying set. (Birationality is a separate question)
If it is the graph of a polynomial function $f$. You get the set of points of the form
$$
(x,f(x))
$$
$y-f(x)$ gives the polynomial in two variables you need to cut this out.
Answer: For the first question, you have the right spirit but your reasoning is wrong: what you've called $V(\cos(x),\sin(x))$ is $\varnothing$, not $\Bbb R$ (for exactly the reason you describe: it is the variety of any nonzero constant polynomial, e.g. $V(1)$).
The second question seems to be the following: Consider the set $C=\{(\cos(x),\sin(x))\in\Bbb R^2: x\in\Bbb R\}$; can this be realized as a variety. The answer is yes, which you will see immediately if you draw the graph.
Note that the polynomial(s) you are looking for will necessarily be polynomials in two variables (say, in $y$ and $z$). Clearly, if the graph satisfies the equation $f(x,y)=c$ for some polynomial $f$, then this is still a variety because the modified polynomial $\tilde f(x,y)=f(x,y)-c$ vanishes there.


asymptotic of graph equation

Question: I need help to resolve this exercise :

Using asymptotic limited development in the neighborhood of + ∞ of the
  function
$$g(x) = 2x + 3 \sqrt{x^2 -1} $$ Determine an equation of the straight
  line asymptote to the graph of g in + ∞ and position the
  representative curve of g with respect to this asymptote.

Sorry for my basic english..
Answer: The question is asking: What does this graph look like for very large $x$?
$$
g(x) = 2x + 3 \sqrt{x^2 -1} \stackrel{\text{subtracting 1 is no biggie for}\;x\sim \infty}{\sim} 2x+3\sqrt{x^2}\\
=2x+3|x|\stackrel{x>0}{=}5x\Rightarrow g(x)\sim 5x
$$
or the graph of the function approaches the graph of $y=5x$.
edit: As noted, in my attempt to be cute I may have swept something important under the rug, if instead we had
$$
g(x)=2x + 3 \sqrt{x^2 -x}
$$
This function would be similar to $5x+b$, since the lower order term in the square root is still dominated, but will add a relatively small but existent perturbation for large $x$.
Comment: +1 for "no biggie". @imranfat: I agree, but I think that's fixed with a sentence of elaboration.
Comment: Had that $1$ inside that radical been an $x$, then subtracting $x$ from $x^2$ also would not have been an issue for $x$ going to infinity, yet, the equation of the asymptote would be different. While I won't downvote, I think the reasoning is flawed...
Comment: @imranfat had that 1 been an x, then it definitely would be a "biggie" for $x\sim \infty$.
Comment: @qbert. That is where the reasoning fails. Had that $1$ been an $x$, the equation of the asymptote would have been $y=5x+b$ with a nonzero $b$. Your argument only works if behind the $x^2$ is a constant, like $-1$ and I think you should point that out in the answer...
Comment: @imranfat fair enough. I have only ever cared about the function it looks like up to a translation
Comment: @qbert True, the asymptote is shifted. (b-value)
Answer: the asymptotic will have the form $y=ax+b$
$a= g'(x)\lim_{x\to∞ } =\lim_{x\to∞ }$$2+$ $\frac{3x}{\sqrt {x^2-1}}\ $ =
$ \lim_{x\to∞ }$$2+$ $\frac{3x}{x\sqrt {1-\frac{1}{x^2}}}\ $ = $ \lim_{x\to∞ }$$2+$ $\frac{3}{\sqrt {1-\frac{1}{x^2}}}\ $
$\frac{1}{x^2}$ will be 0 so the limit is
$ \lim_{x\to∞ }$$2+$ $\frac{3}{\sqrt {1}}\ $ $= 2+3$ $=a$
b will be infinity big
So the asymptotic function will be $y=5x$

asymptotic of graph equation


Clearing a textbox when any other radio buttons are selected

Question: I started working on some code for a webpage yesterday & i am having trouble getting a few things working.
I have 4 radio buttons, 3 of which have values applied to them & one which allows the user to enter a custom amount with a textfield next to it e.g
[] = 3
[] = 11
[] = 32
[] = [_________] = Enter Custom Amount
The problem is, if a user selects custom amount by pressing the radio button and enters 300 e.g, then afterwards decides to choose a predefined amount of 11 they can still submit which will enter both values.
So what I done was write some of this code below to CLEAR the textbox if a predefined radio button is selected.
The problem I have now is that say the page loads and the user instantly wants to enter a custom amount, 9 times out of 10 they are more than likely to PRESS or click inside the textfield rather than use the radio button next to it but because I have disabled it on startup i don't know what the best way to resolve this UX problem. Can anyone give help? Here's what I have so far:
  <input type="radio" name="am_payment" value="3" checked="checked"> 64

<input type="radio" name="am_payment" value="11" checked="checked"> 100

<input type="radio" name="am_payment" value="32" checked="checked"> 250

<input type="radio" value="" name="am_payment">Other

<input type="text" name="CP_otheramount" value="" id="theamount" disabled="disabled"/>

$('input[name="am_payment"]').on('click', function() {
   if ($(this).val() === '') {
     $('input[name="CP_otheramount"]').val('');
      $('#theamount').removeAttr("disabled");
   }
   else {
      $('#theamount').prop("disabled", "disabled");
     $('input[name="CP_otheramount"]').val('');
   }
});

Answer: About this?

  $('input[name="am_payment"]').on('click', function() {
   if ($(this).val() === '') {
      $('#theamount').val('').prop("disabled", false).focus();
   }
   else {
      $('#theamount').val('').prop("disabled", true);
   }
});

<input type="radio" name="am_payment" value="3"> 64

<input type="radio" name="am_payment" value="11"> 100

<input type="radio" name="am_payment" value="32"> 250

<input type="radio" value="" name="am_payment" checked>Other

<input type="number" name="CP_otheramount" value="" id="theamount" />
Answer: I guess what you want is that when someone click on the text input
the radio event has to be triggered and the input has to be on focus

function activate() {
  console.log('clicked');
  $('#other').prop('checked', true);
  $('#other').trigger('click');
  $('#theamount').focus();
}
$('input[name="am_payment"]').on('click', function() {
  console.log('changed');
  if ($(this).val() === '') {
    $('input[name="CP_otheramount"]').val('');
    $('#theamount').removeAttr("disabled");
  } else {
    $('#theamount').prop("disabled", "disabled");
    $('input[name="CP_otheramount"]').val('');
  }
});

<input type="radio" name="am_payment" value="3" checked="checked"> 64

<input type="radio" name="am_payment" value="11" checked="checked"> 100

<input type="radio" name="am_payment" value="32" checked="checked"> 250

<input type="radio" value="" name="am_payment" id="other">
Other

<input type="text" name="CP_otheramount" value="" id="theamount" disabled="disabled"/>
Comment: if a user clicks inside the textbox then the radio button OTHER needs to be selected. When a different predefined value radio button is selected the textbox needs to clear (if any text has been put inside of it). Exactly how you have done above so thank you :-)
Comment: ive just replicated this in JSfiddle but it $('#theamount').focus(); doesnt seem to be working? http://jsfiddle.net/dnGKM/310/


Probability You Choose at least one chip of every color

Question: There are 16 chips: 6 red, 7 white, and 3 blue. 4 chips are selected randomly and are not replaced once selected.
What is the probability that at least one chip of every color is selected?
I'm not every good at figuring out how to create an equation of probability for these "at least one of each kind" problems. Thanks for your help and kindness in advance. It is much appreciated.
Comment: @sasha can you go into a little bit more detail? I just started this Statistics course a week ago, we have never learned of that principle. We just learned the basic counting principle. This is all relatively new to me.
Answer: Denoting the $(N_r, N_w, N_b)$ the triple of counts of each color in the sample, configurations that meet the requirements are $(2,1,1)$, $(1,2,1)$ or $(1,1,2)$.
The probability of the first configurations is
$$
   p_1 = \frac{\binom{6}{2} \cdot \binom{7}{1}\cdot \binom{3}{1}}{\binom{16}{4}} = \frac{9}{52}
$$
Compute $p_2$ and $p_3$ similarly. Since these events are disjoint the answer is
$$
   p_1 + p_2 + p_3 = \frac{9}{20}
$$
The tuple $(N_r, N_w, N_b)$ follows multivariate hypergeometric distribution, and you seek evaluate
$$
   \Pr\left(N_r > 0 \land N_w > 0 \land N_r > 0 \right)
$$
Answer: If you get at least one chip of every color, there are 3 cases to consider:
1) 2 red, 1 white, 1 blue
2) 1 red, 2 white, 1 blue
3) 1 red, 1 white, 2 blue.
Therefore the probability is given by
$\displaystyle\frac{\binom{6}{2}(7)(3)+\binom{7}{2}(6)(3)+\binom{3}{2}(6)(7)}{\binom{16}{4}}=\frac{9}{20}$.
Comment: Can you explain the numerator of that longer fraction? More specifically the multiplied coefficients by the binomials in the numerator and their purpose. Thanks a lot.
Comment: In the first term, for example, $\binom{6}{2}$ is the number of ways to choose the 2 red chips, 7 is the number of ways to choose a white chip, and 3 is the number of choices for a blue chip.
Answer: Since you're just learning this stuff, maybe this will help.
One thing I try to keep in mind when dealing with "at least one of" type problems:

    Call "p" the probability of getting NO occurrences of whatever it is (basically all the ways things can be chosen so that there are no occurrences of the target item).

    Then (1-p) is the probability of getting is the probability of getting at least one (or more).
Comment: I agree with that and Have been told that strategy before, I just didn't know how to apply it in this problem since their are only 3 colors and 4 selections of the chips.


How to configure HAProxy to forward requests to Mongo database

Question: Is it possible to setup/use HAProxy to forwards requests to a mongo database? If so can someone provide a basic example of how to set this up in the haproxy.cfg file?
I tried this, but this doesn't work:
listen  mongo
    bind 10.123.45.6:27017
    mode tcp
    balance roundrobin
    server mongo1 10.456.78.9:27017

Where 10.123.45.6 is the IP of instance w/ HAProxy installed.
Where 10.456.78.9 is the IP of instance w/ mongodb installed.
Screenshot when trying to invoke client via command line:
C:\Program Files\MongoDB\Server\3.6\bin>mongo "mongodb://10.123.45.6:27017"
MongoDB shell version v3.6.11
connecting to: mongodb://10.123.45.6:27017/?gssapiServiceName=mongodb
2020-01-23T15:53:41.707-0800 W NETWORK  [thread1] Failed to connect to 10.123.45.6:27017 after 5000ms milliseconds, giving up.
2020-01-23T15:53:41.707-0800 E QUERY    [thread1] Error: couldn't connect to server 10.123.45.6:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed

Answer: Your settings are right, however I am adding an example for you

listen port_27017
  bind :27017
  mode tcp
  server mongodb-port 10.156.78.9:27017

It should connect, but just to confirm from where are trying to connect? Is it within the local network or somewhere from the cloud. Because as per RFC 1918 all the 10.0.0.0/8 belong to private network, if you are outside the network and trying to access the 10.123.45.6 it won't work.
And if it is within network, and try to tail the log of HAProxy and see if it is able to connect to the Mongo or not.
If it is outside, you need to connect to HAProxy using it's public IP address rather than private IP.
Comment: 10.456.78.9 is an invalid IP address.


Finding missing 2 solutions of a 4th order ODE using Wronskian

Question: I am trying to follow a research paper in physics where the authors end up with the following differential equation:
$$
D^2(f)=0, \qquad D=\left(\frac{\rm d^2}{{\rm d}t^2} + \frac1r \frac{\rm d}{{\rm d}r} - \frac{1}{r^2}-k^2\right)
$$
where the operator $D$ is applied twice, and with $k$ an unknown real number.
The article states that using the "Wronskian method" and discarding solutions singular at $r=0$, one can find the following general solution:
$$
f(r)=A I_1(kr) + B \left(K_1(kr)\int I_1^2(kr')dr'-I_1(kr)\int I_1(kr')K_1(kr)r'dr'\right)
$$
with $A$ and $B$ constant,$I_1$ and $K_1$ the first-order Bessel function of the first and second kind.
No more details are given and I'm trying to understand how to do this. I also don't really care about discarding singular solutions at $r=0$.
I can easily find two solutions of this differential equation. Functions satisfying $D(f)=0$, a modified Bessel equation, are also solutions of the initial equation, so we have the two independent family of solutions: $f(r)=\alpha I_1(kr) + \beta K_1(kr)$. Then I assume some tricks based on the Wronskian can be used to find the other two fundamental solutions ...
I looked up examples on how to use the Wronskian but I could't understand how this could be applied here for a 4th order ODE where only 2 solutions are known.
From Abel's idenity the Wronskian is $W(r)=k/r^2$, $k$ a constant. I could compute the Wronskian with the determinant definition, but this would give a very ugly expression with 2 unknown functions and their derivatives, which doesn't seem to help ?
The resources and exemples I could find always consider an $n$-th order equation for which we already know $n-1$ fundamental solutions, so I'm not sure what to do when two are missing like here.
Comment: How did you lose the independent variable $t$? You start with a PDE, but then only consider the solution process for ODE?
Answer: With $L$ a second order differential operator, the task is to solve $L[L[y]]=0$. Given any solution $y$, then $z=L[y]$ is a solution to $L[z]=0$.
Let $y_{1,2}$ be basis solutions to $L$. Then $z=αy_1+βy_2$. Now it remains to solve $L[y]=z$. Use variation of parameters
$$
\begin{bmatrix}y_1&y_2\\y_1'&y_2'\end{bmatrix}
\begin{bmatrix}c_1'\\c_2'\end{bmatrix}
=
\begin{bmatrix}0\\αy_1+βy_2\end{bmatrix}
\\
\implies
W[y_1,y_2]\begin{bmatrix}c_1'\\c_2'\end{bmatrix}
=\begin{bmatrix}y_2'&-y_2\\-y_1'&y_1\end{bmatrix}
\begin{bmatrix}0\\αy_1+βy_2\end{bmatrix}
$$
This gives a solution formula of
$$
y=d_1y_1+d_2y_2-y_1\int\frac{y_2(αy_1+βy_2)}{W[y_1,y_2]}dr+y_2\int\frac{y_1(αy_1+βy_2)}{W[y_1,y_2]}dr
$$
In the situation with the singularity the solution $y_2$ that diverges at $r=0$ is discarded, $β=d_2=0$. The Wronskian satisfies
$$
W[y_1,y_2](r)\sim \exp\left(-\int_1^r\frac1{r'}\,dr'\right)=\frac1r.
$$
This means that there should be a factor $r'$ in both integrands.


Partial derivatives of implicit functions

Question: So, I have an implicit expression for a change of variables from Cartesian to a different system using $u$ and $v$.
This is given by:
$G(x,y,z,u,v)=0$, $F(x,y,z,u,v)=0$, where $F$, $G$, $u=f(x,y,z)$ and $v=g(x,y,z)$ are all differentiable.
Differentiating F, say, we get:
$\frac{dF}{dx} = \frac{\partial{F}}{\partial{x}} + \frac{\partial{F}}{\partial{u}} \frac{\partial{u}}{\partial{x}} + \frac{\partial{F}}{\partial{v}}\frac{\partial{v}}{\partial{x}}$
My questions:
Is this because you have $\frac{\partial{x}}{\partial{x}} = 1$, and  $\frac{\partial{y}}{\partial{x}} = \frac{\partial{z}}{\partial{x}} = 0$?
This seems like an obvious question but I don't really understand where the $ \frac{\partial{F}}{\partial{x}}$ term is coming from, or why is just appears here. For example if we had $f(x,y,z)=f(x(t), y(t), z(t))$, if we wanted to differentiate that with respect to t we wouldn't have an $ \frac{\partial{f}}{\partial{t}}$ term.
Answer: It's just the chain rule.
Perhaps it's easier to see if you rename things a little, so that you don't use the same symbols for the coordinates as for the functions involved.
If from the function $F(x,y,z,u,v)$ you form the composed function
$$
f(r,s,t)=F\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr)
,
$$
then the chain rule says that
$$
\begin{split}
\frac{\partial f}{\partial r}(r,s,t)
&=
\frac{\partial F}{\partial x}\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr) \frac{\partial X}{\partial r}(r,s,t)
\\ &+
\frac{\partial F}{\partial y}\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr) \frac{\partial Y}{\partial r}(r,s,t)
\\ &+
\cdots
\\ &+
\cdots
\\ &+
\frac{\partial F}{\partial v}\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr) \frac{\partial V}{\partial r}(r,s,t)
.
\end{split}
$$
In your case you have
$$
X(r,s,t)=r
,\quad
Y(r,s,t)=s
,\quad
Z(r,s,t)=t
$$
and
$$
U(r,s,t)=f(r,s,t)
,\quad
V(r,s,t)=g(r,s,t)
.
$$
Then $\partial X/\partial r=1$ and $\partial Y/\partial r=\partial Z/\partial r=0$, so you're left with
$$
\begin{split}
\frac{\partial f}{\partial r}(r,s,t)
&=
\frac{\partial F}{\partial x}\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr)
\\ &+
\frac{\partial F}{\partial u}\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr) \frac{\partial f}{\partial r}(r,s,t)
\\ &+
\frac{\partial F}{\partial v}\bigl(X(r,s,t),Y(r,s,t),Z(r,s,t),U(r,s,t),V(r,s,t)\bigr) \frac{\partial g}{\partial r}(r,s,t)
,
\end{split}
$$
which is the formula that you asked about, in slightly different notation.


What is the name of the drum sound where the hi-hat creates a "riser" by opening after being hit?

Question: There's a very common drumming technique, usually towards the end of a bar, where the hi-hat is hit while being opened creating a "riser" sound.
I had always thought it was called a "fill," but it's really just a very simple version of a fill.  What is this sound/technique called?
Comment: Does this answer your question? [What is the name of this drums "disco" rhythm/technique?](https://music.stackexchange.com/questions/64980/what-is-the-name-of-this-drums-disco-rhythm-technique)
Comment: Open hi hat? Not everything has a name.
Comment: Not sure, but it's definitely not "[drum riser](https://soimagescdn.azureedge.net/productimage/Intellistage/ISG-ISMDRUM6413.jpg)", which is something else entirely.
Comment: @SephReed the point is, it doesn't seem to name beyond "open hi-hat" or at least nobody here has heard it. My best guess is that after coming up with "pataflafla" and ""flamadiddle-diddle", the mysterious cabal that invents the names decided it's getting too silly and stopped.
Comment: Good question! We like labels, so if there isn't one, maybe there should be! Although there are various hi-hat sounds from hard shut through 'half open', to completely open, let alone 'hit it closed, and open it straight away'. +1.
Comment: Open hat, and closed hat are both things I can easily search for on any sound library.  I would be really surprised if this doesn't have a name, given how widely used and introductory it is.
Comment: @ojs, that is definitely very close.  There is a subtle difference between `open-close-open-close` and an "opening" sound in isolation.  I've heard songs that have that opening sound alone, and it doesn't sound like an open hat hit.  I think this "opening" sound is a byproduct of the `open-close` pattern, but they're probably so related that differentiating between the two is pedantic in most scenarios.
Answer: It sounds like you might be describing this sound:

I would describe this simply as "gradually open hi-hat" / "slowly open hi-hat"
Answer: It's just called "open hi-hat". And yes, it is often used as simple type of drum fill.
Here is a short lesson on how to play open hi-hat:

Open hi-hat is usually represented in notation by a small circle (o) above a regular hi-hat note.  Closing the hi-hat is then represented with a small plus sign (+) above the note.  Once the hi-hats are closed the plus sign is not written.


How does the Drupal session system work?

Question: I would like to implement the familiar "Remember me" functionality on user login forms, i.e. if a registered user leaves the browser without hitting the log out link, (s)he will still be logged in when visiting the website afterwards. A quick search leads to the Remember me module, whose description states:

(...) the default Drupal behaviour is to remember your session for the extent of 3 weeks and 2 days. (...) Can you imagine the colossal risk this places on users accessing your service from public terminals or shared workstations, with no means to their disposal of securing themselves against this threat.

If the first sentence is true, it seems that I do not need the module to accomplish my need. Indeed, I can safely exit Firefox without loosing my session for "a while" (I do not know the exact time interval). However, other users on my website complain that they are immediately logged out after closing their browser.
So now I want to know the ins and the outs of the matter. Are sessions handeled differently for different browsers and, if yes, why? Does Drupal remember sessions for the extent of 3 weeks and 2 days and, if yes, why was this long time interval chosen? Is not using a module like Remember me indeed a risk?
Answer: Drupal has a pluggable session handler, however it generally uses a cookie + database session model by default.
The sessions table in the database stores the session details for the users. The session id is stored and matched from a browser cookie.
The settings for session duration can be found in settings.php, in particular:
/**
 * Set session lifetime (in seconds), i.e. the time from the user's last visit
 * to the active session may be deleted by the session garbage collector. When
 * a session is deleted, authenticated users are logged out, and the contents
 * of the user's $_SESSION variable is discarded.
 */
ini_set('session.gc_maxlifetime', 200000);

/**
 * Set session cookie lifetime (in seconds), i.e. the time from the session is
 * created to the cookie expires, i.e. when the browser is expected to discard
 * the cookie. The value 0 means "until the browser is closed".
 */
ini_set('session.cookie_lifetime', 2000000);

You can adjust those settings to affect the session lifetime. Indeed, the "remember me" module uses the session.cookie_lifetime setting to apply its functionality.
Comment: Thanks, that is already a start. Can you elaborate a bit more on the other questions I asked at the end?
Answer:
However, other users on my website complain that they are immediately
  logged out after closing their browser.

They should not be, unless they have history set to Never remember history/cookies or they use an app/extension that clears the history/cookies when the browser is closed.
So the cause of the problem is really on their end.
You could use IP Login so they get logged in automatically.