Find the mood value with python (Rike Koi)

Introduction

I was reading Rike Koi and was urged to make a mood value calculation program, so I made it.

I tried to prove the mood value because I fell in love with science. It is a numerical value of the mood that appears in Volume 3.

Mood value definition formula

(From Rikekuma's Terminology Corner)

Define the mood value as follows

M = P_1 + P_2 + P_3 + P_4 + P_5\quad(-∞<M\leqq100)

・ P 1 </ sub> (Beauty index) = x 1 </ sub> (Average score indicating the beauty and fashion of the place)

x_1=\frac{1}{n}\sum_{i=1}^{n}\frac{1}{5}a_i\quad(-∞<a_1\leqq100,n is the number of evaluators)

・ P 2 </ sub> (third party index) If the number of people paying attention to this is x 2 </ sub>

\begin{align}
&x_2=When 0, P_2=20\\
&x_2>When 0, P_2=-10000x_2.
\end{align}

・ P 3 </ sub> (illuminance index) x 3 </ sub> = Illuminance on the spot (lux)

P_3 = \frac{1}{5}{104-2(\frac{x_3}{20}+\frac{20}{x_3})}

・ P 4 </ sub> (Quietness index) If the noise level [db] on the spot is x 4 </ sub>

\begin{align}
&0\leqq x_4 <At 20 t=100\\
&20\leqq x_4 <At 70 t=100-2(x_4-20)\\
&70\leqq x_4 At the time P_4=-∞
\end{align}

・ P 5 </ sub> (Gaze index) If the number of seconds for silent staring is x 5 </ sub>

\begin{align}
&0<x_5<At 30 S=\frac{100}{30}x_5\\
&30\leqq x_5 \When leqq60 S=100\\
&60<x_5 At the time S= 100-5(x_5-60)
\end{align}

program

Mood value.py


# M = P1+P2+P3+P4+P5 (-∞<M<=100)

# P1

# P1 = x1

n = int(input('Number of evaluators:'))
m = 1
a = 0

for _ in range(n):
    ai = int(input(str(m) + 'Eye evaluation:'))
    m += 1
    a = a + ai

x1 = (a / 5) / n

P1 = x1


# P2
x2 = int(input('The number of people paying attention to this:'))

if x2 == 0:
    P2 = 20

else:
    P2 = -10000 * x2

# P3

x3 = float(input('Illuminance on the spot(lux):'))

P3 = (104 - 2 * (x3 / 20 + 20 / x3)) / 5

# P4

x4 = float(input('Noise level on the spot[db]:'))

if 0 <= x4 < 20:
    t = 100
    M = None

elif 20 <= x4 < 70:
    t = 100 - 2 * (x4 - 20)
    M = None

else:
    M = '-∞'

if not M == '-∞':
    P4 = 30 - 1000 / t

else:
    pass

# P5

x5 = float(input('Silence staring seconds:'))

if 0 < x5 < 30:
    S = 100 * x5 / 30

elif 30 <= x5 <= 60:
    S = 100

else:
    S = 100 - 5 * (x5 - 60)

P5 = S / 5

# M

if M == '-∞':
    pass

else:
    M = P1 + P2 + P3 + P4 + P5

print('Mood value=' + str(M) + 'md')

Postscript

I feel that the following program is more beautiful for finding P 1 </ sub>

# P1

#P1 = x1

n = int(input('Number of evaluators:'))

a = []

for m in range(n):

    ai = int(input(str(m + 1) + 'Eye evaluation:'))
    a.append(ai)

x1 = sum(a) / 5 / n

P1 = x1

At the end

Rike love is interesting so please read it. Animation also starts from 1/10, so by all means !!!

Recommended Posts

Find the mood value with python (Rike Koi)
[Python] Find the second smallest value.
Find the Levenshtein Distance with python
Find the maximum value python (fixed ver)
Find the SHA256 value with R (with bonus)
Find the maximum Python
Find the divisor of the value entered in python
Find the shortest path with the Python Dijkstra's algorithm
Find the difference in Python
Call the API with python3.
Find the maximum python (improved)
I tried to find the entropy of the image with python
Find the definition of the value of errno
Extract the xz file with python
Extract the maximum value with pandas.
Replace dictionary value with Python> update ()
Try singular value decomposition with Python
Get the weather with Python requests
Get the weather with Python requests 2
Hit the Etherpad-lite API with Python
Install the Python plugin with Netbeans 8.0.2
I liked the tweet with python. ..
Master the type with Python [Python 3.9 compatible]
Find image similarity with Python + OpenCV
Find the optimal value of a function with a genetic algorithm (Part 2)
Tips: [Python] Calculate the average value of the specified area with bedgraph
Make the Python console covered with UNKO
[Python] Set the graph range with matplotlib
Behind the flyer: Using Docker with Python
Check the existence of the file with python
[Python] Get the variable name with str
[Python] Round up with just the operator
Display Python 3 in the browser with MAMP
Search the maze with the python A * algorithm
Let's read the RINEX file with Python ①
Working with OpenStack using the Python SDK
Download files on the web with Python
Find the general terms of the Tribonacci sequence with linear algebra and Python
Learn the design pattern "Singleton" with Python
[Python] Automatically operate the browser with Selenium
Get the return value of an external shell script (ls) with python3
Learn the design pattern "Facade" with Python
The road to compiling to Python 3 with Thrift
[Scientific / technical calculation by Python] Numerical calculation to find the value of derivative (differential)
Compare the sum of each element in two lists with the specified value in Python
[Python Tips] How to retrieve multiple keys with the maximum value from the dictionary
I tried "smoothing" the image with Python + OpenCV
[Python] Get the files in a folder with Python
Load the network modeled with Rhinoceros in Python ③
Prepare the execution environment of Python3 with Docker
Find the second derivative with JAX automatic differentiation
2016 The University of Tokyo Mathematics Solved with Python
I tried "differentiating" the image with Python + OpenCV
[Note] Export the html of the site with python.
Find a position above the threshold with NumPy
The easiest way to synthesize speech with python
Try to solve the man-machine chart with Python
[Automation] Extract the table in PDF with Python
Calculate the total number of combinations with python
Specify the Python executable to use with virtualenv
Use logger with Python for the time being