```python

```


```python
#Import packages
from scipy import optimize,arange
from numpy import array
import numpy as np
import matplotlib.pyplot as plt
import random
import sympy as sm
from math import *
%matplotlib inline
from IPython.display import Markdown, display
import pandas as pd


```


```python
a = sm.symbols('a') 
c_vec = sm.symbols('c_vec') 
b = sm.symbols('b') 
q_vec = sm.symbols('q_i') # q for firm i
q_minus = sm.symbols('q_{-i}') # q for the the opponents

#The profit of firm 1 is then: 
Pi_i = q_vec*((a-b*(q_vec+q_minus))-c_vec)

#giving focs:
foc = sm.diff(Pi_i,q_vec)
foc

```




$\displaystyle a - b q_{i} - b \left(q_{i} + q_{-i}\right) - c_{vec}$



In order to use this in our solutionen, we rewrite $x_{i}+x_{-i} = \sum x_{i}$ using np.sum and then define a function for the foc


```python
def foc1(a,b,q_vec,c_vec):
    # Using the result from the sympy.diff 
    return -b*q_vec+a-b*np.sum(q_vec)-c_vec
```


```python

```

cfb604e1a04f934fa8f818212845d0e7256750d2
ipynb
Jupyter Notebook
modelproject/Untitled1.ipynb
AskerNC/projects-2021-aristochats
cade4c02de648f4cd1220216598dc24b67bb8559
MIT
modelproject/Untitled1.ipynb
AskerNC/projects-2021-aristochats
cade4c02de648f4cd1220216598dc24b67bb8559
MIT
modelproject/Untitled1.ipynb
AskerNC/projects-2021-aristochats
cade4c02de648f4cd1220216598dc24b67bb8559
MIT
Qwen/Qwen-72B
1. YES
2. YES