To solve the given optimization problem, we first need to define the decision variables and the objective function. Let's denote:

- $F$ as the number of fridges to be stocked.
- $S$ as the number of stoves to be stocked.

The objective is to maximize profit. The profit per fridge is $400, and the profit per stove is $500. Thus, the total profit can be represented as $400F + 500S$.

Now, let's formulate the constraints based on the given information:

1. **Floor Space Constraint**: Each fridge requires 10 sq ft of floor space, and each stove requires 15 sq ft. The total available floor space is 1000 sq ft. So, we have $10F + 15S \leq 1000$.

2. **Percentage of Fridges Constraint**: Management requires that at least 40% of all appliances in stock be fridges. This can be represented as $\frac{F}{F+S} \geq 0.4$. To make it linear, we multiply both sides by $F+S$, resulting in $F \geq 0.4(F+S)$ or $0.6F \geq 0.4S$.

3. **Capital Constraint**: A fridge ties up $1000 in capital, and a stove ties up $1200 in capital. The store wants to have a maximum of $40,000 worth of capital tied up at any time. So, we have $1000F + 1200S \leq 40000$.

4. **Non-Negativity Constraints**: Both the number of fridges and stoves cannot be negative, so $F \geq 0$ and $S \geq 0$.

Given these constraints and the objective function, we can now formulate this problem as a linear programming (LP) problem:

Maximize: $400F + 500S$

Subject to:
- $10F + 15S \leq 1000$
- $0.6F \geq 0.4S$ (which can be rearranged for clarity in the model as $0.6F - 0.4S \geq 0$)
- $1000F + 1200S \leq 40000$
- $F, S \geq 0$

To solve this LP using Gurobi in Python:

```python
from gurobipy import *

# Create a new model
m = Model("Appliance_Profit_Optimization")

# Define the decision variables
F = m.addVar(lb=0, name="Number_of_Fridges")
S = m.addVar(lb=0, name="Number_of_Stoves")

# Set the objective function: Maximize profit
m.setObjective(400*F + 500*S, GRB.MAXIMIZE)

# Add constraints
m.addConstr(10*F + 15*S <= 1000, name="Floor_Space_Constraint")
m.addConstr(0.6*F - 0.4*S >= 0, name="Percentage_of_Fridges_Constraint")
m.addConstr(1000*F + 1200*S <= 40000, name="Capital_Constraint")

# Optimize the model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print(f"Optimal solution found: {m.objVal}")
    print(f"Number of Fridges: {F.x}")
    print(f"Number of Stoves: {S.x}")
else:
    print("No optimal solution found.")
```