On February 19 2017 06:52 tofucake wrote:
It gets even more annoying when you can edit any post...
It gets even more annoying when you can edit any post...
Trying to excuse future mod abuse eh? :p
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
emperorchampion
Canada9496 Posts
February 18 2017 22:22 GMT
#16941
On February 19 2017 06:52 tofucake wrote: Show nested quote + On February 19 2017 05:30 spinesheath wrote: Gee why do I keep using quote instead of edit... It gets even more annoying when you can edit any post... Trying to excuse future mod abuse eh? :p | ||
Hanh
146 Posts
February 19 2017 00:23 GMT
#16942
On February 19 2017 04:56 Acrofales wrote: Show nested quote + On February 18 2017 18:11 Hanh wrote: Look at the variables. there exists x, such that for all y and for all y, there exists x They are flipped in the second statement. For any predicate P(x, y) for which, If [there is a x for which for all y, P(x, y) is true] then [for all y, there is a x for which P(x, y) is true]. In the first case x cannot depend on y. In the second case it can. Okay, I see it now. So for starters, and this is more at travis than at you: quantified variables are quantified variables. For all I cared, you could use "cupcake" as your variable name. If the order of your variables are important, make it explicit. But either way, the claim is still wrong. For the sake of simplicity, I have written it out here: (1) \exists x \forall y P(x, y) is stronger than (2) \forall x \exists y P(y, x) This is also not true. All we need to do is find a P and a model m such that m \models (1), but m \not\models (2). Right. Or if you prefer it in your form of implication (2) \rightarrow (1) is false if (1) is false while (2) ist true (which boils down to essentially the same thing, but is less formal. Here's a simple counter example: Let X = {a, b} and Y = {a} R = {(a, a)} Now: \forall x \in X \exists y \in Y such that (y, x) \in R This is false. Counter example: x=b However: \exists x \in X \forall y \in Y such that (x, y) \in R This is true, because it is true for x=a. Therefore, unless you also make some requirements of the domains of your variables and probably some properties of P, this is definitely not true. There is an interesting relationship between the two statements. I'm not sure whether your lemma might be true if we restrict x and y to be from the same set. I didn't immediately see a counterexample (but also haven't looked very hard, or tried to construct a proof). But the sweeping statement you made is still false even when you clarify the switched variables. + Show Spoiler + Thankfully. Would be rather embarrassing for me to be wrong on something like this It seems to me that you are grasping at straws in order to be right. So, ok - fine you are right. For the record, the discussion thread that you seemed to have missed was about the order of the quantifiers. Travis didn't see why they matter. In context, the domains of x and y are set, so your counter example doesn't apply. Why can't you admit that you didn't notice that and just move on. | ||
Nesserev
Belgium2760 Posts
February 19 2017 07:24 GMT
#16943
| ||
meatpudding
Australia520 Posts
February 19 2017 07:51 GMT
#16944
On February 19 2017 03:50 travis wrote: Anyone want to tell me what they think of this C code? I feel like it's pretty well written. To the point. Normally I end up making these small exercises way more convoluted than they need to be. (inb4 i find out it's shit) the specifications are to take the prototype and implement the function. the function takes the source string and copies it to the results string with leading and trailing whitespace removed. it then records how many spaces were removed into number_of_spaces. You return -1 if there was nothing to copy over. code: + Show Spoiler +
In the j-- loop there is no checks for j < 0. You could use a for loop like for (j; j > 0; j--)just in case the string is all whitespace. Instead of the k loop, I would look into using memcpy. It's cleaner than having to loop every char, and it's a good exercise for understanding pointers. | ||
Acrofales
Spain17835 Posts
February 19 2017 08:48 GMT
#16945
On February 19 2017 09:23 Hanh wrote: Show nested quote + On February 19 2017 04:56 Acrofales wrote: On February 18 2017 18:11 Hanh wrote: Look at the variables. there exists x, such that for all y and for all y, there exists x They are flipped in the second statement. For any predicate P(x, y) for which, If [there is a x for which for all y, P(x, y) is true] then [for all y, there is a x for which P(x, y) is true]. In the first case x cannot depend on y. In the second case it can. Okay, I see it now. So for starters, and this is more at travis than at you: quantified variables are quantified variables. For all I cared, you could use "cupcake" as your variable name. If the order of your variables are important, make it explicit. But either way, the claim is still wrong. For the sake of simplicity, I have written it out here: (1) \exists x \forall y P(x, y) is stronger than (2) \forall x \exists y P(y, x) This is also not true. All we need to do is find a P and a model m such that m \models (1), but m \not\models (2). Right. Or if you prefer it in your form of implication (2) \rightarrow (1) is false if (1) is false while (2) ist true (which boils down to essentially the same thing, but is less formal. Here's a simple counter example: Let X = {a, b} and Y = {a} R = {(a, a)} Now: \forall x \in X \exists y \in Y such that (y, x) \in R This is false. Counter example: x=b However: \exists x \in X \forall y \in Y such that (x, y) \in R This is true, because it is true for x=a. Therefore, unless you also make some requirements of the domains of your variables and probably some properties of P, this is definitely not true. There is an interesting relationship between the two statements. I'm not sure whether your lemma might be true if we restrict x and y to be from the same set. I didn't immediately see a counterexample (but also haven't looked very hard, or tried to construct a proof). But the sweeping statement you made is still false even when you clarify the switched variables. + Show Spoiler + Thankfully. Would be rather embarrassing for me to be wrong on something like this It seems to me that you are grasping at straws in order to be right. So, ok - fine you are right. For the record, the discussion thread that you seemed to have missed was about the order of the quantifiers. Travis didn't see why they matter. In context, the domains of x and y are set, so your counter example doesn't apply. Why can't you admit that you didn't notice that and just move on. Not really, because the context changed when he said "for a predicate P". But even if we look at asymmetric order, they are simply not comparable. I don't know how many different ways I have to say it: flipping the quantifiers is simply saying something different about your world, and unless you impose some very narrow conditions on your world, you cannot ever say that one is stronger than the other. And even if we go with the original statement, there simply is no stronger relationship between the two predicates (although it took me a while to realize where the error in thought was). For all x exists y x < y Exists x for all y y < x The latter says something about a global maximum, but we have to finagle with the definition of our domain. Either x\in D and y \in D - {x}, or you have a problem: let y=x, and the second predicate is false even if the set has a global maximum. However, the former says nothing about maxima, it simply says something about seriality (in fact, that is the very definition of seriality). However, seriality of < is particularly not true if there is a maximum in your set. And there isn't much you can do about it, because the same trick we just applied doesn't work: For all x in D there is a y in D - {x} such that x < y Counter example let x be the maximum of the set. So no. Even then, you are simply making two different statements about your sets and your relation. Now if you say that he really meant that the domains are numeric and equal, then the latter statement is always trivially false: if there is a global maximum, pick it as y for your counter example. If there is no global maximum then there simply is no x for which it might ever hold. So it is trivially false. Given that under these strict conditions, the former statement is sometimes true, your latter statement is indeed stronger, but it's trivial, because False is always the strongest statement, but I assumed we weren't talking about trivial cases... | ||
Hanh
146 Posts
February 19 2017 10:34 GMT
#16946
the order matters? I thought I remembered the professor saying the order matters for this, but when I conceptualized it I couldn't see the difference between there exists x, such that for all y and for all y, there exists x travis didn't put the complete statement, but I'm sure he meant this: (1) exists x in X, for all y in Y, P(x, y) (2) for all y in Y, exists x in X, P(x, y) because he said: "the order matters?" And I said: (1) => (2) If you don't agree with that and you think that x and y are unbound then the discussion is moot. By changing the domain, statements change meaning. It's true for any logical statement with quantifiers. You don't have to go very far to see that. P: for all x in X, x = 0. False if X = {0, 1}, True if X = {0}. Essentially, statements without a domain are meaningless. Btw, it's a classic question. I could google an answer here: http://math.stackexchange.com/questions/1064889/the-order-of-mixed-quantifiers For all x exists y x < y Exists x for all y y < x The latter says something about a global maximum, but we have to finagle with the definition of our domain. Either x\in D and y \in D - {x}, or you have a problem: let y=x, and the second predicate is false even if the set has a global maximum. Well, as you said, you have to change the domain. IMO, the context made clear that x was bound to X, and y to Y. then exists x in R, for all y in R, x < y: means there is a real number lower than every other real number. Which is false. for all y in R, exists x in R, x < y: every real number has a number lower than it. which is true. | ||
Hanh
146 Posts
February 19 2017 11:58 GMT
#16947
On February 19 2017 03:50 travis wrote: Anyone want to tell me what they think of this C code? I feel like it's pretty well written. To the point. Normally I end up making these small exercises way more convoluted than they need to be. (inb4 i find out it's shit) the specifications are to take the prototype and implement the function. the function takes the source string and copies it to the results string with leading and trailing whitespace removed. it then records how many spaces were removed into number_of_spaces. You return -1 if there was nothing to copy over. In addition to what other people have commented before, I think that the prototype of the function isn't a good one. It's not something that you can always control but in case it is your choice, there are a few abnomalities
1. What size was result allocated with? Am I going to do a buffer overrun by copying from source? I don't know. 2. Why isn't the length of source passed in? If the caller has it already, this would save a strlen. 3. Why optimize for the empty string case? Is it really important for remove_spaces to handle that? 4. Returning -1 could be unexpected by the caller and result in a bug because the semantics of remove_spaces were overly complex. If the caller wants to check, it could just look at *result == 0 If instead we had,
Or even better if you allow for SAL annotations (or something similar)
Your compiler could check for buffer overreads and overwrites. Then your code could also get easier. (Untested, I hope it's not completely wrong).
I'm returning the new length, instead of the number of spaces removed. The new length is more interesting to have because it is a property of the new string. If the caller wants to have the number of spaces removed, he can subtract the new length from the old one. | ||
Acrofales
Spain17835 Posts
February 20 2017 11:47 GMT
#16948
On February 19 2017 19:34 Hanh wrote: Once again, there is a context. Show nested quote + the order matters? I thought I remembered the professor saying the order matters for this, but when I conceptualized it I couldn't see the difference between there exists x, such that for all y and for all y, there exists x travis didn't put the complete statement, but I'm sure he meant this: (1) exists x in X, for all y in Y, P(x, y) (2) for all y in Y, exists x in X, P(x, y) because he said: "the order matters?" And I said: (1) => (2) If you don't agree with that and you think that x and y are unbound then the discussion is moot. By changing the domain, statements change meaning. It's true for any logical statement with quantifiers. You don't have to go very far to see that. P: for all x in X, x = 0. False if X = {0, 1}, True if X = {0}. Essentially, statements without a domain are meaningless. Btw, it's a classic question. I could google an answer here: http://math.stackexchange.com/questions/1064889/the-order-of-mixed-quantifiers Show nested quote + For all x exists y x < y Exists x for all y y < x The latter says something about a global maximum, but we have to finagle with the definition of our domain. Either x\in D and y \in D - {x}, or you have a problem: let y=x, and the second predicate is false even if the set has a global maximum. Well, as you said, you have to change the domain. IMO, the context made clear that x was bound to X, and y to Y. then exists x in R, for all y in R, x < y: means there is a real number lower than every other real number. Which is false. for all y in R, exists x in R, x < y: every real number has a number lower than it. which is true. I had written a long reply that was going point by point, but I realized that the main issue is that we are simply using different levels of mathematical rigour, which is causing a misunderstanding... in particular to other people who might be interested in reading this (very few by now, I'd assume ![]() So lets clarify. As long as x and y are in the same domain the implication holds. In other words: \exists x \forall y P(x,y) \rightarrow \forall y \exists x P(x,y) holds as long as x, y \in D (which is an underlying assumption for the stackexchange article if you actually follow the proof). If x, y in different sets (x \in X and y \in Y), then you need restrictions on X and Y (and/or properties of P), and it can no longer be said to hold in the general case. Given that Travis was talking about x,y in the same subset of R, it holds (there is never a universal maximum that is also greater than itself, and thus it is trivially true). | ||
Manit0u
Poland17187 Posts
February 20 2017 13:33 GMT
#16949
https://github.com/LuaDist/lcms/blob/master/include/icc34.h | ||
Acrofales
Spain17835 Posts
February 20 2017 13:39 GMT
#16950
On February 20 2017 22:33 Manit0u wrote: So, 3 month at new work now. Starting to feel comfortable with RoR. Then I get thrown into a new project where I have to deal with stuff like this (implementing it in Ruby): https://github.com/LuaDist/lcms/blob/master/include/icc34.h That seems fairly straightforward? Just a bunch of structs getting defined in a header? Did you link the wrong thing? There doesn't seem to be anything particularly complex there, just a load of work. I admit, I didn't read it very carefully, and I know you're just venting here and not asking for help or advice, but can you explain what the problem is that you have to deal with? | ||
Manit0u
Poland17187 Posts
February 20 2017 13:45 GMT
#16951
On February 20 2017 22:39 Acrofales wrote: Show nested quote + On February 20 2017 22:33 Manit0u wrote: So, 3 month at new work now. Starting to feel comfortable with RoR. Then I get thrown into a new project where I have to deal with stuff like this (implementing it in Ruby): https://github.com/LuaDist/lcms/blob/master/include/icc34.h That seems fairly straightforward? Just a bunch of structs getting defined in a header? Did you link the wrong thing? There doesn't seem to be anything particularly complex there, just a load of work. I admit, I didn't read it very carefully, and I know you're just venting here and not asking for help or advice, but can you explain what the problem is that you have to deal with? http://www.color.org/icc-book1.PDF That's just a small part of what I'm dealing with now. Basically, I have to build a system from ground-up. It'll be an application residing on the server cluster, mapping resources to the database, keeping them synced and serving them to other applications that reside on numerous other clusters and process said resources... It would all be cool and dandy, if not for the fact that the guy leading this project needs it to be done in Rails (3), but he hates Rails so framework conventions are out the window. He also doesn't agree with the current best practices in Ruby so that's out the window too... I can't even write proper tests because with the current architectural implementation the framework's test suite can't be launched at all (have to run tests on each file manually) etc. etc. I'm in some deep shit and in addition I have to learn all about printer operation and such, which is boring as hell and will take forever. Thankfully I have my other project in Rails 5 with best practices enforced all around. It's the one thing that's keeping me sane right now. | ||
Blitzkrieg0
United States13132 Posts
February 20 2017 15:55 GMT
#16952
On February 20 2017 22:45 Manit0u wrote: It would all be cool and dandy, if not for the fact that the guy leading this project needs it to be done in Rails (3), but he hates Rails so framework conventions are out the window. He also doesn't agree with the current best practices in Ruby so that's out the window too... How do people handle stuff like this? People who do everything their own way are really hard to work with. | ||
Acrofales
Spain17835 Posts
February 20 2017 16:17 GMT
#16953
On February 20 2017 22:45 Manit0u wrote: Show nested quote + On February 20 2017 22:39 Acrofales wrote: On February 20 2017 22:33 Manit0u wrote: So, 3 month at new work now. Starting to feel comfortable with RoR. Then I get thrown into a new project where I have to deal with stuff like this (implementing it in Ruby): https://github.com/LuaDist/lcms/blob/master/include/icc34.h That seems fairly straightforward? Just a bunch of structs getting defined in a header? Did you link the wrong thing? There doesn't seem to be anything particularly complex there, just a load of work. I admit, I didn't read it very carefully, and I know you're just venting here and not asking for help or advice, but can you explain what the problem is that you have to deal with? http://www.color.org/icc-book1.PDF That's just a small part of what I'm dealing with now. Basically, I have to build a system from ground-up. It'll be an application residing on the server cluster, mapping resources to the database, keeping them synced and serving them to other applications that reside on numerous other clusters and process said resources... It would all be cool and dandy, if not for the fact that the guy leading this project needs it to be done in Rails (3), but he hates Rails so framework conventions are out the window. He also doesn't agree with the current best practices in Ruby so that's out the window too... I can't even write proper tests because with the current architectural implementation the framework's test suite can't be launched at all (have to run tests on each file manually) etc. etc. I'm in some deep shit and in addition I have to learn all about printer operation and such, which is boring as hell and will take forever. Thankfully I have my other project in Rails 5 with best practices enforced all around. It's the one thing that's keeping me sane right now. That book looks mindnumbingly boring. I hope the blurb at the front is written tongue-in-cheek. Or perhaps I am missing something and international color codes are actually fascinating (I guess everything *can* be interesting). Anyway, I guess all I can say is that I sympathize and good luck. The way I would deal with a job where my boss tells me what to do but also tells me that I can't use any of the tools to do it, is just use the tools anyway, and then when it's done and he asks what I used, I tell him frankly that I used all the tools he told me I wasn't allowed to use. Of course, this only works if you have the freedom of a boss who doesn't micromanage. If your boss does micromanage your tasks, then I guess you're screwed and have to comply (or quit). | ||
Deleted User 3420
24492 Posts
February 20 2017 20:10 GMT
#16954
Yes, this is homework help. No, I am not a sack of shit, I am only asking because I am trying to learn more. No one gets through college by cheating on homework anyways since like 80% of your grades are exams. First question series is titled "math of interest" and has 7 parts but I will only list a couple of them, and maybe it will give me a better idea on how to do the rest. + Show Spoiler + the domain for the following problems are N. You can have +,-,x,/,= and (for all, there exists, epsilon (what would you call this one, "in" ?) and (and, or, not) 1.) write a formula ONE(x) such that ONE(x) holds iff when x is divided by 4 the remainder is 1: So my first question is wtf is ONE(x). Is this a function, or is this a formula? It says write a formula. Is an answer literally x=1(mod 4)? But it doesn't say we can use mod so then it wants something like "(x-1)/4 = y where y is in N?" 2.) write a formula PRIME(x) such that PRIME(x) holds iff x is Prime: so, just throwing out an idea for all x in N, for all y in n, [(x does not equal y) and (x/y is not in N) different type of problem here + Show Spoiler + if x is congruent to 2 (mod 7) and y is congruent to 3 (mod 14) then what can you say about xy? WTF DO THEY WANT. I do not know anything interesting you can say about xy. I expect it has to do with some rule that I don't know. I looked through the text and can't find anything. last one: + Show Spoiler + show that if n^3 is congruent to 0 (mod 7) then n is congruent to 0 (mod 7): I do not know how to prove this. I mean it seems obvious this is true to me.. I just have no idea how to prove it :/ | ||
spinesheath
Germany8679 Posts
February 20 2017 20:17 GMT
#16955
On February 21 2017 05:10 travis wrote: if x is congruent to 2 (mod 7) and y is congruent to 3 (mod 14) then what can you say about xy? WTF DO THEY WANT. I do not know anything interesting you can say about xy. I expect it has to do with some rule that I don't know. I looked through the text and can't find anything. They want the a and b in "xy is congruent to a (mod b)". Now this has been years ago and I have no idea anymore how it works. | ||
Deleted User 3420
24492 Posts
February 20 2017 20:32 GMT
#16956
On February 21 2017 05:17 spinesheath wrote: Show nested quote + On February 21 2017 05:10 travis wrote: if x is congruent to 2 (mod 7) and y is congruent to 3 (mod 14) then what can you say about xy? WTF DO THEY WANT. I do not know anything interesting you can say about xy. I expect it has to do with some rule that I don't know. I looked through the text and can't find anything. They want the a and b in "xy is congruent to a (mod b)". Now this has been years ago and I have no idea anymore how it works. kinda just doin some random stuff I think that "xy is congruent to 6 (mod 7)" might be what they want then? | ||
Deleted User 3420
24492 Posts
February 20 2017 21:06 GMT
#16957
do the contrapositive: if n is not congruent to 0 (mod 7) then n^3 is not congruent to 0 (mod 7) then just do the cases where n = 1, n = 2, n = 3, n = 4, n = 5, n = 6 proving that the contrapositive holds true for each of these cases? | ||
Blisse
Canada3710 Posts
February 20 2017 21:29 GMT
#16958
On February 21 2017 05:32 travis wrote: Show nested quote + On February 21 2017 05:17 spinesheath wrote: On February 21 2017 05:10 travis wrote: if x is congruent to 2 (mod 7) and y is congruent to 3 (mod 14) then what can you say about xy? WTF DO THEY WANT. I do not know anything interesting you can say about xy. I expect it has to do with some rule that I don't know. I looked through the text and can't find anything. They want the a and b in "xy is congruent to a (mod b)". Now this has been years ago and I have no idea anymore how it works. kinda just doin some random stuff I think that "xy is congruent to 6 (mod 7)" might be what they want then? Sure. x === 2 (mod 7) y === 3 (mod 14) 7*a = x - 2 x = 7*a + 2 14*b = y - 3 y = 14*b + 3 xy = (7*a + 2)(14*b + 3) xy = 98ab + 21a + 28b + 6 xy - 6 = 98ab + 21a + 28b xy - 6 = 7(14ab + 3a + 4b) xy === 6 (mod 7) | ||
Deleted User 3420
24492 Posts
February 20 2017 21:42 GMT
#16959
On February 21 2017 06:29 Blisse wrote: xy - 6 = 7(14ab + 3a + 4b) xy === 6 (mod 7) I think I understand what you did here, but I think it would be helpful if you could explain it to me | ||
Manit0u
Poland17187 Posts
February 20 2017 22:26 GMT
#16960
On February 21 2017 00:55 Blitzkrieg0 wrote: Show nested quote + On February 20 2017 22:45 Manit0u wrote: It would all be cool and dandy, if not for the fact that the guy leading this project needs it to be done in Rails (3), but he hates Rails so framework conventions are out the window. He also doesn't agree with the current best practices in Ruby so that's out the window too... How do people handle stuff like this? People who do everything their own way are really hard to work with. I really don't know. This guy has 6 years of experience more than me (in some really big projects too) so I'm not really in a position to dispute his methods. Why is he using Notepad++ and insists on using tabs instead of spaces is beyond me though... | ||
| ||
![]() StarCraft 2 StarCraft: Brood War Dota 2 League of Legends Counter-Strike Other Games summit1g13087 C9.Mang01026 hungrybox668 shahzam332 singsing293 Tasteless189 JuggernautJason177 Skadoodle109 ViBE59 semphis_31 ZombieGrub27 Organizations
StarCraft 2 • Berry_CruncH206 StarCraft: Brood War• practicex ![]() • v1n1z1o ![]() • IndyKCrew ![]() • AfreecaTV YouTube • sooper7s • intothetv ![]() • Kozan • LaughNgamezSOOP • Laughngamez YouTube • Migwel ![]() Dota 2 League of Legends Other Games |
PiG Sty Festival
Clem vs Bunny
Solar vs Zoun
Replay Cast
BSL Nation Wars 2
Korean StarCraft League
PiG Sty Festival
herO vs Rogue
ByuN vs SKillous
SC Evo Complete
[BSL 2025] Weekly
Online Event
Replay Cast
SOOP Global
ByuN vs Zoun
Rogue vs Bunny
[ Show More ] PiG Sty Festival
MaxPax vs Classic
Dark vs Maru
Sparkling Tuna Cup
BSL Nation Wars 2
Online Event
The PondCast
|
|