#algos-and-data-structs
1 messages · Page 75 of 1
and maybe do this in a mutex so no one else tries to acquire the semaphore while it's being flushed.
but there might be a better way, that wont be so implementation dependent.
I mean sure
An Event is basically a Condition around a Lock and a flag
a semaphore is the same but instead of a flag it has a value
But you could definitely abstract around the value to only use 0 and 1 and broadcast events with it
https://www.microsoft.com/en-us/research/wp-content/uploads/2004/12/ImplementingCVs.pdf
historically at least, it seems semaphores are used to implement condition variables, not the other way round.
An Event is basically a Condition around a Lock and a flag feels the other way round too. that a Condition variable would be an Event and a Lock.
I mean, semaphore is the building block of a mutex
and mutex is the building block of thread-safe data structures that can tell you when new data arrives
so yes?
Hey guys, sorry if this isn't allowed but I'm doing a college project on cyber-crimes. If you could take 2 minutes to fill it in, it would be greatly appreciated.
THIS IS NOT ALLOWED
HOW FUCKING DARE - One sec, ganna fil this out before I continue
@cursive frigate done. Some of the questions are a bit ambiguous. 'Have you been affected by...'. Well yes, there are bots hammering on ssh every few second; no, none have been successful. 'Do you use an anti-virus?' Well yes, Windows Defender is installed on all computers Windows 7 and up; no, I don't pay for shady garbage AV products.
Yes, I have received fraudulent emails; no I have not sent $2000 in Google Play cards to tech support scammers.
Thanks guys, it's not that serious. It's just so I have some data to present. People reading it won't have a fucking clue what what's behind a prince of Nigeria email lol
Hey guys, I have known python as a Physics student for a while now, but recently I have
joined as a grad student in a CS department, and the people here are light years ahead of me in coding.
I feel I lack basic design principles and any understanding of OOP principles. I feel this is a gap which I cant fill just by programming
on my own, I need some technical guidance from a book with examples, which will let me design medium to large scale
software which are modular and neater. I really want to learn this in the most canonical-pythonic way possible.
Does anyone have any references ?
@simple matrix take a look at ffmpeg
@fiery cosmos unrelated, but have you done anything with gravitation in your physics classes?
@fiery cosmos If you already mastered the fundemntals and know how to impliment classes, functions, basic control flow and whatever, go through "Fluent Python: Clear, Concise, and Effective Programming" (I am also a physics person going into CS) it's a great way to learn how to make hyper effective programs. I don't know if it gives you the complete structure of a program, but it's pretty f***ing good.
It wont teach you computer science principles with runtimes or advanced data structures like heaps, sorts, trees, linked lists, or graph structures, for that you should take MIT opencourseware into to algs 6.002? (fall 2011)
@gusty grove There are lots of ways you could be asking that question. You learn about basic gravity in your intro class. But that is without respect to relativistic gravity equations which is different from other stuff like how light deals with gravity or calculating tidal forces or how gravity waves interact with objects and give off momentum or whatever
Ok, specifically the n body problem
Ah, I think you were on this a few days ago ?
What about it
So, in physics a big part of understanding the dynamic interactions between objects is the continuous /non-discrete sum of their behavior over time
LOl
sorry Sagar
Now, @gusty grove There is a clear defined solution for the single body case where one object is completely stationary and the other object is moving
It's given by one equation
There are equations that satisfy the n <= 2 body problem
There are no equations that satisfy for the n>3 body problems
Yeah exactly
That is what discrete means
But you could do iterative continuous functions as well
Ah
For instance, iterative integrals/derivatives wouldn't be discrete
SO as a naive/simple approx for your approach is you would calculate the aprox gravitational pull between each N object which gives you N! different gravities to approx
Then you calculate the discrete time step of that interaction
Then update the velocity due to accel
and then rinse repeat
Unfortunately it gets too big to calculate with n >15? objects
im doing the calculations on the gpu so i can go up to a few hundred/thousand
I don't think that matters
how should i handle collisions?
GPU doesn't solve this because the number of objects interacting with oneanother grows factorially
the number of interactions at 80 is larger than the number of particles in the known universe
So typically you use approxs to handle that many particles, and other tricks to reduce the problem size dramatically
You could handle collisions as Inelastic collisions
and total mass is just m1 +m2
You could also make them act like billiard balls
ah ok
That's a different equation
yo i'm doing a pretty Coding and Algorithms thing (my own implementation of the Wave Function Collapse thing) and i need someone who is good at the computers to help me figure out more efficient recursion stuff
if anyone likes this kind of stuff and has a minute to spare please ping me here and i'll send the details
okay the chance is basically zero but have you heard of wave function collapse
(the 2016 algorithm not the quantum thing)
(it's named after quantum thing)
here's the github https://github.com/mxgmn/WaveFunctionCollapse
I'm looking it up now btw
anyway i'm working on a python remake myself cause i feel like it
here's a very very good explanation https://youtu.be/fnFj3dOKcIQ?t=304
This talk is from the 2019 Roguelike Celebration - find out more at https://roguelike.club/event2019.html
Brian is a developer at Freehold Games and has worked on Caves of Qud and Sproggiwood
from a very cool person
(starts at useful timestamp)
so here's the highlights of how i'm doing it
(i'll get to the question bit dw)
make the 'cards' by chopping up the input
each card has a 'sphere of influence'
basically cards can affect things 2n-1 away
in both axis
so if we have 2x2 squares, i can affect things up to 1 away from the centre
3x3, affect things up to 2 away
does that follow
(like it works but does that explanation make sense)
I am not sure why a 3x3 thing should effect things upto 2 spaces away
wait
from the center
Sure
yeah
That seems like a weird definition
each 'card' is positioned so the top left is 0,0
okay maybe that's my dumb thing
yeah
nah 2x2 can effect 8
cause whilst it overlaps on the bottom right, it also has to get covered top left
3x3 hits 24
sounds like (2n-1)^2 - 1 to me btw
Yeah you're right
okay so we can precalculate card overlaps
It's 2n-1 because that's how squares work
like if this card were to be here, what can the relative cell (2,2) away be
1,4,9,16,25
1+3+ 5 +7 + 9 . . .
each card has an id, and then it has a 2d list of the acceptable cards away from it
vewy efficient, vewy nice
so we've precalculated everything about each card
so we've precalculated everything about each card
I'm following you
i'm calculating entropy as just 'how many options are there'
not the entropy formula but since we're calculating only one relative to another then nbd
(unless it is a bd without me realising since maybe original algorithm does something like comparing sums of them? who knows)
(the original algorithm calculates entropy as nlogn)
that
like this decision only matters for choosing which stack to collapse
i've seen another implementation that does it the naive way like me and it seems okay
It's fine depending on what we are talking about
I would imagine you are trying to reduce the states with the lowest entropy
yeah
which then updates neighbors
legit that just looks the prettiest apparently
well the big deal is how we propogate the information
It doesn't seem to be that big of a deal TBH
so collapsing is obvious, choose a cell with the lowest entropy, and set all but one of its acceptable cards to false
I am wondering for instance if it is possible to get into a state of contradiction
true
well all the compute time for me is spent on propagating so i'll explain what i'm doing
That seems like that wouldn't be that computationally intensive
It should be very easy
you'd think
anyway the first thing i tried was basically
- try to update each cell in the sPhErE oF iNfLuEnCe (left to right, top to bottom)
- if an update needs to be made, then it could also affect other stuff, so run step 1 but from this new point as well
n=2 was kinda okay
but n=3 caused stack overflows
so much wasted shit
Code ?
so i switched to a queue thing
mind if i put it on a hastebin
It's whatevs
well right now i just add everything to the queue, and instead of recursing the whole function i instead add stuff to the back of the queue
(if it's already there don't bother)
My instinct is that everything can be done procedurally
okay just for context
n=2 is a bit fast
n=3 takes like 11 seconds per collapse cycle
the original algorithm can do like 30 a second
so i can agree i'm doing something wrong
it's just the original was written like it was made in the 90s or some shit
Do you know about graphs and relaxation ?
It's okay. It's tangentially relevant, the same solution for shortest path will I think apply to this problem which essentially is a graph problem
I'm just going through your code at the moment
Lol
just one quick insight thing: part of the problem that i've found is that you often have to update things multiple times
That's fine
cause its surroundings can change
I'M SORRY THE CODE HAS BEEN THROUGH A LOT OF CHANGES IT PROBABLY LOOKS VERY CURSED RN
weird commented lines everywhere as well
like it SHOULD or it does?
So what is happening is that you have an expanding boundary
and each pixel should only be on average be investigated 3 times
did 3 come from a back of the napkin thing or is that hard maths
and does that apply to n=3 only or all n
um
If it is concave/convex it'll be more/less
man that feels so correct but it feels wrong
also n=3 it would be affected from further away but like
okay here problem
WAIT
WAITING
*quietly (so like, line a updates line b above it, which updates line c above that, but that may have ramifications for line a)
(that's the problem i'm having)
(n=4 is same problem +1)
does that mean i'm dumb
I am asking about the sphere of influence
That things can effect things from 3 lines out
You are growing problem exponentially then yeah?
yes!
that's why i'm so confused as to how other people get it right!
n=2 runs at an acceptable speed
okay should probably be a bit faster but like
yeah
output is a linear problem
It's still not that bad
if i double the size of the output, it takes about twice as long
TBH
basically what am i doing wrong
So, whenever you settle a tile (collapse it)
i've done the profiling btw, it spends like all its time on that one bit where it compares the two lists
You immediately update all effected tiles
aka do these tiles overlap okay
So when you check to collapse a tile, you never ever check for upates
you just run whatever state it is at and collapse it with the probability distribution
then you update tiles based on it's updated value
So lets say n = 3
sorry are you telling me what is happening or what should be happening here
also by collapse do you mean 'making an observation' in the quantum phrasing
i don't
SO in this case you are given a set of probabilities for a particular state
And you run the weighted probabilities and see what happens
You take your weighted probabilities and run a random.randint + weighted prob or something
and see what it's collapsed state is
right ?
yeah
like, different cards appear more or less often on the input
so i just have each card come with a count and do a weighted
'cards' are a NxN
Sure
so yeah state
For your program that is what that means
yes
But i think what I am saying is true for all cases
so collapsing is easy, that bit's not a problem
What's the problem ?
propogating
?
like, updating everything else
yeah sorry this is why i was confuse about terminology
there's an initial collapse for each iteration
that's where it makes ONE DECISIVE DECISION
and does something random
but then everything else that follows isn't random
i'm like pretty sure it's true
yeah
you choose randomly between the cells of lowest entropy
collapse bit isn't the hard part
that's definitely random
but the idea is you then propogate that information so that all the cells then know what is and isn't available anymore
That seems really easy
cause collapsing removes options, so a bunch of overlaps aren't gonna work anymore
yeah it seems easy but don't forget i'm an idiot
hell yeah
and remember, two wrongs don't make a right
Wait
There is nothing to go from there 😦
to go from where
The screenshot
yeah the phrasing is dumb
your code requires an enigma machine
my code is fine art
fukin freudian keyboard there
LOL
it's also a mess cause i keep adding in logging elements
and all those globals need to go
cleanup comes after i figure out a better formula tho
my iteration thing right now is wack but i can't think of a better one
the queue thing seems alright in theory since it makes sure to deal with the priority stuff first
but like
it doesn't
i dunno how to figure out priority
cause everything affects everything
@acoustic fox i do warn you it's possible that i've just blinded you from seeing the really obvious explanation to the problem by explaining my solution
i do that a lot to people lmao
i was doing this question in physics about how long it takes the moon to orbit the earth and my teacher couldn't figure out what i was doing wrong cause i managed to convince her that it actually takes a year for that to happen
I KNOW I'M AMAZED I GOT IT WORKING AT ALL
this is like the first time i've done some proper sexy algorithmsss and not just fukin with the requests modules

@acoustic fox uhh it's like sleep oclock where i am
thank you so so so so so much for the help
Take a look at this
LOL
Basically each cell has a dictionary of possible states through bools or weighted values.
You have a dic that has a set of rules for each state on how it affects its neighbors.
You go through a list of affected neighbors and you update their cells internal rules through the dictionary calls.
yup
wait
what
uhh
UHH
so you only go through each cell once?
We collapse cell (1,2)
It updates each adjacent cell within its square of influence once
Then we add those adjacent cells that are updated into the priority queue of cells that need to be collapsed
so far so same
if 0,0 updates ((0,1),(1,1),(1,0) you update the priority queue and then you go through things one by one
wait what
what
cells that need to be COLLAPSED?
WAVE FUNCTIONS COLLAPSE
Yeah it does
you haven't updated the entire output yet
like
okay
hang on
when you say collapse, do you mean choose one at random?
and make that the only option?
cause you can only do that when you KNOW the rest of the board is okay
You choose cell 0,0
You collapse cell 0,0.
-> you update cells (0,1),(1,1),(1,0)
You add those cells into the priority queue of the next cells to be collapsed
[(0,1),(1,1),(1,0) ]
You update (0,1)
you update cells [(0,2,) (1,1),(1,2)]
You add them to the priority queue
[(0,1),(1,1),(1,0), (0,2,),(1,2)]
you sort by lowest entropy
[,(1,1),(0,1),(1,0), (0,2,),(1,2)]
You update (1,1)
Repeat
(This is if n = 1)
i'm lost
??
n=1 is no overlap
the size of the patterns you get from the input is NxN
well yeah 1 reach n=2
You can define things by their reach or their space from the center
In this example I have boundaries that you can't have negative numbers
starting from the top left of a square in this case
Just to make it simpler
but i need to clear up
when you say collapse
do you mean choose something at random
Collapse means you define the state of the celll
or do you mean update the cell according to its neighbours
By random, by probability, by discrete choice, it doesn't matter
if you collapse a cell, it becomes the state of 'sand'
and it isn't probabilistic/anything else anymore
It is fixed
And it should never change ever again
but the algorithm doesn't work by just collapsing cell after cell, it has to update the whole board inbetween
....
It does update the baord
board*
When you collapse a cell, it updates every other cell it can reach
Then you go onto the next cell
but you can't just update 0,1 1,1 and 1,0, cause you also need to update the neighours of THOSE
??
You are saying a -> b - > c?
where a b and c are ?
cells
What is the range of A?
say a can only reach b
and b can only reach c
there's still a knock on
if n=3 then maybe a can reach c and then it gets even harder
So
but a change to one cell effects more than just its neighbours
This is still fine
I mean
Computationally it's going to explode because you are getting into !n territory
sorry how do you approximate whether patterns overlap
because technically c -> b ->d ->c again
And you can use an integral / infinite series to get an analytical solution
but fuck that
In this case
so what's the insight
yeah you're starting to see the problem
It's not really a problem
the relationships are complex and everything needs to be updated from all angles
hence a recursive technique
ohh
ohhhh
wait no i very nearly had it
fuk i need to do sleep
or i'm gonna die
if you have any more magic thoughts on this please do send
also btw this algorithm is literal magic it has so many untapped possibilites
my favourite is that you can have one axis be time
no one has made game of life yet but i'm convinced it's possible
someone get on it
who is better than me
okay gonna fukin slep
thank you so much for doing brain
whenever people of your culture sleep i hope it's really great
Is a white paper describing the process
I think the way you are describing is just a particular way you value possible outcomes but is not endemic to the process as a whole
FUK I SAW THAT PAPER AGES AGO BEFORE I'D FINISHED THE FIRST WORKING VERSION
THAT IS VERY HELPFUL
THANK YOU VERY MUCH
okay that's my takeaway now i go die
also go play caves of qud it's why i'm doing this in the first place
byeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
thank you :)))
New channel?
Yeah - been here a few weeks now https://discordapp.com/channels/267624335836053506/354619224620138496/650413660933586945
You have me to thank! >:DDDD
First rule of computer science channel, don't talk about computer science channel
Hello, what's the best module to solve differential equations on python?
@acoustic fox ha! it works
Unfortunately it gets too big to calculate with n >15? object
as if! i can go up to n=10**5 easily with a dt of 1/1000
and well even smaller dt for smaller N
gpus really are amazing
im not handling collisions and just using a cutoff to avoid zero division so the system does lose energy on collisions
gonna have to fix that
Opengl yup
How did you deal with the reflection issue ?
@tribal pendant I don't know about "best", but I'd look at https://www.sympy.org/en/index.html
@acoustic fox Thanks alot. Went over the reviews and index so far , seems exactly the book I was looking for
@acoustic fox whats that?
@gusty grove
Butt out
I help more people than just you
If I am not mistaken, I recommended http://shop.oreilly.com/product/0636920032519.do
♥️
@acoustic fox This book is fucking insane, chapter one is teaching me much more about all frameworks I have ever used than all frameworks i ever used did ! ;D
Fluent Python is my favourite Python book. There's a new edition coming out in a couple of months that updated to Python 3.8.
Still, the current version is still really relevant
Although the chapter about coroutines is in need of an update, since it uses pre-async def/await syntax (yield from and generator.send)
@acoustic fox well you haven't really helped me yet, why don't you Start? ;)
Is there any good libraries to compare audio features between two files?
Like comparing 1s of one file to 1s of another or something like this
the task of first extracting the signal with FFT and then plotting it on a spectogram myself seem a bit daunting tbh
There are some great fft libs out there :)
And matplotlib is great for plotting
Numpys fft
LOL
I drew you a pretty gravity picture, that counts.
more fluent python for me today.
@stark bridge Ty, but I was more looking at a method to generate approximate functions rather than a tool that tries to "solve it" formally (because it's impossible to solve), but that's my fault I didn't specify enough my question 🙂 Ty anyway!
For those who are interested, I used scipy.integrate.odeint and I did the work.
Could someone explain me how is an audio file encoded on the PC? what does the PC read? the MHz on each point for different channels?
cuz as far as i know, it only sends pulses to the speaker
and the speaker moves according to them
so what are the different channels for?? to make the sum on each point and send that result?
Putting aside all the container formats and different compressions, look up PCM
Multiple channels is so different signals can be played simultaneously
how is gonna a single speaker play different channels at once???
You can't unless you have electronics to combine them together
It's useful when there are multiple speakers e.g.headphones
usually you have two channels for two speakers i.e. left and right
@long sleet So it's actually the case that you can approximate any signal through an infinite sum of sine waves
a FFT breaks down a signal into sine waves and transmits their coefficients (2? I think?) and that is what is what is stored on your computer. So once you have a format of coefeccients it is easy to reproduce the sound by reversing the FFT and recomposing the signal into AC and then driving a speaker
You can have a speaker play multiple 'channels' if you want
But then you move from having a dual/stereo system (where audio is coming from two sources) into a mono system. (Audio is coming from one source) It's very easy to take two signals and combine them
okey, maybe my question was bad
Encoding audio files is different/tricky because with a FFT you are dealing with infinite sums, some coefficients aren't that important so you discard them
what is the difference between an song from nowadays and a 8-bit song?
what do those 8-bit represent?
cuz i know normally songs have 44100 points per second
iirc
ok, 8 bit usually means
not 8 bit literally in terms of sample size [though that does exist]
ye ye xD i supossed that ahahah
but people say "8 bit" when they mean "the style typical of 8 bit game systems"
8 Bit doesn't mean sample size I believe ?
yes it does, sample size is usually either 8 bit or 16 bit
That ...doesn't actually make sense TBH
8 bit can be linear, µ-law, a-law, etc
does the 8bit has anything to do on the ammount of points stored?
or the maximun value they can have?
yes what i'm saying is there's also legitimate 8 bit sample size pcm
8 bit sample at 200 hz is going to be 1 bit sample at 1600 hz
thats not how it works
okey, my question came when ive listen an anime opening on 8-bit format xD
how is that made?
taking the original and reducing the quality
or recreating the original as if it was 8-bit?
I don't know if 8 bit represents the total tonal output
or that can be done in both ways?
or the aplitude of the output , I think it is tonal frequencies ?
like i said the term "8 bit" has several different meanings
"Subcribe" OOOOPS
Download: https://soundcloud.com/pip-pap/sword-art-online-opening-1-crossing-field-8-bit-nes-remix
This was a popular request, so here you go. Support The Musikage on Patreon for cool rewards: https://www.patreon.com/user?u=7552376 Support The Musikage on Pa...
how is that made?
@acoustic fox pcm doesn't encode frequencies directly at all, it just encodes the voltage sent to the speaker at each moment in time, the signal goes up and down to represent a frequency
modifying the original or recreating it?
yeah that's something someone recreated
and can u modify the original to get the same result?
btw i think the 8 bit is the tonal difference
UHH
but anyway, that music is clearly in NES style specifically
I was guessing that you could only output 255 frequencies ???
But that is probably not true
I'm thnking
the NES could generate two square wave instruments, one triangle wave, and one white noise signal
@spice ravine 'Measuring voltage' You are still talking about sampling times
huh? i wasn't talking about sampling times before so idk what you mean
50k HZ sample time at 8 bit is completely different than 10hz sample time 8 bit
ok but you were talking about sound frequencies, the sample time is fixed, so i don't know what you mean by "tonal frequencies"
8 bit is the resolution of possible amplitudes of a given sample time
it's usually 16 bit on modern systems
It just depends
(I deal with microcontrollers and I see a lot of options,e ct)
(Neither here or there)
so the bit are the samples?
Yes
ye
So lets say your sine wave amplitude is 10
If 8 bit was a ruler, it would be only able to measure 255 levels of that 10 amplitude signal
So if you straight up record and output the signal without analysis, it would output in increiments of .04 *amplitude steps
ok but there is still some confusion
because the 8 bit you asked about, like, that sword art music you linked,
has nothing to do with 8 bit pcm samples
it's basically just emulating the style of the NES which is an 8 bit game system
^ Random knows what they are talking about
8 bit modern is not constrained to the 8 bit systems that existed
8 bit is a style now which is not constrained
sorry for the delay
so the NES was an 8 bit system
what does that have to do with the sound?
Means that the NES has only 255 colors it can put on the screen I believe
even if u dont understand anything from the vid (not ur language)
Vídeo de Zorman: https://youtu.be/Gvm_VpxvIVQ
Hay partes que no han sonado en el vídeo.
Escucha la Banda Sonora completa de PAX, Una Aventura Espacial
♫ Youtube: https://youtu.be/ni3gfpOtBh4
♫ Spotify: https://spoti.fi/2HuwsWY
♫ Otras plataformas: http://bit.ly/2HjB7...
go min 2.30
ff is 8-bit and zelda is 16-bit
i mean, there is clearly a difference between them
but i dont know exactly what
http://forums.nesdev.com/viewtopic.php?t=19091 May be of use
what i wanted to know is the difference between a final fantasy OST from now and from the one on 1990
Now: PCM encoded in music files
Then: 6502 instructions sent directly to sound generating chip in game system
Small trolling: None just the composer plagiarizing himself over and over
what ever. I just want to know the difference in terms of encoding uwu
hey, not sure if this is any place to ask since it's just python, and feel free to chuck me a server if there's a better one for my question
I'm having trouble with an assignment on information systems & databases, questions include tech stacks, ERDs ect, and having a tough time understanding some questions
the question in particular:
Research the data model of an organisation by looking at their API documentation and any other sources of publicly available information and describe the organisational functions that are possible based on the API.
if you take n random steps in a grid world you will travel an average sqrt(n) right?
running simulations it seems to be ~ 2.5 * sqrt(n)
are you allowing diagonal movement?
UH
Is that true?
Wouldn't the total average be 0
I mean, you'll probably never hit the origin again in a 2d grid
But random walk in one direction about 0 is invariant to the random walk in another direction about 0
P(r) = (2r)/N*e^(-r^2/N)
step length N is 1 in my case
so P(r) = 2r*e^(-r^2)
That's the probability distribution
UH
@gusty grove no diagonals
The absolute average distance is different than that average displacement
I think
Maybe I am just wrong
But if you imagine walking around in a circle of some given radius
Your average displacement is the radius but your average position is 0
def functionjj(n):
for i in range(n):
if i == 0:
for j in range(n):
for k in range(10000):
print("string")
What is the asymptotic time complexity of functionjj with respect to n?
It's just n I think, assuming n > 0
if i == 0 means the for j in range only runs once in total
Write answers as a polynomial of variable n in the standard form (eg 10n + 5, 50n ^ 2 + 3n + 30, or n). Be sure not to use the * symbol.
and the inner most loop is just a constant so that can be omitted
You can't just copy paste your homework questions here and expect help
You need to try them yourself first and ask specific questions
I've been dealing with it for hours, and I don't know anymore
with *
is O(log N)
Did you miss the if i ==0?
brainfu*k
def function(n):
for i in range(n):
for j in range(n):
for k in range(10000):
print("output")
the if
😭
been a while since i've done that.
the second link should help
since your not aloud to use the *
@devout helm square both sides, subtract 50^2, divide by 30 and then take the square root
it's absolutely not 20
nor 30
it's 20*square(10) ~ 63
>>> from math import sqrt
>>> sqrt(50**2+20**2*30)
120.41594578792295
>>> sqrt(50**2+30**2*30)
171.75564037317667
>>> sqrt(50**2+(20*sqrt(10))**2*30)
350.00000000000006
>>> sqrt(50**2+63**2*30)
348.66889737973474
@devout helm
well to be exact it has two solutions
one at +20*sqrt(10) and one at -20*sqrt(10)
the blue line is 350 and the purple one is your equation
350 = sqrt(50^2 + c^2(30))
350^2 = 50^2 + 30c^2
350^2 - 50^2 = 30 c^2
(350^2 - 50^2)/30 = c^2
+/-sqrt((350^2 - 50^2)/30) = c
-> ±20√10, or ±63.2456
350 = sqrt(50^2 + (30)c^2)
350^2 = 50^2 + (30)c^2
350^2 - 50^2 = (30)c^2
(350 - 50)(350 + 50) = (30)c^2 # Difference of squares
120000 / 30 = c^2
c = +/- sqrt(4000)
c = +/- (2 * sqrt(1000))
c = +/- 63.2455532034
Factorizing it makes it a lot easier to do in your head because in a lot of cases you wouldn't need the decimal answer, you can just use "+/- (2 * sqrt(1000))"
I don't think it was meant to be read as python code, just math. If it was python then 350 = sqrt(50^2 + (30)c^2) is an illegal assignment, and numerous other problems
Who has the fastest pc?
At 148.600pflops "summit" is the fastest currently
Not really a surprise but it belongs to the usa
@subtle agate
Yes
Ok
Anybody with fastest gaming pc
Probably ask that in a ot channel
Ive taken my laptop on a plane
My guess is the raspberry pis on the iss are faster
Speed is relative anyway.
hi!
Hi!
Hey
🐱
Imagine asking if people in a programming discord server know how to program
lol
what do u mean @trim apex I thought we're learning witchcraft
Well fair question, some are still learning
Anyone has an idea where to start learning about machine learning coding
?
I can find a source to learn from
I've heard about NEAT and Q-learning
but I can't find a course or something else to do it
and learn it
any help?
#data-science-and-ml probably has some good links
just checked thee pins - looks like some good links
Is this a channel to ask for maths?
sure
so this is a dumb problem, but how do I compute (x * c**d) % y where c**d is way too big to fit in an integer (and I need the precision that I would lose using a float)
use the built-in pow function with its third parameter instead of ** and %
pow(x, y, z=None, /)
Equivalent to x**y (with two arguments) or x**y % z (with three arguments)
Some types, such as ints, are able to use a more efficient algorithm when
invoked using the three argument form.
but can I simplify (x * c**d) % y to x * (c**d % y) % y?
I think yes, but let me check again
I believe ab % n === ((a % n)(b % n)) % n...?
that's how the algorithm works anyway
aiui it calculates the "exponent" by multiplying and taking the mod at each step so the intermediate result never gets big
right
[i.e. pow(x, y, z) itself is (((x%z)(x%z)%z)(x%z))%z etc]
@tacit moss
is way too big to fit in an integer
Just as an FYI, ints in Python are effectively without a limit, (unlike most languages) so this typically isn't a concern. It's not like C or Java where there's a fixed maximum.
you say that, but it seems to be chugging on -19204542550164141017840894367007800359160643584000000000000000**101741582076661
@tacit moss so I take it you don't want to use the built-in pow?
I did! It seems to work...when I raise things to 1 and 0 but my solution isn't working for higher numbers (although I don't have much of a reference). I'm not sure if it's a problem with my math though
@tacit moss spoiler alert: http://ix.io/25YC
Could someone help me solve a problem in C?
Hello there, i don't know if this channel is the right one but i would have a question
I learned python and i love it but i would like to try some App development. I already know the Javascript basic(var, functions, objects and etc.) and a little c++
Could someone give me some Tipps and tell me what he/she thinks would be better to concentrate on?
That might be better suited for data-science
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@native jungle what kind of apps? web? mobile? desktop?
Mobile
Hey, i've a merge sort algorithm written in python
so i just want to check out the time complexity of merge_sort algo.
here's the code
def merge_hard(array):
""" time complexity -> O(n+n+n) in worst case
>>> merge_hard([3,4,5,2,1])
[1, 2, 3, 4, 5]
"""
center = len(array) // 2
left_array = array[0:center] # O(n)
right_array = array[center::] # O(n)
i = j = k = 0
# Find the smallest between these two sorted arrays
sorted_la = sorted(left_array) # O(n)
sorted_ra = sorted(right_array) # O(n)
# NEED TO BE CONFIGURE
while (i < len(sorted_la) and j < len(sorted_ra)):
if sorted_la[i] < sorted_ra[j]:
array[k] = sorted_la[i]
i += 1
else:
array[k] = sorted_ra[j]
j += 1
k += 1
while (i < len(sorted_la)):
array[k] = sorted_la[i]
i += 1
k += 1
while (j < len(sorted_ra)):
array[k] = sorted_ra[j]
j += 1
k += 1
return array
is the time complexity of this function is O(n+n+n) ??
I might be the only person up
so you'll need to wait a day to get an educated response
ohhokay .. but what are thought on this ?
I'm looking
okay
I could be wrong
for what?
But I think you need to reinitialize the second and third while loop
I think ( i >= len(sorted_la)
when you enter the second while loop
You might need to reset i = 0
just as an FYI
the second while loop = 0(n/2) and the third while loop = 0(n/2)?
so the total order for those two while loops together would be 0(n) ?
ohh .. why i make a use of last two while loops is because ..
suppose, you have a list of 5 element and you break it into two parts. Now
a = [7, 9]; b = [3,2,1]
okay, so in the first while loop i'm comparing elements of both the list and overwrite the orignal list .. but what if, one of these two list (a and b) have done comparing with all elements of other list.
i mean,
1. 7 -> 3
2. 9 -> 2
now, our first while loop stop getting executed because i of first list is now equal to the length of a i.e., 2 and there's one element left in list b i.e., 1 which isn't compare by anyone else ..
so that's why i put these two loops after the main while loop
You understand it ?
@acoustic fox isn't is now O(n logn) ??
You might need to reset i = 0
No, no need to reset i = 0 because if we do this then we start from the 0th index of the list and let suppose, the element which isn't compare by anyone exist on 5th index and now we just directly overwrite the orignal list by that element without comparing..
so that's the reason of why not reset the i after the first while loop
no worries at all
@balmy siren is that some kind of college assignment ?
if so, then you probably want to re-write you merge sort
sorted_la = sorted(left_array) # O(n)
sorted_ra = sorted(right_array) # O(n)
1st it's wrong estimation since sorted function of python implements Timsort which is O(nlogn)
2nd typically if your challenge to implement merge sort you are expected to do a classic version of it, where you do it in recursive manner splitting your array until it's 1 element and start merging it back
@scenic iris no of course not
@scenic iris i also use Recursion to implement merge sort
Wait let me put it here
def merge_sort(array):
if len(array) < 2:
return array
center = len(array) // 2
left = array[0:center]
right = array[center::]
merge_sort(left)
merge_sort(right)
return merge(left, right, array)
def merge(left, right, array):
i = j = k = 0
while (i < len(left) and j < len(right)):
if left[i] < right[j]:
array[k] = left[i]
i += 1
else:
array[k] = right[j]
j += 1
k += 1
while i < len(left):
array[k] = left[i]
i += 1
k += 1
while j < len(right):
array[k] = right[j]
j += 1
k += 1
return array
yeah, that looks better
but what if, i sort the first divided sub-lists then i don't need to further division of sub-lists .. but is it right to do so?
kinda again, if you want a classical implementation you divide until it's 1 element
e.g shell short has best sorting performance but only when it comes to data sets < 1000 elements
so you can do something like divide until array has len() <= 1000 elements then apply shellsort
So ive only recently began learning to code. Ive learnt a little bit of python, but i am wondering what coding language is best suited for game creation? because after my python course is over i planned to learn C#
@feral shale thankyou
hey, i have a basic math question. I am trying to write down |x-y| (where the difference is always positive), however, I do not remember how it is called in english -> can't properly look it up
absolute value?
Ok so I have a problem with understanding Hoare's partitioning scheme for Quicksort. I made myself a small example list so I can play around with it and to understand it. The list is the following: 0 1 2 6 1 5 3 4 9 8 1 2 0. In the first iteration, the Pivot is at index 0 + (12 - 0) / 2 = 6, meaning its the 3. After applying the scheme, which pseudocode looks the following:
algorithm quicksort(A, lo, hi) is
if lo < hi then
p := partition(A, lo, hi)
quicksort(A, lo, p)
quicksort(A, p + 1, hi)
algorithm partition(A, lo, hi) is
pivot := A[lo + (hi - lo) / 2]
i := lo - 1
j := hi + 1
loop forever
do
i := i + 1
while A[i] < pivot
do
j := j - 1
while A[j] > pivot
if i ≥ j then
return j
swap A[i] with A[j]
the partition function returns the index 7 and the list looks like this if I did nothing wrong: 0 1 2 0 1 2 1 3 9 8 4 5 6.
Now when doing the next iteration I encounter the following problem on the left list which looks like this: 0 1 2 0 1 2 1. Here the pivot is at index 0 + (6 - 0) / 2 = 3, meaning its the 0. Now my brain cant get this to work. Going by this scheme it should do the following:
Stop the i incrementing loop, as 0 < 0 is false. i = 0.
Stop the j decrementing loop, as 0 > 0 is false. j = 3.
Swap.
This basically changes nothing
Would I just let the algorithm check for <= or >= at some point?
not that it would change anything
nvm... Would I just let the algorithm check for == at some point is the question
in that case i could skip the entry and continue
or something
ah yes got it. I need to check if the items at these indices are equal when i >= j is false. If thats the case, I'd need to increment i or decrement j until I find a respective item for a swap
Sorry for walling this channel ^^
thinking about it further i forgot how incrementing works
at least I know that my question was lead by the misconception that i and j would be reset to lo and hi....
oof
Why are my odds of getting a good grip on the practical(coding) side of machine learning with very little experience with python?
if you have plenty of experience with other languages, probably fine.
If not, you're gonna have trouble
My problem is practice.
Any website where I could practice. (I don't have a problem with theory)
Thx for your feedback
Kaggle?
@tacit nymph what kind of machine learning are you looking at?
I'm following a book : Python Machine Learning by Sebastian Raschka and Vahid Mirjalili
But for now, I'm mostly reviewing concepts I saw 2 years ago in an udemy course
no, I mean what methods
Basic perceptrons
do you want
okay
what I mean to ask is
do you want practice with the engineering part i.e. implementation of learning methods
or with the science part i.e. experimentation on how to solve a business problem using those implementations?
Engineering part plz
does anyone know about nmos and pmos transistors
yes
I guess that would be more fitting in #microcontrollers than here. Anyway, just ask your question, don't ask for people.
wait whattt
is AND when its within the same "line" and OR when its separated?
but im still confused actually
IF and only IF
So that second left only has connection IF AND ONLY IF A and B are high
But the other, can have a connection when A and B are high, but also ANOTHER way of making the connection work
Lol np I hope I'm right I havent done this shit in 2 years
i'm going to go with your answer as it makes logical sense
🙂
Does anyone know where I can read something useful about encoding (utf-8, ascii etc.)?
Or its's not very useful and I should focus on learnign some other things?
You should know what it is
Different encoding types will come up and you should be able to recognize which type you are dealing with which will give you a clue to how to solve some issue
Learning how to encode matters more with C level programming or whatever
@lunar pivot https://nedbatchelder.com/text/unipain.html
not sure if this is the right channel but. But say you have an equation to denote a propagation rule, A = X + Y, but change what Y means and you write a new rule A = X + Y
Should you change the variable name, or add a hat?
and what if you have another iteration, can't really add another hat
Hey does anyone know a good C++ IDE that uses the Clang compiler?
I think visual studio, CLion and QT Creator all have options to use the clang compiler
I dont get it
gonna try to elaborate in #tools-and-devops
Thanks
tips on how to reverse engineer my code into a flowchart?
ive never done it before bit lost
Yeah
@fiery cosmos Flow charts are a mixture of design + engineering.
Engineering usually benefits from a top down approach where there are fuzzinesses around the edges when one engineering discipline intersects another or needs to make compromises around non discipline components of the project
Design is a vastly different approach where you make progress through (rapid) iteration. There are many ways to skin a cat and what you do is try a few different ways, figure out which approach is best, take the case which is the best, repeat until you get to a solution that is 'good' for your use case
In this example, use paper or a white board, start taking functions/whatever you are trying to flow and just draw it out and try to make it complete as possible. You will come up with an absolute mess.
You'll then need to reorganize and after you understand a bit about the underlying structure, you take your shit and do it all again. This time you are probably 80-85% there
You will notice mistakes and it's probably good to write down all the mistakes in a 'bug fix' list and then when you do the next update, you address each mistake.
Occasionally you'll find through this process that some pieces just don't makes sense together and you'll have to wonder why things work out the way it does.
--
flow charts are only as useful as their function of doing something. Making something pretty for nontechnical people to show you are doing work is going to yield a different flow chart than clearly explaining lets say the data flow through a program
--
Sumory -> Rough sketch -> organize -> refined sketch -> reorganize. ->repeat
okay thanks
@fiery cosmos are you ok?
Hey all, wanted to share this here (CS is the most general channel for this) on how I developed a reddit video generator 🙂 https://medium.com/@liamsorta/millions-are-watching-software-generated-youtubers-a6fde7968472
Happy to answer any questions about using the APIs / parsing the json
Can we get some code?
class Neural_Network():
def __init__ (self):
self.inputSize = 3
self.outputSize = 1
self.hiddenSize = 2
self.W1 = np.random.randn(self.inputSize,self.hiddenSize)/2
self.W2 = np.random.randn(self.hiddenSize,self.outputSize)/2
def forward(self,x):
self.z = np.dot(x,self.W1)
self.z2 = self.sigmoid (self.z)
self.z3 = np.dot(self.z2, self.W2)
o = self.sigmoid(self.z3)
return o
def backwards(self,x,y,o):
self.o_error = y - o
self.o_delta = self.o_error*self.sigmoidPrime(o)
self.z2_error = self.o_delta.dot(self.W2.T)
self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2)
self.W1 += x.T.dot(self.z2_delta)
self.W2 += self.z2.T.dot(self.o_delta)
def train(self,x,y):
o = self.forward(x)
self.backwards(x,y,o)
def sigmoid(self,x):
return 1/(1+np.exp(-x))
def sigmoidPrime(self,x):
return self.sigmoid(x)*self.sigmoid(1-x)```
When running this code to get a better understanding of neural networking, I ran into an issue that when feeding
```python
x = np.array(([0,0,0],
[1,1,1],
[1,1,0],
[1,0,1],
[1,0,0],
[0,1,1],
[0,1,0],
[0,0,1],
),dtype=float)
y = np.array(([0],
[1],
[1],
[1],
[0],
[1],
[0],
[1],), dtype = float)```
this information into the AI, it was preforming better when I left out the instance of [1,1,1] giving [1]. I was wondering if someone could explain why? When [1,1,1] [1] was left in, I was getting false positives for [0,1,0] and [1,0,0].
This goal was ment to predict a binary search tree of : A * B + C
feel free to ping me
Hi, is there ways to improve the registry searching using winreg?
@unique jasper awesome project 👍 and nice blog
Thanks @analog flare !
Guys anyone ever worked on a self driving RC car project? Let me know. I need some help.
Hey guys ✌🏼
Currently I am dealing with the topic online courses for coders.
I'm trying to find out how to make it easier for people to learn and would love to hear how you learn and stay up to date right now.
If someone has a few minutes for a quick chat it would be a great help for me.
Would be awesome if you just DM me 😊
Just bumping this
class Neural_Network():
def __init__ (self):
self.inputSize = 3
self.outputSize = 1
self.hiddenSize = 2
self.W1 = np.random.randn(self.inputSize,self.hiddenSize)/2
self.W2 = np.random.randn(self.hiddenSize,self.outputSize)/2
def forward(self,x):
self.z = np.dot(x,self.W1)
self.z2 = self.sigmoid (self.z)
self.z3 = np.dot(self.z2, self.W2)
o = self.sigmoid(self.z3)
return o
def backwards(self,x,y,o):
self.o_error = y - o
self.o_delta = self.o_error*self.sigmoidPrime(o)
self.z2_error = self.o_delta.dot(self.W2.T)
self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2)
self.W1 += x.T.dot(self.z2_delta)
self.W2 += self.z2.T.dot(self.o_delta)
def train(self,x,y):
o = self.forward(x)
self.backwards(x,y,o)
def sigmoid(self,x):
return 1/(1+np.exp(-x))
def sigmoidPrime(self,x):
return self.sigmoid(x)*self.sigmoid(1-x)```
When running this code to get a better understanding of neural networking, I ran into an issue that when feeding
```python
x = np.array(([0,0,0],
[1,1,1],
[1,1,0],
[1,0,1],
[1,0,0],
[0,1,1],
[0,1,0],
[0,0,1],
),dtype=float)
y = np.array(([0],
[1],
[1],
[1],
[0],
[1],
[0],
[1],), dtype = float)```
this information into the AI, it was preforming better when I left out the instance of [1,1,1] giving [1]. I was wondering if someone could explain why? When [1,1,1] [1] was left in, I was getting false positives for [0,1,0] and [1,0,0].
This goal was ment to predict a binary search tree of : A * B + C
idk if this is the right place but... How can i transform an ogg file into m4a?
i mean... I want some tags ogg files dont have
{'language': ['eng'], 'encoder': ['Lavf58.18.104']}
those are the tags i can find on an ogg file so far
Ubuntu I think
that triangle logo in the upper left
Ubuntu brand, app and web guidelines that help you create professional materials, software, sites, apps that build the Ubuntu brand.
Hi! I have a more theoretical based question. I have polygons and I'm trying to find gaps between points.
The polygons can be simple or complex. What would be the best approach to it?
Here some examples
What I did so far: I'm using shapely to get the convex hull of the polygon. Doing so I have the concavities, but I'm clueless what to do next
it looks like you're trying to find the boundary of the shape within a specific region
I don't know for sure
but I bet if you parameterize it in polar coordinates and take the derivative you'll be able to do this rather easily
Just bumping this
class Neural_Network():
def __init__ (self):
self.inputSize = 3
self.outputSize = 1
self.hiddenSize = 2
self.W1 = np.random.randn(self.inputSize,self.hiddenSize)/2
self.W2 = np.random.randn(self.hiddenSize,self.outputSize)/2
def forward(self,x):
self.z = np.dot(x,self.W1)
self.z2 = self.sigmoid (self.z)
self.z3 = np.dot(self.z2, self.W2)
o = self.sigmoid(self.z3)
return o
def backwards(self,x,y,o):
self.o_error = y - o
self.o_delta = self.o_error*self.sigmoidPrime(o)
self.z2_error = self.o_delta.dot(self.W2.T)
self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2)
self.W1 += x.T.dot(self.z2_delta)
self.W2 += self.z2.T.dot(self.o_delta)
def train(self,x,y):
o = self.forward(x)
self.backwards(x,y,o)
def sigmoid(self,x):
return 1/(1+np.exp(-x))
def sigmoidPrime(self,x):
return self.sigmoid(x)*self.sigmoid(1-x)```
When running this code to get a better understanding of neural networking, I ran into an issue that when feeding
```python
x = np.array(([0,0,0],
[1,1,1],
[1,1,0],
[1,0,1],
[1,0,0],
[0,1,1],
[0,1,0],
[0,0,1],
),dtype=float)
y = np.array(([0],
[1],
[1],
[1],
[0],
[1],
[0],
[1],), dtype = float)```
this information into the AI, it was preforming better when I left out the instance of [1,1,1] giving [1]. I was wondering if someone could explain why? When [1,1,1] [1] was left in, I was getting false positives for [0,1,0] and [1,0,0].
This goal was ment to predict a binary search tree of : A * B + C
@fiery cosmos So what you are doing is relaxing edges of a certain length, because technically
Are also gaps
You can apply a recursive smoothing algorithm that deals with weighted averages and a decay factor
If you are only looking for convex/concave you would track the curvature in either x, y coordinate..
You can find all inflection points that share positive slopes in both directions
Where you then say "This boundary is the largest closed surface once the tangent line to both slopes is = 180 degrees
Just bumping this
class Neural_Network():
def __init__ (self):
self.inputSize = 3
self.outputSize = 1
self.hiddenSize = 2
self.W1 = np.random.randn(self.inputSize,self.hiddenSize)/2
self.W2 = np.random.randn(self.hiddenSize,self.outputSize)/2
def forward(self,x):
self.z = np.dot(x,self.W1)
self.z2 = self.sigmoid (self.z)
self.z3 = np.dot(self.z2, self.W2)
o = self.sigmoid(self.z3)
return o
def backwards(self,x,y,o):
self.o_error = y - o
self.o_delta = self.o_error*self.sigmoidPrime(o)
self.z2_error = self.o_delta.dot(self.W2.T)
self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2)
self.W1 += x.T.dot(self.z2_delta)
self.W2 += self.z2.T.dot(self.o_delta)
def train(self,x,y):
o = self.forward(x)
self.backwards(x,y,o)
def sigmoid(self,x):
return 1/(1+np.exp(-x))
def sigmoidPrime(self,x):
return self.sigmoid(x)*self.sigmoid(1-x)```
When running this code to get a better understanding of neural networking, I ran into an issue that when feeding
```python
x = np.array(([0,0,0],
[1,1,1],
[1,1,0],
[1,0,1],
[1,0,0],
[0,1,1],
[0,1,0],
[0,0,1],
),dtype=float)
y = np.array(([0],
[1],
[1],
[1],
[0],
[1],
[0],
[1],), dtype = float)```
this information into the AI, it was preforming better when I left out the instance of [1,1,1] giving [1]. I was wondering if someone could explain why? When [1,1,1] [1] was left in, I was getting false positives for [0,1,0] and [1,0,0].
This goal was ment to predict a binary search tree of : A * B + C
this is your 3rd time posting it here
haha
i think you might head over to #data-science-and-ml , they do things such as numpy
Where can I learn the equivalent of a college level intro to discrete structures course online or via books?
I'm gonna take it in the summer and want to prepare in advance
Mit open course ware probably has something
may i ask at what point is it considered plagiarism when it comes to code?
when you put your name on it
if you take an algorithm on github and modify to complete your task
is that still ?
if you say it's yours
and put your name on it
and don't include that you used anothers code
but you have to check with the original owner whether they allow reuse, reuse with modification, reuse with attrib. ....
I don't know if theres a clear way to identify the point at which it becomes plagiarism if you're just opying relatively small snippets like that. For larger projects, they should have a licence dictating how you can reuse the code
it's only 3 lines, but i guess i'll try to find another approach. thanks guys
If its 3 lines, it's almost certainly OK
Just make sure you change its style to fit the rest of your code
Just bumping this
class Neural_Network():
def __init__ (self):
self.inputSize = 3
self.outputSize = 1
self.hiddenSize = 2
self.W1 = np.random.randn(self.inputSize,self.hiddenSize)/2
self.W2 = np.random.randn(self.hiddenSize,self.outputSize)/2
def forward(self,x):
self.z = np.dot(x,self.W1)
self.z2 = self.sigmoid (self.z)
self.z3 = np.dot(self.z2, self.W2)
o = self.sigmoid(self.z3)
return o
def backwards(self,x,y,o):
self.o_error = y - o
self.o_delta = self.o_error*self.sigmoidPrime(o)
self.z2_error = self.o_delta.dot(self.W2.T)
self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2)
self.W1 += x.T.dot(self.z2_delta)
self.W2 += self.z2.T.dot(self.o_delta)
def train(self,x,y):
o = self.forward(x)
self.backwards(x,y,o)
def sigmoid(self,x):
return 1/(1+np.exp(-x))
def sigmoidPrime(self,x):
return self.sigmoid(x)*self.sigmoid(1-x)```
When running this code to get a better understanding of neural networking, I ran into an issue that when feeding
```python
x = np.array(([0,0,0],
[1,1,1],
[1,1,0],
[1,0,1],
[1,0,0],
[0,1,1],
[0,1,0],
[0,0,1],
),dtype=float)
y = np.array(([0],
[1],
[1],
[1],
[0],
[1],
[0],
[1],), dtype = float)```
this information into the AI, it was preforming better when I left out the instance of [1,1,1] giving [1]. I was wondering if someone could explain why? When [1,1,1] [1] was left in, I was getting false positives for [0,1,0] and [1,0,0].
This goal was ment to predict a binary search tree of : A * B + C
@jovial creek If no one can answer, that’s it, why do you continue reposting over and over.
@acoustic fox thank you very much I'll have a look!
@frank nest if you have nothing constructive to contribute then try not responding at all
@bronze gazelle Alright, sorry. I am just a bit getting mad at those types of people.
“These types of people” being people who want help?
In case you haven’t been paying attention, that’s what this server is for
no, these types of people who continuously repost their question in different channels for several days
How else do you expect them to get an answer?
What is your proposed alternative?
Because telling them to go away isn't it
I didn’t say them to go away, I just told that if no one is responding, reposting won’t work.
I’m sure lots of people are just scrolling through channel histories looking for questions to answer
If you’re frustrated, keep it to yourself

hi am a new member of this python community is there anyone who is also trying to pass IGCES for computer science I'm asking this because I really need help with my mock exam assignment and was wandering if any else doing the same thing I am.
What exam board are you on? @pulsar vapor
IGCSE year 11
its real easy but lmao i haven't done any python in 6 months and its all gone
so I have a problem and im not sure what hardware I would use to begin to seolve it. I need to track the motion of a helmet so that turning your head turns a camera that you are viewing through, problem is, I don't know if I should use an accelerometer or some sort fo two piece device that tracks helmet position realative to your shulders or something, or if I should go fro a different control method entirely.
working on some webscrapping tools but not understanding this HTML, can someone help me interoperate what its saying? feel free to ping
<p><b>Note: </b><i><script>var bb = document.getElementsByTagName("b");bb[bb.length-1].style.display="none"</script><input type="hidden" name="_status" value="277272282B2D2627" /><P><input type="submit" name="submitAnswers" value="Get a new version of this problem" onclick="document.getElementById('_reseed').value=25707" /><br/><style>.problemHeader {display:none}</style><input type="hidden" name="_reseed" id="_reseed" value="0" /></i></p>
cause I assume its calling a JS function to compare my answer with the new answer
<input id="previewAnswers_id" name="previewAnswers" onclick="this.form.target='_self'" type="submit" value="Preview My Answers" /><input id="submitAnswers_id" name="submitAnswers" onclick="this.form.target='_self'" type="submit" value="Submit Answers" />
the last one I believe is the submit answers the :
<input id="submitAnswers_id" name="submitAnswers" onclick="this.form.target='_self'" type="submit" value="Submit Answers" />```
ijust have no clue what its doing
how do I calculate how many bits a long int variable is without using things like sizeof in C
real byte size of the Python object representing it in memory, or just how many bits would be needed in theory to represent a number?
in memory
So I know that the Reduce function applies an operation over all the elements of a list and returns just the final result. What's the official term for a function that returns a list showing the in-between results of each operation in addition to the final one?
would be easy to write but I'm sure there's a name for it already