have you heard of ctypes? write the number crunching stuff in C, and then make the OO stuff in Python. but keep in mind that in Python there is a (large) constant cost to calling any function, so you should try to call as little Python functions as possible. see my above comments (repplies to "C'mon Python users tell us why") if you're interested: I generate C code, then compile and run it through Python.
I did it once, and I got a huge C file. I didn't even have the patience to go through it, but I saw that a lot of stuff was defined that I didn't actually need. and it was for something relatively trivial. I decided it's safer to write my own C code, at least I can read the C source if there's a problem. and it's mostly just generating a couple of formulas using sympy, and then plugging them into a C template (that I write explicitely as strings in the Python file). Cython might be good when you try to translate a large piece of Python into C, but that's not what I'm trying to do. for me, running time for the Python script is negligible when compared to the running time of the generated executable, and I'm pretty certain that if I use Cython, overall efficiency will go down.
I haven't had a TV for 3 years, and I live in Europe. I doubt we're gonna get one soon, because we're moving to another country that doubles everything on TV and we hate that. so I never learned about the digital TV stuff. but you say that n people watching a show means n times the content is transfered over the network (so I understand that the data is separately transfered for each user). with analog TV, the station sent out a signal, and that was it. ok, sometimes the signal is strengthened along the way, but if n people watched a show "1 bandwidth" was consumed. and that is funny, because the old technology was much more efficient. did I misunderstand?
well, for now I've only done it for stuff where the C source is tiny (using gcc), and compiling doesn't take that long. anyway, I'm talking about cases where you can't really compare the running time (> 2 minutes) to the compiling time (1 second); and for serious work only the running time will increase. in practice the time cost for dressing everything in Python (and using sympy to generate formulas in the C source) is more important (but still negligible next to the time spent running the C generated executable). however, it is true that for one particular problem I'm already compiling a C library (it's for computing certain classes of polynomials, so I generate individual libraries for individual classes if they're not already there), and then I'm loading it with cdll from ctypes. it's a general enough class of functions that it's worth the trouble to do it. it's also relevant that the functions themselves take a number and return another number, whereas it might be more efficient to run external code when I need to generate a large amount of (binary) data. in terms of what serious programmers do, you have to realize that, when it comes to physical sciences (I'm a physicist myself), programming abilities can be (and usually are) very limited.
I cheat. I write python code that writes its own plain C code, compiles it then executes it. this way, I work once to write a C template, that I then reuse through a high level language. and when I combine the advantages of python (sympy for instance) with the speed of C, I get stuff that is ridiculously faster than what I did before. in the sense that I don't work a lot to write it, and I don't wait around a lot for it to actually run afterwards. working with numerical simulations, I'm allowed to cheat this way...
kind of offtopic, but I have to laugh at this. do you realize how stupid it is that TV is eating internet bandwidth? a few years ago I could leave the TV on 24/7, just like the radio, and nobody cared. but now, I would be impacting the infrastructure...
they should probably forbid the use of ssh too, as otherwise people could ssh into a foreign machine that does have access to the torrent sites. in the end, I think their best option is to simply shoot everybody who has a computer. that way, they can't infringe copyright. right? oh, and those with tape recorders too. and the ones with pens and paper. and the ones with good memory.
you make a good point. the zynga people are, in practice, printing money. the difference is that they built an "infrastructure" where people have fun after they give zynga real money. this guy did not have a contribution to the infrastructure, but he was still taking real money from the people having fun (or planning on doing it). I can't honestly say who is the bad guy here. to put it bluntly, I can't say if either of them has a hint of "good guy" in them.
You've got that backwards. The responsibility of government is to serve the public, not manipulate their attention [...]
I am usually reluctant to authority, and think we should have as much as information as possible. But in the case when you have a people traumatised and panicked, it usually makes sense for the government to manipulate their attention. I'm not sure their decision to keep the footage from the public is a good one, but one of their roles now is to manipulate people into a functioning state. It's just like parents try to keep things from children in bad situations, and trying to get them to focus on some specific task instead of trying to deal with the whole thing. So my message is not that they're doing the right thing now (I have no idea who could give a relevant answer to that), but that sometimes serving the public means manipulating the public.
look, we all know it makes sense to have sunlight in the evening. but why not simply start work earlier? get up at 5 instead of 6, go to bed at 22 instead of 23, problem solved.
or, you know, companies could change their schedule instead. I mean, the trains get messed up anyway when the clock changes, why not simply shift their schedule? with today's technology, it's very cheap to change the big letters that tell people which train goes where and when.
actually, the real 12:00 is when the sun is at its highest point in the sky. this whole time measuring business started with the sun, so the middle of the day was "placed" when the sun was in the middle of its jurney. it seems kind of stupid to me to change the labels on the sun dials every six months, when you could simply decide to change the work schedule. honestly, I don't understand why it was ever considered a good idea.
just playing devil's advocate. the fact is that up to about a hundred and fifty years ago or less, the chinese (and japanese) lived healthier and longer lives than europeans and americans (on average). and nowadays chinese traditional medicine is being adapted by europeans and americans. my mother (medic, general practitioner) learned to practice acupuncture in the 1980s, and she uses it regularly. she told me several times that the religious stuff behind it is kind of stupid, but the technique works for a series of problems. I am however aware that research into acupuncture didn't see a difference between acupuncture and sticking needles at random (so it might just be placebo). But I'm convinced it deserves some further research, because something is happening to these patients. Regarding the GPs comment: as far as I know, going to a point where China is a superpower with the most advanced technology on Earth would simply be a return to the natural order of things... But I would like their views on human rights to change before they get very powerful.
and your point is? let me give you a hint: "I don't think it's a very good idea to cook food. it would allow the whole population to slowly, but surely, grow smaller and weaker teeth."
as far as I understand it, the point of patents is to allow inventors to profit from their invention even though it's not an industrial secret. the community can benefit from understanding why the invention works, and the inventor gets back their investment, plus profit. there are a lot of problems with this system at the moment, because too many things are getting patented. there are a lot of cases where several researchers concentrate on some given problem, they publish intermediary results, and it is predictable that within some time frame most specialists will arrive at the same solution. however, only the first one to find the final result (or the first one to file for the patent) is awarded the patent. this is wrong in my view, because there is an entire community working in that direction. in medicine, I'm pretty confident this is the general case, and pretty much the reason there are several different but similar drugs dealing with the same medical problems.
basically, I think patents should only be granted to individual researchers who can prove they developped a concept (on their own) based on widely available information. anything other than that is just simple research, and should be rewarded with grants or prizes by private persons/organisations, but not with a patent. "ethics" and religion should have nothing to do with patentability.
the truth is, fusion is N billion dollars away (I'm not sure about the N, probably 20-30), and the world is only willing to pay over 50 years. I think after this scare, some governments will try to speed up the process.
what would be the motivation of a war between india and china? or russia and china? I'm not trolling, I am simply curious. generally, you go to war if you have something to gain. ok, I agree you can think of a number of immediate reasons for war between these countries (like it was with the assassination that sparked world war 1), but what would be the real motivations (world war 1 was bound to happen, because there were a lot of peoples trying to get independence, there were the Germans who knew that without colonies they couldnt catch up to the UK and France and so on; at least, I've been told there were a lot of more profound reasons)? and a final note: I am certain that if a war breaks out between China and India, NATO will intervene (with the real motivation that the winner would be much too powerful). As for Russia, NATO would intervene to protect the nukes.
I searched and I couldn't find anything. Maybe I misunderstood my teacher (I was 11 or 12). The only reference to a lake of mercury that I could find was in this article http://www.jstor.org/stable/3915188, where they say there was a legend about a lake of mercury in California... I find it strangest that I've never looked it up properly before.
first of all, note that not all people refer to the christian/muslim/whatever God when they use the word "God". It is most likely that the grandparent poster was referring to some generic supernatural being. you should relax when it comes to this topic. in the sense of mathematical truth, you cannot prove there is no God (in the sense of a counscious being "outside" reality). also, you cannot prove that there is a God (because you cannot distinguish, in practice, sufficiently advanced technology from magic). You have to understand that for many scientists inclined to use mathematical logic, it comes natural to use "prove" in the sense of mathematical logic. Whereas there are a lot of other scientists who use "prove" in the sense of "provide theoretical model that explains empirical evidence, or empirical evidence that confirms theoretical model". I personally don't care if there is or there is not a "God". I accept that I can interact with my surroundings, and I base my actions on the belief that my experiences tell me the truth about the world. I accept that I cannot prove or disprove the existence of a God, and I insist that there can be no such proof, in the mathematical logic sense of the word. but when I say all this, I am really just being pedantic, insisting that we use the proper meaning for the word "proof". I do agree you can prove the events in the bible (and other "holy books") did not happen (and I think that's already done, mostly). Anyway, here is a modern, reasonable discussion on the existence of God, if you're interested: http://www.simulation-argument.com/
I heard there's a lake of mercury somwhere in South America. on the same note, I would like to go "swimming" in that lake sometime (obviously, some kind of protection, especially from the vapors, would be needed...).
yes, but what's the efficiency of a solar cell that is almost parallel to the light? and you can't really put them on vertically and rotate them after the sun, because then you don't have a large surface anymore.
I think I remember the relationships between different objects. If I have a visual representation for these objects, I can reconstruct images; in fact when I remember an image I remember objects in that image, and then I can see details if I want to --- but I'm not generally aware of the full process. I'm usually considered good with math (I'm finishing a PhD in physics), but I can't honestly say how I handle it. I see formulas and the relationships between symbols. I see graphs of functions. I usually see vectors when I'm talking about stuff happening in Hilbert spaces. The thing is, if I think about the relationships between objects, I first see boxes linked with arrows or simple lines. I can't say for sure why I interpret the stored information as an image. But I first see the schematic "drawing" (it's usually 3D), and then I think of an algorithm/system to recreating the information from that image. It might be because I played with blocks a lot as a kid, I can't say for sure. I also generally recognize people by their faces, even if I can't remember their names or where I've met them exactly.
Whenever I get into this sort of discussion, I remember why it's so damn hard to build thinking machines (we don't know how thinking machines work).
I can't imagine what it must be like not to use images in thought. So I'm curious (not trolling): how do you handle text? Reading various fonts, handwriting, typing... In the end, written symbols are drawings. Mathematically, they are curves with specific properties. In order to recognise them, you are using those properties in some way, so you are "postprocessing" the visual data in some way. I would be curious (as a programmer) to find out what it is your brain is actually doing, taking into account that it's apparently not very good at handling images.
have you heard of ctypes? write the number crunching stuff in C, and then make the OO stuff in Python. but keep in mind that in Python there is a (large) constant cost to calling any function, so you should try to call as little Python functions as possible. see my above comments (repplies to "C'mon Python users tell us why") if you're interested: I generate C code, then compile and run it through Python.
I did it once, and I got a huge C file. I didn't even have the patience to go through it, but I saw that a lot of stuff was defined that I didn't actually need. and it was for something relatively trivial. I decided it's safer to write my own C code, at least I can read the C source if there's a problem. and it's mostly just generating a couple of formulas using sympy, and then plugging them into a C template (that I write explicitely as strings in the Python file).
Cython might be good when you try to translate a large piece of Python into C, but that's not what I'm trying to do. for me, running time for the Python script is negligible when compared to the running time of the generated executable, and I'm pretty certain that if I use Cython, overall efficiency will go down.
I haven't had a TV for 3 years, and I live in Europe. I doubt we're gonna get one soon, because we're moving to another country that doubles everything on TV and we hate that. so I never learned about the digital TV stuff.
but you say that n people watching a show means n times the content is transfered over the network (so I understand that the data is separately transfered for each user). with analog TV, the station sent out a signal, and that was it. ok, sometimes the signal is strengthened along the way, but if n people watched a show "1 bandwidth" was consumed. and that is funny, because the old technology was much more efficient.
did I misunderstand?
well, for now I've only done it for stuff where the C source is tiny (using gcc), and compiling doesn't take that long. anyway, I'm talking about cases where you can't really compare the running time (> 2 minutes) to the compiling time (1 second); and for serious work only the running time will increase. in practice the time cost for dressing everything in Python (and using sympy to generate formulas in the C source) is more important (but still negligible next to the time spent running the C generated executable).
however, it is true that for one particular problem I'm already compiling a C library (it's for computing certain classes of polynomials, so I generate individual libraries for individual classes if they're not already there), and then I'm loading it with cdll from ctypes. it's a general enough class of functions that it's worth the trouble to do it. it's also relevant that the functions themselves take a number and return another number, whereas it might be more efficient to run external code when I need to generate a large amount of (binary) data.
in terms of what serious programmers do, you have to realize that, when it comes to physical sciences (I'm a physicist myself), programming abilities can be (and usually are) very limited.
I cheat. I write python code that writes its own plain C code, compiles it then executes it. this way, I work once to write a C template, that I then reuse through a high level language. and when I combine the advantages of python (sympy for instance) with the speed of C, I get stuff that is ridiculously faster than what I did before. in the sense that I don't work a lot to write it, and I don't wait around a lot for it to actually run afterwards.
working with numerical simulations, I'm allowed to cheat this way...
kind of offtopic, but I have to laugh at this. do you realize how stupid it is that TV is eating internet bandwidth? a few years ago I could leave the TV on 24/7, just like the radio, and nobody cared. but now, I would be impacting the infrastructure...
they should probably forbid the use of ssh too, as otherwise people could ssh into a foreign machine that does have access to the torrent sites.
in the end, I think their best option is to simply shoot everybody who has a computer. that way, they can't infringe copyright. right? oh, and those with tape recorders too. and the ones with pens and paper. and the ones with good memory.
you make a good point. the zynga people are, in practice, printing money. the difference is that they built an "infrastructure" where people have fun after they give zynga real money. this guy did not have a contribution to the infrastructure, but he was still taking real money from the people having fun (or planning on doing it).
I can't honestly say who is the bad guy here. to put it bluntly, I can't say if either of them has a hint of "good guy" in them.
"folding" refers to bending, not making one dimension go away. nice idea though. kind of reminds me of the ansible stuff from Children of the Mind.
You've got that backwards. The responsibility of government is to serve the public, not manipulate their attention [...]
I am usually reluctant to authority, and think we should have as much as information as possible. But in the case when you have a people traumatised and panicked, it usually makes sense for the government to manipulate their attention. I'm not sure their decision to keep the footage from the public is a good one, but one of their roles now is to manipulate people into a functioning state.
It's just like parents try to keep things from children in bad situations, and trying to get them to focus on some specific task instead of trying to deal with the whole thing.
So my message is not that they're doing the right thing now (I have no idea who could give a relevant answer to that), but that sometimes serving the public means manipulating the public.
look, we all know it makes sense to have sunlight in the evening. but why not simply start work earlier? get up at 5 instead of 6, go to bed at 22 instead of 23, problem solved.
or, you know, companies could change their schedule instead. I mean, the trains get messed up anyway when the clock changes, why not simply shift their schedule? with today's technology, it's very cheap to change the big letters that tell people which train goes where and when.
actually, the real 12:00 is when the sun is at its highest point in the sky. this whole time measuring business started with the sun, so the middle of the day was "placed" when the sun was in the middle of its jurney.
it seems kind of stupid to me to change the labels on the sun dials every six months, when you could simply decide to change the work schedule. honestly, I don't understand why it was ever considered a good idea.
just playing devil's advocate.
the fact is that up to about a hundred and fifty years ago or less, the chinese (and japanese) lived healthier and longer lives than europeans and americans (on average).
and nowadays chinese traditional medicine is being adapted by europeans and americans. my mother (medic, general practitioner) learned to practice acupuncture in the 1980s, and she uses it regularly. she told me several times that the religious stuff behind it is kind of stupid, but the technique works for a series of problems.
I am however aware that research into acupuncture didn't see a difference between acupuncture and sticking needles at random (so it might just be placebo). But I'm convinced it deserves some further research, because something is happening to these patients.
Regarding the GPs comment: as far as I know, going to a point where China is a superpower with the most advanced technology on Earth would simply be a return to the natural order of things... But I would like their views on human rights to change before they get very powerful.
and your point is?
let me give you a hint: "I don't think it's a very good idea to cook food. it would allow the whole population to slowly, but surely, grow smaller and weaker teeth."
as far as I understand it, the point of patents is to allow inventors to profit from their invention even though it's not an industrial secret. the community can benefit from understanding why the invention works, and the inventor gets back their investment, plus profit.
there are a lot of problems with this system at the moment, because too many things are getting patented.
there are a lot of cases where several researchers concentrate on some given problem, they publish intermediary results, and it is predictable that within some time frame most specialists will arrive at the same solution. however, only the first one to find the final result (or the first one to file for the patent) is awarded the patent. this is wrong in my view, because there is an entire community working in that direction.
in medicine, I'm pretty confident this is the general case, and pretty much the reason there are several different but similar drugs dealing with the same medical problems.
basically, I think patents should only be granted to individual researchers who can prove they developped a concept (on their own) based on widely available information. anything other than that is just simple research, and should be rewarded with grants or prizes by private persons/organisations, but not with a patent. "ethics" and religion should have nothing to do with patentability.
the truth is, fusion is N billion dollars away (I'm not sure about the N, probably 20-30), and the world is only willing to pay over 50 years. I think after this scare, some governments will try to speed up the process.
what would be the motivation of a war between india and china? or russia and china? I'm not trolling, I am simply curious.
generally, you go to war if you have something to gain.
ok, I agree you can think of a number of immediate reasons for war between these countries (like it was with the assassination that sparked world war 1), but what would be the real motivations (world war 1 was bound to happen, because there were a lot of peoples trying to get independence, there were the Germans who knew that without colonies they couldnt catch up to the UK and France and so on; at least, I've been told there were a lot of more profound reasons)?
and a final note: I am certain that if a war breaks out between China and India, NATO will intervene (with the real motivation that the winner would be much too powerful). As for Russia, NATO would intervene to protect the nukes.
sarcasm?
I searched and I couldn't find anything. Maybe I misunderstood my teacher (I was 11 or 12). The only reference to a lake of mercury that I could find was in this article http://www.jstor.org/stable/3915188, where they say there was a legend about a lake of mercury in California...
I find it strangest that I've never looked it up properly before.
first of all, note that not all people refer to the christian/muslim/whatever God when they use the word "God". It is most likely that the grandparent poster was referring to some generic supernatural being.
you should relax when it comes to this topic. in the sense of mathematical truth, you cannot prove there is no God (in the sense of a counscious being "outside" reality). also, you cannot prove that there is a God (because you cannot distinguish, in practice, sufficiently advanced technology from magic).
You have to understand that for many scientists inclined to use mathematical logic, it comes natural to use "prove" in the sense of mathematical logic. Whereas there are a lot of other scientists who use "prove" in the sense of "provide theoretical model that explains empirical evidence, or empirical evidence that confirms theoretical model".
I personally don't care if there is or there is not a "God". I accept that I can interact with my surroundings, and I base my actions on the belief that my experiences tell me the truth about the world. I accept that I cannot prove or disprove the existence of a God, and I insist that there can be no such proof, in the mathematical logic sense of the word. but when I say all this, I am really just being pedantic, insisting that we use the proper meaning for the word "proof".
I do agree you can prove the events in the bible (and other "holy books") did not happen (and I think that's already done, mostly).
Anyway, here is a modern, reasonable discussion on the existence of God, if you're interested: http://www.simulation-argument.com/
I heard there's a lake of mercury somwhere in South America. on the same note, I would like to go "swimming" in that lake sometime (obviously, some kind of protection, especially from the vapors, would be needed...).
yes, but what's the efficiency of a solar cell that is almost parallel to the light?
and you can't really put them on vertically and rotate them after the sun, because then you don't have a large surface anymore.
I think I remember the relationships between different objects. If I have a visual representation for these objects, I can reconstruct images; in fact when I remember an image I remember objects in that image, and then I can see details if I want to --- but I'm not generally aware of the full process.
I'm usually considered good with math (I'm finishing a PhD in physics), but I can't honestly say how I handle it. I see formulas and the relationships between symbols. I see graphs of functions. I usually see vectors when I'm talking about stuff happening in Hilbert spaces.
The thing is, if I think about the relationships between objects, I first see boxes linked with arrows or simple lines. I can't say for sure why I interpret the stored information as an image. But I first see the schematic "drawing" (it's usually 3D), and then I think of an algorithm/system to recreating the information from that image. It might be because I played with blocks a lot as a kid, I can't say for sure.
I also generally recognize people by their faces, even if I can't remember their names or where I've met them exactly.
Whenever I get into this sort of discussion, I remember why it's so damn hard to build thinking machines (we don't know how thinking machines work).
I can't imagine what it must be like not to use images in thought. So I'm curious (not trolling): how do you handle text? Reading various fonts, handwriting, typing...
In the end, written symbols are drawings. Mathematically, they are curves with specific properties. In order to recognise them, you are using those properties in some way, so you are "postprocessing" the visual data in some way. I would be curious (as a programmer) to find out what it is your brain is actually doing, taking into account that it's apparently not very good at handling images.