title: How can I use the elements of a FiniteSet for my following calculations?
body: <p>I'm trying to dissolve an equation using solveset(equation, variable), which will get me the value of the variable as result. As result I get an FiniteSet {value}. Is this FiniteSet accessible so that I can use the value (which is hopefully of the type float) for the next calculations?</p>
  
  <p>The problem is the following: 
  I define three SymPy Symbols (<code>drift1, drift2, drift3 = symbols('drift1 drift2 drift3')</code>), which should be kind of placeholders for the following calculations. They have no values. They are part of two equations (<code>equation1</code> and <code>equation2</code>, both are functions of <code>drift1, drift2</code> and <code>drift3</code>). 
  My aim is to program an iteration loop to optimize all three symbols drift1, drift2 and drift3 by solving both equations and use the results for the next iteration step. For this, I define three Python variables <code>x, y</code> and <code>z</code>, the initial values of a and y are <code>0.0188</code> and <code>0.0099</code>. z is a function of x and y and will be calculated new with every iteration step. 
  In the first step z is calculated with x and y (and other variables I defined in the code) and I substitute drift2 and drift3 by y and z in equation1 (equation is now a function of drift1). By activating <code>equation1=0</code>towards drift1, I'm using <code>solveset(equation1.subs(drift2, y).subs(drift3, z), drift1)</code> and I get a <code>FiniteSet</code>, which contains the result. I will use this result for solving the second equation by doing <code>solveset(equation2.subs(drift1, result from FiniteSet).subs(drift3, z), drift2)</code>. This does not work because the result is not a <code>float</code> variable but <code>sympy.sets.sets.FiniteSet</code>-type. </p>
  
  <p>Can anyone tell me how I can use the value of the FiniteSet ('inside' the FiniteSet; {value}) for the next calculations? I use Pyhton 3 and SymPy.</p>
  
  <pre><code>import numpy as np
  from sympy import *
  import scipy as sp
  
  drift1, drift2, drift3 = symbols('drift1 drift2 drift3')
  init_printin(use_unicode=True)
  
  equation1 =  0.005*(drift1*(-23.88*drift2*(15.16*drift3 + 1.15)-20.31*drift3
                         +00.47*drift2*(15.16*drift3+1.15)+1.03*drift3+0.05))/drift1
  
  equation2 = 0.005*(drift1*(35.73*drift2*(-13.79*drift3 + 0.86)+7.91*drift3+2.09)
                         +1.65*drift2*(-13.79*drift3+0.86)+0.75*drift3+0.07)/drift1
  
  x, y = 0.0188, 0.0099
  gesamtlaenge = 1.676
  laenge1 = 0.04
  laenge2 = 0.02
  
  # the loop for the iteration is not included in this code
  # the only thin I wanna know is how to substitute drift1 by the solution of 
  # the first calculation sol1
  
  z = gesamtlaenge-laenge1-laenge2-x-y
  expr1 = equation1.subs(drift2, y).subs(drift3, z)
  sol1 = solveset(equation, drift1)
  # up to this point, the code is running, but now, I get a FiniteSet {0.047} as
  # result for sol1 and I wanna use this value to substitute drift1 in the next calculation
  expr2 = equation2.subs(drift1, sol1).subs(drift3, z)
  sol2 = solveset(equation, drift2)
  print(drift1, drift2, drift3)
  </code></pre>
  
  <p>When I execute <code>expr2 = equation2.subs(drift1, sol1).subs(drift3, z)</code>, I get equation2 as a function of drift1 and drift2, because it cannot use the value in FiniteSet {0,047} (0.047 is the value I need). I understand why this is the case but I have no solution.</p>
  
  <p>I'm thankful for any help! Cheers</p>