Calculate amount of FLOPs for an eigenvalue problem solver

I’ve got 2 complex, non symmetric, matrices $ A_{1000×1000}$ , $ B_{1000×1000}$ and I am using Matlab to get it’s eigenvalues (functions like eig or eigs). Both matrices are different – one is more dense and the other one has more complex values. To compare the complexity of the eigenvalue solving process for both matrices I would like to calculate the amount of FLOPs needed for this procedure. Ofcourse it is possible to calculate the time need for the eigenvalue solver to complete it’s task, but this is highly unstable, since a lot of background processes might be creating some noise.

In Matlab there is no function that would allow me to get FLOPs for eigs but I might use an other software, since the only thing I need are these matrices $ A,B$ which can be exportet. Does anyone have an Idea how I could reach my goal?

How do I calculate the average grade from .txt file in Python?

I am struggeling with a Python assignment. From a txt.file the average grade of each mentor needs to be calculated. The data in the txt.file looks like this:

firstname secondname________6.7 3.5 7.7   firstname secondname________5.1 2.3 8.4  firstname secondname________7.0 6.0 9.4 

This is the code I made:

import sys  def print_grades(input_grades):     grade = input_grades.split()      grade1 = grade[0]     grade2 = grade[1]     grade3 = grade[2]      average_grade = (grade1+grade2+grade3)/3  def print_mentor(mentor):     mentor_name = mentor.split("_")      name = mentor_name[0]     grades = mentor_name [1]      print_grades(input_grades)  '''Start Program''' mentor_grades = open('class_grades.txt').readlines()  for mentor in mentor_grades     print_mentor(mentor) 

Obviously, this will not result in an output like:

The average grade of firstname secondname is 5.6 The average grade of firstname secondname is 6.3 

Can someone help me with coding so I get the output in above format?

Calculate Discount Based on Total

I’m new to Cognito Forms and am trying to give a discount once a Total is met? I have a FormTotal calculation field but it doesn’t seem to be calculate all the fields! I would like to Total the sections and base a discount off of that and then subtract that from the subtotal? Is it possible!

My FormTotal Calculation is =SquareBales.ItemTotal+RoundBales.ItemTotal

And my discount one is: =FormTotal >= 500 ? – FormTotal* 0.2 : 0

Any guidance is very appreciated!

How to calculate the attack rolls and ability checks for monsters?

Very new player here. Looking at the stat block of a goblin: for a shortbow attack it says +4 to hit and the goblin has a Dex modifier of +2.

Does this mean I add 6 to the d20 roll or just the 4 and ignore the Dex modifier?

Same with using Stealth. It says Skills: Stealth +6. So would I take 6 and add +2 of the Dex modifier or just add 6 to the d20 of the Stealth check roll?

Thank you!

How to calculate Big O of $T(n) = aT(n^b) + f(n)$?

I’m a student studying Big O. I know that we can solve $ T(n) = aT(\frac{n}{b}) + f(n)$ by compering $ n^{\log_b{a}}$ to $ f(n)$ or

$ O(n^{\log_b{a}} + f(n))$

Today I was faced with $ T(n) = T(\sqrt n) + 1$ and I think it is $ O(\log\log n)$ . and I was faced with this too, $ T(n) = T(\sqrt n) + O(\log\log n)$ that I think it is $ O(\log^2\log n)$ .

I’m wondering what is the formula (or method) to solve any kind of this type of problems (my guess is $ O(f(n)a^n\log\log n)$ ). so:

How to calculate Big O of $ T(n) = aT(n^b) + f(n)$ with $ 0<b<1$ ?

Thanks in advance.

Google Sheets Cells don’t calculate when printed or viewing as PDF

Workbook: Very large workbook with multiple tabs of data and multiple tabs of reports using sumproduct, query and filter formulas. Tabs

Payroll tab is a reflection of our master database so i’m not dead in the water; however, here’s my issue:

Query pulls data from multiple tabs (temple log, killeen log) using conditions to pull specific data. Here’s a look: Query Example

There are some hidden columns of data, but Mid, End, Wash, % Bonuses are all calculated fields off of the query data to the left columns. Everything in the screenshot above is showing and calculating correctly. When I print the sheet, that’s when things change. Formatting stays the same but some of my cells do not calculate.

Using Google Chrome with built-in PDF viewer. Also tried disabling built in PDF viewer. Chrome: Version 35.0.1916.114

The highlighted field (CPS Bonus) shows a 0 when viewing PDF and sometimes the % Bonuses have not calculated either.


enter image description here

As you see a stark difference.

My opinion is the sheet is calculating but because it takes a moment to pull all the data then calculate, Sheets generates the image for the sheet before the calculates have occurred.

Example query formula pulling data – this works flawlessly:

=if(Q1="","",query(vmerge('Temple Log'!A:Z,'Killeen Log'!A:Z),"select Col3,Col4,Col2,Col8,Col26,Col14,Col6,Col10,Col21,Col22,Col24,Col23 where (Col3='" & Q1 & "' or Col4='" & Q1 & "') and (Col11 is not null) and (upper(Col24)='M' or upper(Col24)='W' or upper(Col24)='E') ",0)) 

Example formula in CPS Bonus (does not show when PDF is generated):

=if(isblank(Q1),"",   IF(countif('Temple Log'!$  X$  2:$  X,"=W")>0, sum(iferror(filter(CPS!B4:B32*40,CPS!A4:A32=Q1)) - iferror(filter(CPS!D4:D32*40,CPS!A4:A32=Q1),"")))) 

Example formula in % Bonuses (sometimes these do not show when PDF is generated):

=        if(AND($  P$  30>0,I3>0),if($  E$  30 >= $  U$  7,if(I3*$  V$  7*E3 >M3,I3*$  V$  7*E3-M3,"")if($  E$  30 >= $  U$  6,if(I3*$  V$  6*E3 >M3,I3*$  V$  6*E3-M3,""),"")), "") 

Anybody have any ideas for work-arounds?

Can you precisely calculate x^pi(up to first 200 decimals) whitout a computer

i have reacantly discovered how to calculate R1^R2.

I have noticed that the R2 in fraction form will always be R2*10^R2’s decimal length/10^R2’s decimal length. But if R2 is a big number, it would be painfull to write the exponent and to calculate the n-th root (in this case 10^200’th root of 3.1415926(…)). Is there any easy/ efficent way to calculate this?

Btw i am a 5th grader so please try to explain it well(if possible)!

Thank you.

Calculate decision boundary of two Gaussians with different missclassification costs

Assuming we have two classes $ C_1$ and $ C_2$ represented as two Gaussians with $ (2\mu_2, \sigma)$ and $ (\mu_2, \sigma)$ . We know further that $ \mu_2 > 0$ and $ p(C_1) = p(C_2)$ .

We want now calculate the decision boundary assuming that classifying $ x \in C_2$ as $ C_1$ is three times more expensive than the opposite. Classifying $ x$ correctly has no costs.

At first we note that we need some representation of the loss function. Let $ \alpha_1$ be the decision for $ C_1$ and $ \alpha_2$ the decision for $ C_2$ , then we get

$ \begin{align} R(\alpha_1|x) &= \lambda_{11}p(C_1|x) + \lambda_{12}p(C_2|x)\ R(\alpha_2|x) &= \lambda_{21}p(C_1|x) + \lambda_{22}p(C_2|x) \end{align}$

where $ \lambda_{ij} = \lambda(\alpha_i|C_j)$ is the cost for deciding for class $ i$ and being in fact class $ j$ .

Hence we have $ \lambda_{11} = \lambda_{22} = 0$ and with $ \lambda_{21} = c$ we get $ \lambda_{12} = 3c$ .

We are now searching the the decision boundary, where it holds $ R(\alpha_1|x) = R(\alpha_2|x)$ . We can use the previous equations and substitute the $ \lambda$ ‘s: \begin{align} R(\alpha_1|x) = 3c\cdot p(C_2|x) &= c \cdot p(C_1|x) = R(\alpha_2|x)\ \Longleftrightarrow 3c\frac{p(x|C_2)p(C_2)}{p(x)} &= c\frac{p(x|C_1)p(C_1)}{p(x)}\ \Longleftrightarrow 3p(x|C_2) &= p(x|C_1)\ \Longleftrightarrow 3 \exp(-\frac{(x – 2\mu_2)^2}{2\sigma^2}) &= \exp(-\frac{(x – \mu_2)^2}{2\sigma^2})\ \Longleftrightarrow \frac{\exp(-\frac{(x – \mu_2)^2}{2\sigma^2})}{\exp(-\frac{(x – 2\mu_2)^2}{2\sigma^2})} &= 3\ \Longleftrightarrow – \frac{(x – \mu_2)^2}{2\sigma^2} + \frac{(x – 2\mu_2)^2}{2\sigma^2} &= \ln(3)\ \Longleftrightarrow \frac{-x^2 + 2x\mu_2 – \mu_2^2 + x^2 – 4x\mu_2 + \mu_2^2}{2\sigma^2} &= \ln(3)\ \Longleftrightarrow \frac{-2x\mu_2}{2\sigma^2} &= \ln(3)\ \Longleftrightarrow x &= -\ln(3)\frac{\sigma^2}{\mu_2} \end{align}

Sorry for this long equivalent transformation. Is my basic approach correct? And is my result also correct?

Thank you for reading and helping!