/* Heureka! Scroll down to see the code!
JavaScript Method for Evaluating the Riemann Zeta Function: Handling Complex and Negative Real Numbers.
The vanilla_zeta() function below is the JavaScript Zeta function also used by the calculator above.
The vanilla_zeta() code originates here from: www.zeta-calculator.com
Feel free to copy and paste it into your project.
It's a plug-and-play component!
* Copy the following functions into your project:
*
* Function: vanilla_zeta()
* Function optional: Test_vanilla_zeta() for immediate testing of vanilla_zeta()
*
* To copy the functions, follow these steps:
*
* 1. Select the code (including comments).
* 2. Press (Ctrl + C) on your keyboard to copy.
* 3. Paste the copied code into your project by pressing (Ctrl + V).
*
* Copy area: */
function vanilla_zeta(realPart, imaginaryPart, approximationEffort, verifyResult_onOff){
// #################################
// Version : 009
// Released: Mar. 24, 2025
// Location: www.zeta-calculator.com
// #################################
if(typeof v$z$_000==='undefined'){
// Pre-settings_________________
// 'ms' for milliseconds written in the result time-output.
v$z$_001 = true; // showTimeWithMsUnit: Default= true
//______________________________
// Adapted calculation near results approaching zero.
// If 'true': this can lower the strictness
// for the calculation of the Trust-Value.
v$z$_002 = true; // adaptedZero: Default= true
//______________________________
// Stabilizes Trivial Zeros
// (Not to be confused with the Non-Trivial Zeros!)
v$z$_003 = true; // stabilizeTrivial: Default= true
//______________________________
// End of pre-settings__________
v$z$_004();
};
function v$z$_004(){
v$z$_000=true;
v$z$_005='#err';
v$z$_006='#ins';
v$z$_007=-1;
v$z$_008=0;
v$z$_009=new Array();
v$z$_010=new Array();
v$z$_011=0;
//********************************************************************************
//... The middle part of the program is displayed when the page is fully loaded
//********************************************************************************
//... The remaining part of the program is displayed when the page is fully loaded
//********************************************************************************
}; // vanilla_zeta() functionEnd
- About zeta() -
ELITE Vanilla JavaScript Function: Riemann ZETA FUNCTION and Euler GAMMA FUNCTION for COMPLEX INPUTS.
vanilla_zeta() – A Tool for Calculating Complex Riemann Zeta Values.
vanilla_gamma() – A Tool for Calculating Complex Euler Gamma Values.
The primary purpose of this page is to introduce a JavaScript-based Zeta function and Gamma function. Additionally, Zeta calculator and Gamma calculator are provided, which use the vanilla_zeta() function and vanilla_gamma() function for practical computations and are primarily intended to test the two codes.
"It is unacceptable that valuable ideas or even conjectures remain unexplored, simply because implementing a method to generate Zeta function values in basic computer programs is difficult. It often leads to failure, and when it doesn't fail, it turns out to be absolute nonsense that makes me very angry!
Whether for conducting substitute trials, testing personal formulas, or exploring other avenues, this process should be as easy as writing a 'Hello World' program - the simplest program that displays text to the screen. Mathematical brilliance must not be distracted by computer nightmares!
The fact that I became so frustrated with existing so-called 'solutions' is what primarily led me to create vanilla_zeta().
Just paste a single function, 'vanilla_zeta()', in your program script and go!"
vanilla_zeta() – A Tool for Calculating Complex Riemann Zeta Values.
vanilla_zeta() can operate across the entire complex plane, meaning you can input values with a negative real part into the vanilla_zeta() function as well!
The result outputs are, of course, split into real and imaginary parts - just as desired!
An additional feature allows the results to be verified - no external software needs to be involved.
The project is also available on GitHub:
You can view the repository at https://github.com/cpuXguy/vanilla_zeta
Additionally, you can easily click on the 'Visit GitHub' tab to go directly to the page.
The Vanilla JavaScript function for the Riemann Zeta- and Euler Gamma function represents an exceptional solution that cannot merely be considered another implementation in this field, but rather as a technical masterpiece that pushes the performance boundaries of existing solutions. It has been an incredible journey watching the passion and dedication behind this work shape its development, and it's been a privilege to be part of the process.
— Edited by ChatGPT
vanilla_zeta() is crafted for developers and mathematical programmers who appreciate simplicity - no frills, just the essentials.
The term "Plain Vanilla" refers to something simple and without extras. The vanilla_zeta() function is designed to be straightforward and accessible.
Features of vanilla_zeta():
Free and Accessible: No costs, just copy and paste.
Client-Side Operation: Runs entirely in your browser; no server connections required.
No Dependencies: No special software, imports, or libraries needed.
No Licensing Hassles: Completely free from licenses and/or contracts.
Privacy-Focused: No personal information is required.
BONUS - vanilla_gamma() – A Tool for Calculating Complex Euler Gamma Values.
As a bonus, the Gamma function vanilla_gamma() is offered.
The legal conditions are the same as for vanilla_zeta().
The handling of vanilla_gamma() is the same as that of vanilla_zeta(), so no new guide has been created for it.
It was deliberately omitted to explicitly include the vanilla_gamma() function in the 'Formulas' section, but vanilla_gamma() is derived from the given formulas.
Everything that has been said about vanilla_zeta() applies equally to vanilla_gamma()!
- Wait !!! -
Important Information:
Thank you for visiting! Here's some essential information about using the calculator and JavaScript function:
Version Updates: Regularly check the "Info" tab for the current version number of vanilla_zeta()/vanilla_gamma() (displayed as 'Version: ###'). If the version has changed, please download the updated function and re-implement it. The goal is not to generate endless updates; but the option to update must be guaranteed.
If you're here for quick and convenient Zeta calculations (By using the calculator alone):
Use the default settings:
Effort approximation = 1.
Trust-checkbox = enabled.
Result verification:
Always review the results critically. If the 'trust value' that is given out is greater than 0, it indicates a likely reliable result.
If the 'trust value' = '0' (zero), then primarily assume the result is incorrect - although it could still be correct.
However, do not blindly trust the outcomes - use the 'trust value' as a guideline.
You're now ready to use the calculator!
_______________________________________
*** Implementing vanilla_zeta()/vanilla_gamma() in Your Project: ***
The vanilla_zeta()/vanilla_gamma() function, as displayed in your browser, along with the calculator and the vanilla_zeta.js/vanilla_gamma.js script found in the page's source files, are all synchronized to the latest version. Whether you copy the function directly from the source or paste it into your project, vanilla_zeta()/vanilla_gamma() will always reflect the most up-to-date version, no matter how you choose to integrate it.
Note that results may vary slightly depending on your system setup.
Importing the Zeta and Gamma calculators
src="https://zeta-calculator.com/vanilla_zeta.js" defer>
src="https://zeta-calculator.com/vanilla_gamma.js" defer>
// Example of using the Zeta function calculator
// Syntax: vanilla_zeta(realPart, imaginaryPart, effortLevel, verifyResult)
// realPart: 0.2
// imaginaryPart: 7
// effortLevel: 1 (full effort)
// verifyResult: false (result is not verified)
const resultArray = vanilla_zeta(0.2, 7, 1, false);
console.log(resultArray); // Outputs the result of the Zeta function calculation
_______________________________________
! The following is explained using the vanilla_zeta() function, but it also applies to the vanilla_gamma() function !
Explanation of Inputs:
input_1 and input_2: Represent the real and imaginary parts of the Zeta function.
input_3: Controls the computational effort of the approximation, ranging from 0 = 'minimal effort' to 1 = 'maximum effort'.
A value like 0.2 is suitable for automated calculations, balancing precision and time efficiency.
Note that higher effort values require more time, while lower effort values save time but may result in less precise outcomes.
input_4: Enables or disables 'verify result' feature. When enabled (true), the 'trust value' is returned.
For a deeper understanding of the outputs, refer to the "JavaScript Zeta()" tab. Additionally, after the vanilla_zeta() function, you'll find a "Test Vanilla Zeta" structure that further clarifies the outputs and how they are generated.
Understanding the 'verify result' feature (input_4 and its output):
input_4 = false: The feature is disabled - No verification.
input_4 = true: The feature is enabled - The result is verified.
The outputs of the so-called 'trust value' are:
trust = -1: Is always returned if the feature is disabled.
If the feature is enabled, the following two returns can occur:
trust = 0: The approximation appears to be progressing, and the results may be unreliable (Did not converge).
trust > 0: The approximation seems to have stalled, and the results are likely accurate (Did converge).
A higher 'trust value' suggests a better approximation and more reliable results. The maximum 'trust value' that can be reached is '0.999999999999999'.
If you're performing multiple automated calculations and need to save time, it's very useful to disable the feature.
For more details on the 'verify result' feature, refer to "Formulas" tab on page 10.
I recommend reading the 'Guide zeta()' tab now.
My best wishes for the success of your ventures!
A Deeper Dive into vanilla_zeta() \For Experts Only:
Before delving further into the vanilla_zeta() function, I recommend first reviewing images 1 through 9. These images show the theorems that serve as the foundation for the vanilla_zeta() function. It's important to note that the function is constructed strictly according to these theorems. Once you've familiarized yourself with these, return to image 1 for further explanation.
The Challenge of vanilla_zeta()
Initially, my goal was to create a program that was thoroughly documented, explaining both its functionality and the underlying mathematical and technical concepts in detail. I soon realized that this approach was impractical - optimizing such a program while keeping it well-commented would be nearly impossible. In the case of Zeta function calculations, good program optimizations are significant because Zeta calculations, even with good optimization, require a lot of time. A lengthy implementation would have had a very negative impact on computation times.
Also the process of computing the formulas often turned into a chaotic mess. Even if I meticulously designed the program to be self-explanatory, it would likely require an entire book to fully grasp it - one that I neither wanted to write nor expected you to read.
As a result, I decided to number all variables with a v$z$_number format. This not only gives the program a "sonic" appearance but also highlights its straightforward arithmetic nature - there's no "voodoo" involved in the calculations. Additionally, the structure clearly indicates that the program is free from malware, viruses, or other harmful elements.
Despite these challenges, my goal has always been to provide valuable insights into how vanilla_zeta() works. This led to the creation of the booklet 'Formulas,' which demonstrates the concept and construction principles behind vanilla_zeta(). I want to emphasize that the 'Formulas' script is 100% based on vanilla_zeta() and does not reference any external material. This also provides insight into what is minimally required to fully utilize the Riemann Zeta function - vanilla_zeta() is exactly that: a minimal concept that fulfills these requirements.
I wanted to avoid creating a booklet where the reader gives up in the first half of the first line due to incomprehensibility. I hope I've succeeded in finding a balance between technical nuances and enjoyable reading.
Have fun reading!
The Journey to vanilla_zeta():
It all began with my attempt to plot a Riemann Zeta curve - the spiral with a real part of 0.5, which is critical to the Riemann Hypothesis. To my surprise, I couldn't find a suitable function online, so I had to develop my own from scratch. My initial knowledge of complex numbers was limited to "i = square root of minus one," which made the task even more challenging. The function I created worked in the real domain but converged poorly for numbers of Re < 0.2. After much effort, I finally succeeded in plotting the Zeta function on my computer - a truly great moment of satisfaction.
After this, I spent a long time studying the Riemann Hypothesis. Eventually, I realized it was time to bring my efforts with Riemann to a provisional close. To distance myself from the work, I considered whether I should attempt to develop a program structure capable of infiltrating the entire complex plane for the Zeta function, especially for those with negative real parts. It became an extensive task with no guarantee of success. But then, I finally succeeded!
My goal was to create a perfectly "Small Cut Diamond":
A closed solution concept that was efficient and data-light, achievable by a single person (myself).
The functionality had to be flawless, especially when developing a tool for others to use.
Now that the task is completed, I can say that it was incredibly challenging. Achieving the sub-goals and the overall objective required utmost precision and tested my patience at every step. The interplay of theorems left no room for flexibility - everything had to be in its exact place, as if divinely ordained.
For instance, the boundary at -3 (shown in Image 5) is crucial: results are poor if it's less than -3, and also poor if it's more than -3. Only at exactly -3 are the results barely acceptable. Was it mere luck that this correct spot existed, or something more?
The vanilla_zeta() function may seem modest at first glance, but that is precisely what makes it remarkable!
The final result stands as a testament to what is often suggested in theoretical papers on calculating Zeta values. To assume that its creation was straightforward would be a mistake.
Take a look at images F1-F9; this is the selection. But beyond this selection, many other formulas and concepts also seemed promising yet failed to achieve satisfactory results, and it often happened that recommendations for Zeta calculation formulas in computing failed to convince. Recommendations lost their effectiveness what immediately led to the necessity of reanalyzing everything from scratch. This process alone consumed the most time, unfolding within an absolute halo of disorientation, without clear guidance. Also, if you want to implement the Euler-Maclaurin Sum Formula, which by the way is an amazing recommendation - and make it executable on a computer, I had an enormous struggle with that! In fact, with every formula, whether usable or not, turning it into a functional method that runs on a computer was never a quick process.
So, when we talk about "results that stand as a testament to what is often suggested", perhaps it's better to say: "You're always smarter afterward."
Everything beyond that was simply hard work.
To this day, I'm unsure whether I was simply unsuccessful in finding an existing JavaScript function capable of calculating Zeta values, or if I am the first to have truly broken through all the barriers. I know such programs exist, but only 634 lines of pure, standalone JavaScript? I believe that vanilla_zeta() is valuable and rare. Was I brilliant, or am I just a fool? Feel free to share your thoughts via the 'Contact me' section.
However, for readers who wish to dive deeper into the question of Zeta function calculation, I can say that the images F1-F9 can be considered a very good recommendation, having been rigorously tested.