# Filtering out 'no solutions' after solving a high order polynomial

I am dealing with a fourth order polynomial. I get all of the desired out put however above a certain range I also get these - {}. From my understanding this means that there is no solution. I am trying to plot the final output however {} runes any chance of that. How could I remove the 'no solution'?

I have tried Select and Reduce.

Ddd = (a1) Dd^4 - (a2) Dd + (a2);
Table[NSolve[Ddd == 0, Dd, Reals], {t, t3}];


My output looks like this:

{{1.*10^-7, 0.000312683}, {1.0056*10^-7, 5.29149*10^-7}, {1.01653*10^-7, 3.59975*10^-7}, {1.0323*10^-7,  2.83353*10^-7}, {1.05406*10^-7, 2.36121*10^-7}, {1.08473*10^-7, 2.02102*10^-7}, {1.13219*10^-7, 1.74367*10^-7}, {1.23859*10^-7,   1.45755*10^-7}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}}


I would just like to retain all the numbers an non of the rest.

Cheers for any ideas.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Nov 18 '14 at 3:54

A couple of ways:

sols = {{1.*10^-7, 0.000312683}, {1.0056*10^-7,
5.29149*10^-7}, {1.01653*10^-7, 3.59975*10^-7}, {1.0323*10^-7,
2.83353*10^-7}, {1.05406*10^-7, 2.36121*10^-7}, {1.08473*10^-7,
2.02102*10^-7}, {1.13219*10^-7, 1.74367*10^-7}, {1.23859*10^-7,
1.45755*10^-7}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, \
{}};

DeleteCases[sols, {}]
sols /. {} -> Sequence[]


Side remark:

sols = Table[NSolve[Ddd == 0, Dd, Reals], {t, t3}];


then the output should have the form

((sol11, sol12,...), {sol21,...}, ..., {}, {}, ...}


If so, you can get rid of the {} with

Flatten[sols, 1]

• Thank you very much Michael, that worked perfectly. I spent a really long time trying to find a way around it, I did not realize mathematica had this function...so much to learn. – Valentin Nov 18 '14 at 15:22
• @ValentinU You're welcome. – Michael E2 Nov 18 '14 at 17:43