Sunday, 8. November 2009, 22:29:28
Cramer law, equations java, java cramer
Hi, i was working in some geometric shit with circles, and one point was like "deduce the equation of the circle with 3 points" so i had a 3x3 type of equation, was to late and i am not in my wave in math so i decide to code it

...
there is the kramer law for a 3x3 equation

first a little explanation if we have a system like this Ax=B we can obtain x doing this x = (B/A) and we have a matrix with the constants of the equation so is basically x
n = Det[x
n]/Det[General]
where Det is the substracion of the addition of the multiplication of the cross values in matrix

here is the code

enjoy it...
import java.io.*;
import java.util.*;
public class deter{
public static double coe[][]=new double[3][3];
public static double sol[] = new double[3];
public static void main(String args[]) throws IOException{
if(args.length<1){
System.err.println("Ingresa el archivo");
return;
}
BufferedReader lector = new BufferedReader(new FileReader(args[0]));
String tmp = "";
int p = 0;
while((tmp=lector.readLine())!=null){
if(p == 3){
StringTokenizer sr = new StringTokenizer(tmp,",");
for(int n = 0;n<3;n++)
sol[n]=Double.parseDouble(sr.nextToken());
break;
}
StringTokenizer st = new StringTokenizer(tmp);
for(int n = 0;n<3;n++)
coe[p][n]=Double.parseDouble(st.nextToken());
p++;
}
resolv();
}
public static void resolv(){
double d = Det(coe);
for(int n = 0;n<3;n++){
double tmp[][] = new double[3][3];
for(int w = 0;w<3;w++){
for(int e = 0;e<3;e++)
tmp[w][e]=coe[w][e];
}
for(int x = 0;x<3;x++)
tmp[x][n]=sol[x];
System.out.println(Det(tmp)/d);
}
}
public static double Det(double a[][]){
double c = 0,b = 0;
for(int n = 0;n<3;n++){
c+=(a[n][0]*a[(n+1)%3][1]*a[(n+2)%3][2]);
b+=(a[(n+0)%3][2]*a[(n+1)%3][1]*a[(n+2)%3][0]);
}
return c-b;
}
}
Pd: the file need to be in this way
x
1 y
1 z
1x
2 y
2 z
2x
3y
3 z
3res
1,res
2,res
3
Tuesday, 3. November 2009, 21:25:17
Yesterday i finished the second important function of N&R, the first one is the main that i explain in the first post.
The function i have done is the Comp function, it function let the program calculate value in an expresion, ex:
the function input is Tan[90]-3*2^4
the function output is -49.99
I do not paste the code until i have the first version of all the program, so wait
Saturday, 31. October 2009, 23:53:53
Today i decide to start writing another program. A program that apply the Newton and rhapson method for lookup up single variables in an equation that can not be developed by matrix method or simple substitution or algebraic methods.....
Newthon and rhapson Method uses derivation and a x0 variable for find the unknown value of the variable...
the equation looks like
X
n=X
n-1-(F(X
n-1)/F'(X
n-1))
it can be demostrated in a Trigonometrically way using the slope in the Tan(x angle) way...I cant paint it so i hope you use your imagination

-->-->
The programs input will be the initial root(X
0) and the function in a string way Ex. "3*x^2-tan[(2*x)]"
the program uses some functions that i will be exposing soon.....
I wish you read this and write to me advices or suggestions

Happy hacking!
Saturday, 10. October 2009, 03:17:47
It is simple, I love thee!
Saturday, 3. October 2009, 17:16:10
you. writing in your pda asking for some reunion, eating the best of the best, smoking the expensive cigarrette, drinking the oldest whisky, fucking the best horn..You the man that is in the best house of the best neighbourhood,this is for you....
Do you remember when you was young???, do you remember the things that yo got to study for being the man that you are now?, do you remember all the shit that you ate?...
That was the things you did for being the man sitting in the comfortable sofa...why dont you leave this comfortable numb and still studying, still producing?, are you not enought rich???
What the fuck is happening to us???, we are living the mtv life? we are no more productive after getting the necesary for living.....
i dont want to live that type of life, this is my manifesto!
Monday, 28. September 2009, 01:26:54
What do we think?, we dont live a wonderful life...
Saturday, 26. September 2009, 15:31:12
MONOTONY
Another day...to tell thou the true, i realy dont know what a day is; A modular time space that has a limit and start again whe this limit appears, what kind of sentence do we live???, we are sentence to monotony, to do the same;All this shit makes me remind the Dante's hell, we are sentence to carry a stone up to a mountain for let it go again to floor for start again and again, we are sentence to stupidly repetitive but, before and beyond that, we have our own "Minos" that clasify each of us and the reason of live our reality. Another day in wich i woke up early in the morning and in wich i heard the sound of the cock, all of this because someone thougth that we must rest when the moon lay down in the starry sky and we must work when the sun accompany this side of the earth; All of this because someone saids that an animal like the cock must be the universal alarm clock.
After of took a little human time that i am not going to explain here i went out to my regular job, an action that i dont like to do for satisfy a "Minos" protected that does the same thing, in his own context, than me. An action that im bound to do for a Quid pro quo service sometimes social, sometimes economic, sometimes just for try to not think and that is the way i go far away the big question, i live in this stupidly monotony reality but i really dont want to think about it, i got a little hope, what a magical word!, the hope of break this monotony; Kill somebody for the natural desire of blood, realise my young fantacies, maybe climb and own inside the society.
I do not want to do more details of this..I walk away job and the only thing i find up is the service quid pro quo that i told thee that is avaliable in society "Bread and circus to the people" i would say "Alcohol, drugs, sex and sports to the people" that is the way that they use to keep the ideas out of the people, that is the way we dont modify the social and population pyramid and the way that they use to keep us far away the reality; I just want to told thou that it works perfectly im going to ask for a whorehouse, im going to fuck a lot of girls and im going to faint because of the drugs and alcohol, all of this just for do it again the next day.
Tuesday, 22. September 2009, 21:14:02
Im becoming a type of human that i used to hate......i dont want to be involved in all this fucking drama, i dont like that shit!!!!!!!!!!!
This is so stupid...

, I DONT WANT MORE OF THIS, i love my life in the way it was, without getting involve anybody, without carrying someone else problems....without problems with anyone

..
I love myself been a geek :'(
AHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Tuesday, 15. September 2009, 22:55:50
Hi everyone reading this shit

....
I just want to excuse myself beacause of my dissapearing, i cant spend the same time inb my opera than before, but i promise often posts for let know you im alive

.....
I really have anything to tell you, but im in my last 2 months of school, just at a step for hoing college to study math, I LOVE MATH's

...i can tell you about my heart realtionship, it is going very well

, i can tell you about hacking( I feel Im really sucking in this part of my life

).........I dont know what other aspects of my life, so ask me if you want to know...See you dears....
Thursday, 10. September 2009, 20:35:24
Im in my finals at school..Im just so tired

...actually i have slept like 5 hours since tuesday

So please Bao dont be sad with be

and talk to me what about you this time

.....
I love thee Juli

Jejjeje no more dedications, see you in the pandemonium
1 2 3 4 5 ... 9 Next »
Showing posts 1 -
10 of 88.