Neo4 Posted December 4, 2007 at 07:25 PM Report Share #152301 Posted December 4, 2007 at 07:25 PM Boas noites pessoal, eu tenho que fazer um trabalho para sistemas dinamicos em C do metodo de newton. para alem de apresentar o grafico (opengl que vou usar) o programa deve calcular as raizes imaginarias e o meu problema está aqui mesmo... alguem sabe como manipular numeros imaginarios em C de forma simples? Obrigado. Link to comment Share on other sites More sharing options...
Triton Posted December 4, 2007 at 07:47 PM Report Share #152312 Posted December 4, 2007 at 07:47 PM alguem sabe como manipular numeros imaginarios em C de forma simples? Não sei se te ajuda, mas a partir do C99 existem tipos nativos de números complexos. <3 life Link to comment Share on other sites More sharing options...
mogers Posted December 4, 2007 at 07:58 PM Report Share #152316 Posted December 4, 2007 at 07:58 PM 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 More sharing options...
Neo4 Posted December 4, 2007 at 08:37 PM Author Report Share #152326 Posted December 4, 2007 at 08:37 PM 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 More sharing options...
Betovsky Posted December 4, 2007 at 08:41 PM Report Share #152327 Posted December 4, 2007 at 08:41 PM Tens de por o -lm na altura de compilar/linkar "Give a man a fish and he will eat for a day; Teach a man to fish and he will eat for a lifetime. The moral? READ THE MANUAL !" Sign on a computer system consultant's desk Link to comment Share on other sites More sharing options...
Neo4 Posted December 4, 2007 at 08:58 PM Author Report Share #152334 Posted December 4, 2007 at 08:58 PM obrigado! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now