<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

	<title>Planet Sage</title>
	<link rel="self" href="http://planet.sagemath.org/atom.xml"/>
	<link href="http://planet.sagemath.org"/>
	<id>http://planet.sagemath.org/atom.xml</id>
	<updated>2010-03-18T12:11:48+00:00</updated>
	<generator uri="http://www.planetplanet.org/">Planet/2.0 +http://www.planetplanet.org</generator>

	<entry>
		<title type="html">Hypergeneralization</title>
		<link href="http://fredrik-j.blogspot.com/2010/03/hypergeneralization.html"/>
		<id>tag:blogger.com,1999:blog-4754734402679928849.post-59187826230880460</id>
		<updated>2010-03-17T19:27:38+00:00</updated>
		<content type="html">The &lt;a href=&quot;http://mpmath.googlecode.com/svn/trunk/doc/build/functions/hypergeometric.html#generalized-hypergeometric-functions&quot;&gt;generalized hypergeometric function&lt;/a&gt; can itself be generalized endlessly. I have recently implemented three such extensions in mpmath: bilateral series, two-dimensional hypergeometric series, and &lt;i&gt;q&lt;/i&gt;-analog (or &quot;basic&quot;) hypergeometric series.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Bilateral series&lt;/h3&gt;&lt;br /&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilateral_hypergeometric_series&quot;&gt;bilateral hypergeometric series&lt;/a&gt; is the simplest extension, and consists of taking the usual hypergeometric series and extending the range of summation from [0,∞) to (-∞,∞):&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_rh0QblLk0C0/S6CftbGPcYI/AAAAAAAAAOw/GsDYbUeiXic/s1600-h/75a6680a08d19b12ed51c10c3f2435c188d4eebe.png&quot;&gt;&lt;img src=&quot;http://3.bp.blogspot.com/_rh0QblLk0C0/S6CftbGPcYI/AAAAAAAAAOw/GsDYbUeiXic/s400/75a6680a08d19b12ed51c10c3f2435c188d4eebe.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449531151835165058&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This series only converges when |&lt;i&gt;z&lt;/i&gt;| = 1 and &lt;i&gt;A&lt;/i&gt; = &lt;i&gt;B&lt;/i&gt;, but interpreted as a sum of two ordinary hypergeometric series, it can be assigned a value for arbitrary &lt;i&gt;z&lt;/i&gt; through the analytic continuation (or Borel regularization) of the ordinary hypergeometric series, which mpmath implements. Anyway, the convergent case is the interesting one. Here one obtains, for instance, &lt;a href=&quot;http://mathworld.wolfram.com/DougallsFormula.html&quot;&gt;Dougall's identity&lt;/a&gt; for 2H2:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; from mpmath import *&lt;br /&gt;&gt;&gt;&gt; mp.dps = 25; mp.pretty = True&lt;br /&gt;&gt;&gt;&gt; a,b,c,d = 0.5, 1.5, 2.25, 3.25&lt;br /&gt;&gt;&gt;&gt; bihyper([a,b],[c,d],1)&lt;br /&gt;-14.49118026212345786148847&lt;br /&gt;&gt;&gt;&gt; gammaprod([c,d,1-a,1-b,c+d-a-b-1],[c-a,d-a,c-b,d-b])&lt;br /&gt;-14.49118026212345786148847&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As an example of regularization, the divergent 1H0 series can be expressed as the sum of one 2F0 function and one 1F1 function:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; a = mpf(0.25)&lt;br /&gt;&gt;&gt;&gt; z = mpf(0.75)&lt;br /&gt;&gt;&gt;&gt; bihyper([a], [], z)&lt;br /&gt;(0.2454393389657273841385582 + 0.2454393389657273841385582j)&lt;br /&gt;&gt;&gt;&gt; hyper([a,1],[],z) + (hyper([1],[1-a],-1/z)-1)&lt;br /&gt;(0.2454393389657273841385582 + 0.2454393389657273841385582j)&lt;br /&gt;&gt;&gt;&gt; hyper([a,1],[],z) + hyper([1],[2-a],-1/z)/z/(a-1)&lt;br /&gt;(0.2454393389657273841385582 + 0.2454393389657273841385582j)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Two-dimensional series&lt;/h3&gt;&lt;br /&gt;The most common hypergeometric series of two variables, i.e. a twodimensional series whose summand is a hypergeometric expression with respect to both indices separately, is the Appell F1 function, previously available in mpmath as &lt;tt&gt;appellf1&lt;/tt&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_rh0QblLk0C0/S6Cj4Gzq-gI/AAAAAAAAAO4/FtgLLpKSFTk/s1600-h/2a732d5aa33892d5768d4c5ab48008ce0ce48ba3.png&quot;&gt;&lt;img src=&quot;http://1.bp.blogspot.com/_rh0QblLk0C0/S6Cj4Gzq-gI/AAAAAAAAAO4/FtgLLpKSFTk/s400/2a732d5aa33892d5768d4c5ab48008ce0ce48ba3.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449535733413640706&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, much more general functions are possible. There are three other Appell functions: F2, F3, F4. The &lt;a href=&quot;http://mathworld.wolfram.com/HornFunction.html&quot;&gt;Horn functions&lt;/a&gt; are 34 distinct functions of order two, containing the Appell functions as special cases. The &lt;a href=&quot;http://mathworld.wolfram.com/KampedeFerietFunction.html&quot;&gt;Kampé de Fériet function&lt;/a&gt; provides a generalization of Appell functions to arbitrary orders.&lt;br /&gt;&lt;br /&gt;The new &lt;tt&gt;hyper2d&lt;/tt&gt; function in mpmath can evaluate &lt;b&gt;all&lt;/b&gt; these named functions, and more general functions still. The trick for speed is to write the series as a nested series, where the inner series is a generalized hypergeometric series that can be evaluated efficiently with &lt;tt&gt;hyper&lt;/tt&gt;, and where the outer series has a rational recurrence formula. This rewriting also permits evaluating the analytic continuation with respect to the inner variable (as implemented by &lt;tt&gt;hyper&lt;/tt&gt;).&lt;br /&gt;&lt;br /&gt;The user specifies the format of the series in quasi-symbolic form, and the rewriting to nested form is done automatically by mpmath. For example, the Appell F1 function can be computed as&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;hyper2d({'m+n':[a], 'm':[b1], 'n':[b2]}, {'m+n':[c]}, x, y)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and indeed, this is essentially what &lt;tt&gt;appellf1&lt;/tt&gt; now does internally. The Appell F2-F4 functions have also been added explicitly as &lt;tt&gt;appellf2&lt;/tt&gt;, &lt;tt&gt;appellf3&lt;/tt&gt;, &lt;tt&gt;appellf4&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt;Hypergeometric functions of two (or more) variables have numerous applications, such as solving high-order algebraic equations, expressing various derivatives and integrals in closed form, and solving differential equations, but I have not yet found any simple examples that make good demonstrations except for F1. (I have mostly found examples of that take half a page to write down.) Any such examples for the documentation would be a welcome contribution!&lt;br /&gt;&lt;br /&gt;Some trivial examples from the documentation are:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; x, y = mpf(0.25), mpf(0.5)&lt;br /&gt;&gt;&gt;&gt; hyper2d({'m':1,'n':1}, {}, x,y)&lt;br /&gt;2.666666666666666666666667&lt;br /&gt;&gt;&gt;&gt; 1/(1-x)/(1-y)&lt;br /&gt;2.666666666666666666666667&lt;br /&gt;&gt;&gt;&gt; hyper2d({'m':[1,2],'n':[3,4]}, {'m':[5],'n':[6]}, x,y)&lt;br /&gt;4.164358531238938319669856&lt;br /&gt;&gt;&gt;&gt; hyp2f1(1,2,5,x)*hyp2f1(3,4,6,y)&lt;br /&gt;4.164358531238938319669856&lt;br /&gt;&gt;&gt;&gt; hyper2d({'m':1,'n':1},{'m+n':1},x,y)&lt;br /&gt;2.013417124712514809623881&lt;br /&gt;&gt;&gt;&gt; (exp(x)*x-exp(y)*y)/(x-y)&lt;br /&gt;2.013417124712514809623881&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;An example of a Horn function, H3:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; x, y = 0.0625, 0.125&lt;br /&gt;&gt;&gt;&gt; a,b,c = 0.5,0.75,0.625&lt;br /&gt;&gt;&gt;&gt; hyper2d({'2m+n':a,'n':b},{'m+n':c},x,y)&lt;br /&gt;1.190003093972956004227425&lt;br /&gt;&gt;&gt;&gt; nsum(lambda m,n: rf(a,2*m+n)*rf(b,n)/rf(c,m+n)*\&lt;br /&gt;...     x**m*y**n/fac(m)/fac(n), [0,inf], [0,inf])&lt;br /&gt;1.190003093972956004227425&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This also demonstrates the recently added generic support for &lt;a href=&quot;http://fredrik-j.blogspot.com/2010/02/numerical-multidimensional-infinite.html&quot;&gt;multidimensional infinite series&lt;/a&gt; in mpmath. But of course, &lt;tt&gt;nsum&lt;/tt&gt; is much slower than &lt;tt&gt;hyper2d&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Hypergeometric &lt;i&gt;q&lt;/i&gt;-series&lt;/h3&gt;&lt;br /&gt;Before introducing the &lt;i&gt;q&lt;/i&gt;-analog of the hypergeometric series, I should introduce the &lt;a href=&quot;http://en.wikipedia.org/wiki/Q-Pochhammer_symbol&quot;&gt;&lt;i&gt;q&lt;/i&gt;-Pochhammer symbol&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_rh0QblLk0C0/S6CzB6_YYbI/AAAAAAAAAPA/xEmIbtVz-7c/s1600-h/qpoch.png&quot;&gt;&lt;img src=&quot;http://2.bp.blogspot.com/_rh0QblLk0C0/S6CzB6_YYbI/AAAAAAAAAPA/xEmIbtVz-7c/s400/qpoch.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449552394714636722&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;This itself is a new function in mpmath, implemented as &lt;tt&gt;qp(a,q,n)&lt;/tt&gt; (with two- and one-argument forms &lt;tt&gt;qp(a,q)&lt;/tt&gt; and &lt;tt&gt;qp(q)&lt;/tt&gt; also permitted) and is the basis for more general computation involving &lt;a href=&quot;http://en.wikipedia.org/wiki/Q-analog&quot;&gt;q-analogs&lt;/a&gt;. The &lt;i&gt;q&lt;/i&gt;-factorial and &lt;i&gt;q&lt;/i&gt;-gamma function have also been added (as &lt;tt&gt;qfac&lt;/tt&gt; and &lt;tt&gt;qgamma&lt;/tt&gt;), but are not yet documented.&lt;br /&gt;&lt;br /&gt;The &lt;i&gt;q&lt;/i&gt;-analogs have important applications in number theory. As a very neat example, numerically computing the Taylor series of 1/(&lt;i&gt;q&lt;/i&gt;, &lt;i&gt;q&lt;/i&gt;)&lt;sub&gt;∞&lt;/sub&gt; with mpmath gives&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; taylor(lambda q: 1/qp(q), 0, 10)&lt;br /&gt;[1.0, 1.0, 2.0, 3.0, 5.0, 7.0, 11.0, 15.0, 22.0, 30.0, 42.0]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;These are the values of the &lt;a href=&quot;http://mathworld.wolfram.com/PartitionFunctionP.html&quot;&gt;partition function&lt;/a&gt; &lt;i&gt;P&lt;/i&gt;(&lt;i&gt;n&lt;/i&gt;) for &lt;i&gt;n&lt;/i&gt; = 0,1,2,..., i.e. the number of ways of writing &lt;i&gt;n&lt;/i&gt; as a sum of positive integers.&lt;br /&gt;&lt;br /&gt;Replacing the rising factorials (Pochhammer symbols) in the generalized hypergeometric series with their &lt;i&gt;q&lt;/i&gt;-analogs gives the hypergeometric &lt;i&gt;q&lt;/i&gt;-series or &lt;i&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Basic_hypergeometric_series&quot;&gt;basic hypergeometric series&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_rh0QblLk0C0/S6C2H65uubI/AAAAAAAAAPI/IciuynXeI70/s1600-h/a8efaffc0e5fe799f97388cdc4eef302ba675f3f.png&quot;&gt;&lt;img src=&quot;http://4.bp.blogspot.com/_rh0QblLk0C0/S6C2H65uubI/AAAAAAAAAPI/IciuynXeI70/s400/a8efaffc0e5fe799f97388cdc4eef302ba675f3f.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449555796305033650&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This function is implemented as &lt;tt&gt;qhyper&lt;/tt&gt;. Like &lt;tt&gt;hyper&lt;/tt&gt;, it supports arbitrary combinations of real and complex arguments (assuming |&lt;i&gt;q&lt;/i&gt;|  1). Some examples from the documentation:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; qhyper([0.5], [2.25], 0.25, 4)&lt;br /&gt;-0.1975849091263356009534385&lt;br /&gt;&gt;&gt;&gt; qhyper([0.5], [2.25], 0.25-0.25j, 4)&lt;br /&gt;(2.806330244925716649839237 + 3.568997623337943121769938j)&lt;br /&gt;&gt;&gt;&gt; qhyper([1+j], [2,3+0.5j], 0.25, 3+4j)&lt;br /&gt;(9.112885171773400017270226 - 1.272756997166375050700388j)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Like &lt;tt&gt;hyper&lt;/tt&gt;, it automatically ensures accurate evaluation for alternating series:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt;&gt;&gt; q = 0.998046875&lt;br /&gt;&gt;&gt;&gt; mp.dps=5; qhyper([2],[0.5], q, -0.5)&lt;br /&gt;6.6738e-69&lt;br /&gt;&gt;&gt;&gt; mp.dps=15; qhyper([2],[0.5], q, -0.5)&lt;br /&gt;6.67376764851253e-69&lt;br /&gt;&gt;&gt;&gt; mp.dps=25; qhyper([2],[0.5], q, -0.5)&lt;br /&gt;6.673767648512527695718826e-69&lt;br /&gt;&gt;&gt;&gt; mp.dps=100; qhyper([2],[0.5], q, -0.5)&lt;br /&gt;6.673767648512527695718826106778799352769798151218768443717704076836963752188876&lt;br /&gt;561888441662933081804e-69&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;With the &lt;i&gt;q&lt;/i&gt;-analog of the generalized hypergeometric function implemented, it becomes possible to compute &lt;i&gt;q&lt;/i&gt;-exponentials, &lt;i&gt;q&lt;/i&gt;-sines, &lt;i&gt;q&lt;/i&gt;-orthogonal polynomials, &lt;i&gt;q&lt;/i&gt;-Bessel functions, and pretty much anything else. If there is interest, such function could be added explicitly to mpmath.&lt;br /&gt;&lt;br /&gt;For more information and examples of the functions discussed in this post, see the sections on &lt;a href=&quot;http://mpmath.googlecode.com/svn/trunk/doc/build/functions/hypergeometric.html&quot;&gt;hypergeometric functions&lt;/a&gt; and &lt;a href=&quot;http://mpmath.googlecode.com/svn/trunk/doc/build/functions/qfunctions.html&quot;&gt;&lt;i&gt;q&lt;/i&gt;-functions&lt;/a&gt; (a little terse at the moment) in the mpmath documentation.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4754734402679928849-59187826230880460?l=fredrik-j.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Fredrik Johansson</name>
			<email>fredrik.johansson@gmail.com</email>
			<uri>http://fredrik-j.blogspot.com/search/label/sage</uri>
		</author>
		<source>
			<title type="html">Fredrik Johansson</title>
			<link rel="self" href="http://fredrik-j.blogspot.com/feeds/posts/default/-/sage"/>
			<id>tag:blogger.com,1999:blog-4754734402679928849</id>
			<updated>2010-03-18T03:11:49+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Shamir’s fast knapsack signature</title>
		<link href=""/>
		<id>http://amca01.wordpress.com/?p=638</id>
		<updated>2010-03-15T23:55:15+00:00</updated>
		<content type="html">This post demonstrates how the knapsack problem can be used to construct a digital signature. As with the knapsack systems themselves, it has been broken. However, it is an elegant system, and also very fast. It was designed by Shamir in 1978; our description is based on an article by Andrew Odlyzko.  It&amp;#8217;s quite [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=amca01.wordpress.com&amp;blog=3321115&amp;post=638&amp;subd=amca01&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>Alasdair McAndrew</name>
			<uri>http://amca01.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Alasdair's musings » Sage</title>
			<subtitle type="html">Life, mathematics teaching</subtitle>
			<link rel="self" href="http://amca01.wordpress.com/category/sage/feed/"/>
			<id>http://amca01.wordpress.com/category/sage/feed/</id>
			<updated>2010-03-18T12:11:15+00:00</updated>
		</source>
	</entry>

</feed>
