How to create a function directly from the output of Solve

前端 未结 5 1844
天命终不由人
天命终不由人 2020-12-31 14:34

If I evaluate Solve[f[x,y]==0,x], I get a bunch of solutions like:

{{x -> something g[y]}, {x -> something else}}, etc.

Now I

5条回答
  •  佛祖请我去吃肉
    2020-12-31 14:39

    This is really cool. Thanks. By converting Solve results into functions I could use Manipulate in a Plot. Something like

    In[73]:= g = solutionFunctions[x^2 + a x + b == 0, x]
    Out[73] = {Function[{a, b}, 1/2 (-a - Sqrt[a^2 - 4 b])], 
      Function[{a, b}, 1/2 (-a + Sqrt[a^2 - 4 b])]}
    
    In[74]:= Manipulate[Plot[g[[1]][a, b], {a, 0, 4}], {{b, 1}, 0, 10}]
    

    And you get a plot where you can manipulate parameter b

提交回复
热议问题