LaTexLearner wrote:Why does the following code produce a graph with a kink near the origin?
The plot function uses a finite number of plot points, called samples, AFAIK.
Said samples are initially set to 25. For more detail in the plot, simply increase its number.
LaTexLearner wrote:Why does the following code produce a graph with a kink near the origin?
The plot function uses a finite number of plot points, called samples, AFAIK.
Said samples are initially set to 25. For more detail in the plot, simply increase its number.
Got it.
It does occur to me, though, that given the average amount of computing power typically available that the default number of samples should be orders of magnitude larger than 25, especially for simple functions.
Or is there a rationale behind a default of 25 that I don't know about?
LaTexLearner wrote:Also, should I be bothering to make these kinds of things with just TikZ or should I also learn the PGF package?
You may want to have a look at the pgfplots package.
LaTexLearner wrote:It does occur to me, though, that given the average amount of computing power typically available that the default number of samples should be orders of magnitude larger than 25, especially for simple functions.
Are you sure? One very simple function i can think of is y=3. To draw this with a mixumum of accuraccy, i only need two points.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
LaTexLearner wrote:It does occur to me, though, that given the average amount of computing power typically available that the default number of samples should be orders of magnitude larger than 25, especially for simple functions.
Are you sure? One very simple function i can think of is y=3. To draw this with a mixumum of accuraccy, i only need two points.
Are you saying that there is some huge downside to having computers calculate, say, 250 points instead of 25?
If 25 points are used for both y=3 and y=sqrt(x) only one graph looks reasonable.
If 250 points are used for each of those points, both graphs look reasonable.
TeX was designed in the end of the seventies to the end of the eighties, memory was a very very big thing in those times.
Even today, if you have several files and want to plot the results, it is quit possible that you fence the memory cap, still carried over. You can set it to a higher value though or use the modern LuaTeX that sets up more memory if needed during compile.
On the other hand, TeX wass designed for typesetting, not for complex calculations. With every extra sample, it will take longer to compile.
For those reasons, the tikz-library externalize was introduced. It opens up an auxiliary LaTeX run to produce a pdf, in later runs this pdf can be included very easily.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Johannes_B wrote:
TeX was designed in the end of the seventies to the end of the eighties, memory was a very very big thing in those times.
...
With every extra sample, it will take longer to compile.
I see.
How much longer are we talking? It seems to me that this is the kind of calculation that can literally be completed in a millisecond. E.g. look at how fast and smooth the graphs are at Desmos.com.
Johannes_B wrote:
...
For those reasons, the tikz-library externalize was introduced. It opens up an auxiliary LaTeX run to produce a pdf, in later runs this pdf can be included very easily.
When I start needing more complex functions, I will check this out. Thanks again!
LaTexLearner wrote:How much longer are we talking? It seems to me that this is the kind of calculation that can literally be completed in a millisecond. E.g. look at how fast and smooth the graphs are at Desmos.com.
Hard to say, depends on the hardware. Right now, my laptop seems to have some kind of bug or virus or ... i don't know. A three-page document tooks 2 seconds to compile with pdflatex, one testrun with LuaLaTeX of a one-sife document took about 10 to twelve seconds. Clearly, that is a fault on my side and doesn't even have anything to do with pgfplots.
But speed depends on the hardware (and maybe software) you have available.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.