Ohhh my my my!! I can barely hold my fingers!! I'm now writing from a recently installed Windows Vista and if surprise could be seen, a person on the moon could see me glowing tonight. I installed Vista directly connected to the Internet and still no sign of virus. It's running wonderfully on my Intel Dual Core at 2.13 Ghz + 2 GB RAM + Nvidea Graphics (256MBs). Even faster than XP and certainly much more appealing visually.
With some gymnastics current Desktop has 3 installed Os (Win XP, Win Vista , Linux Slackware). Of course all made possible by lilo magic and two physical disks split up in a total of (4+2=6) partitions.
SDA(250GB)
sda1 - Windows XP (ntfs)
sda2 – Linux Swap
sda3- Linux Slackware(ext2 )
sda4- Files (Fat32 so I can write on it from linux as well)
HDB(80GB)
hdb1 – Windows Vista
hdb2 – Another FAT32 file partition
It's soon to say, but I'm tempted to mark this as the end of my Microsoft allergy.
Or not... :P still think of it as an OA (as in Open Ass). Not that it's particularly more insecure than linux by default. The question is, I believe, that being vulgar... it's a more apealing target to work on.
sexta-feira, fevereiro 15, 2008
terça-feira, fevereiro 05, 2008
Geting just about any music you want
If it's streaming in to my computer, then there must be a way to grab it I thought- frustrated while not being able to figure out where the damn file was being pulled from. See most sites now have players in flash, because you can't trace the source of an swf, unless there's some way of decompiling it. But hey! Even if there is, that's a hell of a lot more trouble than reading the html source, or downloading that “hidden” *.js the guy has in some dark directory on the same server.
So... by accident while trying to read some tuts on wireshark, I just stumbled on another you tube magical video.
now this is about video files... but hey, potatoes and tomatoes it's all vegetables. Same to any stream. The guy suggests looking for the file, but my blind eyes and rather hazy mind suggest using ctrl+f , then select string and type your keyword like “mp3” or something like that. And voyla. Host and get bla blabla magic. Concatenate and paste on location in your favorite browser.
In conclusion I must say that I am not in favor of “stealing” everything. Point being that I couldn't have it otherwise. Is it that wrong? I couldn't buy it, I'd buy it if I could! There's no money taken.
Support your favorite artists, more money for them means more music for you do enjoy.
So... by accident while trying to read some tuts on wireshark, I just stumbled on another you tube magical video.
now this is about video files... but hey, potatoes and tomatoes it's all vegetables. Same to any stream. The guy suggests looking for the file, but my blind eyes and rather hazy mind suggest using ctrl+f , then select string and type your keyword like “mp3” or something like that. And voyla. Host and get bla blabla magic. Concatenate and paste on location in your favorite browser.
In conclusion I must say that I am not in favor of “stealing” everything. Point being that I couldn't have it otherwise. Is it that wrong? I couldn't buy it, I'd buy it if I could! There's no money taken.
Support your favorite artists, more money for them means more music for you do enjoy.
sábado, dezembro 22, 2007
magazine
I guess because god was so unmerciful when he decided just how much intelligence I should have, instead punishing me with absurd curiosity I am always delighted when I perceive it.
Just found this, though of sharing
http://www.intellectbooks.com/magazine/
Just found this, though of sharing
http://www.intellectbooks.com/magazine/
sudoers
My favorite thing about computers is that they always do what they're told, even when you tell them bad things =P If there's an error, it's always the programmer's error! Well if not a chip error, but in that case... it's a design error, the machine is still doing what it was told to do.
I just noticed today that I always open the same programs when I start the computer. So I though... why the hell am I doing the same commands when I can just code some shell script to do it for me?
And that's what I did.
Now I came across a little problem. I have several partitions on a sata disk, and an IDE disk working in this system...
And slackware recognizes them and mounts them as told by /etc/fstab. I like this, and do not want to change it, because it's comfortable when I just need to read and not write info to those partitions....
In case the house is on fire and I need to transfer some files to a removable media... you never know, I'm the Murphy's laws in flesh...
############################################################################
# Configuring the sudoers file #
############################################################################
So on to it, we want to use root commands so we'll need special permissions. Such may easily be achieved using:
myUserName@hostName:~$ sudo myUsuallyRootCommand
But in order to use this we must specify the current user has an authorized user for the myUsuallyRootCommand.
We do this by editing: /etc/sudoers file.
So grab your konsole and log as root to edit /etc/sudoers.
root@hostName:~$ kwrite /etc/sudoers &
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# bunch of bla bla bla in here...
# Samples
%users ALL=NOPASSWD: /bin/mount /cdrom,/bin/umount /cdrom, /bin/mount /dev/mysatapartition, /bin/umount /dev/mysatapartition, /bin/mount /dev/myIDEpartition, /bin/umount /dev/myIDEpartition
%users ALL=/sbin/shutdown -h -t secs now
uncoment the %users ALL=blabla line and add the commands you'd like.
The ALL=NOPASSWD: detail specifies that users in the users group can sudo to those commands with no password required.
############################################################################
# doing a very simple shell script #
############################################################################
grab any editor, I like Kwrite 'cause it automatically colors the words for me, avoiding certain Parkinson errors (as in Parkinson disease, tremble and press the wrong key without ever realizing it).
the next line identifies the shell you want to use it should be the first line in your file
#!/bin/bash
# grant all is reset , cause kde sometimes does a “save session” thing and keeps opening stuff I left
# open on exit X.
killall amarok
killall amsn
#--------------------------------------------------------------------
# MOUNT PARTITIONS
#--------------------------------------------------------------------
#use sudo to umount your partitions
sudo umount /dev/mySata
sudo umount /dev/myIDE
#Then mount them has your own
mount /dev/mySata
mount /dev/myIDE
#--------------------------------------------------------------------
# STARTING STUFF
#--------------------------------------------------------------------
#just run your favorite applications.
# you can even run a self welcoming voice file, but I guess that would be kind of sick =P
/usr/bin/thunderbird &
/usr/bin/amsn &
/usr/bin/amarok &
###################################################################
Save it has IlikeThisFileName.sh and then set it to be executable:
myUserName@hostName: chmod 755 IlikeThisFileName.sh
what that 755 is a list of permitions each digit corresponds to the individual permitions of a set, in order: owner , group, and all. Then to interpret it you must translate it to binary, least significant bit means executable, then writable, then readable. So 755 means, (111)(101)(101), owner can read write and execute, group and all the others can read and execute. Always though this was delightfull, wanna grab the guy who tough of this and kiss it. Well or not. =P but it's funny.
Off course you can then write another script for your work environment, say you're working on school assignments, set it to run you're favorite IDE, your favorite playlist to study, so and so. Customize!!!!
I believe more and more that laziness is the mother of invention. \_/
I just noticed today that I always open the same programs when I start the computer. So I though... why the hell am I doing the same commands when I can just code some shell script to do it for me?
And that's what I did.
Now I came across a little problem. I have several partitions on a sata disk, and an IDE disk working in this system...
And slackware recognizes them and mounts them as told by /etc/fstab. I like this, and do not want to change it, because it's comfortable when I just need to read and not write info to those partitions....
In case the house is on fire and I need to transfer some files to a removable media... you never know, I'm the Murphy's laws in flesh...
############################################################################
# Configuring the sudoers file #
############################################################################
So on to it, we want to use root commands so we'll need special permissions. Such may easily be achieved using:
myUserName@hostName:~$ sudo myUsuallyRootCommand
But in order to use this we must specify the current user has an authorized user for the myUsuallyRootCommand.
We do this by editing: /etc/sudoers file.
So grab your konsole and log as root to edit /etc/sudoers.
root@hostName:~$ kwrite /etc/sudoers &
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# bunch of bla bla bla in here...
# Samples
%users ALL=NOPASSWD: /bin/mount /cdrom,/bin/umount /cdrom, /bin/mount /dev/mysatapartition, /bin/umount /dev/mysatapartition, /bin/mount /dev/myIDEpartition, /bin/umount /dev/myIDEpartition
%users ALL=/sbin/shutdown -h -t secs now
uncoment the %users ALL=blabla line and add the commands you'd like.
The ALL=NOPASSWD: detail specifies that users in the users group can sudo to those commands with no password required.
############################################################################
# doing a very simple shell script #
############################################################################
grab any editor, I like Kwrite 'cause it automatically colors the words for me, avoiding certain Parkinson errors (as in Parkinson disease, tremble and press the wrong key without ever realizing it).
the next line identifies the shell you want to use it should be the first line in your file
#!/bin/bash
# grant all is reset , cause kde sometimes does a “save session” thing and keeps opening stuff I left
# open on exit X.
killall amarok
killall amsn
#--------------------------------------------------------------------
# MOUNT PARTITIONS
#--------------------------------------------------------------------
#use sudo to umount your partitions
sudo umount /dev/mySata
sudo umount /dev/myIDE
#Then mount them has your own
mount /dev/mySata
mount /dev/myIDE
#--------------------------------------------------------------------
# STARTING STUFF
#--------------------------------------------------------------------
#just run your favorite applications.
# you can even run a self welcoming voice file, but I guess that would be kind of sick =P
/usr/bin/thunderbird &
/usr/bin/amsn &
/usr/bin/amarok &
###################################################################
Save it has IlikeThisFileName.sh and then set it to be executable:
myUserName@hostName: chmod 755 IlikeThisFileName.sh
what that 755 is a list of permitions each digit corresponds to the individual permitions of a set, in order: owner , group, and all. Then to interpret it you must translate it to binary, least significant bit means executable, then writable, then readable. So 755 means, (111)(101)(101), owner can read write and execute, group and all the others can read and execute. Always though this was delightfull, wanna grab the guy who tough of this and kiss it. Well or not. =P but it's funny.
Off course you can then write another script for your work environment, say you're working on school assignments, set it to run you're favorite IDE, your favorite playlist to study, so and so. Customize!!!!
I believe more and more that laziness is the mother of invention. \_/
terça-feira, novembro 20, 2007
Human Computation .|. Luis Von Ahn
;) ;) ;) THE ESP Game
A game where you have to guess what the other person is writting to label the same image your viewing.
Human Computation - Google Video
"Luis von Ahn is an assistant professor in the Computer Science Department at Carnegie Mellon University, ... all » where he also received his Ph.D. in 2005. Previously, Luis obtained a B.S. in mathematics from Duke University in 2000. He is the recipient of a Microsoft Research Fellowship.
ABSTRACT Tasks like image recognition are trivial for humans, but continue to challenge even the most sophisticated computer programs. This talk introduces a paradigm for utilizing human processing power to solve problems that computers cannot yet solve. Traditional approaches to solving such problems focus on improving software. I advocate a novel approach: constructively channel human brainpower using computer games. For example, the ESP Game, described in this talk, is an enjoyable online game -- many people play over 40 hours a week -- and when people play, they help label images on the Web with descriptive keywords. These keywords can be used to significantly improve the accuracy of image search. People play the game not because they want to help, but because they enjoy it.
I describe other examples of "games with a purpose": Peekaboom, which helps determine the location of objects in images, and Verbosity, which collects common-sense knowledge. I also explain a general approach for constructing games with a purpose."
A game where you have to guess what the other person is writting to label the same image your viewing.
Human Computation - Google Video
Luis von Ahn
"Luis von Ahn is an assistant professor in the Computer Science Department at Carnegie Mellon University, ... all » where he also received his Ph.D. in 2005. Previously, Luis obtained a B.S. in mathematics from Duke University in 2000. He is the recipient of a Microsoft Research Fellowship.
ABSTRACT Tasks like image recognition are trivial for humans, but continue to challenge even the most sophisticated computer programs. This talk introduces a paradigm for utilizing human processing power to solve problems that computers cannot yet solve. Traditional approaches to solving such problems focus on improving software. I advocate a novel approach: constructively channel human brainpower using computer games. For example, the ESP Game, described in this talk, is an enjoyable online game -- many people play over 40 hours a week -- and when people play, they help label images on the Web with descriptive keywords. These keywords can be used to significantly improve the accuracy of image search. People play the game not because they want to help, but because they enjoy it.
I describe other examples of "games with a purpose": Peekaboom, which helps determine the location of objects in images, and Verbosity, which collects common-sense knowledge. I also explain a general approach for constructing games with a purpose."
terça-feira, novembro 13, 2007
Fucking 4X4 matrix keyboard
Still don't get it totally, well... based on the code I got anyhow.
The idea of a 4X4 matrix printing in to a 16 keys keyboard seems rather easy if one thinks the numbers are actually written in base 4. Then any number n= (line/4)*4 + (col%4);
now if one intends to save such a result in a counter, one shall evaluate the lower bits to match the col, and the higher bits to match the line. Sounds easy, either multiplexer or decoder should do the job and we'd all be happy. But this implementation I got, makes the cols independent of any input. And this I find at minimum ; QUITE ODD and am going crazy. And simulated the got deamn keyboard on a JAPPLET. And found my own got deamn solution for the problem and it works. So in case your busting your brain against the monitor searching for google on "keyboard 4x4 decoder" "keyboard 4x4 matrix" ... etc sick of reading datasheets and pic code...
Try the JApplet :P 'cause I'm such a nice person I've included the code. (not that I have issues with disassemblers but they mess up variable names anyhow).
well I guess I'm not a genious... but fortunately there are many shades of gray between Angelina Jolie's face and Bush's Ass hole and today I feel rather close to the neck.
need sleep.
root@desktop# shutdown -h -t secs now;
The idea of a 4X4 matrix printing in to a 16 keys keyboard seems rather easy if one thinks the numbers are actually written in base 4. Then any number n= (line/4)*4 + (col%4);
now if one intends to save such a result in a counter, one shall evaluate the lower bits to match the col, and the higher bits to match the line. Sounds easy, either multiplexer or decoder should do the job and we'd all be happy. But this implementation I got, makes the cols independent of any input. And this I find at minimum ; QUITE ODD and am going crazy. And simulated the got deamn keyboard on a JAPPLET. And found my own got deamn solution for the problem and it works. So in case your busting your brain against the monitor searching for google on "keyboard 4x4 decoder" "keyboard 4x4 matrix" ... etc sick of reading datasheets and pic code...
Try the JApplet :P 'cause I'm such a nice person I've included the code. (not that I have issues with disassemblers but they mess up variable names anyhow).
well I guess I'm not a genious... but fortunately there are many shades of gray between Angelina Jolie's face and Bush's Ass hole and today I feel rather close to the neck.
need sleep.
root@desktop# shutdown -h -t secs now;
quinta-feira, novembro 08, 2007
ohhh you need to know assembly to hack?
About three mounths ago there was a terrified null assembly coder kid, in a room somewhere at ISEL, asking in desperation for a book with pictures or other fine explanation of memory management, and stack pointers and stuff. [since this stupid kid skipped some classes] Only to receive as an answer I know not of more bibliography than that assigned to this subject. Try INTEL web site.. .I tryed... ohhh my, spear my limited brain of such limited approach. It would take me millions of years to understand the language, and a couple more geological eras to do something funny with it.
Well since I am now brain stopped by the recent loss of my father and need some funny diversion... though it was a nice idea to start learning some serious hacking... (no... not that kind of black hat hacking... you naughty boy) and ended up tripping on this. So to any one looking for a glimpse on stack, function pointers and a general view to what the hell is codding at it's most raw state (assembly) take a look at this book. Especially if you're a nob like me :$
(a nob at hacking... if you're a nob at coding there should be other things more suitable)
The Shellcoder's Handbook: Discovering and Exploiting Security Holes
take a glimpse now:
quarta-feira, agosto 01, 2007
More geek stuff
Well I'm stuck at level 5, in mod-X where I'm suppose to hack in to an FTP using telnet.
Has I know so little on this matter, I'm stuck on Google looking for clues and yes sometimes I get distracted and go on to useless yet funny stuff.
One of them I found on the related videos on this site.
The original animation (in case you don't wanna get in to that command line stuff):
can be found here.
_________________________________________________________________________________________________
I've been reading so much crap on how hackers, and crackers are "terrorists" I'm beginning to feel like a muslim trapped on the twin towers in 9/11.
"I'm harmless dude!" - she whispered.
And if that's not good enough so sorry... if there's gonna be a law on curiosity and on tech knowledge, just because some idiots use it badly... I hope there's equal effort in to stopping governments to use their resources to do the exact same thing!
terça-feira, julho 31, 2007
mod-X
Have I told you about mod-X ?
this little baby has been keeping me up late most nights and will make any aspiring geek go nuts.
It ALMOST got me enjoying all those ideas about stack and all that other stuff you don't really need to know 'cause someone already built an API for you...
------------------------
| "ohh wait a minute I just said something intelligent let me write it down" AHAHAHA
------------------------
I feel sorry for the fact people can't be decompiled.. Somethimes I'd really love to read the source code.
this little baby has been keeping me up late most nights and will make any aspiring geek go nuts.
It ALMOST got me enjoying all those ideas about stack and all that other stuff you don't really need to know 'cause someone already built an API for you...
------------------------
| "ohh wait a minute I just said something intelligent let me write it down" AHAHAHA
------------------------
I feel sorry for the fact people can't be decompiled.. Somethimes I'd really love to read the source code.
domingo, julho 29, 2007
clocky
ahahaha era mesmo uma coisa destas que eu precisava. =P
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Clocky - Robotic Alarm                                                                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Clocky - Robotic Alarm                                                                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
quarta-feira, abril 04, 2007
ssh .. X11 forwarding
Não vou perder tempo a fazer o que outros já fizeram melhor que eu poderia fazer agora :
http://wiki.linuxquestions.org/wiki/X11_forwarding_with_OpenSSH
Aqui fica muito sucintamente como se faz.
Só temos de descomentar as linhas que dizem respeito ao X :P nos ficheiros
/etc/ssh/ssh_config
#HOST *
# ForwardAgent no
ForwardX11 yes
# .... bla bla bla
e /etc/ssh/sshd_config
lá para o fim do ficheiro está
#AllowTcpForwarding yes
#GatewarPorts no
X11Forwarding yes
X11DisplayOffset 10 # isto é o que nos queremos que va para fora e vai apareçer no dispay
X11UseLocalHost yes
#... bla bla bla
E garantir que o .bash_profile do utilizador inicia a variavel DISPLAY
# DISPLAY = machine_where_runs:forward_display_from_this_machine.to_machine_where_runs_display
DIPLAY=localhost:10.0
http://wiki.linuxquestions.org/wiki/X11_forwarding_with_OpenSSH
Aqui fica muito sucintamente como se faz.
Só temos de descomentar as linhas que dizem respeito ao X :P nos ficheiros
/etc/ssh/ssh_config
#HOST *
# ForwardAgent no
ForwardX11 yes
# .... bla bla bla
e /etc/ssh/sshd_config
lá para o fim do ficheiro está
#AllowTcpForwarding yes
#GatewarPorts no
X11Forwarding yes
X11DisplayOffset 10 # isto é o que nos queremos que va para fora e vai apareçer no dispay
X11UseLocalHost yes
#... bla bla bla
E garantir que o .bash_profile do utilizador inicia a variavel DISPLAY
# DISPLAY = machine_where_runs:forward_display_from_this_machine.to_machine_where_runs_display
DIPLAY=localhost:10.0
quinta-feira, março 29, 2007
DynDNS
the fortune teller forecasts :
Your mode of life will be changed to ASCII.
helga.homelinux.com up and running hihihi hurray to ssh!! God I'm loving this semester. And my group is all curious and intelligent people, that actually want to explore things. I'm in wonderland. ;)
Maibe I find time these vacations to configure APACHE ;) then I'll post a link to my web page lol
Keep loving linux ;)
Dynamic DNSSM
Actions
*
Create Hosts
*
Manage Hosts
The free Dynamic DNS service allows you to alias a dynamic IP address to a static hostname in any of the many domains we offer, allowing your computer to be more easily accessed from various locations on the Internet. We provide this service, for up to five (5) hostnames, free to the Internet community.
The Dynamic DNS service is ideal for a home website, file server, or just to keep a pointer back to your home PC so you can access those important documents while you're at work. Using one of the available third-party update clients you can keep your hostname always pointing to your IP address, no matter how often your ISP changes it. No more fumbling to find that piece of paper where you wrote down your IP address, or e-mailing all your friends every time it changes. Just tell them to visit yourname.dyndns.org instead!
http://www.dyndns.com/services/dns/dyndns/
http://ddclient.sourceforge.net/
Your mode of life will be changed to ASCII.
helga.homelinux.com up and running hihihi hurray to ssh!! God I'm loving this semester. And my group is all curious and intelligent people, that actually want to explore things. I'm in wonderland. ;)
Maibe I find time these vacations to configure APACHE ;) then I'll post a link to my web page lol
Keep loving linux ;)
Dynamic DNSSM
Actions
*
Create Hosts
*
Manage Hosts
The free Dynamic DNS service allows you to alias a dynamic IP address to a static hostname in any of the many domains we offer, allowing your computer to be more easily accessed from various locations on the Internet. We provide this service, for up to five (5) hostnames, free to the Internet community.
The Dynamic DNS service is ideal for a home website, file server, or just to keep a pointer back to your home PC so you can access those important documents while you're at work. Using one of the available third-party update clients you can keep your hostname always pointing to your IP address, no matter how often your ISP changes it. No more fumbling to find that piece of paper where you wrote down your IP address, or e-mailing all your friends every time it changes. Just tell them to visit yourname.dyndns.org instead!
http://www.dyndns.com/services/dns/dyndns/
http://ddclient.sourceforge.net/
segunda-feira, março 26, 2007
My god!! I just smoked the peace pipe with pointers!!
Few things in life (right now lol) bring me more pleasure then saving a line of code, or a variable. And a pointer does just that! Because it's a variable and an iterator all in one! ;) Well sort of, you can use it both ways.
As an iterator, because it's really a memory index so... if you increase it you go to the next memory index, same if you decrease it , or add a given quantity to it etc. (search for pointer arithmetic) Great to arrays!!
And as a variable, because using the operator * you can access whatever the pointer points to.
Anyway, the hole reason for my excitement is not in pointers. It's I've been looking arround for a magical function that would transform an integer to a char array,but I couldn't find the code!! So I made one :P After stretching my brain a while I came up with this.
char * itc(char *d, int n){ /*int to char binary*/
    char *init;
    int i;
    init = d;
     for(i=sizeof(int)*8 -1; i>=0; i-- , d++ )
       *d= ((n>>i)&1 ) + '0';
    *d='\0';
    return init;
}
itc receives a pointer to a char array (one assumes big enough!! Easy peasy say you declare it like : char myLovelyCharArray[sizeof(int)*8]; Remenber: 1 byte == 8 bits) :P
We need to return the beginning of the string so we save it in init.
Then the brilliant Idea is to go bit by bit. But, but ohh my god! How am I gonna do that? int is bytes in memory but how am I going to access that? [that was my reaction when it stroke me anyway]. So then I reminded the bitwise operator. But never really got how to use it and Ritchie wasn't much of a help because the example was way to complicated for strike one :P so I experimented a little till I finally got it.
Do you have your boolean algebra up to date?
say 6 => 011 0
now shift right is an interesting concept if one considers it this way : what's the value of bit in position 1 ? Meaning if I divide 6 by 2^1 what do I get? 2=11 = 0011 .
Here's a visual example:
shift    (0110)>>nBits)&1
0110>>0 => 0
0110>>1 => 1
0110>>2 => 1
0110>>3 => 0
So our task becomes as simple as to translate this int value in to correspondent char. So we take advantage of the ASCII code ;) and just add the shift to it. If zero then = '0' otherwise = '0' +1; meaning 48 or 49. (6) ohh lovely. :P
Few things in life (right now lol) bring me more pleasure then saving a line of code, or a variable. And a pointer does just that! Because it's a variable and an iterator all in one! ;) Well sort of, you can use it both ways.
As an iterator, because it's really a memory index so... if you increase it you go to the next memory index, same if you decrease it , or add a given quantity to it etc. (search for pointer arithmetic) Great to arrays!!
And as a variable, because using the operator * you can access whatever the pointer points to.
Anyway, the hole reason for my excitement is not in pointers. It's I've been looking arround for a magical function that would transform an integer to a char array,but I couldn't find the code!! So I made one :P After stretching my brain a while I came up with this.
char * itc(char *d, int n){ /*int to char binary*/
    char *init;
    int i;
    init = d;
     for(i=sizeof(int)*8 -1; i>=0; i-- , d++ )
       *d= ((n>>i)&1 ) + '0';
    *d='\0';
    return init;
}
itc receives a pointer to a char array (one assumes big enough!! Easy peasy say you declare it like : char myLovelyCharArray[sizeof(int)*8]; Remenber: 1 byte == 8 bits) :P
We need to return the beginning of the string so we save it in init.
Then the brilliant Idea is to go bit by bit. But, but ohh my god! How am I gonna do that? int is bytes in memory but how am I going to access that? [that was my reaction when it stroke me anyway]. So then I reminded the bitwise operator. But never really got how to use it and Ritchie wasn't much of a help because the example was way to complicated for strike one :P so I experimented a little till I finally got it.
Do you have your boolean algebra up to date?
say 6 => 011 0
now shift right is an interesting concept if one considers it this way : what's the value of bit in position 1 ? Meaning if I divide 6 by 2^1 what do I get? 2=11 = 0011 .
Here's a visual example:
shift    (0110)>>nBits)&1
0110>>0 => 0
0110>>1 => 1
0110>>2 => 1
0110>>3 => 0
So our task becomes as simple as to translate this int value in to correspondent char. So we take advantage of the ASCII code ;) and just add the shift to it. If zero then = '0' otherwise = '0' +1; meaning 48 or 49. (6) ohh lovely. :P
sábado, março 24, 2007
Linux!! Linux!! linux!!
The goods make the bads worthwhile.
System up!! ;)
Has promised first time hole went for the system. Ended up breaking my pride and formating the system partition... 'cause actually it was the only thing I had to lose.
My strategy of moving all non system files, and some configuration files to a different partition worked like a charm. Saved me days of Google searching, and naturally all of my "sensitive data".
Still took me a couple of hours to get things my way, which tells me the next step is to do a script to do all this for me every time I format the disk. But that's a little more complicated than it seems 'cause there are versions, and kernel stuff to take care of for it to be perfect.
And... that would be a little out of reach for me at the moment.
Still, I'm rather pleased today ;)
System up!! ;)
Has promised first time hole went for the system. Ended up breaking my pride and formating the system partition... 'cause actually it was the only thing I had to lose.
My strategy of moving all non system files, and some configuration files to a different partition worked like a charm. Saved me days of Google searching, and naturally all of my "sensitive data".
Still took me a couple of hours to get things my way, which tells me the next step is to do a script to do all this for me every time I format the disk. But that's a little more complicated than it seems 'cause there are versions, and kernel stuff to take care of for it to be perfect.
And... that would be a little out of reach for me at the moment.
Still, I'm rather pleased today ;)
sexta-feira, março 23, 2007
Rainlendar
segunda-feira, março 19, 2007
domingo, março 11, 2007
break;
NewH(){
    while(energy())
      if(dayofweek==weekend)
         break;
      else
         bangHead();
    reset();
    NewH();
}
É fim de semana. Parece-me legitimo fazer uma pausa :P
será que um dia vou acabar assim?
just reminded someone I shouldn't. Must go running back to hide inside C.
    while(energy())
      if(dayofweek==weekend)
         break;
      else
         bangHead();
    reset();
    NewH();
}
É fim de semana. Parece-me legitimo fazer uma pausa :P
será que um dia vou acabar assim?
just reminded someone I shouldn't. Must go running back to hide inside C.
segunda-feira, março 05, 2007
Yet another C experiment
My weekend flew in between trains and a weeding. Got home with an incremented flue and a huge head ache. Fortunately a few ours Zombie[ing] where enough to get me back on track.
Thought I'd share this with ya just because I'm amazed at how much mental effort can be in three lines of code . The exercise was:
/* write the function any(s1,s2), which return the first location in the string s1 where any character from the string s2 occurs, or -1 if s1 contains no characters from s2. (The standard library function strpbrk does the same job but returns a pointer to the location)*/
now what most students would write should be something like
int any(char[] s1, char s2[]) {
for(i=0; s1[i]!='\0'; ++i)
for(int j=0; s2[j]!='\0';++j)
if(s1[i]==s2[j])
return i;
return -1;
}
direct reasoning:
go through firstString, if any char in string 2 == current char in string 1 ,return this index.
If no index is found return -1.
and that's what I wrote at frist. Two hours later at 3 am I had 3 lines of code less.
int any(char s1[], char s2[]){
int i, j;
for(i=j=0; s1[i]!='\0' && s1[i-1]!=s2[j]; ++i)
for(j=0; s1[i]!=s2[j] && s2[j]!='\0'; ++j)
;
return s1[i-1]==s2[j] ? i-1 : -1;
}
indirect resoning:
go trough first string only while there are chars in the firstSTring and the last one in frist string is different from the current in second string. This is important because the second cicle interropts if it finds an equal char in the second string and when it returns to test s1, it must stop all cicles.
Finally if last index was an equal char, return it. Else return -1; meaning no equal chars where found.
Deception comes with a much simpler code from standard library... as expected
you can find it together with your sources at:
~/glibc-build/sysdeps/generic/strpbrk.c
strpbrk (s, accept)
const char *s;
const char *accept;
{
while (*s != '\0')
{
const char *a = accept;
while (*a != '\0')
if (*a++ == *s)
return (char *) s;
++s;
}
return NULL;
}
This code uses pointers. In fact originally, as stated before: it returns one!
Pointers are the next curve on my so green C path. I'm hopping to be able to explain this one this afternoon. hihihi
It's been fun so far. Let's hope practice makes perfect. ;)
Better than Valium... try it out.
Thought I'd share this with ya just because I'm amazed at how much mental effort can be in three lines of code . The exercise was:
/* write the function any(s1,s2), which return the first location in the string s1 where any character from the string s2 occurs, or -1 if s1 contains no characters from s2. (The standard library function strpbrk does the same job but returns a pointer to the location)*/
now what most students would write should be something like
int any(char[] s1, char s2[]) {
for(i=0; s1[i]!='\0'; ++i)
for(int j=0; s2[j]!='\0';++j)
if(s1[i]==s2[j])
return i;
return -1;
}
direct reasoning:
go through firstString, if any char in string 2 == current char in string 1 ,return this index.
If no index is found return -1.
and that's what I wrote at frist. Two hours later at 3 am I had 3 lines of code less.
int any(char s1[], char s2[]){
int i, j;
for(i=j=0; s1[i]!='\0' && s1[i-1]!=s2[j]; ++i)
for(j=0; s1[i]!=s2[j] && s2[j]!='\0'; ++j)
;
return s1[i-1]==s2[j] ? i-1 : -1;
}
indirect resoning:
go trough first string only while there are chars in the firstSTring and the last one in frist string is different from the current in second string. This is important because the second cicle interropts if it finds an equal char in the second string and when it returns to test s1, it must stop all cicles.
Finally if last index was an equal char, return it. Else return -1; meaning no equal chars where found.
Deception comes with a much simpler code from standard library... as expected
you can find it together with your sources at:
~/glibc-build/sysdeps/generic/strpbrk.c
strpbrk (s, accept)
const char *s;
const char *accept;
{
while (*s != '\0')
{
const char *a = accept;
while (*a != '\0')
if (*a++ == *s)
return (char *) s;
++s;
}
return NULL;
}
This code uses pointers. In fact originally, as stated before: it returns one!
Pointers are the next curve on my so green C path. I'm hopping to be able to explain this one this afternoon. hihihi
It's been fun so far. Let's hope practice makes perfect. ;)
Better than Valium... try it out.
sábado, março 03, 2007
Who framed calculus?
It's 3 Am and I can't sleep... thought I'd do something useful like sharing with you guys this book I just found “Foundations of Differential Calculus” by Euler L. [on good old 1755 ] Translated by: John D. Blanton
can you tell why the hell do you write d/dx , do you know what a diferential is? well... read mister Euler.. never read or heard a better explanation quite honestly. The reasoning that leads to it is so simple it's quite frightening, mostly because no one ever mentioned it out loud in classes before.
Let's go smell the preface:
“What differential calculus, and, in general, analysis of the infinite, might be can hardly be explained to those innocent of any knowledge of it. Nor can we here offer a definition at the beginning of this dissertations as is sometimes done in other disciplines. It is not that there is no clear definition of this calculus; rather, the fact is that in order to understand the definition there are concepts that must first be understood. Besides those ideas in a common usage, there are also other from finite analysis that are much less common and are usually explained in the course of the development of the differential calculus. For this reason, it is not possible to understand a definition before it's principles are sufficiently clearly seen.
In the first place this calculus is concerned with variable quantities. Although every quantity can naturally be increased or decreased without limit, still, since calculus is directed to a certain purpose, we think some quantities as bring constantly the same magnitude, while others change through all the stages of increasing and decreasing. We note this distinction and call the former constant quantities and the latter variables. This characteristic difference is not required by the nature of things,but rather because of the special question addressed by the calculus.
In order that this difference between constant quantities and variables might be clearly illustrated, let us consider a shot fired from a cannon with a charge of gunpowder; then, the angle of elevation of the cannon above the horizon; third, the distance traveled by the shot; and, fourth, the length of time the shot is in the air. Unless the same cannon is used throughout the experiment, we must also bring in to our calculations the length of the barrel and the weight of the shot. Here, we will not consider variations in the cannon or the shot, lest we become entailed in very complicated questions. Hence, if we always keep the same quantity of powder, the elevation of the barrel will vary continuously with the distance traveled and the shot's duration of time in the air. In this case, the amount of powder, or the force of the explosion, will be the constant quantity. The elevation of the barrel, the distance traveled, and the time in the air should be the variable quantities. If for each degree of elevation we were to define these things, so that they may be noted for future reference, the changes in distance and duration of the flight arise from all of the different elevations. There is another question: Suppose the elevation of the barrel is kept the same, but the quantity of powder is continuously changed. Then the changes that occur in the flight need to be defined. In this case, the elevation will be the constant, while the quantity of powder, the distance, and duration are the variable quantities. Hence, it is clear that when the question is changed, the quantities that are constant and those that are variables need to be noted. At the same time, it must be understood from this that in this business the thing that requires the most attention is how the variable quantities depend on each other. When one variable changes, the others necessarily are changed. For example, in the former case considered, the quantity of powder remains the same, and the elevation is changed; then the distance and duration of the flight are changed. Hence, the distance and duration are variables that depend on the elevation; if this changes, then the others also change at the same time. In the latter case, the distance and duration depend on the quantity of charge of powder, so that a change in the charge must result in certain changes in the other variables.
Those quantities that depend on others in this way, namely, those that undergo a change when others change, are called functions of these quantities. This definition applies rather widely and includes all ways in which one quantity can be determined by others. Hence, if x designates the variable quantity, all other quantities that in any way depend on x are determined by it are called it's functions. Examples are x^2, the square of x, or any other powers of x, and indeed, even quantities that are composed with the powers in any way, even transcendentals, in general, whatever depends on x in such a way that when x increases or decreases, the function changes. From this fact there arises a question; namely, if the quantity x is increased or decreased, by how much is the function changed, whether it increases or decreases? For the more simples cases, this question is easily answered. If the quantity x is increased by the quantity w, it's square x^2 receives an increase of 2xw + x^2. Hence, the increase in x is to the increase of x^2 as w is to 2xw + w^2, that is, as 1 is to 2x + w. In a similar way, we consider the ratio of the increase of x to the increase or decrease that any function of x receives. Indeed, the investigation of this kind of ratio of increments is not only very important, but it is in fact the foundations of the whole of analysis of the infinite. in order that this may become even clearer, let us take up again the example of the square x^2 with its increment of 2xw + w^2, which it receives then x itself is increased by w. We have seen that the ration here is 2x +w to 1. From this it should be perfectly clear that the smaller the increment is taken to be, the closer this ratio comes to the ratio of 2x to 1. However , it does not arrive at this ratio before the increment itself, w, completely vanishes. From this we understand that if the increment of the variable x goes to zero, then the increment of x^2 also vanishes. However, the ratio holds as 2x to 1. What we have said here about the square is to be understood of all other functions of x; that is, when their increments vanish as the increment of x vanishes, they have a certain and determinable ration. In this way, we are led to a definition of differential calculus: It is a method for determining the ratio of the vanishing increments that any function take on when the variable, of which they are functions, is given a vanishing increment. It is clearly manifest to those who are not strangers to this subject that the true character of differential calculus is contained in this definition and can be adequately deduced from it.
Therefore, differential calculus is concerned not so much with vanishing increments, which indeed are nothing, but with the ratio and mutual proportion. Since these ratios are expressed as finite quantities, we must think of calculus as being concerned with finite quantities. Although the values seem to be popularly discussed as defined by these vanishing increments, still from a higher point of view, it is always from their ratio that conclusions are deduced. In a similar way, the idea of integral calculus can most conveniently be defined to be a method fro finding those functions from the knowledge of the ratio of their vanishing increments.
In order that these ratios might be more easily gathered together and represented in calculations, the vanishing increments themselves, although they are really noting, are still usually represented by certain symbols. Along with these symbols, there is no reason not to give them a certain name. Thy are called differentials, and since they are without quantity they are also said to be infinitely small. Hence, by their nature they are to be so interpreted as absolutely nothing, or they are considered to be equal to nothing. Thus, if the quantity x is given an increment w, so that it becomes x+w, its square x^e becomes x^2 + 2x^2w + w^2, and it takes the increment 2xw+w^2. Hence, the increment of x itself, which is w, has the ratio to the increment of the square, which is 2xw + w^2, as 1 to 2x + w. This ratio reduces to 1 to 2x, at least when w vanishes. Let w=0, and the ratio of these vanishing increments, which is the main concern of differential calculus, is a 1 to 2x. On the other hand, this ratio would not be true unless that increment w vanishes and becomes absolutely equal to zero. Hence, if this nothing that is indicated by w refers to the increment of the quantity x, since this has the ratio to the increment of the square x^2 as 1 to 2x, the increment of the square x^2 is equal to 2xw and for this reason is also equal to zero. Although both of these increments vanish simultaneously, this is no obstacle to their ratios being determined as 1 to 2x. With respect to this nothing that so far has been represented by the letter w, in differential calculus we use the symbol dx and call it the differential of x, since it is the increment of the quantity x. When we put dx for w, the differential of x^2 becomes 2x dx. In a similar way, it is shown that the differential of the cube x^3 will be equal to 2x^2 dx. In general, the differential of any quantity x^n will be equal to nx^(n-1) dx. No matter what other functions of x might be proposed, differential calculus gives rules for finding its differential. Nevertheless, we must constantly keep in mind that since these differentials are absolutely nothing, we can conclude nothing from them except that their mutual ratios reduce to finite quantities. This, it is in this way that the principles of differential calculus, which are in agreement with proper reasoning, are established, and all of the objections that are wont to be brought against it crumble spontaneously; but these arguments retain their full rigor if the differentials,that is, the infinitely small, are not completely annihilated.
To many who have discussed the rules of differential calculus, it has seemed that there is a distinction between absolutely nothing and a special order of quantities infinitely small, which do not quite vanish completely but retain a certain quantity that is indeed less than any assignable quantity. Concerning these, it is correctly objected that geometric rigor has been neglected. Because these infinitely small quantities have been neglected, the conclusions that have been drawn are rightly suspected. Although these infinitely small quantities are conceived to be few in number, when a few, or many, or even an innumerable number of these are neglected, an enormous error may result. There is an attempt wrongfully to refute this objection with examples of this kind, whereby conclusions are drawn from differential calculus in the same way as from elementary geometry. Indeed, if these infinitely small quantities, which are neglected in calculus, are not quite nothing, then necessarily an error must result that will be greater the more these quantities are heaped up. If it should happen that the error is less, this must be attributed to a fault in the calculation whereby certain error are compensated by other errors, rather then freeing the calculation from suspicion of error. In order that there be no compensating one error by a new one, let me fix firmly the point I want to make with clear examples. Those quantities that shall be neglected must surely be held to be absolutely nothing. Nor can the infinitely small that is discussed in differential calculus differ in any way from nothing. Even less should this business be ended when the infinitely small is described by some with the example wherein tiniest mote of dust is compared to a huge mountain or even the whole terrestrial globe. If someone undertakes to calculate the magnitude of the whole terrestrial globe, it is the custom easily to grant hum an error of a single grain of dust, but even many thousands of these. However, geometric rigor shrinks from even so small an error, and this objection would be simply to great were any force granted to it. Then it is difficult to say what possible advantage might be hoped for in distinguishing the infinitely small from absolutely nothing. Perhaps they fear the if they vanish completely, then will be taken away their ratio, to which they feel this whole business leads. It is avowed that it is impossible to conceive how two absolutely nothings can be compared. They think that some magnitude must be left for them that can be compared. They are forced to admit that this magnitude is so small that it is seen as it it were nothing and can be neglected in calculations without error. Neither do they dare to assign any certain and definite magnitude, even though incomprehensibly small. Even if they where assumed to be two or thee times smaller, the comparisons are always made in the same way. From this it is clear that this magnitude gives nothing necessary for undertaking a comparison, and so the comparison is not taken away even though that magnitude vanishes completely.
Now from what has been said above, it is clear that comparison, which is the concern of differential calculus, would not be valid unless the increments vanish completely. The increment of the quantity x, which we have been symbolizing by w, has a ration to the increment of the square x^2 which is 2xw + w^2, as 1 to 2x +w. But this always differs from the ratio of 1 to 2x unless w=0, and if we do require that w=0, then we can truly say that this ratio is exactly as 1 to 2x. In the meantime, it must be understood that the smaller the increment w becomes, the closer this ratio is approached. It follows that not only is it valid, but quite natural, that these increments be at first considered to be finite and even in drawings, if it necessary to give illustrations, that they be finitely represented. However, then these increments must be conceived to become continuously smaller, and in this way, their ratio is represented as continuously approaching a certain limit, which is, as it were, the final ratio of those increments, is the true object of differential calculus. Hence, this ration must be considered to have laid the very foundation of differential calculus for anyone who has a mind to contemplate these final ratios to which the increments of the variable quantities, as they continuous are more diminished, approach and at which they finally arrive. ”
We find among some ancient authors some trace of these ideas, so that we cannot deny to them at least some conception of the analysis of the infinite. Then gradually this knowledge grew, but it was not all of a sudden that it has arrived at the summit to which it has now come. Even now, there is more that remains obscure than what we see clearly. As differential calculus is extended to all kinds of functions, no matter how they are produced, it is not immediately know what method is to be used to compare the vanishing increments of absolutely all kinds of functions. For example, for the rational functions, the ultimate ration that the vanishing increments attain could be assigned along before the time of Newton and Leibniz, so that the differential calculus applied to only these rational functions must be held to have been invented long before that time. However, there is no doubt that Newton must be given credit for that part of differential calculus concerned with irrational functions. This was nicely deduced from his wonderful theorem concerning the general evolution of powers of a binomial. By this outstanding discovery, the limits of differential calculus have been marvelously extended. We are no less indebted to Leibniz insofar as this calculus at that time was viewed as individual tricks, while he put it into the form of a discipline, collected its rules into a system, and gave a crystal-clear explanation. From this there followed great aids in the further development of this calculus, and some of the open questions whose answers were sought were pursued through certain definite principles. Soon, through the studies of both Leibniz and Bernoulli's, the bounds of differential calculus were extended even to transcendental functions, which had in part already been discussed. Then, too, the foundations of integral calculus were firmly established. Those who followed in the elaboration of this field continued to make progress. ............................................................... blá blá history of calculus..................
No matter what name the mathematicians of different nations are wont to give to this calculus, it all comes to this, that they all agree on this outstanding definition. Whether they call the vanishing increments whose ratios are under consideration by the name differentials or fluxions, these are always understood to be equal to zero, and this must be the true notion of the infinitely small. From this it follows that everything that has been debated about differentials of the second and higher orders, and this has been more out of curiosity then usefulness, comes back to something very clear, namely, that when everything vanishes together we must consider the mutual ratio rather than the individual quantities. Since the ratio between the vanishing increments of the functions is itself expressed by some function, and if the vanishing increment of this function is compared with others, the result must be considered as the second differential. In this way, we must understand the development of differentials of higher order in such a way that they always are seen to be truly finite quantities and that this is the only proper way for them to be represented. At first sight, this description of analysis of the infinite may seem, for the most part, both shallow and extremely sterile, although that obscure notion of the infinitely small hardly offers more. In truth, if the rations that connect the vanishing increments of any functions are clearly know, then this knowledge very often is of the utmost importance and frequently is so important in extremely arduous investigations that without it almost nothing can be clearly understood. For instance, if the question concerns the motion of a shot fired from a cannon, the air resistance must be known in order to know what the motion will be through a finite distance, as well as both the direction of the path at the beginning and also the velocity, on which the resistance depends. But this changes with time... However, the less distance the shot travels, the less the variation, so that it is possible more easily to come to knowledge of true relationship. In fact, it we let the distance vanish, since in that case both the difference in the direction and change in velocity also are removed, the effect of resistance produced at a single point in time, as well as the change in the path, can be defined exactly. When we know these instantaneous changes or, rather, since these are actually nothing, their mutual relationship, we have gained a great deal. Furthermore, the work of integral calculus is to study changing motion in a finite space. It is my opinion that it is hardly necessary to show further the uses of differential calculus and analysis of the infinite, since it is now sufficiently noted, if even a cursory investigation is made. If we want to study more carefully the motion of either solids or fluids, it cannot be accomplished without analysis of the infinite. _Indeed, this science has frequently not been sufficiently cultivated in order that the matter can be accurately explained. Throughout all the branches of mathematics, this higher analysis has penetrated to such an extent that anything that can be explained without it's intervention must be esteemed as next to nothing.
I have establish in this book the whole of differential calculus, deriving it from true principles and developing it copiously in such a way that nothing pertain to it that has been discovered so far has been omitted. The work is divided in to two parts. In the first part, after laying the foundations of differential calculus, I have presented the method for differentiating every kind of function, for finding not only differentials of the first order, but also those of higher order, and those for functions of a single variable as well as those involving two or more variables. In the second part, I have the study of series. In that part, I have also given a very clear explanation of the theorem concerning maxima and minima. As to the application of this calculus to the geometry of plane curves, I have nothing new to offer, and this is all the less to be required, since in other works I have treated this subject so fully. Even with the greatest care, the first principles of differential calculus are hardly sufficiently developed that I should bring them, as it where drawn from geometry, to this science. Here, everything is kept within the bounds of pure analysis, so that in the explanation of the rules of this calculus there is no need for any geometric figures.
can you tell why the hell do you write d/dx , do you know what a diferential is? well... read mister Euler.. never read or heard a better explanation quite honestly. The reasoning that leads to it is so simple it's quite frightening, mostly because no one ever mentioned it out loud in classes before.
Let's go smell the preface:
“What differential calculus, and, in general, analysis of the infinite, might be can hardly be explained to those innocent of any knowledge of it. Nor can we here offer a definition at the beginning of this dissertations as is sometimes done in other disciplines. It is not that there is no clear definition of this calculus; rather, the fact is that in order to understand the definition there are concepts that must first be understood. Besides those ideas in a common usage, there are also other from finite analysis that are much less common and are usually explained in the course of the development of the differential calculus. For this reason, it is not possible to understand a definition before it's principles are sufficiently clearly seen.
In the first place this calculus is concerned with variable quantities. Although every quantity can naturally be increased or decreased without limit, still, since calculus is directed to a certain purpose, we think some quantities as bring constantly the same magnitude, while others change through all the stages of increasing and decreasing. We note this distinction and call the former constant quantities and the latter variables. This characteristic difference is not required by the nature of things,but rather because of the special question addressed by the calculus.
In order that this difference between constant quantities and variables might be clearly illustrated, let us consider a shot fired from a cannon with a charge of gunpowder; then, the angle of elevation of the cannon above the horizon; third, the distance traveled by the shot; and, fourth, the length of time the shot is in the air. Unless the same cannon is used throughout the experiment, we must also bring in to our calculations the length of the barrel and the weight of the shot. Here, we will not consider variations in the cannon or the shot, lest we become entailed in very complicated questions. Hence, if we always keep the same quantity of powder, the elevation of the barrel will vary continuously with the distance traveled and the shot's duration of time in the air. In this case, the amount of powder, or the force of the explosion, will be the constant quantity. The elevation of the barrel, the distance traveled, and the time in the air should be the variable quantities. If for each degree of elevation we were to define these things, so that they may be noted for future reference, the changes in distance and duration of the flight arise from all of the different elevations. There is another question: Suppose the elevation of the barrel is kept the same, but the quantity of powder is continuously changed. Then the changes that occur in the flight need to be defined. In this case, the elevation will be the constant, while the quantity of powder, the distance, and duration are the variable quantities. Hence, it is clear that when the question is changed, the quantities that are constant and those that are variables need to be noted. At the same time, it must be understood from this that in this business the thing that requires the most attention is how the variable quantities depend on each other. When one variable changes, the others necessarily are changed. For example, in the former case considered, the quantity of powder remains the same, and the elevation is changed; then the distance and duration of the flight are changed. Hence, the distance and duration are variables that depend on the elevation; if this changes, then the others also change at the same time. In the latter case, the distance and duration depend on the quantity of charge of powder, so that a change in the charge must result in certain changes in the other variables.
Those quantities that depend on others in this way, namely, those that undergo a change when others change, are called functions of these quantities. This definition applies rather widely and includes all ways in which one quantity can be determined by others. Hence, if x designates the variable quantity, all other quantities that in any way depend on x are determined by it are called it's functions. Examples are x^2, the square of x, or any other powers of x, and indeed, even quantities that are composed with the powers in any way, even transcendentals, in general, whatever depends on x in such a way that when x increases or decreases, the function changes. From this fact there arises a question; namely, if the quantity x is increased or decreased, by how much is the function changed, whether it increases or decreases? For the more simples cases, this question is easily answered. If the quantity x is increased by the quantity w, it's square x^2 receives an increase of 2xw + x^2. Hence, the increase in x is to the increase of x^2 as w is to 2xw + w^2, that is, as 1 is to 2x + w. In a similar way, we consider the ratio of the increase of x to the increase or decrease that any function of x receives. Indeed, the investigation of this kind of ratio of increments is not only very important, but it is in fact the foundations of the whole of analysis of the infinite. in order that this may become even clearer, let us take up again the example of the square x^2 with its increment of 2xw + w^2, which it receives then x itself is increased by w. We have seen that the ration here is 2x +w to 1. From this it should be perfectly clear that the smaller the increment is taken to be, the closer this ratio comes to the ratio of 2x to 1. However , it does not arrive at this ratio before the increment itself, w, completely vanishes. From this we understand that if the increment of the variable x goes to zero, then the increment of x^2 also vanishes. However, the ratio holds as 2x to 1. What we have said here about the square is to be understood of all other functions of x; that is, when their increments vanish as the increment of x vanishes, they have a certain and determinable ration. In this way, we are led to a definition of differential calculus: It is a method for determining the ratio of the vanishing increments that any function take on when the variable, of which they are functions, is given a vanishing increment. It is clearly manifest to those who are not strangers to this subject that the true character of differential calculus is contained in this definition and can be adequately deduced from it.
Therefore, differential calculus is concerned not so much with vanishing increments, which indeed are nothing, but with the ratio and mutual proportion. Since these ratios are expressed as finite quantities, we must think of calculus as being concerned with finite quantities. Although the values seem to be popularly discussed as defined by these vanishing increments, still from a higher point of view, it is always from their ratio that conclusions are deduced. In a similar way, the idea of integral calculus can most conveniently be defined to be a method fro finding those functions from the knowledge of the ratio of their vanishing increments.
In order that these ratios might be more easily gathered together and represented in calculations, the vanishing increments themselves, although they are really noting, are still usually represented by certain symbols. Along with these symbols, there is no reason not to give them a certain name. Thy are called differentials, and since they are without quantity they are also said to be infinitely small. Hence, by their nature they are to be so interpreted as absolutely nothing, or they are considered to be equal to nothing. Thus, if the quantity x is given an increment w, so that it becomes x+w, its square x^e becomes x^2 + 2x^2w + w^2, and it takes the increment 2xw+w^2. Hence, the increment of x itself, which is w, has the ratio to the increment of the square, which is 2xw + w^2, as 1 to 2x + w. This ratio reduces to 1 to 2x, at least when w vanishes. Let w=0, and the ratio of these vanishing increments, which is the main concern of differential calculus, is a 1 to 2x. On the other hand, this ratio would not be true unless that increment w vanishes and becomes absolutely equal to zero. Hence, if this nothing that is indicated by w refers to the increment of the quantity x, since this has the ratio to the increment of the square x^2 as 1 to 2x, the increment of the square x^2 is equal to 2xw and for this reason is also equal to zero. Although both of these increments vanish simultaneously, this is no obstacle to their ratios being determined as 1 to 2x. With respect to this nothing that so far has been represented by the letter w, in differential calculus we use the symbol dx and call it the differential of x, since it is the increment of the quantity x. When we put dx for w, the differential of x^2 becomes 2x dx. In a similar way, it is shown that the differential of the cube x^3 will be equal to 2x^2 dx. In general, the differential of any quantity x^n will be equal to nx^(n-1) dx. No matter what other functions of x might be proposed, differential calculus gives rules for finding its differential. Nevertheless, we must constantly keep in mind that since these differentials are absolutely nothing, we can conclude nothing from them except that their mutual ratios reduce to finite quantities. This, it is in this way that the principles of differential calculus, which are in agreement with proper reasoning, are established, and all of the objections that are wont to be brought against it crumble spontaneously; but these arguments retain their full rigor if the differentials,that is, the infinitely small, are not completely annihilated.
To many who have discussed the rules of differential calculus, it has seemed that there is a distinction between absolutely nothing and a special order of quantities infinitely small, which do not quite vanish completely but retain a certain quantity that is indeed less than any assignable quantity. Concerning these, it is correctly objected that geometric rigor has been neglected. Because these infinitely small quantities have been neglected, the conclusions that have been drawn are rightly suspected. Although these infinitely small quantities are conceived to be few in number, when a few, or many, or even an innumerable number of these are neglected, an enormous error may result. There is an attempt wrongfully to refute this objection with examples of this kind, whereby conclusions are drawn from differential calculus in the same way as from elementary geometry. Indeed, if these infinitely small quantities, which are neglected in calculus, are not quite nothing, then necessarily an error must result that will be greater the more these quantities are heaped up. If it should happen that the error is less, this must be attributed to a fault in the calculation whereby certain error are compensated by other errors, rather then freeing the calculation from suspicion of error. In order that there be no compensating one error by a new one, let me fix firmly the point I want to make with clear examples. Those quantities that shall be neglected must surely be held to be absolutely nothing. Nor can the infinitely small that is discussed in differential calculus differ in any way from nothing. Even less should this business be ended when the infinitely small is described by some with the example wherein tiniest mote of dust is compared to a huge mountain or even the whole terrestrial globe. If someone undertakes to calculate the magnitude of the whole terrestrial globe, it is the custom easily to grant hum an error of a single grain of dust, but even many thousands of these. However, geometric rigor shrinks from even so small an error, and this objection would be simply to great were any force granted to it. Then it is difficult to say what possible advantage might be hoped for in distinguishing the infinitely small from absolutely nothing. Perhaps they fear the if they vanish completely, then will be taken away their ratio, to which they feel this whole business leads. It is avowed that it is impossible to conceive how two absolutely nothings can be compared. They think that some magnitude must be left for them that can be compared. They are forced to admit that this magnitude is so small that it is seen as it it were nothing and can be neglected in calculations without error. Neither do they dare to assign any certain and definite magnitude, even though incomprehensibly small. Even if they where assumed to be two or thee times smaller, the comparisons are always made in the same way. From this it is clear that this magnitude gives nothing necessary for undertaking a comparison, and so the comparison is not taken away even though that magnitude vanishes completely.
Now from what has been said above, it is clear that comparison, which is the concern of differential calculus, would not be valid unless the increments vanish completely. The increment of the quantity x, which we have been symbolizing by w, has a ration to the increment of the square x^2 which is 2xw + w^2, as 1 to 2x +w. But this always differs from the ratio of 1 to 2x unless w=0, and if we do require that w=0, then we can truly say that this ratio is exactly as 1 to 2x. In the meantime, it must be understood that the smaller the increment w becomes, the closer this ratio is approached. It follows that not only is it valid, but quite natural, that these increments be at first considered to be finite and even in drawings, if it necessary to give illustrations, that they be finitely represented. However, then these increments must be conceived to become continuously smaller, and in this way, their ratio is represented as continuously approaching a certain limit, which is, as it were, the final ratio of those increments, is the true object of differential calculus. Hence, this ration must be considered to have laid the very foundation of differential calculus for anyone who has a mind to contemplate these final ratios to which the increments of the variable quantities, as they continuous are more diminished, approach and at which they finally arrive. ”
We find among some ancient authors some trace of these ideas, so that we cannot deny to them at least some conception of the analysis of the infinite. Then gradually this knowledge grew, but it was not all of a sudden that it has arrived at the summit to which it has now come. Even now, there is more that remains obscure than what we see clearly. As differential calculus is extended to all kinds of functions, no matter how they are produced, it is not immediately know what method is to be used to compare the vanishing increments of absolutely all kinds of functions. For example, for the rational functions, the ultimate ration that the vanishing increments attain could be assigned along before the time of Newton and Leibniz, so that the differential calculus applied to only these rational functions must be held to have been invented long before that time. However, there is no doubt that Newton must be given credit for that part of differential calculus concerned with irrational functions. This was nicely deduced from his wonderful theorem concerning the general evolution of powers of a binomial. By this outstanding discovery, the limits of differential calculus have been marvelously extended. We are no less indebted to Leibniz insofar as this calculus at that time was viewed as individual tricks, while he put it into the form of a discipline, collected its rules into a system, and gave a crystal-clear explanation. From this there followed great aids in the further development of this calculus, and some of the open questions whose answers were sought were pursued through certain definite principles. Soon, through the studies of both Leibniz and Bernoulli's, the bounds of differential calculus were extended even to transcendental functions, which had in part already been discussed. Then, too, the foundations of integral calculus were firmly established. Those who followed in the elaboration of this field continued to make progress. ............................................................... blá blá history of calculus..................
No matter what name the mathematicians of different nations are wont to give to this calculus, it all comes to this, that they all agree on this outstanding definition. Whether they call the vanishing increments whose ratios are under consideration by the name differentials or fluxions, these are always understood to be equal to zero, and this must be the true notion of the infinitely small. From this it follows that everything that has been debated about differentials of the second and higher orders, and this has been more out of curiosity then usefulness, comes back to something very clear, namely, that when everything vanishes together we must consider the mutual ratio rather than the individual quantities. Since the ratio between the vanishing increments of the functions is itself expressed by some function, and if the vanishing increment of this function is compared with others, the result must be considered as the second differential. In this way, we must understand the development of differentials of higher order in such a way that they always are seen to be truly finite quantities and that this is the only proper way for them to be represented. At first sight, this description of analysis of the infinite may seem, for the most part, both shallow and extremely sterile, although that obscure notion of the infinitely small hardly offers more. In truth, if the rations that connect the vanishing increments of any functions are clearly know, then this knowledge very often is of the utmost importance and frequently is so important in extremely arduous investigations that without it almost nothing can be clearly understood. For instance, if the question concerns the motion of a shot fired from a cannon, the air resistance must be known in order to know what the motion will be through a finite distance, as well as both the direction of the path at the beginning and also the velocity, on which the resistance depends. But this changes with time... However, the less distance the shot travels, the less the variation, so that it is possible more easily to come to knowledge of true relationship. In fact, it we let the distance vanish, since in that case both the difference in the direction and change in velocity also are removed, the effect of resistance produced at a single point in time, as well as the change in the path, can be defined exactly. When we know these instantaneous changes or, rather, since these are actually nothing, their mutual relationship, we have gained a great deal. Furthermore, the work of integral calculus is to study changing motion in a finite space. It is my opinion that it is hardly necessary to show further the uses of differential calculus and analysis of the infinite, since it is now sufficiently noted, if even a cursory investigation is made. If we want to study more carefully the motion of either solids or fluids, it cannot be accomplished without analysis of the infinite. _Indeed, this science has frequently not been sufficiently cultivated in order that the matter can be accurately explained. Throughout all the branches of mathematics, this higher analysis has penetrated to such an extent that anything that can be explained without it's intervention must be esteemed as next to nothing.
I have establish in this book the whole of differential calculus, deriving it from true principles and developing it copiously in such a way that nothing pertain to it that has been discovered so far has been omitted. The work is divided in to two parts. In the first part, after laying the foundations of differential calculus, I have presented the method for differentiating every kind of function, for finding not only differentials of the first order, but also those of higher order, and those for functions of a single variable as well as those involving two or more variables. In the second part, I have the study of series. In that part, I have also given a very clear explanation of the theorem concerning maxima and minima. As to the application of this calculus to the geometry of plane curves, I have nothing new to offer, and this is all the less to be required, since in other works I have treated this subject so fully. Even with the greatest care, the first principles of differential calculus are hardly sufficiently developed that I should bring them, as it where drawn from geometry, to this science. Here, everything is kept within the bounds of pure analysis, so that in the explanation of the rules of this calculus there is no need for any geometric figures.
sexta-feira, março 02, 2007
C experiments
Alguma vez pensaram em ler um numero da esquerda para a direita? É completamente anti-intuitivo!! Mas um computador é capaz de lhe achar bastante piada.
A ideia base é a seguinte:
o primeiro digito é o das unidades. x1
há mais?
entao o primeiro digito é o das dezenas e o segundo é o das unidades [ x1 * 10 + x2 ]
há mais?
entao o primeiro digito é o das centenas o segundo é o das unidades e o terceiro é o das unidades [ 10(x1*10 + x2) +x3] ...
and in C this would come has simple as
int atoi(char s[]){
int i , n ;
n=0;
for(i=0; s[i]>='0' && s[i]<='9';++i)
n = n*10 + (s[i]-'0');
return n;
}
s[i]-'0', justifica-se pelo facto de os caracteres '0','1','2'.. etc terem valores incrementalmente superiores. no meu caso '0'=48, '1'=49...etc
A vantagem?? bom para começar dispensa o uso de uma segunda funçao power, para computar as potencias de 10. Suponto o raciocinio mais comum de x = x1 + x2*10 + x3 * 10^2.... etc
Consequentemente o tempo de execução é menor porque o numero de "contas" que o cpu faz é menor.
Estou deliciada!
more to come soon lol or otherwise get Richie's "The C programing language" and go for it your self. It's fun!! ;)
A ideia base é a seguinte:
o primeiro digito é o das unidades. x1
há mais?
entao o primeiro digito é o das dezenas e o segundo é o das unidades [ x1 * 10 + x2 ]
há mais?
entao o primeiro digito é o das centenas o segundo é o das unidades e o terceiro é o das unidades [ 10(x1*10 + x2) +x3] ...
and in C this would come has simple as
int atoi(char s[]){
int i , n ;
n=0;
for(i=0; s[i]>='0' && s[i]<='9';++i)
n = n*10 + (s[i]-'0');
return n;
}
s[i]-'0', justifica-se pelo facto de os caracteres '0','1','2'.. etc terem valores incrementalmente superiores. no meu caso '0'=48, '1'=49...etc
A vantagem?? bom para começar dispensa o uso de uma segunda funçao power, para computar as potencias de 10. Suponto o raciocinio mais comum de x = x1 + x2*10 + x3 * 10^2.... etc
Consequentemente o tempo de execução é menor porque o numero de "contas" que o cpu faz é menor.
Estou deliciada!
more to come soon lol or otherwise get Richie's "The C programing language" and go for it your self. It's fun!! ;)
Subscrever:
Mensagens
(
Atom
)