# Scaling Mechanism

Both *Dv* and *Response* can be scaled in msolve.

Additional properties are provided (*factor, mean, scaleBySen* in *Dv* and
*factor* in *Response*) for scaling and you don’t need to change the
rest of code.

## Scaling Dv

`factor`and

`mean`are specified, the value of Dv is calculated by the following:

scaleBySenis a Boolean flag that determines how Dvs are scaled in automatic scaling; the default value is true, meaning that Dvs are scaled by the sensitivity of objective function.

### Example

The example below shows how you can use a scaled Dv as the mass of a rigid body:

```
>>> # Create a scaled Dv
>>> dv = Dv(b=1.0, mean=1.0, factor=2.0)
>>> # Create a Part with designable mass; the current value of mass is 3.0
>>> part = Part(mass=dv, ip=[10,10,10], cm=Marker())
```

## Scaling Response

Every response class can be scaled if `factor` is given. The
value/sensitivity of the scaled response is the value/sensitivity of the original
one multiplied by the scaling factor.

### Example

```
>>> # Create RMS2 and scale it by 0.01
>>> dx_coupler = "DX({marker})".format(marker=m.coupler.cm.id)
>>> a2x = RMS2(targetValue=xy, measuredValue=dx_coupler, factor=0.01)
```

Scaling could help the optimization problem converge. For more details, please refer to the Advanced Topics section.