<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Table of Contents
<p><div class="lev1"><a href="#Function-Optimization"><span class="toc-item-num">1&nbsp;&nbsp;</span>Function Optimization</a></div><div class="lev2"><a href="#scipy.optimize.fsolve"><span class="toc-item-num">1.1&nbsp;&nbsp;</span>scipy.optimize.fsolve</a></div><div class="lev1"><a href="#Conclusion"><span class="toc-item-num">2&nbsp;&nbsp;</span>Conclusion</a></div>
# Function Optimization
Problem
Step1:  scipy.optimize.fsolve
<ASSISTANT_TASK:>
Python Code:
from IPython.display import display
import pandas as pd
# data
data = pd.DataFrame([
    [10, 300],
    [20, 200],
    [30, 100],
    [40, 400]        
], columns=['QTY', 'UNIT.V'], 
   index=['A', 'B', 'C', 'D'])
display(data)
def gain(unit_v, qty):
    return unit_v*qty*0.1
data['GAIN'] = data.apply(lambda v: gain(v['UNIT.V'], v['QTY']), axis=1)
display(data)
def gain_1_2(var_qty, unit_v):
    return unit_v*var_qty*0.12
Explanation: Table of Contents
<p><div class="lev1"><a href="#Function-Optimization"><span class="toc-item-num">1&nbsp;&nbsp;</span>Function Optimization</a></div><div class="lev2"><a href="#scipy.optimize.fsolve"><span class="toc-item-num">1.1&nbsp;&nbsp;</span>scipy.optimize.fsolve</a></div><div class="lev1"><a href="#Conclusion"><span class="toc-item-num">2&nbsp;&nbsp;</span>Conclusion</a></div>
# Function Optimization
Problem:
We have a order with quantity of a product and its unit value. 
We know that for each product sold we gain 10% but, how should be its quantity if we gain 12% for each product and to have the same total.
|PRODUCT|QTY|UNIT.V|GAIN|QTY_X|
|:-:|:-:|:----:|:--------:|:--------:|
|A|10 | 300  |300 | ?|
|B|20 | 200  |400 | ?|
|C|30 | 100  |300 | ?|
|D|40 | 400  |1600| ?|
End of explanation
from scipy.optimize import fsolve
help(fsolve)
fsolve(
    gain_1_2, [1], args=()
)
Explanation: scipy.optimize.fsolve
End of explanation
<END_TASK>