I assume you want a non-moving background object to be scaled linearly(=same height or width increment or decrement in every frame interval, not same in percents but same in millimeters) during the run. The foreground object also doesn't move, but has a constant apparent size during the run.
Assuming the camera lens aperture to be so small that the image is sharp when the lens is focused to infinity, the ray geometry reduces to quite simple:
We have the camera in the left. A is the foreground object at distance D, B is the background object, the distance difference is S.
We compare computer screen images a and b of objects A and B. We use the same symbols for the heights. Symbol a means onscreen height of the foreground object which has real height A, etc...
Computer screen heights a and b are pretty much bigger than the sizes in the film. If the real focal length is =f, the imaging plane distance from the lens is N*f where N is the scaling factor from "on film image size" to "on screen image size"
Equations (1) and (2) are ordinary triangle proportion laws. (3) and (4) are the same equations, but solved to give needed camera distance D and focal length f.
(5) and (6) tell what actually is wanted. We have a series of video frames which covers our camera run. Frames are indexed v=0,1,2,...K. b0 is the inital onscreen height of B, every frame advance increases it by increment x. In the last frame (v=K) the onscreen size of B has grown from b0 to M*b0
I made Excel spreadsheet to calculate the right camera distance Dv and focal length fv for every frame of the run:
The yellow cells are the input area. There we have
- scaling factor = 20 ie. 18 mm high film frame vs. 360 mm high screen
- the foreground object is 1,5 meters high and shown as 240 millimeters high
- the background object is 5 meters further than the foreground object, its height is 1,5 meters, too and in the beginning it's shown as 100 mm high.
- in the end the background object has grown to 200 mm high onscreen, the growth rate is 2 millimeters per frame
- the run consists 51 frames ie. the initial frame (v=0) and then 50 more, the last frame has index v=50.
About the results:
The camera distance grows. The speed increases. In the beginning the speed is about 130 mm per frame. In the end the speed is about 1,5 meters per frame. Start distance is = 3,5 meters, final distance is 25 meters
To keep the foreground object having the same onscreen size, the focal length grows from 28,6 mm to 200 mm
These numbers are unrealistic for a real run, but in computer all is possible. Without computers focal length growth can be replaced by enlargening.
The spreadsheet is here: https://www.dropbox.com/s/dlxc8wuvytdd0nx/VertigoZoom.xlsx?dl=0
Note: there's nothing about "how to program a piece of graphic software to do the calculated run".