Mathematica Asked by ppp on January 4, 2021
My function is as follows:
$$f(x)=ax^5+bx^4+cx^3+dx^2+ex+g=0$$
Since it does not generate an analytical solution, I tried to do a simulation exercise as follows.
Simulation values: $a=-2$, $b=3$, $c=5$, $g=3.5$.
And for $0leqslant dleqslant 1$ and $0leqslant eleqslant 1$, among five different solutions, I would like to pick the one that is real and positive, and 3DPlot
it against $d$ and $e$.
My Mathematica code is as follows:
Plot3D[x/.sol=Select[{Solve[ax^5+bx^4+cx^3+dx^2+ex+f==0,x]},#>0&,1],{d,0,1},{e,0,1}]
And the result I get is this:
Any help would be greatly appreciated!
This may be close to what you want.
a = -2;
b = 3;
c = 5;
g = 3.5;
tab = Table[
x /. Solve[a x^5 + b x^4 + c x^3 + d x^2 + e x + g == 0, x,
Reals][[1]], {d, 0, 1, .1}, {e, 0, 1, .1}];
ListPlot3D[tab, DataRange -> {{0, 1}, {0, 1}}, AxesLabel -> {d, e}]
Answered by Bill Watts on January 4, 2021
With[{a = -2, b = 3, c = 5, g = 35/10},
sol = Solve[{a x^5 + b x^4 + c x^3 + d x^2 + e x + g == 0, 0 <= d <= 1, 0 <= e <= 1}, x, Reals]
]
Plot3D[
Evaluate[x /. sol],
{d, 0, 1}, {e, 0, 1}
]
Answered by MarcoB on January 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP