How Do You Write A Algorithm?
#1
Posted 04 October 2011 - 06:35 PM
(a(3+a)(bc - jk)za
(1(1+3)(2*3) - (10*11)) (26*1)
<p>
=) Thanks for anyone who takes the time!
~Clover
#2
Posted 05 October 2011 - 07:02 AM
(1(1+3)((2*3) - (10*11)) (26*1)
add 1 and 3, multiply 2 and 3, multiply 10 and 11, multiply 26 and 1.
(1*4*(6 - 110))*26
subtract 110 from 6.
1*4*-104*26
multiply 1, 4, -104 and 26.
-10816
#3
Posted 05 October 2011 - 07:10 AM
a = 1
b = 2
c = 3
j = 10
k = 11
z = 26
print (a*(3+a)*((b*c) -(j*k)))*z*a
would be an example.
#4
Posted 16 February 2012 - 03:30 PM
Clover, on 04 October 2011 - 06:35 PM, said:
(a(3+a)(bc - jk)za
(1(1+3)(2*3) - (10*11)) (26*1)
Clover,
An algorithm for above example as philip1882 showed you is trivial. So an
algorithm may need a better example.
Say you have twelve suits on a rack and you want to know how many you
have that are double breasted with matching pants.
Showing you this algorithm [in pseudocode] is thus
get coat rack
for each hanger in rack
- if contents of hanger is suit then
-- if contents of hanger has pants
--- if contents of hanger that is suit of type "double breasted" then
--- if contents of hanger that is suit "match" contents of hanger that is pants then
---- incr count by 1
print count
Now this is Not code of any language. One could though by defining a
few things write an actual program in any language.
Only increment our counter if what is found on each hanger is a suit,
that is double breasted and that has pants that match.
Another example is a fractal. Fractals such as the Mandlebrot set
are iteration functions that are mapped on the whole complex pane.
In case you do not know of complex arithmetic a brief intro
A complex number is Z = ax + iby where a, b are some constants, x, y
are your coordinates in a plane and i = sqrt(-1).
So an iteration function is for example Z = Z^2 + c where c is some
complex constant say (a, b ) or c = a + ib.
You then plot this for the whole complex plane. You get a Mandlebrot set.
I will leave this as an exercise for you to work out an algorithm in
pseudocode.
maddog
This post has been edited by maddog: 16 February 2012 - 03:31 PM
#5
Posted 17 April 2012 - 10:49 PM
This post has been edited by suresh kumawat: 17 April 2012 - 10:51 PM
#6
Posted 19 April 2012 - 02:44 AM
http://www.codingmon...hp?action=forum
I just put this link for another query, but you can find a lot of Basic compilers here. I think I placed a link there once to Delphi 7 PE, but Borland no longer supports it largely because Borlsnd is no more.
I'm saying this because D7 has so many math routines that any Delphi version makes life easy for math guys.
EBasic or IWBasic have floor and ceil routines that allow for integration routines, summation. So does Delphi. Delphi has string variables and converters and allow extremely long floats. An algebraist's dream
email me at drcharbonneau@live.com
See my work as it grows along with my group at:
http://www.jootbox.net76.net
or
http://www.jootbox.websitetoolbox.com
My time is limited online presently and I have to spend much there building the group. Access at the forum has the usual email verification.
"Anything that is truly great or inspiring is created in the mind of one individual laboring in freedom."
-Albert Einstein

Help
Join now


Promote to Article










