<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Graph Forums — Prime counting function]]></title>
		<link>https://forum.padowan.dk/viewtopic.php?id=761</link>
		<atom:link href="https://forum.padowan.dk/extern.php?action=feed&amp;tid=761&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Prime counting function.]]></description>
		<lastBuildDate>Sun, 30 Dec 2012 14:26:17 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Prime counting function]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=2086#p2086</link>
			<description><![CDATA[<p>You can add as many functions in one file as you wish. </p><p>There is an overhead when calling into Python. I just made a quick test showing that sinc(x) is between 4 and 5 times as slow when implemented in Python compared to a custom function in Graph. But this may vary depending on the complexity of the function.</p>]]></description>
			<author><![CDATA[null@example.com (Ivan Johansen)]]></author>
			<pubDate>Sun, 30 Dec 2012 14:26:17 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=2086#p2086</guid>
		</item>
		<item>
			<title><![CDATA[Re: Prime counting function]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=2085#p2085</link>
			<description><![CDATA[<p>So Graph can use Python math functions by just creating a file like mymath.py containing</p><p>Import Graph<br />Import math</p><p>Graph.CustomFunctions[&quot;pmf1&quot;] = pmf1<br />Graph.CustomFunctions[&quot;pmf2&quot;] = pmf2<br />Graph.CustomFunctions[&quot;pmf3&quot;] = pmf3</p><p>or does each function need to be in a separate file?</p><p>Do you know if there is a significant overhead in calling Python functions? For example, sinc() could also be a custom function in Graph. Would graphing speed of a complicated function using sinc() be noticeably different between the Graph defined sinc() and the Python defined sinc()?</p>]]></description>
			<author><![CDATA[null@example.com (zubaroo)]]></author>
			<pubDate>Sun, 30 Dec 2012 09:19:52 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=2085#p2085</guid>
		</item>
		<item>
			<title><![CDATA[Re: Prime counting function]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=2057#p2057</link>
			<description><![CDATA[<p>For learning Python I can recommend the tutorial in the help installed with Python. There are several example scripts installed with Graph but not one that shows how to add functions.</p><p>But here is an example. If you place the following code in a file called sinc.py in the Plugins directory and you have Python 3.2 installed, you will be able to use the function sinc in Graph like f(x)=sinc(x):<br /></p><div class="codebox"><pre><code>import Graph
import math

def sinc(x):
    if x == 0:
        return 1
    return math.sin(x) / x

Graph.CustomFunctions[&quot;sinc&quot;] = sinc</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Ivan Johansen)]]></author>
			<pubDate>Sun, 09 Dec 2012 13:24:17 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=2057#p2057</guid>
		</item>
		<item>
			<title><![CDATA[Re: Prime counting function]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=2056#p2056</link>
			<description><![CDATA[<p>Including a script with the package would serve as a practical example of how to extend graph by using Python. It would assist those who are unfamiliar with either using Python scripts or how to program specialized functions. I think it would be valuable &quot;documentation&quot; for showing the power and versatility of adding Python scripts to Graph. It might even start a community of contributors sharing other scripted specialized functions and applications designed for Graph. I think it&#039;s a great idea. You have my two thumbs up for including some example scripts with a future version.</p><p>In the meantime, I&#039;m in the category of being unfamiliar with the Python scripting language. Would it be possible to post or refer me to an example of a script that implements a function not native to graph and an example graph using it?</p>]]></description>
			<author><![CDATA[null@example.com (zubaroo)]]></author>
			<pubDate>Sat, 08 Dec 2012 06:24:28 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=2056#p2056</guid>
		</item>
		<item>
			<title><![CDATA[Re: Prime counting function]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=2055#p2055</link>
			<description><![CDATA[<p>The functions you suggest do not seem widely used. I therefore think it would be best to have them as custom functions or implemented in a Python script. I might add a script with rare functions to one of the next versions, but meanwhile you can also do it yourself.</p>]]></description>
			<author><![CDATA[null@example.com (Ivan Johansen)]]></author>
			<pubDate>Fri, 07 Dec 2012 09:23:54 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=2055#p2055</guid>
		</item>
		<item>
			<title><![CDATA[Prime counting function]]></title>
			<link>https://forum.padowan.dk/viewtopic.php?pid=2054#p2054</link>
			<description><![CDATA[<p>Hi Ivan,</p><p>Graph has some great functions, such as gamma and zeta, but none that directly relate to primes, such as:</p><p>pi(n):&nbsp; You would need another name for the function since pi is used as a constant in Graph.</p><p>isprime(n): For small n there are some good ideas on efficiently storing a lookup table of small primes at <a href="http://www.rsok.com/~jrm/printprimes.html">http://www.rsok.com/~jrm/printprimes.html</a> and for large n there are primality tests much faster than trial division by all primes to sqrt(n).</p><p>iscomposite(n) or notprime(n): This one could be implemented using the Miller–Rabin test.</p><p>Graphing the behavior of primes is highly desirable for any graphing program. I might be able to implement a simple sieve just using Graph&#039;s existing functions. Though I suspect your recommendation will be to use a Python script, having some functions for working with primes built in to Graph would be more convenient.&nbsp; Remember, accuracy is only required to the limit of Graph&#039;s x-axis, not infinity.</p><p>Some other functions to consider implementing that would be useful to number theory graphs:</p><p>Riemann&#039;s prime-counting function<br />Logarithmic integral function<br />Exponential integral function<br />von Mangoldt function <br />Möbius function <br />Euler&#039;s totient (phi) function<br />sfn(n)&nbsp; is n a square free number?<br />Lucas-Lehmer test</p>]]></description>
			<author><![CDATA[null@example.com (zubaroo)]]></author>
			<pubDate>Thu, 06 Dec 2012 22:47:03 +0000</pubDate>
			<guid>https://forum.padowan.dk/viewtopic.php?pid=2054#p2054</guid>
		</item>
	</channel>
</rss>
