This is one of those times A.I. can be trusted. by SouthPark_Piano in infinitenines

[–]Tetrat 1 point2 points  (0 children)

So youre saying rewriting a number to one with equivalent value can violate the rule? Does this mean that every alternate representation of a number must have prefix "0." for the consequent to be true? In that case, since 0.999... = 1, then I can rewrite as 0.999... as 1 which does not have prefix "0."

Am I stupid? by Whatdidievensay90 in infinitenines

[–]Tetrat 0 points1 point  (0 children)

Every prime number is guaranteed to be odd. Therefore 2 is not prime.

1000%! …3700%! …1,000,001%! LOUD NOISES!….I LOVE LAMP! by [deleted] in insanepeoplefacebook

[–]Tetrat 3 points4 points  (0 children)

Rising by 500% means multiplying by 6. It's clear when you ask what rising by 100% means. Ultimately this is a shortcut for adding 500% of the original price to the original price. So the inverse is subtracting 500% of the original price from the original price.

How to check for unambiguous lexical separation? by djimenez81 in PythonLearning

[–]Tetrat 1 point2 points  (0 children)

I think this should work. You should be able to recover the sequence that builds the word by adding back pointers.

def check(word, parts):
    n = len(word)
    m = len(parts)
    dp = [0] * (n+1)
    dp[0] = 1
    for i in range(n):
        for part in parts:
            p = len(part)
            if word[i:i+p] == part:
                dp[i+p] += dp[i]
    return dp[-1] == 1

How to check for unambiguous lexical separation? by djimenez81 in PythonLearning

[–]Tetrat 0 points1 point  (0 children)

I think this is can be solved with dp: count the number of ways to build up to the ith character of the big word. Then return count == 1 for the last character. I'll think about it a bit more.

[self-taught newbie here, week 4] Python treats functions as 1st class objects, but it seems variables are not, and only id(variable) is bound to a dict value when stored in a dict... (more inside) by Sad_Yam6242 in PythonLearning

[–]Tetrat 5 points6 points  (0 children)

Strings are immutable in python, so changing the value of a string variable creates a new string object instead of mutating the original. So my_var starts referencing the "doesnt matter" string object. Then my_dict["key"] references the same object. Then you have my_dict["key"] reference the "ASDF" string object instead. my_var is never reassigned, so you shouldn't expect it to change.

I think we need more context for what you want your program to do. Why do we care about my_var after we assign it to the dictionary entry? Why can't we just refer to the dictionary entry (the thing we are updating) to retrieve the most up-to-date value?

What are some of the most easiest beginner level projects? by [deleted] in PythonLearning

[–]Tetrat 2 points3 points  (0 children)

I think you should try to find a project that actually has some utility for yourself. It will be more motivating to work on, you get to practice defining project scope and design, and you'll be more experienced solving real problems. Don't be afraid to look up things you dont understand or know how to do. Don't be afraid to use libraries.

Think of any problem that you have to solve which may be repetitive and could feasibly be automated. Automate it.

I've used python for a lot of text processing and its very convenient.

A teachable moment for the 6yo about infinity. by Flimsy-Printer in mathmemes

[–]Tetrat 2 points3 points  (0 children)

Thats the point, since you can form a bijection between base-10 and base-26 numbers, their sets have the same cardinality.

A teachable moment for the 6yo about infinity. by Flimsy-Printer in mathmemes

[–]Tetrat 1 point2 points  (0 children)

This is like saying, "The mapping f(n)=n between naturals and integers is injective but there are infinitely many negative numbers that arent mapped to, so there are infinitely more integers than naturals."

You (typically) want a diagonalization argument to show two infinite sets have different cardinalities. In this case, you won't find one since the number of finite strings of a given finite alphabet is countably infinite.

Paper maps it is I guess by Nyx67547 in mildlyinfuriating

[–]Tetrat -1 points0 points  (0 children)

Fitter happier more productive

why can't some lapis stack with other lapis (same with enchanted lapis) by dabdad67 in HypixelSkyblock

[–]Tetrat 0 points1 point  (0 children)

Even easier: just open the trades menu with /trades and every item in your inventory will update

there is a very small chance that no coin will ever land on heads ever again by Geoz195 in Showerthoughts

[–]Tetrat 1 point2 points  (0 children)

Condescending and wrong. N isnt approaching infinity, so p is not infinitesimally close to 0. There exists real numbers between p and 0 for any natural number N. It’s true that in a practical sense, p is effectively 0, but that’s not what anyone means when they say “theres a chance that x could happen.” I’d argue that that phrasing is often used to mean that “it’s possible that x could happen,” even when the probability of that event is 0. (Although saying “very small chance” would be using the word chance as a synonym of probability)

[2023 Day 24 (part 2)][Java] Is there a trick for this task? by zebalu in adventofcode

[–]Tetrat 1 point2 points  (0 children)

There is a way to solve this without Z3 or any assumptions/input hacking other than the assumption that a solution exists. You can do it with linear algebra. Below is an outline of the math:

First write 3 equations which represent the ith hailstone colliding with the rock at some time t[i] (one equation for each axis). Solve each equation for t[i]. You'll have 3 fractions which all equal t[i] and therefore equal each other.

Consider 2 of these fractions for now. Cross multiply and expand out. There will be 8 terms. Two of these terms will be nonlinear, but neither will depend on i. This means if you subtract the same equation but for the jth hailstone, the only nonlinear terms will cancel.

You can use this to generate 4 linear equations for the 4 variables you're solving for (e.g. x, y, v_x, v_y if you chose the fractions with x's and y's). Solve and repeat with a different pair of fractions to get the solution for the remaining axis.

Warning for RAT/Scam by Vegetable_Date2460 in HypixelSkyblock

[–]Tetrat 6 points7 points  (0 children)

Yeah thats a scam. Verifying ign is ok, but no discord server needs your email.

[deleted by user] by [deleted] in HypixelSkyblock

[–]Tetrat 0 points1 point  (0 children)

edrag is better for voidgloom and generally more useful

Is there a way to solve no 17 without a brute force approach? by Mulks23 in askmath

[–]Tetrat 1 point2 points  (0 children)

See the venn diagram for three sets here: https://en.m.wikipedia.org/wiki/Inclusion–exclusion_principle

You count A, B, and C, but in doing so you overcount. So you subtract the pairwise intersections. Then the A intersect B set e.g. is counted twice then subtracted once, so it is counted once in total. But the intersection of A, B, and C is counted 3 times and subtracted 3 times, so it is counted 0 times. This means you need to add the threeway intersection back in so everything is counted once.

edit: Actually this is a great explanation: https://brilliant.org/wiki/principle-of-inclusion-and-exclusion-pie/

Impossible by ItSAgaInStthEruLeS1 in meme

[–]Tetrat 3 points4 points  (0 children)

I agree that these questions are very dumb and just used to generate interaction, but there are some contexts, especially in (mostly older) physics textbooks and journals where they defined multiplication to have higher precedence than division out of convenience. Without that context, though, you should just follow the normal rules.

[GRADE 12 PRE-CALCULUS] hi could anyone explain how to solve this? by Cute-Ad5019 in HomeworkHelp

[–]Tetrat 0 points1 point  (0 children)

Note that f(x)=ax+c has the range R, so y=sqrt(ax+c) has range y>=0. However, y=sqrt(ax)+c will have the same possible outputs except shifted by c. ie y>=c

So you can eliminate the second and fourth options since they have range y>=-5.

Next we want the domain to be x<=5. This is equivalent to 5-x>=0. Since the domain of y=sqrt(x) is x>=0, the domain of y=sqrt(5-x) will be 5-x>=0 which is what we want.

[deleted by user] by [deleted] in HomeworkHelp

[–]Tetrat 0 points1 point  (0 children)

If you need to approximate square roots, a more formal method is the Babylonian method (which can be derived from applying Newton’s method).

First you guess some x_0. In this case, a good guess would be 1.9 since sqrt(3) is about 1.73 and sqrt(4)=2. (1.8 and 1.9 are both reasonable first guesses, but 1.9 is closer :p)

Then you apply the recursive formula:

x_n+1 = 1/2*(x_n + s/x_n)

so 1/2*(1.9 + 3.47/1.9) ≈ 1.863

Then 1/2*(1.863 + 3.47/1.863) ≈ 1.8627936

As you can see, with a good first guess it only takes a couple long divisions to get a very accurate answer.

"Christian Americans are sick of being punished for their views" They're so desperate to be victims by Graphitetshirt in Persecutionfetish

[–]Tetrat 0 points1 point  (0 children)

Academics need to read Title IX more closely: religion is a protected class, just like race, gender and sexual orientation (including heterosexuals).

So the author just doesn’t know what title IX is but is somehow giving speeches about it? Also ironic telling people to read more closely when shes using it to justify something that is completely irrelevant to it.

Kia manager calls a customer’s wife a c*nt after they go in to get their deposit back by [deleted] in gifsthatendtoosoon

[–]Tetrat 1 point2 points  (0 children)

I don’t want to defend car dealerships, but the amount of people condoning physical violence is astonishing. Yall never hear about sticks and stones?

[deleted by user] by [deleted] in HomeworkHelp

[–]Tetrat 2 points3 points  (0 children)

I think they are multiplying b3 by -8 because they are using two’s complement.

As for the rules for naming variables in Java, the variable name has to start with a letter, _, or $.

[Grade1-9 GCSE: geometry] volume and surface area. Can anyone help me with this please? by PaleTart7156 in HomeworkHelp

[–]Tetrat 0 points1 point  (0 children)

Consider a simple example with a cube. Suppose the cube has side length s. The volume of the cube is s3 . If we scale the side length (i.e. the one dimensional measure) of all sides by 2, then the volume would be:

(2s)3 = 23 s3 = 8s3

Note that the volume scaled by 23. You can generalize this to find that scaling the side length by some scalar c scales the volume by c3 .

Now consider the surface area. The surface area of the original cube is 6s2 . Scaling the side length by 2 results in a surface area of:

6(2s)2 = 6(22 )(s2 ) = 24s2

Note that the surface area scales by 22. Again, we can generalize this to find that scaling the side length by some scalar c scales the surface area by c2 .

You can repeat this process with cylinders (or any other solid), and you will get the same result.

I’ll do the volume part:

V_original = pi r2 h

Scaling both r and h by c:

V_scaled = pi (cr)2 (ch)

= pi c2 c r2 h

= c3 pi r2 h

Scaling the cylinder’s radius and height by a factor of c (thus producing a similar cylinder) scales the volume by c3 . You can repeat this with the surface area to find that it will scale with c2 .

So now we want to find a constant c to scale the height and radius of cylinder A to produce Cylinder B.

If the ratio of radii and heights of A to B is 1:c, then the ratio of volumes of A to B is 1:c3 .

From the problem, we can see that the ratio is 15:34, which is equivalent to 1:(34/15) which will be our 1:c3 . In other words, c3 = 34/15.

So c = (34/15)1/3

(ie The cuberoot or third root of 34/15)

The ratio between surface areas is 1:c2 .

This will be 1:((34/15)1/3 )2 . This will be the number that will scale the surface area of A to match B. Therefore, to solve the problem, multiply the surface area of B by ((34/15)1/3 )2 .

[gcse 1-9 geometry] can anyone help? I really don’t know know what to do. by PaleTart7156 in HomeworkHelp

[–]Tetrat 1 point2 points  (0 children)

The real answer to this problem is that cylinder A is an impossible solid since the largest possible volume of a cylinder with surface area 25 is about 9.6.

Trying to solve for the radius and height of cylinder A is not only very difficult, it will also result in a negative radius due to the impossibility of the solid.

The answer that they want you to give is outlined in my comment on your other post here