Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Random Algebra

Name: Anonymous 2016-08-05 16:07

Given functions
f(a,b) = random(a) < random(b)
and
g(a,b) = a < random(a+b)

which if of them is more likely to result into 1, if random(n) returns arbitrary number in range of [0;n)?

Justify your answer.

Name: Anonymous 2016-08-05 17:10

f = g, because a < random(a+b) = a-random(a) < random(b)

Name: Anonymous 2016-08-05 17:38

(defun f (a b)
(if (< (random a) (random b)) 1 0))

(defun g (a b)
(if (< a (random b)) 1 0))

(defun count-fn-one (fn up-to)
"Counts how many times FN is 1"
(loop for i from 1 to up-to summing
(loop for j from 1 to up-to
summing (funcall fn i j))))

(defun which-is-more-one? (iters)
(if (> (count-fn-one #'f iters)
(count-fn-one #'g iters))
'F 'G))


...and the winner is:

* (which-is-more-one? 100)
F
* (which-is-more-one? 1000)
F
* (which-is-more-one? 10000)
F

Name: Anonymous 2016-08-05 17:50

>>3
BYTH MUSTED: lispers are no math geniuses and LISP wont make you smarter than average nigger.

Name: Anonymous 2016-08-05 17:54

>>4
what's wrong with it?

Name: Anonymous 2016-08-05 18:04

consider f(n,n) and g(n,n)

random(n) < random(n) has 50% chance of being true
n < random(2n) has 50% chance of being true as well

so f(n,n) = g(n,n)

Name: Anonymous 2016-08-05 20:12

Suppose a < b, what is the probability that random(a) < random(b)?

First let x < b, then the probability x < random(b) is (b-x)/b = 1 - x/b

So summing over all possible values of x uniformly, probability = 1/a integral x = 0 to a, 1 - x/b dx = a^2/a (1 - 1 / b)

idk?

Name: Anonymous 2016-08-05 20:21

oh wait, = 1 - a / 2b

Name: Anonymous 2016-08-05 21:51

>>7
PROBABILITY_OF(random(a+b)) = PROBABILITY_OF(random(a) + random(b))

Name: Anonymous 2016-08-05 23:19

>>9
oh so they are equal!

Name: Anonymous 2016-08-05 23:33

>>9
random(a+b) = random(a) + random(b) cannot be guaranteed to be true

Name: Anonymous 2016-08-05 23:43

>>10-11
you are fucking retarded

Name: Anonymous 2016-08-05 23:57

>>4
lisp isn't supposed to make you smarter
it's just a bigger lever than C

Name: Anonymous 2016-08-06 0:05

>>12
no, you are the retard!

Name: Anonymous 2016-08-06 0:35

>>13
ignore him, he's the one guy here who always gets triggered by lisp

Name: Anonymous 2016-08-06 2:09

random
Shalom!

Name: Anonymous 2016-08-06 3:41

Randomness is a jewish conspiracy now?

Name: Anonymous 2016-08-06 5:38

>>17 (((RDRAND))) (((RDSEED)))

Name: Anonymous 2016-08-06 11:58

ITT mental midgets

Name: Anonymous 2016-08-06 12:10

>>19
ITT: People who don't solve your homework

Name: Anonymous 2016-08-06 14:48

>>9,11
Just fuck off back to the ima/g/ereddits already, ``please.''

Name: Anonymous 2016-08-06 17:04

>>1
``
random(n) = [0;n)

random(n+m) = [0;n+m)
random(n) + random(m) = [0;n) + [0;m)
random(n+m) = [0;n) + [0;m)

f(a,b) = random(a) < random(b)
[0;a) < [0;b)

g(a,b) = a < random(a+b)
a < [0;a+b)
a < [0;a) + [0;b)
a - [0;a) < [0;b)
[0;a) < [0;b)

f(a,b) = g(a,b)
``

Name: Anonymous 2016-08-06 17:12

>>3
This is incorrect for two reasons.
One, you defined g incorrectly. It got random(a+b), not random(b).
Two, it's only probability check for three different randoms. You should have generated random(a) and random(b) first, then feed them to simplified f and g functions*, knowing random(a+b) is equal to random(a)+random(b). Only then you would get realistic results.

*
'a = random(a)
'b = random(b)
'f('a,'b) = 'a < 'b
'g(a,'a+'b) = a < 'a+'b

Name: Anonymous 2016-08-06 17:49

>>21
you're a retard

Name: Anonymous 2016-08-06 19:37

/prog/ is now officially proven to be full of inborn retards incapable of solving even elementary school problems, with exception of maybe one or two visitors. No wonder you vote Trump.

Name: Anonymous 2016-08-06 19:58

>>23
Alright fixed. Looks like you're right.

(defun fxn (a b)
(if (< a b) 1 0))

(defun count-ones (up-to)
(let ((f-count 0)
(g-count 0)
(a* 0)
(b* 0))
(dotimes (a up-to)
(progn (setf a* (random (1+ a)))
(dotimes (b up-to)
(progn (setf b* (random (1+ b)))
(setf f-count (+ f-count (fxn a* b*)))
(setf g-count (+ g-count (fxn a (+ a* b*))))))
(return `((F . ,f-count) (G . ,g-count)))))))

(defun which-is-more-one? (iters)
(let* ((result (count-ones iters))
(f-count (cdr (assoc 'F result)))
(g-count (cdr (assoc 'G result))))
(cond ((> f-count g-count) 'F)
((< f-count g-count) 'G)
(t '(F = G)))))


And testing we see they're the same

* (count-ones 100)
((F . 98) (G . 98))
* (count-ones 1000)
((F . 994) (G . 994))
* (count-ones 10000)
((F . 9991) (G . 9991))
* (which-is-more-one? 100000)
(F = G)

Name: Anonymous 2016-08-06 20:30

>>25
if the people here were idiots wouldn't they vote hillary instead?

Name: Anonymous 2016-08-06 21:31

>>27
Unless you're a toilet scrubbing mental midget, you wont be competing with mexicans for the unqualified jobs

Name: Anonymous 2016-08-06 21:40

>>28
Oh, I suppose H1B abuse is fine with you.

Name: Anonymous 2016-08-06 21:41

>>25
But /prog/ votes Hillary.

Name: Anonymous 2016-08-06 21:42

>>28
that's not really the decider

Name: Anonymous 2016-08-06 21:53

>>29
Mexicans illegals don't have higher education. They work in fields or in construction. Programmers without educations usually do freelance web coding stuff and live in some cheap country, like Mexico itself (pro-tip: USA is not the cheapest country to live in).

Name: Anonymous 2016-08-06 21:56

>>32
Only Ukraine would be cheaper than Mexico and have passable IT infrastructure at the same time. Yet most people in Ukraine don't speak english, as they are being forced to learn russian instead. So huge economic opportunity lost.

Name: Anonymous 2016-08-06 22:00

what's the deal with insulting people who can't easily solve the problem?

is somebody insecure about their problem solving ability?

Name: Anonymous 2016-08-06 22:02

Name: Anonymous 2016-08-06 22:10

>>35
The problem with that claim is that most "fat shaming" doesn't promote a desire for self-improvement, it just promotes low self-worth. Pointing out that losing weight will make you healthier and make you feel better about yourself is one thing, but that's not the form that "fat shaming" usually takes.

Name: Anonymous 2016-08-07 2:27

[0 ; a + b] - a > 0 -> g

[-a; b] > 0 -> g

(~?) p(G) = b / (a + b)

1,1 = 0.5, 2,1 = 0.33
0,0 = 0, 1,2 = 0.66

[0 ; b] - [0 ; a] > 0 -> f

(~?) p(F) = (0.5 * b) / a

1,1 = 0.5, 2,1 = 0.25

0,0 = 0, 1,2 = 0.75?

Name: Anonymous 2016-08-07 7:21

random(a + b) = random(a) + random(b) <-- Unproven
a < random(a) + random(b)
= a - random(a) < random(b)
= random(a) < random(b)

(defun random-a+b (n)
"By how much larger is random(a+b) than random(a)+random(b)?"
(float (/ (loop for a from 1 to n sum
(loop for b from 1 to n
summing (- (random (+ a b))
(+ (random a)
(random b)))))
(* n n))))

* (random-a+b 10000)
0.8115202

Name: Anonymous 2016-08-07 9:43

>>38
and..... lispers keep being reddit laughing-stock!

Name: Anonymous 2016-08-07 10:41

>>39
pls no bully

Name: Anonymous 2016-08-07 12:00

>>38
so they're equal?

>>39
could you try being a bit more productive?

Name: Anonymous 2016-08-07 19:23

>>41
so they're equal?

Yes, I think it's definitely equal. random(a+b) is always some very small number (<1) above random(a)+random(b) but that's probably an artifact of the pseudorandom number generator.

Name: Anonymous 2016-08-07 19:26

Name: Anonymous 2016-08-07 20:47

>>43
int getRandomNumber()
{
Stopped reading there.

Name: Anonymous 2016-08-07 22:06

>>44
checkDubs();

Name: Anonymous 2016-08-08 1:23

<<37

for a>0 & b>0

p(F) = ((b*b) / 2) / (a*b) iif (a>=b)
1 - ((a*a) / 2) / (a*b) iif (a<=b)

Name: Anonymous 2016-08-08 2:10

0.5* b^2 / (a*b)
= b^2 / (2ab)
?= b / 2a

b / (a+b) - b / 2a

?= 2ab / 2a(a+b) - (a+b)b / (a+b)2a
= 2ab / 2(aa + ab) - (ab + bb) / 2(aa + bb)
= (2ab - (ab + bb)) / 2(aa + bb)
= (2ab - ab - bb) / (2aa + 2bb)
= (ab - bb) / (2aa + 2bb) [a >= b]

Name: Anonymous 2016-08-08 15:04

<anime> f(a,b) = random(a) < random(b) and g(a,b) = a < random(a+b)
<anime> how to prove they're equal?
<dalcde> anime: No one can help you until you make yourself comprehensible.
<anime> ok
* gfixler has quit (Ping timeout: 265 seconds)
* GoldenKey has quit (Read error: Connection reset by peer)
<FilipinosRich> dalcde what was the link again to your group theory notes
<FilipinosRich> If you don't mind me asking
<dalcde> dec41.user.srcf.net <---------- ### LEL hes a cambridge math toilet scrubber
<FilipinosRich> Thanks
<anime> dalcde, maybe if you had more than 2 IQ points to rub together you could figure it out ;)
<dalcde> This is ##math, not ##psychology.
<dalcde> We are not psychics.
<FilipinosRich> Lool
<xrlk> lol i hope you didnt spend 2 minutes brainstorming that comeback
<xrlk> hey Z-module got any SICK maths to teach me today????
<Svitkona> anime, what do you mean by "equal"
<Svitkona> what is random(a)
<anime> =
<xrlk> XD
<anime> it's a random number from 0 to a
<Svitkona> ok, what does f(a, b) = random(a) < random(b) mean
<anime> this is basic stuff dude
<xrlk> XD
<FilipinosRich> lmfao
<Svitkona> can you explain, then?
<anime> why act like this is confusing or hard
<xrlk> ebin trolle
<someone13> a chick once stabbed me


turns out /prog/ is smarter than cambridge math teachers, who knew?

Name: Anonymous 2016-08-08 15:13

<HisShadow_> anime: use voretion of cobenations
<anime> thanks HisShadow_, I'll try
<ayush1> did anyone find a simpler method for my problem?
<dalcde> HisShadow_: I think anime needs to compute the third derived cohomology group of the stochastic bundle instead.
<zehdeh> I have a set of points that resemble a sphere. I want a single value for every point telling me how much like a perfect sphere it actually is. Is curvature the right thing for this?
<anime> wow u must be so smart dalcde that sounded complicxed xD
<anime> i love pretending to be smart on the internet by talking about cohomology
<zehdeh> *in the area between the point and its neighbors
* cheeseboy has quit (Ping timeout: 240 seconds)
<dalcde> anime: Nah you need to find something harder.
<anime> dalcde, omg you're like sheldon out of big bang theory :D
<dalcde> Cohomology is easy. It is just computing the connected components of the hom sets with the nth delooping of the representing object in an infinity-1 topos.
<dalcde> (That is actually true)
dalcde!*@* added to ignore list.
<Svitkona> anime, can you please explain?
<FilipinosRich> Was about to say that the easy part is relative
<anime> stop pinging me
<Svitkona> anime, do you want me to stop pinging you?
<Svitkona> anime, was that towards me?
<xrlk> anime,
<FilipinosRich> anime why
<xrlk> were u talking about me??
<ayush1> rain1

Name: Anonymous 2016-08-08 18:25

>>48
turns out /prog/ is smarter than cambridge math teachers, who knew?
Nope. The problem is just too simple for them, so they make jokes out of you being stoopid. I.e. recommending you to "compute the third derived cohomology group of the stochastic bundle instead."

Name: Anonymous 2016-08-08 18:30

>>50
And that Svitkona simply uses ELIZA algorithm to troll you. So he is apparently very good at programming too, but just love to troll noobs and idiots.

Name: Anonymous 2016-08-08 21:32

>>48-49
why would you post this, do you think this represents a victory for you?

Name: Anonymous 2016-08-08 21:43

>>52
Yes. See >>4

Name: Anonymous 2016-08-08 21:50

what happened to /prog/? it's a completely different set of people now

we never used to have anyone like >>52

Name: Anonymous 2016-08-08 22:55

(this cohomology group left intentionally empty)

Don't change these.
Name: Email:
Entire Thread Thread List