Categories

## Editing a file based on a pattern appearance

I have a file that contains text and numbers like this: state(1, s(1,a), [s(1,b)]). state(1, s(1,b), [s(1,a)]). state(1, s(2,a), [s(2,b)]). state(1, s(2,b), [s(2,a)]). state(1, s(3,a), [s(3,b)]). state(1, s(3,b), [s(3,a)]). state(1, s(4,a), [t(1), t(2)]). state(1, s(5,a), [t(1), t(3)]). state(1, s(6,a), [s(6,b)]). state(1, s(6,b), [s(6,a)]). …so on I want the numbering with in s(x,y) to change as […]

Categories

## How to calculate the angles between each two successive lines in polygon

I tried to calculate the angles between each two successive lines in the polygon using the law of Cosines: $cos(C) = \frac{a^2+b^2-c^2}{2ab}$, but I’m getting the Error: ValueError: math domain error, because the value of the cos obtained from that rule was out of range [-1, +1]. can you please advise me how […]

Categories

## Can Excel autofill one range but copy another in the same autofill operation?

I have a table in Excel which I need to copy 80 times, and have each one be numbered sequentially. (Table 1, Table 2, Table 3 … Table 80) However, one of the columns in this table contains the text (P1, P2, P3, P4, P5, P6). When I drag the autofill thing down to copy […]

Categories

## How to convert data to log10 while ignoring or removing the values of 0?

The code I’m using: pay3 = [‘P1’, ‘P2’, ‘P3’, ‘P4’, ‘P5’, ‘P6’] logs = np.log10(df[pay3]) So my "pay3" variable is a group of 6 columns from my data frame. All of the data are integers. I’m trying to convert the data in those columns to a log10, and I also need to ignore the values […]

Categories

## R conditional loop to replace vallues

I am looking to conditionally replace values in a column and I think a loop is what I need. Though I know on a basic level how loops work, I have little experience using them so I struggle with wrapping my head around the order of operations. Using the dataframe df <- structure(list(player = c(“p1”, […]

Categories

## Replace underscore with white spaces and make the first letter of the name and the surname to upper case

i want to replace _ (underscore) with white spaces and make the first letter of the name and the surname to upper case while printing the nameList in searchKeyword method. #include <stdio.h> #include <stdlib.h> #include <string.h> void searchKeyword(const char * nameList[], int n, const char keyword[]) { int i,name=0; char *str; const char s[2] = […]

Categories

## Markov models and calculating the period of each state

I am currently studying Markov models from the textbook Introduction to Modeling and Analysis of Stochastic Systems, second edition, by Kulkarni. I have just encountered the concept of periodicity in chapter 2: Definition 2.4. (Periodicity). Let $\{ X_n, n \ge 0 \}$ be an irreducible DTMC on state space \$S = \{1, 2, \dots, N […]

Categories

## Using regular expressions to multiply and sum numeric string characters contained in a hash of mixed numeric strings

Without getting too much into biology, Proteins are made of Amino Acids. Each of the 20 Amino Acids that make up Proteins are represented by characters in a sequence. Each Amino Acid char has a different chemical formula, which I represent as strings. For example, “M” has a formula of “C5H11NO2S” Given the 20 different […]

Categories

## Time difference in execution of MySQL joins

I had a queries in which there was left joins were used and it was taking 30 seconds to complete the execution and return the dataset on mysql terminal. But when I have changed it to join its execution time has been reduced significantly from 30 to 12 seconds. I know this is too much […]