Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,793 members, 7,817,288 topics. Date: Saturday, 04 May 2024 at 09:37 AM |
Nairaland Forum / Science/Technology / Programming / Challenge Me (15518 Views)
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (Reply) (Go Down)
Re: Challenge Me by 4kings: 9:41pm On Oct 25, 2017 |
Olyboy16:Explain or illustrate with code. |
Re: Challenge Me by 4kings: 9:44pm On Oct 25, 2017 |
seunthomas:From suspecting to accusation na wa oo. But i don't understand where parse_pair comes to play in the code or is it an inbuilt function? (I'm assuming you know Rust) Olyboy16:So can you take up the challenge? |
Re: Challenge Me by Olyboy16(m): 9:49pm On Oct 25, 2017 |
4kings:me keeeee?? **holds down my hat, holds up my trouser, picks race** |
Re: Challenge Me by Olyboy16(m): 9:50pm On Oct 25, 2017 |
4kings:is it that you feel my mathematical solution is wrong or you feel my solution can only be correct when i write code? |
Re: Challenge Me by 4kings: 9:54pm On Oct 25, 2017 |
Olyboy16:I don't understand it, that's why i gave an option for you to explain. I can test it myself when i understand it. Olyboy16:lol... What's your forte for interesting challenges then? |
Re: Challenge Me by Olyboy16(m): 10:06pm On Oct 25, 2017 |
4kings: 1. i'm sorry sir, but i don't know how to write the code for that; dhtml118 is really good at coding things like that; if he would grace the honour though. 2. i only solve that which i can solve, i just pick and leave the rest. . *storms out* . . *looks back* i bet the dude was expecting a duel; eh eh "a good soldier lives to fight another day"* |
Re: Challenge Me by 4kings: 10:28pm On Oct 25, 2017 |
Olyboy16:Hold on... You said; {(x', y')} should be a proper set of all steps from (x, y) to A(x,y) or (x2, y2), therefore x and y are the individual coordinates from (0, 0) to (10, 4) right? If so when x is 2.5 and y is 1. The equation would be; x' = 10 - (2.5 + ni) and y' = 4 - (1 + nj) Now i don't know what you mean by loop controls in order to determine ni and nj. If i assume ni and nj are always changing and that's the same case for (x,y), then i'm totally confused on how it'll yeild the right result. This is why i need an explanation, i'm a little bit good at math, so you can throw in some more light to what you had in mind behind the equations. |
Re: Challenge Me by Olyboy16(m): 10:54pm On Oct 25, 2017 |
4kings:now this is my number 2 guy on NL! . ni will be a loop on a range of 9...0, and nj will be 3...0. so a result would be in the form of [10 - (2.5 + 9), 4 - (1 + 3)], [10 - (2.5 + , 4 - (1 + 2)], wait!! dang! that solution is wrong. hold on, leme get some fix 1 Like |
Re: Challenge Me by 4kings: 11:18pm On Oct 25, 2017 |
Olyboy16:Holding on... |
Re: Challenge Me by Olyboy16(m): 11:28pm On Oct 25, 2017 |
4kings: the other solution i took from intuition and twas heading to chaos when i solved it manually, so i guess the only way to solve this will be to use plain basic maths. . you'll agree with me that we'll find line angle by atan(y2/x2), then line length by sqrt(pow(x2-x1,2) + pow(y2-y1, 2)), x' = x1, y' = y1; for 0 to length as ln: x' = cos(angle) + x' * ln; y' = sin(angle) + y' * ln; end for . a set of (x', y') is a solution. implement that and see. no wonder whiztim gave me cold shoulders; thanks for pointing out my jargon bro |
Re: Challenge Me by Olyboy16(m): 11:28pm On Oct 25, 2017 |
4kings:solved! |
Re: Challenge Me by 4kings: 11:35pm On Oct 25, 2017 |
Olyboy16:let me test it... |
Re: Challenge Me by 4kings: 12:18am On Oct 26, 2017 |
Olyboy16:First of all, i can see that this does not answer the question, as i can't find any way to get the number of cells the line would pass through from the parameters you've given. But however since you're trying to calculate vector points, i'm assuming you intend to get every point in the vector space that the line would go through(since i'm seeing the loop again(ln)), afterall if so every point should be in the cell right? Now why do you need lenght of line up there. Anyways, y2, x2 = 4, 10 therefore line angle = atan(0.4 ) = 21.8 degrees Starting from 1 in the loop (that is ln = 1) and (x,y)= 1,1 x' = cos(21.8 ) + 1 * 1 = 0.92848583 + 1 = 1.9 y' = sin(21.8 ) + 1 * 1; = 0.37136784 + 1 = 1.8 which means (0,0) gives (0.9, 0.3) and (1,1) gives (1.9, 1.8 ) Can you see the error? Well if you can't let's solve it for the last points (10, 4); now this will be (10.9 and 4.8 ) So for the begining which is (0,0) ideally the points the line passes through should start from (0,0) but it gives (0.9, 0.3) what happens to 0.8, 0.7 and so on At the end (10.9, 4.8 ), this exceeds the final vector values of (10,4) and we're just starting from the loop 1. So again this approach is incorrect and it's mostly because of the loop you're putting. |
Re: Challenge Me by bolkay47(m): 5:22pm On Oct 26, 2017 |
This thread has finally degenerated into 'clash of egos'? |
Re: Challenge Me by Nobody: 8:20pm On Oct 26, 2017 |
^^^who are the detractors? let me scan the thread for chest-thumpers, i dey come. |
Re: Challenge Me by DharkPoet(m): 9:46pm On Oct 26, 2017 |
bolkay47:I was about saying the same thing, and I think this is why Seun doesn't take this board seriously. A meaningful topic would most likely degrade into a battlefield for the bosses. Some of us just want to learn. |
Re: Challenge Me by Nobody: 9:54pm On Oct 26, 2017 |
I am only here to watch movies, not here to fight anyone. This topic might seem absurb, but seriously, someone should show me a more interesting topic on this board right now? |
Re: Challenge Me by bolkay47(m): 10:36pm On Oct 26, 2017 |
DharkPoet:Exactly sir! I started noticing this from Page 3 or so. It's not so good. Nobody knows it all. Nobody. |
Re: Challenge Me by Nobody: 10:56pm On Oct 26, 2017 |
I taya for the know-it-all people sha o, me i am only here to learn sha. |
Re: Challenge Me by Olyboy16(m): 10:34am On Oct 27, 2017 |
@4kings , you cant find a line through the origin, thats an intercept bro. and a line ends at its last coord, why then would you put (0,0) and (10, 4) which are the first and last coord through the step distance calculations? if you calculate x' =0 and y' =0, your result would give you a list of coords that forms a straight line, and when it reaches an absolute value of (10,4), then you have the end of the line. there isn't any error in that solution, the fractional contigencies occur because all geometric dimensions are real values, but the loop assumes all values are integers, so there will be a cummulative degree of error for every iteration! pick a geometry textbook and confirm my theory bro! sorry for replying at this time though, i was charging my new iphoneX2 |
Re: Challenge Me by 4kings: 12:10pm On Oct 27, 2017 |
Olyboy16:You and this your iphoneX2 sef . Me i'm still managinig my 3310 . I didn't say you could find line through the origin, i said; "you're trying to calculate vector points" not line. All coordinates from 0,0 to 10,4 are points of the segment A(10,4) aren't they? That's the essence of linear equation in finding and predicting points in any axis, not so? And i'm aware that 0,0 is an intercept also, i noted that in my solution too. Now according to you: if you calculate x' =0 and y' =0, your result would give you a listof coords that forms a straight line. I find this odd, because coordinates are gotten through the linear equation. But let's test your theory starting with (0,0), using python.
#Results; -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 -0.9817866687932767 0.18998667579543774 Now if this is correct we should be able to prove this with the linear equation. Let's start with the first coordinates; -0.9817866687932767 0.18998667579543774 b = intersection = 0 m = gradient = 0.4 When y is 0.18998667579543774. x = (y - b)/m print(x) >>> 0.47496668948859433 You can see that the result contradicts yours. Then you said; the fractional contigencies occur because all geometric dimensions are real values, but the loop assumes all values are integers, so there will be a cummulative degree of error for every iteration This your statement sef, so you acknowledge that there will be errors, but still dey bring am up, bro na wa oo. As per "pick a geometry textbook and confirm my theory bro!". I have taken courses on statistical analysis for machine learning and the basic thing to know are vectors, but hey i might be sincerely wrong and possibly don't understand your theory, that's why i encourage you test it, even if you don't want to use code why not create time and test an iteration on paper, the degree of error as you saw in the result is not minute and when you test it with (10,4) the results are way off. |
Re: Challenge Me by Nobody: 10:13pm On Oct 27, 2017 |
seunthomas: Guy chill nah... I have actually shared this exact code on quite a number of platforms including a book by one of my friends. So I wouldn't be surprised if Google popped up some duplicate.. Next time just chill instead of throwing false accusations... |
Re: Challenge Me by Nobody: 5:57am On Oct 28, 2017 |
Aha, seunthomas, I see what you trying to do. danielthegeek, weldone |
Re: Challenge Me by 4kings: 6:22am On Oct 28, 2017 |
DanielTheGeek:Is the book published online? Are you ChayDX on reddit? The code looks very identical to his; https://www.reddit.com/user/ChayDX Anyways, what's the purpose of parse_pair function in your code and where was it defined? 1 Like |
Re: Challenge Me by Nobody: 8:03am On Oct 28, 2017 |
4kings:You'd never hear me calling myself a Rust (or any other random language) developer.. I may know the language but In reality I don't have enough experience in the language to call myself a developer of the language..and NO i am not that guy on Reddit (when last did i even ever use Reddit, lol?).. he probably just cited the code from somewhere or his use was coincidental and unintentional.. parse_pair() isn't an inbuilt function, sorry for sharing an incomplete program.... i didn't notice that because it's actually part of a larger codebase so everything just executed fine after compiling. What does parse_pair() do? It parses the first argument as a "coordinate pair, like `100x100` or `5.0,6.5` " It's return type is none or null based on if the first argument parses correctly and Some((left, right))if otherwise. I shared the code snippet with Jim, January last year (2016) in a book he said was teaching programming in Rust... I never got feedback on the book's launch so I guess it hasn't been launched yet. @seunthomas you said you'll get back to me "the next morning", i haven't gotten any response about the challenge or task (as i'd prefer to call it), i'm guessing you're not chanced due to work... #onelove brah. |
Re: Challenge Me by Nobody: 8:07am On Oct 28, 2017 |
Olyboy16: I'm not a major in Maths (in fact prolly a dumbass ) so the only way I can tell you're wrong is the smiley in the code....hahaha..like if you agree 1 Like |
Re: Challenge Me by Nobody: 8:13am On Oct 28, 2017 |
4kings: WTF! I just looked at that guys post on Reddit... You can tell first hand that he didn't write that code if you read his other posts..
That looks 100% like my code so best guess is the book already launched, since said he just started learning Rust recently and he posted that this year... I really have to find that book and in between i'm gonna ask the dude where he copied that from too.. Someone who just learnt Rust can't write a Mandelbrot set just like that, especially in a time when Rust was still a bit partially esoteric... Someone that can't even compile his program properly, shey na him go come do Mandelbrot program? 1 Like |
Re: Challenge Me by 4kings: 8:24am On Oct 28, 2017 |
DanielTheGeek:Easy bro. If he knows how to do it other language what stops him from doing so in another even if he is rusty with it. I'm not saying he wrote the code, just thinking out loud... and he did say he "just finished writing it". Please do find the book, i would love to learn too. |
Re: Challenge Me by Nobody: 8:57am On Oct 28, 2017 |
*Looking at this thread with field glasses all the way from afri.coders* |
Re: Challenge Me by 4kings: 9:27am On Oct 28, 2017 |
dhtml118:Most africo.ders are not pythonistas. |
Re: Challenge Me by Nobody: 11:48am On Oct 28, 2017 |
Most afri.coders my brother are waiting for updates before they really start posting, and I shall soon grant their request. I need to clear my tables a bit and get some money, then I continue my trolling there. My phpbrowserbox.com needs update too - plenty requests are trollin' in. |
Re: Challenge Me by seunthomas: 2:50pm On Oct 28, 2017 |
DanielTheGeek: Oga you are the biggest shameless thief i have seen. Why do you lie so much like this?? The code you posted here and claimed was yours is someone else's work for a Rust Lang tutorial. I started learning Rust last year and as soon as i saw that code i knew i had seen it from somewhere before. But so as not to jump the gun i chilled until someone just posted here that people were googling code. Then i searched deeper and i discovered the exact copy paste code on that guys tutorial. I am 100% sure you are not the author. I think at this juncture it would be wise to apologize to all of us here. Who are you fooling.... See all the nonsense justification you are posting.... You are shameless. Mtcheew... By the way the original author is one of the early contributors to RustLang.. 2 Likes |
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (Reply)
Why Self Taught Programmers Over “Exaggerate”. / Function Points (FP) Vs Lines Of Code (LOC) / Mobile Technology: Lets Build A Mobile App With Javascript
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 70 |