Categories
Ask Mathematics

Sum of distinct orders of degree-n permutations.

I found a formula for the sum of distinct orders of degree-n permutations here https://oeis.org/A060179, but I’m not quite sure what the p prime and p, k, and x stand for. Prod(p prime, 1 + Sum(k >= 1, p^k*x^(p^k))) / (1-x). Edit: I know the answer to the set {1, 2, 3, 4, 5} is […]

Categories
Mastering Development

How To Grouping Array Data With Date From Ajax Response?

i have array data like this [{ date: “January 2019”, sum: 20, name: “Persada”, },{ date: “Februay 2019”, sum: 21, name: “Persada”, },{ date: “April 2019”, sum: 22, name: “Persada”, },{ date: “January 2019”, sum: 10, name: “Kharisma”, },{ date: “March 2019”, sum: 5, name: “Kharisma”, },{ date: “Februari 2019”, sum: 4, name: “Solusindo”, },{ […]

Categories
Mastering Development

Python custom comparator to sort a specific list

I have an input list like [1,2,2,1,6] the task in hand is to sort by the frequency. I have solved this question and am getting the output as [1,2,6]. But the caveat is that if two of the numbers have the same count like count(1) == count(2). So the desired output is [2,1,6] then in […]

Categories
Ask Mathematics

Don’t understand why Potential Function Works

Consider a puzzle as illustrated below: $$ A=\left[\begin{array}{cccc} 0 & 1 & 0 & 0\\ 0 & 2 & 0 & 0\\ 2 & 0 & 0 & 0\\ 0 & 0 & 0 &3 \end{array}\right] $$ where a $0$ indicates that the box in initially empty. Model the puzzle as a game with the […]

Categories
Mastering Development

Probability of an element in list

My data List = [[[12,1,6],[12,1,6],15],[[12,2,6],[12,2,6],18]],[[12,3,6],[12,3,6],24]] I have a data containing number of rows having a transition from 12,1,6 to 12,1,6 is 15 number of rows having a transition from 12,2,6 to 12,2,6 is 18 number of rows having a transition from 12,3,6 to 12,3,6 is 24 as list This data is not generated.There are many […]

Categories
Mastering Development

forcing a creation of 1d numpy array from a list/array of possibly iterable objects

I’m trying to see if there is a prettier way to create (i.e force the creation) of a 1d numpy array from another list/array of objects. These objects, however, may have entries that are themselves iterable (so they can be lists, tuples, etc. but can also be more arbitrary objects). So to make things really […]

Categories
Ask Mathematics

Is there a triangle array that takes the preceding number and adds one for the first and subtracts one for the second term?

I was wondering if there is a triangle array that would produce 0 1,-1 2,0,0,-2 3,1,1,-1,1,-1,-1,3 4,2,2,0,2,0,0,-2,2,0,0,-2,0,-2,-2,4 where i becomes i+1, i-1 I’m looking for a way to determine if @ row x and position y the value is 0.

Categories
Mastering Development

Is there a way to create new columns in R based on manipulations from multiple data frames?

Does anyone know if it is possible to use a variable in one dataframe (in my case the “deploy” dataframe) to create a variable in another dataframe? For example, I have two dataframes: df1: deploy <- data.frame(ID = c(“20180101_HH1_1_1”, “20180101_HH1_1_2”, “20180101_HH1_1_3”), Site_Depth = c(42, 93, 40), Num_Depth_Bins_Required = c(5, 100, 4), Percent_Column_in_each_bin = c(20, 10, […]

Categories
Mastering Development

Add multiple arrays in Python

What I have created so far I have created an 18×18 square matrix of zeros called ‘master_matrix’. I have created an array called ingreso_datos, whose column 0 [col 0] indicates the data label. I have created a for loop where: For each data label I will have a little_matrix whose values will be assigned to […]

Categories
Ask Mathematics

Find the convergence/divergence of a recursive formula that involves a summation of all previous terms

I was wondering if the following infinite sequence converges or diverges: First in words: The next term equals the previous term plus one divided by the sum of all previous terms. The first term is equal to one. Second as equation: $$a_n=a_{n-1}+\frac{1}{\sum_{x=0}^{n-1}a_x}$$ where $$a_0=1$$ Third as code: $a_n=1$ $sum=1$ For i=1 to $\infty$ $a_n=a_n+1/sum$ $sum=sum+a_n$ […]