Can anybody to be so kind and send me subj.
I want to use it to write big tute-book for everybody use
(electronic) about basic arithmetic\geometric task programming using asm and fpu.
It would be great if we write it together.
I need the book for very simple thing - I need not theory but collection of simple school exersizes in English ( a lot of them -
400-500 or even more would be great)
Then format of the book will be very simple.
Math task grouped by themes.
Some theory material on the theme.
Programming and asm specific material about problem around the theme and possible solutions.
Then with each exersize
- Task
- Detailed solution
- Formalizing to algebraic form for programming
- Computing algo for programming
- Asm realization.

The kind of book I wished to have when I started programmong.

I know that here are many good programmers who can do it very well so may be we can do corporative work.
The idea may be very creative - we even can write the book as result of contest:
If we have the book with lots of exersizes we can all try to do
them and make score system:
1. 1 score if you made it first (of course, with correct solution)
2. 1 Score if you made fastest (in clocks) solution
3. 1 Score if you made smolest (in bytes) solution

So if we have 500 tasks maximum possible value to score is 1500
We can publish solutions here, so I thinks area could become the
precious source of programming info. At least there is nothing simular around, and math tasks is something that every programmer deal with.
5-6 grade task take around 90% of topics that you need in formalized in programm task.

Afterwords result of the conteest we use to write the big tutorial book. And if we'll like it we can proceed to higher grades.

The point is that real pro programming does not separate math and computer operations - actually it is a fuging, mixture of both, and in basic things of math\programming you need to be trained as B.Lee in kung-fu.
It's not enough to be just aware of it - you need to be trained and always be able in short time to find options of solutions to choose the best one.

Why I ask it in English - 'cause all I have is in Russian, and I'm afraid to make mistakes while translating the exercizes.

What do you think?
Posted on 2002-02-05 07:00:19 by The Svin
Well I think its a great idea and I'd love to help in whatever way I can.

Apart from the math book (which unfortunatly I can't really help you with) is there anything at the moment I could do?
Posted on 2002-02-05 07:22:39 by Eóin
It's absolutly great!
If you have paper book with basic arithmitics.
Pick up basic topic.
Retype or write (I know you can) theory part and example.
Give your point of view of what is important around the topic
in solutions in asm.
Type demo task as one of exaple of the tasks relaited to the topic,
formalize it to algebra for (variables instead of constants)
and give exapmle of solution in asm given task.
Then write as much as possible exersizes (from the book or create your own) on topic so that members of the board can send their solutions and we all can analyze them and will try to optimize them.

Main problem that I have that I don't have exersizes in English,
and I'm very worried that I can misspell in English some math terms, You know how important it is to make task conditions absolutly clear.
As for the rest - I know that your math solutions is very good, so if anybody else will send math topics and tasks - I would love to see you solutions in asm.
Posted on 2002-02-05 07:56:09 by The Svin
Svin, I will be glad to help (both composition and solutions) - I have many text here that aply. Maybe I could send you a textbook, or should be able to find some text online? This approach to teaching programming should prove very successful to a large number of students.
Posted on 2002-02-05 10:49:42 by bitRAKE
The Svin,

I don't think there are many of these available in e-format... I have a trig and algebra, geometry college book... I'd be happy to scan a chapter at a time and send to you as an Adobe PDF.. it would be okay because I scan all my receipts and bills anyway and I'm currently archiving my past 5 years and it's taking a long time... I can scan a whole 300 page book and make an PDF in about... 10 hours total time... because I OCR it and shrink the file size to about 66k per page... that's the best I can do...

Posted on 2002-02-05 15:25:49 by _Shawn
... that's the best I can do...

:) I wonder if anyone here can do better than that. I was thinking of doing the same but when I read your post... 300 pp in 10 hrs? No, not me :grin: But I can scan to PDF some other book though, but not 300 pp in 10 hrs :grin:


// btw, i'm willing to commit all the help I can for this project not because I'm a math guru (much less assembly) or something, but because I'm NOT any good in math and assembly (yet). So I'd really like this to push through. :alright: Nice idea Svin
Posted on 2002-02-05 22:06:36 by pixelwise
Agreed, its an interesting idea. Definitely has my attention to say the least. I enjoy teaching/tutoring others as much as i enjoy masm programming. But im uncertain of how i could be any use. You say problems at the 5-6 level, however, Im not entirely sure what this level *is* (as different countries impose different standards).

My greatest asset is electronics and electrical eng. (what i do most of my tutoring in). I've got a good pile of great electrical stuff you can do programmically, which are quite math intensive. But i dont think this is a 5 or 6 grade level (fourier space analysis, and time domain transients + calculus). Perhaps simple Ohms law stuff, but this isnt too interesting in a program/solving situation.???

At anyrate, if you think i may still have use, let me know what your thinking...

Posted on 2002-02-05 22:46:31 by NaN

Svin thats a great idea! I not much of a math person so I'd really like to improve on it and with it being related to something I love to do, I think I'd understand math a whole lot better in a different way that might make more sense! So I'd defiantly read it! :alright:

As for making a contribution, the only math book I have is from my first first and second year of college and is more business type math with a few other stuff.

Funny how college courses make you take business math for programming but anyways... :rolleyes:

Posted on 2002-02-06 00:42:50 by JamesE
i can supply a calculus ebook, and a couple of others, but they are more high school/college/university oriented. I have had a quick look around, and basic math books are definately not common :sad: PM me if you want any of what i have.

Great idea though, i'd be glad to help anyway possible.
Posted on 2002-02-06 04:08:26 by sluggy
this sounds very nice idea .. if you need any help i'm here too :alright:

Posted on 2002-02-06 07:13:21 by eko
he says he's here then he says bye :grin: (just kidding, eko)

Posted on 2002-02-06 08:25:48 by pixelwise
I have to much to say and almost no time to express it :)
So, excuse me if I'll forget something - here will further posts for it.
First of all I'm really happy that you like the idea and I wish you to
fill the idea your own project, and feel free to extend it or go from it to your own thread evaluated from it.

The main point is that as though child inherits some parts of parents he(she) is absolutly unic person.
The same is about machine math.
Though it based of rules of math and machine it in real life becomes some special thing. The integration of understanding it
resulting in machine calculations is a new born child with it's own character and trades.

AOP by D.Knuth was one of example where the author tries to integrate both machine and math education in something new.
BTW it written in assmbly though not in xx86 assembly.

I like many things in AOP - algorithm analyze, represantation solutions in both algorithmic scripts and real programms, math involved in each stage etc. etc. and most of all - number of exersizes and basic rule - that without you own work on solutions any education is useless.

Hyde was inspired by AOP - he says it at the beginning of his AOA.

But there is something I don't like:
1. MIX and xx86 has different operators set. And often operators rules - proper choise is often a solution 'cause the same (even such simple thing as multiplication) may be done in different ways.
2. I'm absolutly sure that basic things is mush more important than complex - and it means that they need more attention.
Any complex topic understanding depends on DEPTH of understanding basics it based on. And Donald left out many basics
and much of his explonation may enough for already educated people in the field the rest of people have no chance even to start.
IMHO AOP is math part is not a text book but a collection of ideas
and interesting notes for those who are already educated.
It's of course very valuble but not as didactic material.
3. Math and algorithm part is separated.

Some time ago I noted that one of core part of assembly -
control bloks, flags and JCC is not used well even by many experienced programmers, and promised to write a tutor.
I have not kept my promise :)
Though I wrote thousand strings and tens tools\demos for it
I felt frustrated 'cause I didn't think it was enough to teach triks -
I needed to explain rules by wich anybody could create his own solutions in control blocks, and every time I would come to part of how to do it I feel a need to show some basic MATH light, but it seemed to me not absoluly relative to a topic, and I have very limited ability in explonation math and my Enlglish makes me swet
each time I need to explain some idea.

So I thoght - maybe before explaining some absolutly machine realated topic we should discuss basic "math in machine" topics wich could be a key to understand the rest?
And I thought that there is no need for me with my limited ability to write Math explonation - I'm sure that English native speakers have wonderfool math text books and all I need, is to disscus something that is important for machine math.

That was when the idea came.
OK let me stop this lirics :)
First of all:
1.Thanks for your offers of book - send anything you think can be of any help.
2. I'm going to start with very basic so most I need is books for children with lots of exersizes.
You see, exersizes should be easy ones:)
'Cause important thing is to learn how to make it in machine,
and how to train youself to find solution fast, and find optimal solution. Given complexity that at the same time a studen need also learn new commands and 100s way to arrange them in optimal way can kill the idea.
The exersizes should be as easy as after you've done first exercize of the kind you could be able make at least 10 simular tasks per hour.
Cause main aim is to find OPTIMAL solution, and this means that
need to create fast different ways to solve the task so that you choose the optimal from them at the end.
We have an example of it here: very simple task was given here
and people gave different solution, it is an example that their is
not just knowlige of some math topic but also DEPTH of knowlige
and VALUE of CREATIVITY used to solve even premitive task.

I personaly have my advantage in looking through ideas from others.
I'm also will be one of student and I'm sure I enjoy it.

in short -
Give me childish math text-book with a lot of exercizes!
Pleaaaaaaaaaaaase! :)))

1 Score for first solution
1 Score for fast solution
1 Score for smolest solution.

Example (try to solve!)

There is mixture of salt and water.
Salt in it has x % of weight.
How many kg of water you need to add so that salt in new mixture was just y % of new weight of mixture
x dd ?; % of salt
y dd ?; new % of salt
w real4 ? ;weight of mixture
watertoadd real4 ? ; how many water to add to increase % of salt
;in the mixture
;Your code:
Posted on 2002-02-08 09:02:53 by The Svin
okay here's my try, probably not the smallest or most optimized but I go for the "1 score for the first" :).

x: % of salt
y: new % of salt
w: weight
add: many water
new: new weight

add = new - w
y = x * w / new
<-> new = x * w / y

add = x * w / y - w

fld w ;st(0)=w
fild x ;st(0)=x st(1)=w
fmul st(0),st(1) ;st(0)=x*w st(1)=w
fidiv y ;st(0)=x*w/y st(1)=w
fsub st(0),st(1) ;st(0)=x*w/y-w st(1)=w
fstp watertoadd ;st(0)=w
fstp st(0) ;.

I hope I got the algo right. btw, you wrote " how many water to add to increase % of salt", shouldn't that be 'decrease'?

edit: changed fst watertoadd to ftsp watertoadd
Posted on 2002-02-08 10:18:29 by Thomas
First solution has been made!
Thomas gets 1 score forever and 2 additional score while nobody can beat his size and speed.
Of course decrease.
That's the one reason I hate translate tasks in Enlish while there are already text books with the tasks :)
Posted on 2002-02-08 10:37:26 by The Svin
fld w ;st(0)=w
fild x ;st(0)=x st(1)=w
fmul st(0),st(1) ;st(0)=x*w st(1)=w
fidiv y ;st(0)=x*w/y st(1)=w
fsub st(0),st(1) ;st(0)=x*w/y-w st(1)=w
fstp watertoadd ;st(0)=w
fstp st(0) ;.
It is your solution but with correct way to empty stack
(eliminates the need of last operation)
fld w
fild x
fmulp ST(1),ST(0) ;st0 = x*w
fidiv y ;st0 = x*w/y
fsub w ;st0 = x*w/y - w
fstp watertoadd ;watertoadd = x*w/y - w st0 empty
Posted on 2002-02-08 11:00:41 by The Svin
I was just about to post something like that, a bit different and a few bytes smaller. Your version is 32 bytes, the one I first posted is 30.
The one below is 27 bytes (28 if you have to use lea instead of mov).

mov eax, offset w ; /lea eax, w
;st(0) st(1) st(2)
fld real4 ptr [eax] ;w
fidiv y ;w/y
fimul x ;w*x/y
fsub real4 ptr [eax] ;w*x/y-w
fstp watertoadd ;.

Posted on 2002-02-08 11:07:12 by Thomas
    mov     eax, offset w

fld real4 ptr [eax]
fidiv dword ptr [eax][offset y - offset w]
fimul dword ptr [eax][offset x - offset w]
fsub real4 ptr [eax]
fstp real4 ptr [eax][offset watertoadd - offset w]
:grin: This could be smaller - depends on where the data is relitive to each other.
Posted on 2002-02-08 11:39:39 by bitRAKE
About my post - I just post your logic but changed towards speed.
So your want to play size then?
OK here is again your logic with little correction towards size:

mov eax, offset w ; /lea eax, w
;st(0) st(1) st(2)
fld real4 ptr ;w
fidiv y ;w/y
fimul x ;w*x/y
fsub real4 ptr ;w*x/y-w
fstp real4 ;.

And thakns, Thomas for you are in the game! :)
Posted on 2002-02-08 11:44:35 by The Svin
bitRake finished the thought I started faster!
Of course if we load offset of one variable into eax we can use
eax+difference of varable not for just additional 1 but for all.

bitRake, I'm glad you in the game!
But for I remember - the first who suggest use a register as
pointer to reduce size was Thomas - we just followed him :)
Posted on 2002-02-08 11:51:41 by The Svin
Yeah, I don't take credit for much - :tongue: - I just follow the lead... shame in my point sucker methods ;)
Posted on 2002-02-08 11:59:27 by bitRAKE