Showing posts with label Language Program. Show all posts
Showing posts with label Language Program. Show all posts

Wednesday, 12 August 2015

Python - How to Make a Simple Matrix


In this video I share about how to make a simple matrix using Python, it's easy to do. So, you can try it by yourself, but before that you have to make sure that you have been installed the program of Python.

I use Python version 2.7

thank's for watching and coming to my blog :D

"Python" Can Make a Temperature Conversion Program

Good morning.. :D

I just remember about my subject study, Physics' Computation. In that subject my lecture teach us about computation in physics using the one of language program, we use Python.
we make some graphics, doing mathematics calculation, etc.

In this article I want to show you how to make Temperature Conversion Program using Python.

1. Firstly, as usual you have to open your IDLE Python, and then you can copy the syntax below:

def Conversion(s):
    print "|TEMPERATURE'S CONVERSION|"
    print "==============="
    print ""
    print "Celcius    :",s,"C"
    print "Reamur     :",4*s/5,"R"
    print "Fahrenheit :",(9*s/5)+32,"F"
    print "Kelvin     :",s+273,"K"
s=input("Input Temperature:")
Conversion(s)

2. After that you can click Run, or press the button F5.

Further more you can watch this video Tutorial by clicking this link

Thanks for reading this article and for your coming to my blog :D

Monday, 27 July 2015

Make a Bouncing Ball Using VPython

Visual Python or VPython as Wikipedia says that VPython is the one of Python Programming Language to make a 3D graphics module called Visual.

As we know that, using VPython we can create objects such as cones, boxes, and spheres in 3D space and displays these objects. This makes it easy to create some illustration especially to visualization physics' subject.

In this tutorial I want to make a simple visualization using VPython it is how to make a bouncing ball :)

1. Firstly open VIDLE Visual Python, I use VPython version 6.10 for Python version 2.7 win32.
if you don't have the program, you can download by click the link below:


2. After you open the VIDLE VPython, type the syntax as shown below. You can copy the syntax.

from visual import *

floor = box (pos=(0, 4, 0), lenght=4, height=0.5, width=4, color=color.green)
ball = sphere (pos=(0,4,0), radius=1, color=color.red)
ball.velocity = vector(0,-1,0)
dt = 0.01

while 1:
    rate (100)
    ball.pos = ball.pos + ball.velocity*dt
    if ball.y < ball.radius:
        ball.velocity.y = abs(ball.velocity.y)
    else:
        ball.velocity.y = ball.velocity.y - 9.8*dt

3. You can change the size of floor, radius of ball, the vellocity and the colour of ball and floor as you want.

4. Before running the syntax you have to save it first with file extension .py (for example: bouncing ball.py)