Question:Where are solutions to 'solve'?

Question:Where are solutions to 'solve'?

I am puzzled at the lack of output in using the solve command.  Bellow is some sample code; the main part being the for k loop with values 1 to 5.  k=1 gives complex solutiions, and k=2 to 5 gives real values.  If the for loop is restricted to from 2 to 5 and the printf statement uncommented, everthing works fine.

I have tried other methods like sols:=fsolve(a*x^2+k*x+c, x, complex);  to little avail. I realize the equation is an easy quadratic & is easy to solve by the usual formula, but I'm interested in how the solve command works.  It seems to perform caculations, without any error messages - which I find frustrating!

The code after the for k from... ...do loop just illustrates examples where solve works - some with complex coefficients - which to my mind makes my problem more enigmatic!  I'm using Maple 7 and am just wondering if the solve command has been made easier to use?

Any help or comments would be most appreciated.

Kind regards,

David

#Program to investigate the solve function.  Putting k=1 gives complex solutions which halts the program.
> restart:
> interface(imaginaryunit, errorbreak=0, errorcursor=true, labelling=false):
> with(SolveTools):
> a:=1:c:=1:
>

################################
> for k from 1 to 5 do
>   sols:=solve(a*x^2+k*x+c, x):  # assuming x::complex;
>   #printf("k=%d  sols[1]=%5.2f  sols[2]=%5.2f\n", k,eval(sols[1]), eval(sols[2]));
> end do:  #for k

#################################

> printf("End of for loop\n\n");
> sols2:=solve(x^2+I);
> sols2[1];
> sols2[2];
> #sols3:=solve(a*x^3+x^2-I+2);
> solve(z^(I+1)+I,z);
> evalc(op(1,%));  #c=Cartesian
> k:=1:
> sols4:=solve(a*x^2+k*x+c, x):
> #evalc(op(1,%));  #c=Cartesian
> print("Evaluating sols4");
> eval(sols4);
> sols4[1];
> sols4[2];

﻿