How to design a form where inputs can be computed from other inputs?

What are the best practices when designing a form in which some inputs can be used to calculate other inputs?

I am designing a form with about a dozen text inputs. The first three of these inputs are required. However, if a user fills out two of the optional inputs we can calculate one of the required inputs.