## Step 1: Define the symbolic representation of the problem

Let's define the symbolic variables:
- $x_1$ represents the amount of money invested in toothpaste company A.
- $x_2$ represents the amount of money invested in toothpaste company B.

The objective is to maximize profit. Each dollar invested in toothpaste company A yields a $0.12 profit, and each dollar invested in toothpaste company B yields a $0.14 profit. Therefore, the objective function can be represented as $0.12x_1 + 0.14x_2$.

## Step 2: Define the constraints

The constraints given are:
1. The total investment should not exceed $5000: $x_1 + x_2 \leq 5000$.
2. At least 40% of the investment should be in toothpaste company A: $x_1 \geq 0.4(x_1 + x_2)$.
3. At least $1000 should be invested in toothpaste company B: $x_2 \geq 1000$.
4. Non-negativity constraints: $x_1 \geq 0$ and $x_2 \geq 0$.

## 3: Convert the constraints into standard form

1. $x_1 + x_2 \leq 5000$
2. $x_1 \geq 0.4x_1 + 0.4x_2$ simplifies to $0.6x_1 - 0.4x_2 \geq 0$.
3. $x_2 \geq 1000$

## 4: Symbolic representation in JSON format

```json
{
    'sym_variables': [('x1', 'money invested in toothpaste company A'), ('x2', 'money invested in toothpaste company B')],
    'objective_function': '0.12*x1 + 0.14*x2',
    'constraints': [
        'x1 + x2 <= 5000',
        '0.6*x1 - 0.4*x2 >= 0',
        'x2 >= 1000',
        'x1 >= 0',
        'x2 >= 0'
    ]
}
```

## 5: Gurobi code in Python

```python
import gurobi

def solve_investment_problem():
    # Create a new model
    model = gurobi.Model()

    # Define variables
    x1 = model.addVar(name="x1", lb=0)  # Investment in toothpaste company A
    x2 = model.addVar(name="x2", lb=0)  # Investment in toothpaste company B

    # Objective function: maximize 0.12*x1 + 0.14*x2
    model.setObjective(0.12 * x1 + 0.14 * x2, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x1 + x2 <= 5000)  # Total investment not exceeding $5000
    model.addConstr(0.6 * x1 - 0.4 * x2 >= 0)  # At least 40% in toothpaste company A
    model.addConstr(x2 >= 1000)  # At least $1000 in toothpaste company B

    # Solve the model
    model.optimize()

    # Print the solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal investment in toothpaste company A: ${x1.varValue:.2f}")
        print(f"Optimal investment in toothpaste company B: ${x2.varValue:.2f}")
        print(f"Maximal profit: ${model.objVal:.2f}")
    else:
        print("The model is infeasible.")

solve_investment_problem()
```