I am looking for an open source program that is compatible with Linux and Windows that allows me to easily create diagrams, of the style necessary to describe mathematical ideas and things like free-body diagrams used in Newtonain physics.
I am looking for something where I can type a relatively simple but very flexible code, with a comparable time commitment to drawing the diagram by hand (LibreOffice's formula editor code accomplishes this very well for algebraic expressions), and output an image, either to the clipboard or to a file that I can then embed into a document.
The images do not need to be fancy, but should be professional, with things like sharp edges and straight lines. I don't even need support for multiple colors.
Examples of the kinds of diagrams I want to be able to create:
Does any such thing exist?