Computing the Cube root of a decimal number manually

In general, it will be difficult to compute the cube root of a decimal number manually?

More the precision of a decimal number, More the Harder?

Examples :

48.70

72.14

93.65

156.3451

python – NEA Computing Task 2 Dice Game

I was recently set Task 2 as seen below and I realise someone answer the question on this site here but I wanted a fresh opinion

1. Allows two players to enter their details, which are then authenticated to ensure that they are authorised players.
2. Allows each player to roll two 6-sided dice.
3. Calculates and outputs the points for each round and each playerâ€™s total score. 4. Allows the players to play 5 rounds.
4. If both players have the same score after 5 rounds, allows each player to roll 1 die each until someone wins.
5. Outputs who has won at the end of the 5 rounds.
6. Stores the winnerâ€™s score, and their name, in an external file.
7. Displays the score and player name of the top 5 winning scores from the external file.

Note: My computing teaching didn’t like me using `break` in the Login definition so I do have to assign a Boolean variable sadly.
Code:

``````try: File = open("Users.txt","r")
except FileNotFoundError:
File = open("Users.txt", "r")

File.seek(0)
for Line in File:
print("Player",Player,"logged in")
print("")
return True
else: print("Invalid Details")
return False

try:
while True:
print("")
while True:
print("")
except KeyboardInterrupt:
raise SystemExit("Exiting...")
finally:
File.close()

import random
Player1Score = 0
Player2Score = 0

def Roll():
Dice1 = random.randint(1, 6)
Dice2 = random.randint(1, 6)
print("You rolled a",Dice1,"and a",Dice2)
Change = Dice1 + Dice2
Change += 10 if (Dice1 + Dice2) % 2 == 0 else -5
if Change < 0: Change = 0
if Dice1 == Dice2:
Dice3 = random.randint(1, 6)
Change += Dice3
print("")
return Change

for X in range(5):
print("Play:",X + 1,"starting")
input("Player 1, press enter to roll: ")
Player1Score += Roll()
input("Player 2, press enter to roll: ")
Player2Score += Roll()
print("Player 1 now has a score of",Player1Score)
print("Player 2 now has a score of",Player2Score)
print("")

if Player1Score > Player2Score: Winner = 1
if Player1Score < Player2Score: Winner = 2
if Player1Score == Player2Score:
print("You both got the same score")
def SameScore():
input("Press enter to roll dice: ")
print("")
Dice1 = random.randint(1, 6)
Dice2 = random.randint(1, 6)
print("Player 1 rolled:",Dice1)
print("Player 2 rolled:",Dice2)
if Dice1 == Dice2: return False
if Dice1 > Dice2: return 1
if Dice1 < Dice2: return 2
Winner = False
while not Winner:
Winner = SameScore()

if Winner == 1:
Winner = Username1 + ": " + str(Player1Score)
if Winner == 2:
Winner = Username2 + ": " + str(Player2Score)
WinnerScore = int(Winner.split(": ")(1))
FileWritten = False
try:
File = open("Scores.txt", "r")
for X in range(len(Data)):
if WinnerScore > int(Data(X).split(": ")(1)):
Data.insert(X, Winner + "n")
if len(Data) > 5: Data.pop(5)
FileWritten = True; break
if len(Data) < 5:
if not FileWritten: Data.append(Winner + "n")
File = open("Scores.txt","w")
for X in Data:
File.write(X.replace("n","") + "n")
except FileNotFoundError:
File = open("Scores.txt","w")
File.write(Winner + "n")
File.close()
print("")

File = open("Scores.txt","r")
print("Highscores:")
for Line in File:
if Line != "": print(Line.replace("n", ""))
File.close()
``````

Any thoughts/optimisations would be greatly appreciated

rt.representation theory – Computing explicit matrix coefficients

I would like to understand in a more explicit way the Fell topology on unitary duals, that is to say the convergence of matrix coefficients of local representations.

If I consider a local representation $$pi_lambda$$ of a certain type (e.g. principal series for $$GL(2)$$ over a non-archimedean field), I would like to get an explicit dependence of the matrix coefficient $$langle pi_lambda(g)v, wrangle_lambda$$ in terms of the parameter $$lambda$$. This in particular involve explicit choices of a model for the representation and specific vectors: has this been done explicitly somewhere?

Ultimately, I want to see to what extent the Fell topology on representations corresponds to the usual topology on its (finite-dimensional) parameters.

linear algebra – Computing SVD of matrix with repeating rows and columns

I have a gigantic matrix whose svd needs to be computed.
However the matrix actually is made of rows and columns with repetitions.

The matrix of unique rows and columns, $$M_{ij}$$ is small enough to be easily handled.
The row $$i$$ repeats $$R_i$$ times and column $$j$$ repeats $$C_j$$ times.

Given (M,R,C) is it possible to reconstruct the singular values of the full matrix from the singular values of $$M$$ alone ?

computer science – Is computing strictly broader than mathematics?

We know with Coq and by software of formal calculations that computer science makes it possible to account for mathematics.

But is the reverse true : in fact there is no mathematical concept that accounts for global variables.

Indeed if g were a global variable, then we would have g which is not necessarily equal to g (indeed between the calls of g, the value of g could have been changed), which is impossible in maths , because of the principle of identity.

Question : Can we make construct in math the concept of global variable?

Computing \$int_{alpha}frac{1}{(z-a)^n(z-b)^m}dz\$

Let $$alpha(t) = re^{it}$$ where $$|a| and $$t in (0,1)$$. I’d like to compute
$$int_{alpha}frac{1}{(z-a)^n(z-b)^m}dz n, m in mathbb{N}.$$
It appears that the answer is
$$2pi i (-1)^m{n + m -2 choose n-1}frac{1}{(b-a)^{n+m-1}}.$$
I try to compute it but I’m not sure how that’s the final answer. Here is my attempt:

Let $$f(z) = frac{1}{(z-b)^m}$$, then by Cauchy integral formula
$$int_{alpha}frac{1}{(z-a)^n(z-b)^m}dz = int_{alpha}frac{f(z)}{(z-a)^n}dz = frac{2pi i}{(n-1)!}f^{(n-1)}(a).$$
Trying to find an expression of $$f^{(n-1)}(z)$$
begin{align*} f^{(1)} &= -mfrac{1}{(z-b)^{m-1}}\ f^{(2)} &= m(m-1)frac{1}{(z-b)^{m-2}}\ f^{(3)} &= -m(m-1)(m-2)frac{1}{(z-b)^{m-3}}\ &vdots\ f^{(n-1)} &= (-1)^{n-1}m(m-1)(m-2)dotsc(m-n + 2)frac{1}{(a-b)^{m-n+1}} end{align*}
I think this should be correct. So,
begin{align*} int_{alpha}frac{1}{(z-a)^n(z-b)^m}dz &= frac{2pi i}{(n-1)!}(-1)^{n-1}m(m-1)(m-2)dotsc(m-n + 2)frac{1}{(a-b)^{m-n+1}}\ &= frac{2pi i}{(n-1)!}(-1)^{2n-2-m}m(m-1)(m-2)dotsc(m-n + 2)frac{1}{(b-a)^{m-n+1}}\ &=frac{2pi i}{(n-1)!}(-1)^{m}m(m-1)(m-2)dotsc(m-n + 2)frac{1}{(b-a)^{m-n+1}}. end{align*}
But the exponent on $$(b-a)$$ is not the same. Further, I have no clue how I can get the binomial coefficient. Writing out the binomial coefficient in the given answer doesn’t seem to help me either.
$${n + m -2 choose n-1} = frac{(n+m-2)!}{(n-1)!(m-1)!} = frac{(n+m-2)(n+m-3)dotsc 2cdot 1}{(n-1)!(m-1)!}$$

ag.algebraic geometry – Computing a tangent cone

In Arbarello and al.’s geometry of algebraic curves vol 1, chap 2, the computation of the tangent cone in the following situation is explained:

Let $$f:Xrightarrow Y$$ be a morphism between smooth (complex) varieties such that $$X$$ is birational to $$f(X)=Z$$. Let $$pin Z$$ such that $$f^{-1}(p)$$ (scheme-theoretic fiber) is smooth. Then the projectivized tangent cone $$mathbb P(mathcal C_{(Z,Y),p})$$ is computed.

Now, let us consider the following situation:
Let $$f:Xrightarrow Y$$ be a morphism between smooth (complex) varieties such that $$X$$ is birational to $$Z=f(X)$$. Assume that there are non-empty subsets $$Z_1subset Z_2subset Z$$ such that the fiber over a point of $$Z_2backslash Z_1$$ is two reduced (smooth) points and the fiber over a point of $$Z_1$$ is one (thus double) point.

Is there a reference where the computation of $$mathbb P(mathcal C_{(Z,Y),p})$$ for $$pin Z_1$$ is explained?

cache – Computing miss penalty to L1 if block sizes are different in L1 and L2

I am having trouble computing the miss penalty in a L1 cache if the block size in L1 is different to the block size in L2 cache. Usually,

miss penalty in L1 = hit time to L2 + (miss rate at L2) x (miss penalty to L2)

However, if the problem specifies that block size in L1 is 32B while it is 64B in L2, does it not mean that L1 will be getting two blocks in every fetch from L2? Will this cause the computed miss penalty to be twice of what it actually should be (because we are actually computing miss penalty for 64B i.e. two blocks at L1)?

For example, with the above block size, say that

• hit time to L2 is 10 clock cycles
• miss penalty at L2 is 100 clock cycles
• miss rate at L2 is 20%

is the miss penalty at L1 half of 10 + 0.2 x 100 i.e. 15 clock cycles?

lie groups – Computing cohomology using bounded hypercovers

Let $$G$$ be a Lie group (paracompact, not necessarily compact), and $$A$$ an abelian Lie group. I want to write down cocycles in $$mathrm{H^n}(mathbf{B}G,A)$$, the cohomology in the cohesive $$infty$$-topos of smooth $$infty$$-stacks. This topos is presented by the model category $${(mathrm{CartSp}^mathrm{op},mathrm{sSet})}_{mathrm{proj,loc}}$$ of simplicial presheaves over the site of Cartesian spaces and smooth maps between them, equipped with the local projective model structure. In other words, I would like to write down morphisms $$mathbf{B}G to mathbf{B}^nA$$ using this model.

I have particular interest in $$A=U(1)$$. In that case, a fibrant presentation of $$mathbf{B}^n A$$ is given by $$Xi(A(n))$$, the image of the chain complex $$A(n)$$ under the Dold-Kan correspondence (applied pointwise). This is Proposition 3.3.21 in (Schr). The proof crucially uses the coefficient exact sequence for $$mathbb{Z} to mathbb{R} to U(1)$$. I would like to know an example of an abelian Lie group $$A$$ where the statement is wrong (and why).

Bounded hypercovers (of height k) are defined e.g. at (nLabHyp) and (ConHyp). They are those hypercovers where the covers of matching objects in simplicial degree $$geq k$$ are isomorphisms. They are relevant here because fibrant objects in the model category $${(mathrm{CartSp}^mathrm{op},mathrm{sSet})}_{mathrm{proj,loc}}$$ satisfy descent with respect to hypercovers, and because Segal’s model for Lie group cohomology is computed in (BryCoh) using simplicial covers (which are essentially hypercovers). Theorem 3.3.28 in (Schr) proves that in two special cases ($$A = mathbb{R}$$ or discrete), the cohomology can indeed be computed by Segal’s model. I tried to trace through the proof to understand why this would go wrong for other coefficient groups, but did not succeed.

Under good assumptions, $$mathbf{B}^nA$$ should be $$k$$-coskeletal for some finite $$k$$, which should allow one to use the adjunction $$mathbf{sk}_k dashv mathbf{cosk}_k$$ to replace hypercovers by bounded hypercovers in general. This motivates my questions:

When are cocycles $$mathbf{B}G to mathbf{B}^nA$$ represented by maps $$Y to Xi(A(n))$$ out of bounded hypercovers $$Y$$ of $$mathbf{B}G$$ (particularly in the case $$A=U(1)$$)?

and

Are there good examples of Lie groups $$G, A$$ as above where Segal’s cohomology fails to model the intrinsic cohomology of smooth $$infty$$-stacks correctly?

References:
(Schr): https://ncatlab.org/schreiber/files/cohesivedocumentv031.pdf
(nLabHyp): https://ncatlab.org/nlab/show/hypercover
(BryCoh): https://arxiv.org/abs/math/0011069

bitcoincore development – Two threats to Bitcoin: Quantum Computing and Mining farm seizures – what new BIPs are needed before it is too late?

1. How resistant is bitcoin blockchain against physical attacks? Contrary to other consensus mechanisms, Bitcoin’s PoW model is dependent on massive Mining Farms with tons of ASIIC hardware. These farms are known to everyone, especially the government of respective country.

Every mining farm in every country, could be sized as one example of a possible future.

What does the bitcoin blockchain do to mitigate such attack of government seizure of all mining farms in one country?

1. The bitcoin network is not using signatures or encryption methods that are especially suited against quantum computer attacks. Especially Bitcoin’s ECDSA and the PoW mining process would become easily vulnerable with quantum computers.

Many bitcoin developers here have the opinion that there is still many years time, let us wait and see what methods the NIST will be selecting.

But this is very naive thinking. Even when nobody knows it for sure, History has always proven to be like this: Very major technology breakthroughs were known way in advance before they hit the public.

When you stick to waiting philosophy, it will be too late to act when NIST picks a cipher. Something should be done before that, adding a new signature type to Bitcoin can be done with a soft fork easily for example.

What is the status of Core Developers regarding this topic?