Rare goods increase in value the further you travel from their point of purchase.
— In-Game Description
Rare goods can be found throughout the galaxy and increase in price based upon how far away from the originating system the goods are.
The price increase can be best approximated by the following function, illustrated in the graphs below. Note that the variables p0, p1, p2, and p3 differ for various commodities, see the thread for details.
SP(x) = p0 + p1 * erf((x - p2) / p3)
Note that if your environment does not have an erf() function for you to use, you can use a trigonometric function instead at the cost of a bit more error - but the result should still be useful:
SP(x) = p0 + p1 * tan−1((x - p2) / p3)