# Plotting the roots of polynomials which coefficients are functions [closed]

I am working on Mathematica just for few days and I am confused to plot the roots of a polynomial which coefficients are functions.

In Mathematica examples, I found some simple examples such as :

Plot[Root[#^5 + a # + 1 &, 1], {a, 0, 10}]

but when I want to plot real part the equation which I have mentioned below, it doesn't work.

DD[z_, y_] := z + y;

EE[z_, y_] := z^2 + y + 1;

H[z_, y_, x_] := x^2 + DD[z, y]*x + EE[z, y];

Plot[Re[Root[H[1, y, x]] &, 1]], {y, 0, 10}]

I am so thankful if anyone can help me, I should to fix it today and I am very sad about it.

• Here is an example of plotting roots: Factoring a two variable polynomial in a special way Mar 13, 2020 at 11:32
• Another one (more appropriate). Mar 13, 2020 at 11:58
• Hi! You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find this meta Q&A helpful Mar 13, 2020 at 12:55
• @Dear Artes, thank you so much Mar 14, 2020 at 9:32
• @Dear Michael E2, thank you for your edit, it was the first time that I was writing and thanks for your helpful comment to write in correct style Mar 14, 2020 at 9:35

Use

Plot[Re[Root[H[1, y, #] &, 1]], {y, 0, 10}]

or

Plot[Re[Root[Function[x, H[1, y, x]], 1]], {y, 0, 10}]

to get

Note: The first argument of Root should be a pure function.

• @Dear kglr, Thank you so much, the first code was OK, I just replaced x by hashtag Mar 13, 2020 at 11:50