## Search found 170 matches

Thu Apr 28, 2011 1:27 pm UTC
Forum: Coding
Topic: Python question
Replies: 9
Views: 1685

### Re: Python question

You may want to take a look at http://docs.python.org/library/ast.html , the ast module. Basically what you can do is subclass ast.NodeVisitor to throw hissyfits when visiting anything other than constants, variables and mathematical operations, do some changes (say, '^' -> '**', ast.NodeTransformer...
Sun Mar 27, 2011 7:08 pm UTC
Forum: Mathematics
Topic: How do I evaluate this infinite summation?
Replies: 13
Views: 2200

### Re: How do I evaluate this infinite summation?

I don't know what level this is either, but I feel like it makes sense to point you to generating functions. Essentially the idea is to think of a function that can be represented as a series and that can be evaluated at a certain point to yield the actual series you're concerned with. Example: ...
Fri Dec 25, 2009 9:45 pm UTC
Forum: Mathematics
Topic: Spheres in a Sphere Packing Efficiency
Replies: 6
Views: 1848

### Re: Spheres in a Sphere Packing Efficiency

Well, seeing how regular packing is, well, regular and its efficiency does converge to pi/sqrt(18) regardless of the shape it is used to fill (under reasonable circumstances I'm sure, but we're talking about a set difference between a ball and a cube here at worst, so I see no problem with it), and ...
Fri Jun 05, 2009 9:05 am UTC
Forum: General
Topic: Advice needed - looking for a place to live in London
Replies: 3
Views: 1065

### Re: Advice needed - looking for a place to live in London

Thanks for the replies:) The company did help a bunch actually - they sent us a relocation booklet with a couple of website addresses - one of them flatshare.com, which seems to work amazingly well. In fact, I'm waiting for an email from my prospective land-lady. If all goes well, this will all be s...
Wed Jun 03, 2009 2:21 pm UTC
Forum: General
Topic: Advice needed - looking for a place to live in London
Replies: 3
Views: 1065

### Advice needed - looking for a place to live in London

Hey, I got accepted to an internship in London along with a couple of friends from my university and right now we're looking for a place to stay over the course of the ~3 months we'll be working there. We're researching different alternatives, but none of us can actually land in the UK before our in...
Fri May 08, 2009 11:11 am UTC
Forum: Mathematics
Topic: Help: Number of potential images based on pixel combinations
Replies: 4
Views: 1763

### Re: Help: Number of potential images based on pixel combinations

Out of some pretty stark boredom I tried this: time python <<<"print (2**24)**(1280*1024)" > cyferki Unfortunately, it didn't complete within the 19 minutes that I spent waiting for it and I accidentally killed it by pressing Ctrl-C to copy the command into the post, Lame as hell, I know, ...
Thu Apr 02, 2009 8:45 am UTC
Forum: Mathematics
Topic: Measure theory problem - test preparation.
Replies: 10
Views: 1325

### Re: Measure theory problem - test preparation.

Oh lord, that's what you get for posting at 2am local time. Yeah, what I meant was \mu(A \cap I) - \mu((A + x) \cap I) \leq 0.05*\mu(I) . It follows from the choice of x. The measure of what will be cut off by taking the intersection after the translation (which is ob...
Wed Apr 01, 2009 11:50 pm UTC
Forum: Mathematics
Topic: Measure theory problem - test preparation.
Replies: 10
Views: 1325

### Re: Measure theory problem - test preparation.

My proof went something like this: First, the lemma. It's a one-liner, really: Let M be the measure of A. Let U={u1,u2,...} be a countable family of intervals such that the sum of all the intervals' lengths is M+epsilon and the intervals cover A. Now consider the sets A\cap u_1,A\cap u_2,... . Each ...
Wed Apr 01, 2009 10:49 pm UTC
Forum: Mathematics
Topic: Measure theory problem - test preparation.
Replies: 10
Views: 1325

### Re: Measure theory problem - test preparation.

Yakk: you're right, your reasoning is really very similar to what I did in my proof. There's also no problem with adapting it to sets of infinite measure: any set of infinite measure must contain a bounded subset of non-zero measure - just consider, for example, all intervals of the form [k,k+1], k...
Wed Apr 01, 2009 7:48 pm UTC
Forum: Mathematics
Topic: Measure theory problem - test preparation.
Replies: 10
Views: 1325

### Measure theory problem - test preparation.

Hi, I have a test in Mathematical Analysis on Friday and there was a bunch of preparatory questions we were given. This isn't going to be marked in any way, it's something for us to work on. I have developed what I believe is a working proof for this one, but it's pretty complicated compared to the ...
Thu Mar 26, 2009 6:25 pm UTC
Forum: Coding
Topic: Rather novice yet puzzling bash scripting issues
Replies: 8
Views: 1025

### Re: Rather novice yet puzzling bash scripting issues

well, a thing to try in such a case would be prefixing the line with DISPLAY=:0 or DISPLAY=:1 or whatever your display is actually called. That will attempt to connect to the X server. Again, there may be more problems than that, though. Do try to launch your script from a non-X terminal (like one o...
Sun Mar 22, 2009 12:13 pm UTC
Forum: Coding
Topic: Sort-of dynamic array
Replies: 17
Views: 1155

### Re: Sort-of dynamic array

Do note the logic OP wants to implement: The user first enters the numbers (the actual numbers, not the number of numbers) and then the array is supposed to be created. I really think the natural C++ way out of this would just be an std::vector. You simply push all the numbers and you're done. Eithe...
Thu Mar 19, 2009 8:11 pm UTC
Forum: Mathematics
Topic: Factual error on my GED locator test.
Replies: 26
Views: 2481

### Re: Factual error on my GED locator test.

The 'that person' thing is weird and sounds a little insulting in itself - why not use the actual nick? Anyway. We all know what a golden rectangle should be. Mind you, nowhere did you state that the test claimed its definition was equivalent with the usual. It seems very close (easily close enough ...
Fri Mar 06, 2009 12:13 pm UTC
Forum: Coding
Topic: Python Question / References and such
Replies: 10
Views: 1538

### Re: Python Question / References and such

I'm not sure if it is possible to do it precisely the way you want, but you can do var2[:] = [] instead of var2 = 0. That way you will change the entire var2 to [] and the same will happen to the var1["point"] reference. Since bool([]) == False, this gets you a way of indicating invalid po...
Sun Feb 22, 2009 1:10 pm UTC
Forum: Computer Science
Topic: Is there a fast way to find each elem thats in all of n sets
Replies: 19
Views: 1953

### Re: Is there a fast way to find each elem thats in all of n sets

Well, O(mn) is the data size, so there should be no possible way you could go lower than that. Designing an o(mn) algorithm would require you to not even look at some elements - at least in the expected case. Yet if we skip even one element, the answer can change. Think of n-1 identical sets and one...
Fri Feb 06, 2009 12:55 am UTC
Forum: Mathematics
Topic: The Busy Beaver function is smarter than our universe....
Replies: 39
Views: 3748

### Re: The Busy Beaver function is smarter than our universe....

antonfire: very, very neat:) I'd like to share this tangentially but amusingly relevant article, though: http://www.scottaaronson.com/writings/bignumbers.html . I don't really remember where I got it from (very well could be this forum) - note especially the later parts, which explain how the BB fun...
Sat Dec 27, 2008 12:05 pm UTC
Forum: Mathematics
Topic: A non-analytic manifold
Replies: 10
Views: 1506

### Re: A non-analytic manifold

http://mathworld.wolfram.com/SmoothManifold.html
says yes - well, at least it says that there exist non-smooth manifolds in R^4 and higher. I can't give you the example though, I just accidentally stumbled upon this while preparing for a test on (among others) C^1 manifolds.
Tue Dec 09, 2008 11:26 am UTC
Forum: Mathematics
Topic: Project Euler problem 30
Replies: 5
Views: 2823

### Re: Project Euler problem 30

The first question I have for you is why do you limit yourself to the range [10000,99999] ? While there might be a valid reason to do so, I can't see one immediately.
Fri Oct 31, 2008 11:27 am UTC
Forum: Mathematics
Topic: Vector projection.
Replies: 8
Views: 1246

### Re: Vector projection.

Yeah, it is... No, it isn't. What you need to do to avoid it is: 1. Find a basis B of the whole vector space V such that it contains a basis of lin(a,b) - can always be done, that's a theorem, you just extend the basis of lin(a,b) with lin. indep. vectors as long as you can. 2. Find the unique repr...
Wed Oct 15, 2008 9:51 pm UTC
Forum: Coding
Topic: Java Binary tree implemented using an array
Replies: 21
Views: 5204

### Re: Java Binary tree implemented using an array

I'm pretty sure it's not even possible to do if you can't store the indices or leave holes. The way I'd do it (and one I'd probably use in C if I wanted to avoid dynamic memory allocation) would most likely be to convert the whole array to an array-stored stack and then basically use it as a custom ...
Sat Aug 30, 2008 12:06 am UTC
Forum: Mathematics
Topic: Sine Derivative Proof?
Replies: 32
Views: 6129

### Re: Sine Derivative Proof?

Precisely - it's an approximation, it's good if you're doing computations using a sine table or something like that, but you can't substitute it for the actual value when you're talking about limits, unless some very stringent requirements are met. Try this proof again without relying on approximati...
Fri Aug 29, 2008 11:55 pm UTC
Forum: Mathematics
Topic: Sine Derivative Proof?
Replies: 32
Views: 6129

### Re: Sine Derivative Proof?

Well, that might be because it's not very true, where did you get that identity anyway? From now on there shall be hints, successively more revealing: 1. Really, really try to think about the most basic expansion for sin (x+h). sin (x+h) = sin x * cos h + cos x * sin h, right? 2. Does that l...
Fri Aug 15, 2008 10:02 pm UTC
Forum: Hardware
Topic: I inhereted a laptop
Replies: 6
Views: 1645

### Re: I inhereted a laptop

But there's a cool, uber-geeky twist you could take to this picture-frame idea. Download a ton of vintage demos and write a script that will play them in a random sequence. You will probably need really old demos, because most of what I saw seemed to use the palette setting feature of VGA, but I'm n...
Tue Aug 05, 2008 11:49 am UTC
Forum: XKCD Meetups
Topic: The Demon European Tour 2008, or "Help us have a fun trip"
Replies: 4
Views: 1791

### Re: The Demon European Tour 2008, or "Help us have a fun trip"

Thanks for the tips, we'll very likely check those places out:) The strippenkaart looks... quite amusingly old-school, actually:D Could you tell me approximately how many actual trips can you make with that large 45-strips kaart? I mean - in the typical usage scenario, how many zones would you pass ...
Sat Aug 02, 2008 3:28 pm UTC
Forum: Coding
Topic: When are different reaction orders acceptable? e.g. O (2^n)
Replies: 12
Views: 2171

### Re: When are different reaction orders acceptable? e.g. O (2^n)

As a guideline for ACM-style competitions we were once told that if our program's time complexity is O(f(n)), the maximum input is x, then if f(x)<=10 6 , the code will most likely execute in less than a second. This has recently become an excessively stringent guideline, but most likely if your pro...
Tue Jul 29, 2008 9:15 pm UTC
Forum: Coding
Topic: getting information about the desktop
Replies: 7
Views: 1131

### Re: getting information about the desktop

what may or may not be a good idea - the icons are most likely drawn somewhat independently of the background/wallpaper, so perhaps you could be able to intercept data pertaining to the icon layer, then separate this into regions and go on from this point? that wouldn't give you an easy way to disti...
Tue Jul 29, 2008 10:58 am UTC
Forum: Coding
Topic: C++ - implementing the algebra of R->R functions
Replies: 4
Views: 1152

### Re: C++ - implementing the algebra of R->R functions

Well, essentialy that's just what I'm doing, right? I have something of this sort: <scalar> ::= the set of C++ floats. | <function>(<scalar>) <function> ::= <function> ( <function> ) | <function> + <function> | <function> * <function> | <function> * <scalar> | <function> + <scalar> | x | sin | ... I...
Wed Jul 23, 2008 7:38 pm UTC
Forum: Coding
Topic: C++ - implementing the algebra of R->R functions
Replies: 4
Views: 1152

### Re: C++ - implementing the algebra of R->R functions

Somehow (most likely by googling C++ lambda) I got the impression that the standard solutions are compile-time (similar to #define or template-based functional programming prosthetics I saw used in C++) , while I want to be able to arbitrarily compose functions at run-time. I'll go read about boost:...
Wed Jul 23, 2008 7:29 pm UTC
Forum: XKCD Meetups
Topic: The Demon European Tour 2008, or "Help us have a fun trip"
Replies: 4
Views: 1791

### The Demon European Tour 2008, or "Help us have a fun trip"

Hi everybody. This September, a friend of mine and me are going for a trip around Western Europe by rail - we're going to use InterRail, to be precise. Right now, we plan to visit Amsterdam, perhaps spend a day or two in Belgium, then head on to France (most likely Paris first), continue to Spain (B...
Wed Jul 23, 2008 6:56 pm UTC
Forum: Coding
Topic: C++ - implementing the algebra of R->R functions
Replies: 4
Views: 1152

### C++ - implementing the algebra of R->R functions

Hi. I'm coding up a personalized sound synthetizer/editor and obviously I want to do it in the nerdiest way possible. That is - by basing the whole thing around a class that would represent functions from real numbrers into real numbers - in this case float's, right now I don't care about 24bit or s...
Sun Jul 13, 2008 1:45 pm UTC
Forum: Hardware
Topic: Mac Mini - should I buy it for my mum?
Replies: 3
Views: 1057

### Mac Mini - should I buy it for my mum?

Well, that's the basic question. My mum is just about completely computer illiterate, but she's quite an intelligent person. Now she has a disgrace of a pc - a celeron 2.8 with 512mb ram. While the specs alone don't make it sound that bad, I'm pretty sure something's wrong with the memory, the whole...
Tue Jul 01, 2008 12:39 pm UTC
Forum: Mathematics
Topic: Neural network x^2 equivalent
Replies: 11
Views: 1930

### Re: Neural network x^2 equivalent

I'm not sure I know the correct terminology, but an ANN is limited to a linear combination of inputs iff the propagation function is f(x)=x. By the propagation function I mean the transformation that is applied to the output value of a neuron between layers. That is: internally, a neuron's excitemen...
Mon Jun 02, 2008 9:51 pm UTC
Forum: School
Topic: SAT Scores
Replies: 241
Views: 33936

### Re: SAT Scores

Time to boast a wee bit: SAT Reasoning: Critical Reasoning - 780 Math - 780 (no idea why not 800, apparently I didn't mark one answer) Writing - 640 (frankly, I had no idea there would be any writing involved. Yes, I'm that disorganized usually.) SAT Subjects: Math lv 2 - 800 (without a graphing cal...
Sat May 31, 2008 10:02 pm UTC
Forum: Mathematics
Topic: A most mysterious of numbers
Replies: 33
Views: 5231

### Re: A most mysterious of numbers

This is irrelevant, as I made a rather stupid mistake earlier on, thinking about sin and writing cos. I realized it after typing, but I decided to leave it here, since it's still not entirely stupid, though basic, and - yes - almost irrelevant. cos isn't a contraction mapping on (0, \frac{\pi}{2} ) ...
Fri May 30, 2008 1:02 pm UTC
Forum: Mathematics
Topic: A most mysterious of numbers
Replies: 33
Views: 5231

### Re: A most mysterious of numbers

Take a look at http://en.wikipedia.org/wiki/Contraction_mapping (this has been mentioned, but not linked). Since cos(x) has an infinite number of points where cos'(x) = 1, it's not a contraction mapping everywhere. If you were to consider an interval with no such point inside (and one that would map...
Tue May 13, 2008 9:35 pm UTC
Forum: Coding
Topic: Python arbitrary slicing
Replies: 12
Views: 1867

### Re: Python arbitrary slicing

seriously, [foo[i] for i in bar] is short and legible. if you need something shorter you could probably create a one-letter-named function that would do either that or dict(zip(foo,bar)), which is considerably less pythonic though, it uses something besides what is considered syntax:D
Mon May 05, 2008 11:10 am UTC
Forum: Mathematics
Topic: Mathematical Proofs
Replies: 5
Views: 1184

### Re: Mathematical Proofs

Spoiler:
It suffices to notice that both 5 and 2 are congruent to -1 (mod 3). Therefore the assignment is equivalent to proving that (-1)n-1+(-1)n = 0 (mod 3). Which is really obvious.
Fri Apr 25, 2008 1:45 pm UTC
Forum: Coding
Topic: Traveling Salesman, or just crazy?
Replies: 6
Views: 1696

### Re: Traveling Salesman, or just crazy?

Are there any limits regarding the actual sequence in which you're supposed to reach those waypoints? Also, I believe there have been some advancements regarding the TSP on planar graphs. Are you sure it actually gives you the lowest total walking time? It might just look for the nearest waypoint wh...
Mon Apr 21, 2008 9:28 pm UTC
Forum: Mathematics
Topic: factoring argument
Replies: 9
Views: 1716

### Re: factoring argument

Well, almost - 3mn-1n = (3m-1)(3m(n-1)+3m(n-2)+...+3m+1) I think.
Sun Apr 20, 2008 10:19 pm UTC
Forum: Mathematics
Topic: factoring argument
Replies: 9
Views: 1716

### Re: factoring argument

Well, you could do a tad better than that, I guess - if k is not prime, than k=m*n, so 3k-1 = 3mn-1 = (3m)n - 1n = (3m - 1)*(the sum you would expect here).
So basically, if k mod n = 0, 3n-1 divides 3k-1. It's not big result, though.