Skip to main content
Filter by
Sorted by
Tagged with
5 votes
2 answers
279 views

I have this code in C++: #include <iostream> #include <iomanip> #include <limits> #include <boost/multiprecision/mpfr.hpp> using namespace boost::multiprecision; template<...
Stasiu222's user avatar
0 votes
0 answers
38 views

Can I define my own lazy mpmath constants, just like mpmath.pi and the others documented here? In other words, can I define a constant whose value is an mpf or mpc computed (or retrieved from memo ...
Don Hatch's user avatar
  • 5,604
0 votes
1 answer
84 views

I am working on a project and I would like to make sure I use Legendre function correctly. I've made a simple comparison between mpmath and Mathematica and the results are different: For mpmath in ...
user avatar
0 votes
0 answers
32 views

I'm working on a python program that uses mpmath to implement the Chunovsky algorithm for computing pi. I want to make my program log its progress to a file on regular intervals, so that I can ...
ulsbai's user avatar
  • 1
1 vote
1 answer
68 views

I'm using the mpmath plot function (which simply uses pyplot, as far as I understood). Consider the following code: from math import cos, sin import mpmath as mp mp.plot([sin, cos], [0, 3]) # this is ...
NYG's user avatar
  • 1,807
0 votes
0 answers
125 views

I've got a differential equation which I have solved exactly in terms of Jacobi elliptic functions. Now I'd like to efficiently evaluate the (exact) solution numerically for the sake of plotting and ...
miggle's user avatar
  • 101
2 votes
1 answer
92 views

I'd like to extend mpmath's (https://mpmath.org/) number type mpf in my own class, but it does not seem to be possible to use it as a base class in the usual way. With import mpmath class A(mpmath.mpf)...
tr7r's user avatar
  • 21
0 votes
3 answers
702 views

a=str(141528231211101319151414.0) print(a) # 1.4152823121110133e+23 This string was printed with scientific notation. I do not understand why. I am using mpmath to deal with arithmetic operations ...
user409's user avatar
  • 125
0 votes
0 answers
78 views

I first did a numerical calculation with numpy and the result was correct, but due to insufficient precision, it could lead to errors. So I used mpmath for the calculation instead, but I found that ...
Yu-Qi Lei's user avatar
1 vote
1 answer
643 views

I recently came to an issue which requires using the complete elliptical integral of the third kind. It was written as a single fuction in the form of PI(m,n). Honestly I am not familiar with this ...
user avatar
0 votes
0 answers
536 views

I am trying to fit (using scipy.optimize.curve_fit) using mpmath.polylog. For this I have defined the following function def Vendik(x, C, T0, eps_cst, Td, xsi): integral = (np.pi**2)/6. + (Td/x) * ...
Jep's user avatar
  • 59
0 votes
0 answers
127 views

I'm working on a numerical evaluation using the sympy evalf() package. Consider the mpmath library's introduction to precision and accuracy https://mpmath.org/doc/current/technical.html, where on ...
ShoutOutAndCalculate's user avatar
1 vote
1 answer
207 views

I did an evaluation of mpmath and sympy and found inconsistencies, which I cannot resolve. I believe mpmath gives correct results. Please, can somebody help in resolving this? import sympy as sp ...
Samson's user avatar
  • 123
0 votes
1 answer
131 views

This post is not a repost, which is related solely to mpmath. But this is mainly related to the comparison between different dot product algorithms. I have coded an accurate dot product in python in ...
WhatsupAndThanks's user avatar
0 votes
1 answer
33 views

In the documentation of mpmath library page 8 it mentioned that There is no restriction on the magnitude of numbers >>> print(mpf(2)**32582657 - 1) 1.24575026015369e+9808357 and I checked ...
ShoutOutAndCalculate's user avatar
0 votes
1 answer
156 views

I am using SymPy to generate some functions requiring the evaluation of Fresnel integrals and would like to save them to disk. When I sm.lambdify the expressions using the default ["scipy", &...
SebAndSeb's user avatar
-1 votes
1 answer
476 views

I'm working with a complex function whose coordinate is omega. I formed it as follows: from sympy import * def alpha(n, rho, l): return n**2 + (2*rho + 2)*n + 2*rho + 1 def beta(n, rho, l): ...
Ramos's user avatar
  • 9
0 votes
1 answer
73 views

How can I cast np.longdouble to mpmath.mpf? import numpy as np import mpmath b = np.longdouble(1.0) a = mpmath.mpf(b) print (a)
Jakub's user avatar
  • 1
1 vote
1 answer
171 views

I have a density function (from quantum mechanics calculations) to be multiplied with the spherical Bessel function with a momentum grid (momentum q 1d array, real space distance r 1d array, so need ...
Zezhong Zhang's user avatar
0 votes
0 answers
222 views

I'm trying to lower the error of my floating point calculation, to this end I wanted to use python mpmath to utilize the arbitrary precision of the library. But I notice that it is much slower than ...
Nitaa a's user avatar
  • 143
1 vote
1 answer
234 views

Given a parabola, $f(x)=10(x-1)^2-1,x\in \Omega =[1,2]$, find the best approximation in the space of all linear functions. The Python code is as follows: import sympy as sym import numpy as np import ...
lianghe's user avatar
  • 55
0 votes
1 answer
94 views

I'm working on this code that requires the use of elliptic integrals to solve an equation as a function of time. Most of the code is pretty straight forward but it runs into an error on the final ...
sorabella91's user avatar
2 votes
1 answer
897 views

I am working on a project related to gravitational lensing, for which I need to evaluate the confluent hypergeometric function 1F1(a,b,z) for an array z of length ~ 10^8 complex points, a = 1+0.48j ...
AstroNerd's user avatar
0 votes
0 answers
158 views

I am coding a newmark beta numerical dynamic equation solver but I got this error: d:\university\payan nameh\cssr python codes\newmarkbeta_method.py:46: RuntimeWarning: overflow encountered in ...
AMKH's user avatar
  • 1
2 votes
1 answer
555 views

I am integrating a function to implement the functions in this paper and I observe different outputs from scipy.integrate.quad and mpmath.quad as per the following: import mpmath as mp from scipy ...
Anil's user avatar
  • 1,459