Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4082006
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:08:00+00:00 2026-05-20T18:08:00+00:00

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

  • 0

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 want to convert each of those x->somethings into a function. Typically, my requirements are low, and my function f[x] is at the most a cubic, with straightforward solutions for x. So I’ve always just defined g1[y_]:=something, g2[y_]:=... etc, manually.

However, for a function that I have now, Solve outputs a complicated polynomial running 4 pages long, and there are 4 such solutions. I’ve tried reducing to simpler forms using Simplify, Collect, Factor etc, but it just seems irreducible.

Is there a way I can automatically assign them to functions? (It’s extremely hard to scroll through pages and copy each one… and I have to look for where the next one begins!)

Something like: {g1[y_], g2[y_], g3[y_]} = output of Solve?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:08:01+00:00Added an answer on May 20, 2026 at 6:08 pm

    It appears Simon beat me to an answer (I am glad that StackOverflow gives me a pop-up to let me know!), therefore I will take a different approach. You should know how to use the output of Solve directly, as quite a few times it will be convenient to do that.

    Starting with

    ClearAll[a, x, sols]
    
    sols = Solve[x^2 + a x + 1 == 0, x]
    

    Here are some things you can do.


    Find the solutions to x for a == 7

    x /. sols /. a -> 7
    

    Plot the solutions

    Evaluate is used here not out of necessity for basic function, but to allow the Plot function to style each solution separately

    Plot[Evaluate[x /. sols], {a, 1, 4}]
    

    enter image description here


    Define a new function of a for the second solution

    Notice the use of = rather than := here

    g[a_] = x /. sols[[2]]
    

    Here is an alternative to Simon’s method for defining functions for each solution

    MapIndexed[(gg[#2[[1]]][a_] := #) &, x /. sols]
    

    The function is then used with the syntax gg[1][17] to mean the first solution, and a == 17

    Plot[gg[1][a], {a, 1, 4}]
    
    gg[2] /@ {1, 2, 3}
    

    These uses do generally require that a (in this example) remain unassigned.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to evaluate .NET as a development platform for a desktop application.
i want to solve a pde according to this matlab code (part of it):
I am trying to evaluate which indicator needs to be displayed next to an
I'm trying to evaluate my js load times, but Firebug won't show them to
How to evaluate whether a career coach is beneficial?
I'm trying to evaluate the purchase of a statistical tool. This will be used
I need to evaluate a mathmatical expression that is presented to me as a
I am trying to evaluate the answer provided here , and am getting the
How does Python evaluate the expression 1+++2 ? How many ever + I put
we need to evaluate a value in an object in run time while we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.