Jump to content

Numeros complexos em C e o método de newton


Neo4

Recommended Posts

Em C++ até penso que há a bblioteca "complex", mas nunca usei (pelo nome, penso que se refere a numeros complexos).

Em C, acho que a melhor forma é seres tu a definir um struct para um numero complexo, e definires os operadores +-*/, etc,  que precisas...

"What we do for ourselves dies with us. What we do for others and the world, remains and is immortal.", Albert Pine

Blog pessoal : contém alguns puzzles, algoritmos e problemas para se resolver com programação.

Link to comment
Share on other sites

So mais um problema...

a minha lib math.h parece nao estar a funcionar bem....

um simples programa de teste:

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

main(){
int i,f;
double x=2;
i=pow(4,2);
f=log(x);
printf("\n\n\n\n\n%d\n\n%d\n\n", i,f);
}

resulta em:

/tmp/cc4qYHyB.o: In function `main':
power.c:(.text+0x28): undefined reference to `log'
collect2: ld returned 1 exit status

e isto tanto com log como sin, cos etc... :S

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.