My Xfire profile

Archive for March, 2008

Defusion - March 16

Tuesday, March 18th, 2008

Matthew Brown’s Defusion Exhibit - March 16Defusion on the 16th of March was an interesting night.

Defusion was the closing party for the Fusion Festival that ran from the 12th until the 16th.

I didn’t attend any of the festival events except for Infusion (the opening party), and Defusion, as I had classes at the times of things I was interested in. I had one of my fractal animations displayed at Infusion, and at Defusion I had a series of fractal prints displayed.

I went to Defusion with Rhi, and I also invited Liza and Evan since Liza actually goes to the University of Queensland and knew where the Cement Box theatre is.

More after the jump.

(more…)

Popularity: 17% [?]

Share and Enjoy:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • TwitThis
  • Mixx
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Python Tutorial 2 - Numeric Expressions

Tuesday, March 18th, 2008

Python programming language logoPython’s interpreter can be used as a calculator quite easily. Of course, this is somewhat pointless since there are calculators built into most operating systems anyway. However, the numeric expressions that are built into Python become quite useful in general applications and are important to know.

Before you can start learning Python, you will need to install it.

The install is pretty straight forward, once you’ve got that done, you are ready to go.

Numeric Operators in Python

Python uses all of the normally expected operators, much the same as most other languages:

+ addition
- subtraction
* multiplication
/ division

Now, using these operators, we can type directly into the Python interpreter, IDLE, and it will return the result:


# Addition:
2 + 2
# Will return 4.

# Subtraction:
4 - 2
# Will return 2.

# Multiplication:
2 * 2
# Will return 4.

# Division:
4 / 2
# Will return 2.

Note that a # indicates a comment in Python.

If you need to take things a bit further, there are more operators commonly used in Python.

** is used to indicate to the power of, such as 8 to the power of 4, or 4 squared and so on.

Additionally, you can use brackets to override the default order that the expression will be interpreted in, the same was you would on a calculator.


# To the power of:
8 ** 4
# Will return 4096.

4 ** 2
# Will return 16.

# Using brackets to change the order:
4 * 2 + 5
# Will return 13, whereas.
4 * ( 2 + 5 )
# Will return 28.

Functions that you may find on a scientific calculator are available as either predefined functions, or need to be imported from a library.


5 + abs(-5)
# The "abs" function will return the absolute value,
# so this returns 10 rather than 0

abs(5 * -5)
# Returns 25 rather than -25.

Importing Additional Functions

Other less common operators are not loaded into Python by default, and so they have to be imported from a library of functions. This can become time consuming when you are writing directly into IDLE. If you open up a blank Python window (File > New Window), you will be able to type as many lines of code as necessary before sending it to IDLE. If you are writing expressions such as the ones above into a separate window, you will need to add a print command before hand, otherwise Python will just evaluate them and not display them, for example:


print 4 - 2
# Should be used so that IDLE will print the result,
# otherwise it will just interpret it without printing it.

To load less common operators, such as the square root operator, you have to load Pythons math library. If you just a single function, such as square root, this can be done as follows:


from math import sqrt

# The square root can then be found with this command:
sqrt(25)
# This will return 5.0.

If you need to use multiple, less common functions it may be easier to load the entire mathematics library.


import math
# This tells IDLE to load the mathematics library.

Once the library has been loaded there are quite a few more functions available, similar to those used in C.


math.ceil(2.2)
# The ceiling function will round the decimal up.

math.floor(2.2)
# The floor funtion will round the decimal down.

math.pi
# The constant, pi (3.1415926535897931).

math.pi*2
# Multiplies pi by 2.

pow(4, 2)
# The power function works similarly to the ** function.

# pow(4, 2) returns the same answer as 4 ** 2.

There are many more available including angular, hyperbolic, trigonometric, powers and other mathematic functions. A full list is available in the Python documentation.

Fractions

So far, we have mostly seen whole numbers as a result to our answers, why do you think this is? What happens if you tell IDLE to interpret the following expressions?


2.3 + 5.9
18.0 / 7.0
18 / 7

The answers and explanations in the next Python tutorial, Integers and Floats.

Thanks for reading, if you have any questions or comments, feel free to let me know below.

Popularity: 50% [?]

Share and Enjoy:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • TwitThis
  • Mixx
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Python Tutorial 1 - Getting Python

Friday, March 14th, 2008

Python programming language logoPython object-oriented programming language at uni in ITB001: Problem Solving and Programming, I figure what better way to solidify what I am learning than to write about it. Someone might find it useful as well.

So if you see anything that is wrong, or anything like that, feel free to point it out, I won’t bite.

First up, you have to get Python, this is pretty straightforward, but I may as well make it the first of my tutorials since it is necessary.

If you use OS X, it comes with it, as do some Linux distributions, though it may be outdated. Grab the latest version for OS X, or Unix based operating systems, or Python for Windows from the Python website.

The install is pretty straight forward and should have you up and running in no time, just follow the instructions, all of the defaults should be fine.

After it is installed, when you run the Python Shell (IDLE), it should bring up a window called IDLE. This is Python’s interpreter window, so anything you run will be evaluated here. You can type directly into IDLE, however it is limited to writing a line at a time which is slow and painful and cannot be saved. It is really only effective for checking a line of code here and there.

If you go to File > New Window, it will open up a blank window. These windows can be saved as .py files and are where you will write the majority of code. You can write as many lines as you want in these and then have Python evaluate them whenever you are ready.

If you want to get straight into Python, the best documentation I have seen personally, and also as recommended by my lecturer, is the documentation material available on the Python website.

I will be going through Python in the same sequence as I have been going through it at uni. So stay tuned and the next tutorial will be up soon.

If you want to leave any thoughts or input, it would be greatly appreciated.

Go on to the next tutorial, Numeric Expressions In Python.

Popularity: 20% [?]

Share and Enjoy:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • TwitThis
  • Mixx
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

TerraMedia Logo Design Idea

Tuesday, March 11th, 2008

TerraMedia Logo Idea 1I have been working on a few new things for TerraMedia, including a new website design and a new logo.

The new website is nearing completion, and one of the last things I have to sort out before it goes live is the new logo.

This is what I am currently looking at using for the logo, or at least basing it on. I’m quite liking it, it portrays TerraMedia much better than the previous logo. Terra of course meaning earth, so it makes sense that there be a reference to a planet in the logo. Previously the logo was intended to represent a mountain, though that may not have been plainly obvious.

What are your thoughts on the new logo idea? Any ideas would be greatly appreciated.

Thanks.

Popularity: 41% [?]

Share and Enjoy:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • TwitThis
  • Mixx
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Twittering

Monday, March 10th, 2008

My Twitter PageIf you have been to the Still As Life website of late, you would have noticed that I have started twittering as my Twitter feed is received in the sidebar of my blog. There is also a link to my Twitter site under the “My Other Sites” menu at the top of the page. Since I like to make things easy though, the Twitter logo also links to my Twitter page, and just for purposes of completeness, it is at http://twitter.com/darksbane, awesome!

I’m not quite sure about the formatting of the feed in my sidebar, what do you think about it? Is it a bit confusing to follow?

Popularity: 14% [?]

Share and Enjoy:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • TwitThis
  • Mixx
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Still As Life is proudly powered by WordPress
Entries (RSS) and Comments (RSS).