Author Topic: what programming language to do this?  (Read 8192 times)

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
what programming language to do this?
« on: 2 January 2010, 04:06 »
I want to essentially program an animation that shows the movement of particles in a vector field.

Need a lot of mathematical power to do things like draw plots alongside it. And these would be intense maths problems, so I hope there are solutions that aren't too basic. R would be pretty cool, but for animation? I've been learning python, but don't know any libraries.

I'd like to learn to do something like this, give me ideas if anyone can. Thanks!

I think I'll come along and post the background idea for this at some point soon. Yes it's like all my other ideas: absolutely batshit big. It's to do with public transport.
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

reactosguy

  • Member
  • **
  • Posts: 269
  • Kudos: 2
    • Microsoft Sucks !!!
Re: what programming language to do this?
« Reply #1 on: 2 January 2010, 06:03 »
I learned Flash and ActionScript basics 1.5 years ago.


It's pretty excellent for animation, but use a Mac for that since the Windows version has tons of crap I had to delete after uninstalling it.

Aloone_Jonez

  • Administrator
  • Member
  • ***
  • Posts: 4,090
  • Kudos: 954
Re: what programming language to do this?
« Reply #2 on: 2 January 2010, 15:04 »
I'm afraid that's the wrong answer, I think pirate Penguin wants something FOSS.

How about using a spreadsheet such as OOo's calc or is that too slow?
This is not a Windows help forum, however please do feel free to sign up and agree or disagree with our views on Microsoft.

Oh and FUCKMicrosoft! :fu:

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: what programming language to do this?
« Reply #3 on: 2 January 2010, 19:21 »
Ah yeah Flash isn't what I'm looking for anyhow. It could be, but I want something with complicated maths features like scatterplots etc etc. Something like R would be perfect. I bet there's a way to do animation with R?

There are (were?) some mathematical fellows on this forum that I though might have a more appropriate solution.
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

reactosguy

  • Member
  • **
  • Posts: 269
  • Kudos: 2
    • Microsoft Sucks !!!
Re: what programming language to do this?
« Reply #4 on: 2 January 2010, 20:39 »
Maybe SVG?


You can program that in JavaScript, which does mathematical functions.


Albeit it's hard to find a SVG animation app.

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: what programming language to do this?
« Reply #5 on: 2 January 2010, 23:18 »
The whole thing could be written in PostScript, but god what a pain in the ass.

What's the target platform?  If you want to do something in the browser, that's a very different process than making a Windows executable, which is different than making a shell script that pipes to an interpreter.  Choosing your platform narrows your language choices considerably, so that's the first step I'd take.

TheQuirk

  • VIP
  • Member
  • ***
  • Posts: 2,154
  • Kudos: 315
Re: what programming language to do this?
« Reply #6 on: 29 April 2010, 19:04 »
The easiest solution to this problem is something like Mathematica or Matlab. Both cost money and both have student discounts. (There is also Octave, which is a Matlab clone. I don't know anything about it.)

Another option is to solve your equations of motion numerically in C or FORTRAN (or whatever), save all coordinates to a file every N steps, and then make an animation using gnuplot. This is often not difficult to implement if your field is nice enough (e.g. you have a formula for each component) or if you need to solve a differential equation for which there is a simple numerical recipe (e.g. wave equation).

If you are still working on this, tell me what sort of problem you're dealing with so that I could check if it overlaps with any of the code that I have.

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: what programming language to do this?
« Reply #7 on: 11 May 2010, 21:51 »
The easiest solution to this problem is something like Mathematica or Matlab. Both cost money and both have student discounts. (There is also Octave, which is a Matlab clone. I don't know anything about it.)

Another option is to solve your equations of motion numerically in C or FORTRAN (or whatever), save all coordinates to a file every N steps, and then make an animation using gnuplot. This is often not difficult to implement if your field is nice enough (e.g. you have a formula for each component) or if you need to solve a differential equation for which there is a simple numerical recipe (e.g. wave equation).

If you are still working on this, tell me what sort of problem you're dealing with so that I could check if it overlaps with any of the code that I have.
Thanks Quirk. I take classes in mathematica/matlab next semester, and I'm not gonna spend time learning them now to satisfy some curiosity. Producing the coordinates in C or Python and plotting using gnuplot, I like that idea if I want to investigate something like this during the summer.

This is more of a thought experiment and I was interested in producing a couple of animations. Basically the idea was, would a transport system (assume only bus, for a start) work better if it didn't do fixed routes at fixed times (I know they have fixed changes too, eg the morning service is entirely different to the evening service), but instead was dynamic, and people could indicate where they wanna go at a bus stop by using a terminal, or as they leave work by using their phones.

Of course there would be a lot of issues with this in real life, but it's still an interesting mathematical problem. I'm sure it would work for some cities better than others, and perhaps wouldn't work for any real life city, with real people who won't fill the system accurately, but maybe it could produce a better, quicker more adaptable transport service? I know in other cities they have great public transport , much better than what I'm used to (one problem I'd love to see solved is why, about 30-50% of the time I'm waiting for a bus to the city center, I could be waiting for an average of 10 minutes (up to 20) and then TWO BUSES come - one right up the arse of the other, it baffles me).

Anways that was something I was thinking about around christmas, and something I might think about more from a mathematical point of view.

Good to see you're still around Quirk.
« Last Edit: 11 May 2010, 22:02 by piratePenguin »
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Re: what programming language to do this?
« Reply #8 on: 11 May 2010, 23:53 »
I don't know a fucking thing about math but you can use the GD library, which makes animooted gifs and MNGs from any language worth a damn. You could do it in good old php, or even C if its intensive at all.

Refalm

  • Administrator
  • Member
  • ***
  • Posts: 5,183
  • Kudos: 704
  • Sjembek!
    • RADIOKNOP
Re: what programming language to do this?
« Reply #9 on: 12 May 2010, 01:43 »
one problem I'd love to see solved is why, about 30-50% of the time I'm waiting for a bus to the city center, I could be waiting for an average of 10 minutes (up to 20) and then TWO BUSES come - one right up the arse of the other, it baffles me
Psychology gets a bit involved. It depends on the personality of the bus driver, when the bus will leave.
A lot of bus drivers in my town leave 5 minutes late, so they can justify driving fast with a bus through town.
The rest actually leave 5 minutes earlier, to adjust for the traffic congestion.

It's certainly an algorithm to take into account.

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: what programming language to do this?
« Reply #10 on: 12 May 2010, 05:21 »
one problem I'd love to see solved is why, about 30-50% of the time I'm waiting for a bus to the city center, I could be waiting for an average of 10 minutes (up to 20) and then TWO BUSES come - one right up the arse of the other, it baffles me
Psychology gets a bit involved. It depends on the personality of the bus driver, when the bus will leave.
A lot of bus drivers in my town leave 5 minutes late, so they can justify driving fast with a bus through town.
The rest actually leave 5 minutes earlier, to adjust for the traffic congestion.

It's certainly an algorithm to take into account.
A bus system based off an adaptable model such as what I mentioned will cope with situations where 2 (and more) buses are (currently) traveling the same route by redirecting one bus in such a way that it will help the system pick up the maximum passengers and leave them where they wanna go i.e. most buses should branch off asap and make different stops to collect people for the city, if that's what's deemed optimal. That raises the problem that, in all probability a bus will have someone or some people on it that seriously restricts the changes that can be made to it's route. But in the first case you will try to put people heading a similar way on the one bus.

It would really not be a simple system! And in normal working weeks I'm sure the optimal system is well approximated by a non-real time (i.e. current day) bus system, without the inconvenience. But, to see this system adapt and cater for concerts and all events, route blockages, and whatever else, in an optimal way - every day, it might just be an addition. A LOT of maths would tell you the answer, and I suspect this might work in SOME CITIES. Dublin is a roughly hopelessly planned city (Google "Dublin sprawl"), and I would venture to guess a dynamic system would work better for a city such as this, than more dense and modern cities (as most cities are).
« Last Edit: 12 May 2010, 05:28 by piratePenguin »
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Re: what programming language to do this?
« Reply #11 on: 12 May 2010, 10:02 »
I have a simpler solution: trains.

Refalm

  • Administrator
  • Member
  • ***
  • Posts: 5,183
  • Kudos: 704
  • Sjembek!
    • RADIOKNOP
Re: what programming language to do this?
« Reply #12 on: 12 May 2010, 13:01 »
I have a simpler solution: trains.
A small city only has a maximum of 4 train stops.

Automated metro rails would be a better idea. However, that doesn't work for rural areas.

Anyway, I know for a fact that ProRail (rail maintenance for the Netherlands and parts of Germany and Belgium) is using Java for their train traffic systems. Busses are a bit more complex when you have to take in account traffic congestion, stops, chauffeur behaviour, closed routes, etc.
Here's an article on Infra Atlas, you can use Google Translate:
http://www.railpedia.nl/display/test/Infra+Atlas
« Last Edit: 12 May 2010, 13:32 by Refalm »

TheQuirk

  • VIP
  • Member
  • ***
  • Posts: 2,154
  • Kudos: 315
Re: what programming language to do this?
« Reply #13 on: 19 May 2010, 10:45 »
I actually saw some recently that explained the two bus problem: http://blogs.discovermagazine.com/cosmicvariance/2010/03/04/buses-are-bosons-and-they-condensate/

Anyway, that sounds like an interesting idea! Are you interested in working on this together? These are my first thoughts:

We could assume a simplified model of a city, represented as a weighted graph (edges would be roads, vertexes would be stops). The weights could be passenger demand (issues of "demand to visit B depends on picking up passengers at A" would have to be worked out), maybe travel time.

Set some probability distribution for number of passengers at each time as a function of time.

Look for near-optimal paths on this graph as time evolves

Record average time/passenger

Run this program many times and bin the data into a histogram.

The same could be done with standard schedules. Then we could see if there are great improvements.

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: what programming language to do this?
« Reply #14 on: 19 May 2010, 19:17 »
I actually saw some recently that explained the two bus problem: http://blogs.discovermagazine.com/cosmicvariance/2010/03/04/buses-are-bosons-and-they-condensate/
Interesting :)

I sure would be interested in working on this together. I finish my exams on Saturday week and after I settle down a few days later, it'll be summer. And one thing I wanna do this summer is further my maths/programming in a useful way (was and am planning to study video compression, or the maths behind something interesting like that).

So yeah, we can both tackle this problem if you're interested. Sounds like a good plan to get started, but you've got years of experience on me, I'm sure it's peanuts for you but I'd have a lot to study! What topics should I start at for this problem?

Model will be very interesting, as the "bus bunching" problem will be minimised, but I wonder will it still be prevelent. That's the big question.

btw I'm finishing second year studying actuary, I've done big amounts of linear algebra, analysis, and probability, introductary differential equations (seems like I'll need that), basic complex analysis, and a fair amount of mathematical stats. Haven't even seen much of this in practice, hence my anticipation. Will graph theory be useful? I know nothing about that at all.

Anyways, it'd be good to work at this with someone who knows what to do, surely! If it's of interest to you to start building something during the next two weeks, go ahead and I'll jump in later. The real problem is determining the conditions that affect the system positively and negatively, testing it under unusual (but realistic) circumstances, and then drawing our conclusions. A model to play with would be a big step.
« Last Edit: 19 May 2010, 19:28 by piratePenguin »
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.