Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function cm($x,$y) {
- return [$x[0]*$y[0]-$x[1]*$y[1],$x[0]*$y[1]+$x[1]*$y[0]];
- }
- function inv($z) {
- return [$z[0]/(($z[0]**2)+($z[1]**2)),-$z[1]/(($z[0]**2)+($z[1]**2))];
- }
- function zetaOriginal($z = [1/2,14.1347251417]) {
- $re = 0; $im = 0;
- for ($i = 1; $i <= 100; $i++) {
- $re -= cos(pi()*$i)/($i**$z[0])*cos($z[1]*log($i));
- $im += cos(pi()*$i)/($i**$z[0])*sin($z[1]*log($i));
- }
- return cm(inv([1-((2**(1-$z[0]))*cos($z[1]*log(2))),(2**(1-$z[0]))*sin($z[1]*log(2))]),[$re,$im]);
- }
- function gamma($z) {
- $prod = cm(inv($z),[exp(-0.577215664901532866060651209*$z[0])*cos($z[1]),exp(-0.577*$z[0])*sin($z[1])]);
- for ($i = 1; $i <= abs($z[1])*10+1000; $i++) {
- $prod = cm($prod,[exp($z[0]/$i)*cos($z[1]),exp($z[0]/$i)*sin($z[1])]);
- $prod = cm($prod,inv([1+$z[0]/$i,$z[1]/$i]));
- }
- return $prod;
- }
- function oneminus($z) {
- return [1-$z[0],-$z[1]];
- }
- function zeta($z = [1/2,14.1347251417]) {
- if ($z[0] >= 1/2) {
- return zetaOriginal($z);
- } else {
- return cm(
- cm (
- cm(
- [2**$z[0]*cos($z[1]*log(2)),2**$z[0]*sin($z[1]*log(2))],
- [pi()**($z[0]-1)*cos($z[1]*log(pi())),pi()**($z[0]-1)*sin($z[1]*log(pi()))]
- ),
- cm (
- [sin(pi()*$z[0]/2)*cosh(pi()*$z[1]/2), cos(pi()*$z[0]/2)*sinh(pi()*$z[1]/2)],
- gamma([1-$z[0],-$z[1]])
- )
- ),
- zetaOriginal([1-$z[0],-$z[1]])
- );
- }
- }
- function value($z) {
- return sqrt($z[0]**2 + $z[1]**2);
- }
- //plot:
- /*$delta = 0.1;
- $str = "<body bgcolor='black'>\n";
- for ($i = -4; $i <= 5; $i += $delta) {
- for ($j = -25; $j <= 25; $j += 1/2) {
- $val = 1/(1+value(zeta([$i,$j])));
- $val255 = 255*$val;
- $str .= "<div val='".(-log($val))."' s='$i' t='$j' style='position: absolute; font-size: 25px; left: ".($i*20+20*5)."px; top: ".($j*4+4*25-10)."px; color: rgba($val255,$val255,$val255,$val)'>.</div>\n";
- }
- }
- file_put_contents("plot.html",$str);
- print "Done !";
- echo `pause>nul`;*/
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement