Skip the higher math and stick to the practical basics
The amount of confusion and pointless discussion going on here is disturbing.
Furthermore, average solenoids are dirt cheap and common, so why would you custom build one if you aren't 12 anymore?
Solenoids are simply a fine-wire choke (wire coil), often with a highly heat- and magnetic- conductive core material, such as transformer-grade silicon steel; some have a fitted steel pin that is mobile, to actuate something else with.
The technology is strictly 19th century.
Try the eMagnet site at (
http://www.netdenizen.com/emagnet) or the Wheeler site (
http://home.earthlink.net/~jimlux/hv/wheeler.htm) for simpler formulas accurate to 2% or so to calculate your coil size with.
Some basics: the usual solenoid has a length several times (5x+) its diameter. The wire is closely wound around the outside of a cylinder, in the form of a helix with a very low pitch. The magnetic field thus created inside the cylinder is quite uniform, especially far from the ends of the solenoid.
The larger the ratio of the length to the diameter, the more uniform the field near the middle.
The approximate value of the magnetic field is given by B = u0nI, where B is the magnetic field, u0 (u sub 0)the permeability of free space, n is the number of turns of wire per unit length, and I the current through the wire. This relationship would be exact if the solenoid was infinitely long. A more precise calculation shows that the above relationship is within 2 percent of the correct value at the center of a solenoid if the ratio of the length to the diameter is five or greater.
This equation shows that one way to increase B is to increase I. But, because all wire has resistance, this procedure requires an increase in voltage across the solenoid and results in more heat being generated by the resistance of the wire. Another way to increase B is to increase n. But this increase can only be accomplished by decreasing the wire size (if the solenoid, as is usually the case, has turns wound as closely as possible), resulting in an increase in resistance and an increase in the voltage required for a given current, as well as an increase in heat generated by the resistance of the wire. An alternative way to increase n is to wind several layers of wire. This procedure increases the resistance of the wire, adds insulation problems, and decreases the length to diameter ratio. The selection of the appropriate trade-off is the principle problem that must be solved by the solenoid designer. Sleeving the coil with a ferromagnetic material (iron sleeve) can conduct away excess heat and even out the magnetic field, but will shut down or interfere with actuator-type solenoids.
If a soft iron rod is placed partly inside a solenoid and the current turned on, the rod will be drawn into solenoid by the induced magnetic field. This motion can be used to actuate a lever, unlock a door, or operate a relay. In this way the operation of a small electric switch can produce a large mechanical action at a remote location.
It is worth noting that the iron core has to be placed at the end of the solenoid where the field is non-uniform for it to move. Furthermore, it is not necessary for the current to flow in one direction only. An alternating current will generate a field also.
The magnetic field of a solenoid can also be used directly with a high degree of accuracy. It is used to deflect the beam of electrons in a television tube. Solenoids are also used to provide the magnetic field for magnetic resonance imaging. Physics textbooks often use solenoids in problems about magnetic fields because the field produced by the solenoid is easily calculated and is easy to visualize.
On the subject of old technology, consider materials from Lindsay Books (
http://www.lindsaybks.com), who carry lots of books on this sort of low technology material.
A very inexpensive tabletop lathe (plastic and aluminium) to wind coils with can be bought for the task at Harbor Freight Tools for less than $40 (on sale from time to time for $20), and altered quite easily. If you need a wider or deeper bed, build it out of aluminium stock.
Most of this will be of no use to you
if, as I suspect, what you are aiming for is a linear solenoid, rather than just something to ring a doorbell with. Linear solenoids (railguns) use computer-controlled overlapping solenoid fields to generate their motion and high velocity, and the power and forces involved are too substantial for anyone but the most dedicated tinkerer.
Good Luck.