The Naked Scientists
  • Login
  • Register
  • Podcasts
      • The Naked Scientists
      • eLife
      • Naked Genetics
      • Naked Astronomy
      • In short
      • Naked Neuroscience
      • Ask! The Naked Scientists
      • Question of the Week
      • Archive
      • Video
      • SUBSCRIBE to our Podcasts
  • Articles
      • Science News
      • Features
      • Interviews
      • Answers to Science Questions
  • Get Naked
      • Donate
      • Do an Experiment
      • Science Forum
      • Ask a Question
  • About
      • Meet the team
      • Our Sponsors
      • Site Map
      • Contact us

User menu

  • Login
  • Register
  • Home
  • Help
  • Search
  • Tags
  • Member Map
  • Recent Topics
  • Login
  • Register
  1. Naked Science Forum
  2. Non Life Sciences
  3. Geek Speak
  4. how to write a algorithm
« previous next »
  • Print
Pages: [1]   Go Down

how to write a algorithm

  • 19 Replies
  • 22462 Views
  • 0 Tags

0 Members and 1 Guest are viewing this topic.

Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« on: 12/01/2009 03:55:34 »
I have been haveing some trouble learning how to write algorithms. can anyone help me?
Logged
 



Offline Chemistry4me

  • Naked Science Forum King!
  • ******
  • 7705
  • Activity:
    0%
  • Thanked: 2 times
    • View Profile
how to write a algorithm
« Reply #1 on: 12/01/2009 03:57:21 »
Are you talking maths or computers?
Logged
 

Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #2 on: 12/01/2009 23:24:54 »
computers
Logged
 

Offline DoctorBeaver

  • Naked Science Forum GOD!
  • *******
  • 12653
  • Activity:
    0%
  • Thanked: 4 times
  • A stitch in time would have confused Einstein.
    • View Profile
how to write a algorithm
« Reply #3 on: 12/01/2009 23:37:40 »
You have to break it down to single, linear steps. What do you want your algorithm to do?
Logged
 

Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #4 on: 14/01/2009 01:31:46 »
just to predict the next outcome of a numer sequence just somethiing simple like that can you tell me how to do that
Logged
 



Offline DoctorBeaver

  • Naked Science Forum GOD!
  • *******
  • 12653
  • Activity:
    0%
  • Thanked: 4 times
  • A stitch in time would have confused Einstein.
    • View Profile
how to write a algorithm
« Reply #5 on: 14/01/2009 02:12:04 »
You have got to be joking! Do you realise how complicated that is? In order to predict the next number you first have to work out what the connection is between the numbers you have to start with.

Can't you start with something simple like an atmospheric model!?  [:P]
Logged
 

Offline RD

  • Naked Science Forum GOD!
  • *******
  • 9094
  • Activity:
    0%
  • Thanked: 161 times
    • View Profile
how to write a algorithm
« Reply #6 on: 14/01/2009 12:18:34 »
Quote from: Dege on 14/01/2009 01:31:46
just to predict the next outcome of a number sequence just something simple like that can you tell me how to do that

If the numbers are points on a smooth line it should be possible to extrapolate to the next number.
Logged
 

Offline dentstudent

  • Naked Science Forum King!
  • ******
  • 3146
  • Activity:
    0%
  • Thanked: 1 times
  • FOGger to the unsuspecting
    • View Profile
how to write a algorithm
« Reply #7 on: 14/01/2009 12:30:37 »
Quote from: RD on 14/01/2009 12:18:34
Quote from: Dege on 14/01/2009 01:31:46
just to predict the next outcome of a number sequence just something simple like that can you tell me how to do that

If the numbers are points on a smooth line it should be possible to extrapolate to the next number.


Certainly, if you are dealing with standard linear relationships. But that assumes that the number sequence consists of numbers that are "related" and dependent. If they are entirely independent, you have no chance. But let's assume that we're dealing with a dependent variable. Curve fitting is rather difficult unless, as Eth says, you already know what the relationship is.

It would be easier to comment if we knew what numbers we were dealing with, and what sort of prediction is required.
Logged
 

Offline dentstudent

  • Naked Science Forum King!
  • ******
  • 3146
  • Activity:
    0%
  • Thanked: 1 times
  • FOGger to the unsuspecting
    • View Profile
how to write a algorithm
« Reply #8 on: 14/01/2009 12:32:13 »
Quote from: Dege on 14/01/2009 01:31:46
just to predict the next outcome of a numer sequence just somethiing simple like that can you tell me how to do that

I can however show you where the capital letters are, as well as commas, question marks and full-stops!
(FOG)
Logged
 



Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #9 on: 14/01/2009 20:53:55 »
haha ok sorry guys can yall start me off with just the basics of algorithms and lets work from there
Logged
 

Offline RD

  • Naked Science Forum GOD!
  • *******
  • 9094
  • Activity:
    0%
  • Thanked: 161 times
    • View Profile
how to write a algorithm
« Reply #10 on: 14/01/2009 23:54:13 »
Draw a flow diagram.
 
If you told us the intended function we may be able to tell you if it is possible and how complex the programme would have to be,
 e.g. if you are looking to create a programme which can predict lottery numbers you're wasting your time.

http://en.wikipedia.org/wiki/Software_development_process
« Last Edit: 14/01/2009 23:56:13 by RD »
Logged
 

Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #11 on: 15/01/2009 02:56:11 »
no its  not for anything like that ok just forget the predictions and just start me off with the simplest thing a algorithm can do, if you dont mind please.
Logged
 

Offline RD

  • Naked Science Forum GOD!
  • *******
  • 9094
  • Activity:
    0%
  • Thanked: 161 times
    • View Profile
how to write a algorithm
« Reply #12 on: 15/01/2009 05:05:59 »
Here is a simple flow diagram ...

 [ Invalid Attachment ]

* flowdiagram.png (104.58 kB, 900x680 - viewed 8121 times.)
Logged
 



Offline Chemistry4me

  • Naked Science Forum King!
  • ******
  • 7705
  • Activity:
    0%
  • Thanked: 2 times
    • View Profile
how to write a algorithm
« Reply #13 on: 15/01/2009 05:07:35 »
Haha, very good RD! Top notch!
Logged
 

Offline DoctorBeaver

  • Naked Science Forum GOD!
  • *******
  • 12653
  • Activity:
    0%
  • Thanked: 4 times
  • A stitch in time would have confused Einstein.
    • View Profile
how to write a algorithm
« Reply #14 on: 15/01/2009 11:37:59 »
RD - don't start him on iterative loops!  [:D]
Logged
 

Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #15 on: 15/01/2009 22:33:50 »
OK thanks allot that helps me out a great deal. OK now one last thing is there any article or download that you know of that can take me through the basics and help me out.thanks again
Logged
 

Offline RD

  • Naked Science Forum GOD!
  • *******
  • 9094
  • Activity:
    0%
  • Thanked: 161 times
    • View Profile
how to write a algorithm
« Reply #16 on: 16/01/2009 04:04:00 »
Here is an article...

Quote
How to describe software design using diagrams and pseudo-code
http://www.scienceprog.com/how-to-describe-embedded-software-design-using-diagrams-and-pseudo-code/

Pseudo-code is a list of stepwise instructions in plain English, like DoctorBeaver mentioned above, it resembles computer code (a.k.a. computer programme).
Logged
 



Offline Chemistry4me

  • Naked Science Forum King!
  • ******
  • 7705
  • Activity:
    0%
  • Thanked: 2 times
    • View Profile
how to write a algorithm
« Reply #17 on: 16/01/2009 05:14:42 »
Don't you ever go to sleep RD?
Logged
 

Offline chrisn

  • First timers
  • *
  • 4
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #18 on: 17/01/2009 09:08:45 »
Fibonacci numbers are generated by an algorithm which is easily converted into a computer program.

The first fibonacci numbers are:

0    1    1    2    3    5    8    13    21    34    55    

The ninth number is 21, which is the sum of the two previous numbers, 8 + 13.
Likewise, 55 = 34 + 21.
By definition, the first two are 0, 1.

If you want to generate the 100'th fibonacci number, it's easy to say that it is the sum of the 99'th and the 98'th number, but what their value is, being tedious fast.

If you want to generate these numbers in a programming language (there is example fibonacci code for basically every language), you define a function (my example is in python, a programming language):

def fibonacci(n): # Returns the n'th fibonacci number
   if n < 2:
     return n # The zero'th fibonacci number is 0, the first one is 1, by definition.
   else:
     return fibonacci(n - 1) + fibonacci(n - 2)

This is quite similar to the explanation in English. If you can describe an algorithm in English (or in math), converting it into a computer-language is quite simple, although you'll have to learn the language first. Describing in English (or in math), what the algorithm does, with all the corner-cases, that's the hard part.
Logged
 

Offline Dege (OP)

  • Full Member
  • ***
  • 67
  • Activity:
    0%
    • View Profile
how to write a algorithm
« Reply #19 on: 23/01/2009 00:40:10 »
OK i would like to thank you all. i am finally starting to get i [:)][img] t. thanks again and i am sorry for the wast of time>
Logged
 



  • Print
Pages: [1]   Go Up
« previous next »
Tags:
 

Similar topics (5)

Must ∞ monkeys on ∞ typewriters really write everything given ∞ time?

Started by chiralSPOBoard General Science

Replies: 28
Views: 29637
Last post 28/03/2020 11:42:26
by yor_on
can you write these elements up to down ..from more reactive to less reactive

Started by tareggBoard Chemistry

Replies: 2
Views: 3738
Last post 22/06/2014 16:33:38
by chiralSPO
What is the difference between "Algorithm" and "Artificial Intelligence"?

Started by evan_auBoard Technology

Replies: 5
Views: 9688
Last post 31/03/2016 15:27:05
by wolfekeeper
Where did Rindler write about relativistic mass and potential energy?

Started by PmbPhyBoard Physics, Astronomy & Cosmology

Replies: 4
Views: 1968
Last post 18/10/2018 12:31:45
by Bill S
Synesthesia – Can sufferers write more expressively using colour?

Started by John ChapmanBoard Physiology & Medicine

Replies: 5
Views: 5867
Last post 21/03/2009 03:50:15
by Karen W.
There was an error while thanking
Thanking...
  • SMF 2.0.15 | SMF © 2017, Simple Machines
    Privacy Policy
    SMFAds for Free Forums
  • Naked Science Forum ©

Page created in 0.714 seconds with 77 queries.

  • Podcasts
  • Articles
  • Get Naked
  • About
  • Contact us
  • Advertise
  • Privacy Policy
  • Subscribe to newsletter
  • We love feedback

Follow us

cambridge_logo_footer.png

©The Naked Scientists® 2000–2017 | The Naked Scientists® and Naked Science® are registered trademarks created by Dr Chris Smith. Information presented on this website is the opinion of the individual contributors and does not reflect the general views of the administrators, editors, moderators, sponsors, Cambridge University or the public at large.