Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

math programming

Name: Anonymous 2011-02-03 11:44

math programming in sepples is rather complicated to the point that books are written on the subject. first there is the factor of limited precision of types, like how much a double or long double can hold. so is it preferable to use dynamic programming languages like Python and Perl that dont have any limit on length of floating point precision? and is it true that twos compliment creates gaps in the number line? do calculators use twos compliment? I noticed some high end calculators use the old Z80 or 6502 CPUs, but is there added arithmetic circuitry or can you rely on these standard CPUs to provide sufficient math processing?

Name: Anonymous 2011-02-03 11:52

Read SICP.

Name: Anonymous 2011-02-03 11:53

Name: VIPPER 2011-02-03 11:54

>>1
and is it true that twos compliment creates gaps in the number line?
Yes.
can you rely on these standard CPUs to provide sufficient math processing?
That depends on the range and precision of your computations.

Also what the fuck are you trying to say?

Name: Anonymous 2011-02-03 11:54

An array of chars, with an integer offset for decimal point.
Or, two char arrays: one for the real part of the number and one for the decimal.

If you really need big numbers, arrays of unsigned long ints where each element contains the maximum amount and then starts adding to the "next" element.

Name: Anonymous 2011-02-03 11:54

>>2
I read the first chapter of SICP, I didnt do any of the exersizes because I dont understand calculus very well, but I dont recall any mention on the topic of precision of floating types

Name: Anonymous 2011-02-03 11:58

>>4
Also what the fuck are you trying to say?
the tldr of this thread is that Im asking if there are advantages of scripting languages over sepples and Im asking if calculators use special math circuitry that regular computers dont have

>>5
thats interesting, math programming is really done with arrays of chars?

Name: Anonymous 2011-02-03 12:06

>>6
Use the wonderful Scheme's numeric tower and rational numbers.

Name: Anonymous 2011-02-03 12:13

>>7
No, that was just a suggestion, humorous and extremely wasteful (1 byte per digit? what am I, nuts!?).  I just chose char because it made the most sense.
I would probably benchmark the unsigned long int trick, though, just to see how much mileage I could get out of it.

Name: Anonymous 2011-02-03 12:44

>>1
Common Lisp (and probably Scheme or Lisp in general) uses rational numbers etcetera.
For example:
[code]
Common Lisp  (/ 2 3) returns: 2/3
             (/ 2.0 3.0) returns: 0.6666667
Python: 2/3 returns: 0
        2.0/3.0 returns: 0.66666666666666663

Name: Anonymous 2011-02-03 12:56

>>10
In CL, rationals are just a pair of two integers (as in math), integers can be bignums as well as fixnums (for efficiency reasons). As for the precision, it depends on the type of floats used - some implementations even allow arbitrary precision or allow you to control the precision through some dynamic variables.

Name: Anonymous 2011-02-03 12:59

>>11
rationals are just a pair of two integers
You have read your SICP today, thank god.

Name: >>1 2011-02-03 13:05

>>7
I don't know what you mean by "special math circuitry".
If you mean that some CPUs provide specialized instructions for more efficiently performing math, then yes, moth CPUs do indeed have such instructions. If you think that CPUs NEED "special math circuitry", you're severly mistaken, as one of the consequences of turing competeness is that general purpose CPUs will all be able to perform the same calculations (yes, even single-instruction CPUs). If you think that CPUs have special circuitry for dealing with "true real numbers", you're also mistaken as real numbers don't exist physically and our physical world is most likely discrete (with the smallest unit of length being the plank length, and the time a transition/step takes is the plank time), thus actually building hardware to calculate with "real numbers" is impossible (although using analog hardware for computations when noise can be tolerated is okay).


You'll really have to clarify your question >>1

Name: Anonymous 2011-02-03 13:06

>>1
Infinite precision rational numbers:
(add1 (Σ (λ (n) (Π (λ (x) (/ 1 x)) 1 n)) 1 550))
2674252347798029384946198185705609758739803632986622164874161407924923161879198217133684339747228053477096755748698975498898773717222559861606844691824717005209680149033834351963214613188494840193536374616755239528249815966286350764056684542455660796873551025601047838069590451006368535109997094361095681100456161363962326138894765317607306952327343378054165728520627039642750400220619615498509816743941038329232888509835670465183175969021490433699473719757352566169915399382021840364337206713297947097226885537230662489769156533348623169285823919179856655149087374801142788520833712303031671148280452212020382677043185475858700789510140593801321646092093558178472727523033329198667460776664328380246669184169576309471388024430964293424898771868336069329506820581433346811774652597744731994484872699028081185945283548738132354492711370234670588784038144866585397462277803334025132450926655275390659854257681717020932064334217733416200070319940431209195773747233603535884869334124937499823156636500097380074239950132542079223141283473088902049758671887980504319178828300599235548135793896513643358596671970442682893701726775472427323571178038324593074268901386304758322448729630491185983848352114593520021992156258583577471449806449971692690600151414641829230653231827577
983802459259356662074355441137793347431110604651144479198088876558281242579164962290011290847981218205152641732478743713575931148850570704399331024351741671603418685893991083019974211115656158469727863800516147215068952498696288647804413609626105839888826318636698777620928878113288059530454577981438625938184784430999044277765668416176951046411343789612801219497439570501315860976283562141864293770573360744319071738127766994612911512526986093731671521974931744004637876910653089649354632288325265126725017917035438713745553476603669041018612024086214295888243325776378267887104542453583554622236714980737116021926883435675996817309306194625486398554206089257552977387419363843116775669760168342145334633627088181364451468661072899282055940126923892566995897425213194448419814496816739726680723075885467393165344115614545706638832736831916194965404407092702428617805961131444051955068427208088014349854252648609083521148307405899166168023886782580362893361144922364350613084000096813163465494744575480095709290137079858998229095039366253082393840005673133623686458426629438417650301086649736293327224359908642184175808069389946716160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Name: >>11,13 2011-02-03 13:06

Erm, damn typos.

Name: Anonymous 2011-02-03 14:31

Σ Π λ
What point in using these ugly characters instead of standard ASCII?

Name: Anonymous 2011-02-03 14:32

>>16
Brevity, mathematical convention, lambda is λ.

Name: Anonymous 2011-02-03 14:33

>>16
Math dont support multi-letter variable names, only greek and hebrew characters.

Name: Anonymous 2011-02-03 14:34

>>17
But this makes code look ugly and unreadable, like APL language.

Name: Anonymous 2011-02-03 14:40

Πρoγraμμiνg Λανγuaγe

Name: Anonymous 2011-02-03 14:42

>>18
Hebrew characters
Why do they all look the same, I can't study kabbalah like this.

Name: Anonymous 2011-02-03 14:44

>>20
a
u
e
i
g
Faggot.

Name: Anonymous 2011-02-03 14:44

>>19
I use only Σ, Π, π and λ, everyone knows what they mean.
I also used to use α, ω and σ when testing macros

>>20
Προγραμμινγ Λανγυαγε

Name: Anonymous 2011-02-03 14:51

>>23
Προγραμμινγ Λανγυαγε = 990 (ιωναθον -- "gift of God")

Name: Anonymous 2011-02-03 14:57

>>13
thats interesting info you give, I didnt know real numbers were unattainable, I thought only irrational numbers were unattainable.

>I don't know what you mean by "special math circuitry".
I heard that PowerPC CPUs have higher floating point precision than the floating point math unit that is in x86 CPUs, so I would imagine that calculators are built with this special high precision floating point circuitry.

Name: Anonymous 2011-02-03 15:01

>>23
They mean that your code looks like shit.

Name: Anonymous 2011-02-03 15:05

>>26
If I used them all the time, yes.

Name: Anonymous 2011-02-03 21:21

>>25
Calculators don't have any floating point circuitry.  Why would they?  It's not like they need to do billions of calculations per second.

Name: Anonymous 2011-02-04 8:32

>>28
>>25 needs his VROOM to render realistic 3D dicks on his graphical calculator.

Don't change these.
Name: Email:
Entire Thread Thread List