##### How to define two functions run simultaneously within a function?
 How to define two functions run simultaneously within a function? Alberto Silly Frenchman Posts: 42 Threads: 20 Joined: May 2017 Reputation: 0 Feb-06-2018, 05:35 PM (This post was last modified: Feb-06-2018, 10:05 PM by Alberto.) Dear Python Users, I have the code below. The problem is that two functions are interdependent and should be run simultaneously (line - 8 and 11). How can I run the re-construct the code? The Final output is the value of "call" the gives the minimum value of "diff" ```warrant_price = [] diff = [] def results(S0, K, T, r, sigma, k, N, M, Iteration): for i in range(1, Iteration): dilution = N/(N +k*M) Value_2 = 10000 Value_1= 10000 warrant = dilution*bsm_call_value(Value_2/N,100,1,0.1,0.2) warrant_price.append(warrant) Value_2 = Value_1 + warrant*M diff1 = Value_1 - Value_2 diff.append(diff1) print(results(100,100,1,0.1,0.2,1,100,10, 10)) call_df = pd.DataFrame({'warrant_price': warrant_price}) diff_df = pd.DataFrame({'diff': diff}) merged_df = call_df.join(diff_df) merged_df.loc[merged_df['diff'].idxmin()] ``` Reply

 Messages In This Thread How to define two functions run simultaneously within a function? - by Alberto - Feb-06-2018, 05:35 PM RE: How to define two functions run simultaneously within a function? - by boring_accountant - Feb-06-2018, 06:37 PM RE: How to define two functions run simultaneously within a function? - by Alberto - Feb-06-2018, 06:46 PM RE: How to define two functions run simultaneously within a function? - by boring_accountant - Feb-06-2018, 08:00 PM RE: How to define two functions run simultaneously within a function? - by Alberto - Feb-06-2018, 10:08 PM

 Possibly Related Threads… Thread Author Replies Views Last Post Help with define a def function Omer_ 3 140 Sep-20-2020, 06:59 PM Last Post: Omer_ How to define a function to create a resorted list? sparkt 6 337 Aug-08-2020, 04:10 PM Last Post: sparkt Cant define turtle color with function argument Wrightys99 2 326 Apr-22-2020, 01:43 PM Last Post: Wrightys99 Run a timer when a functions starts to see how long the function takes to complete Pedroski55 2 393 Apr-19-2020, 06:28 AM Last Post: Pedroski55 Need help with a function that calls other functions. skurrtboi 4 458 Sep-30-2019, 09:28 PM Last Post: stullis How to run same process simultaneously exploit123 1 481 Sep-19-2019, 10:08 AM Last Post: Gribouillis How to define a function that calculates the BMI from dataframe DavidGG 2 1,015 May-30-2019, 03:35 PM Last Post: volcano63 Control 2 stepper motor simultaneously jihene 2 1,014 May-08-2019, 05:27 PM Last Post: DeaD_EyE Moving with objects simultaneously kom2 1 633 Apr-20-2019, 07:12 PM Last Post: SheeppOSU call a function from other functions ... evilcode1 2 962 Sep-05-2018, 09:07 AM Last Post: evilcode1

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020