New answers tagged

5

There is no need for numerical computation here. First, $T(q)$ is a well-known function, the logarithmic integral. Repeated integration by parts gives an asymptotic expansion $$\mathrm{Li}(q) = \frac{q}{\log q}\sum_{k=0}^{K-1} \frac{k!}{\log^k q} + O\left(\frac{q}{\log^{K+1}q}\right).$$ There's also a fairly rapidly convergent representation due to ...


0

I think this question needs more details, but couldn't you just use gauss-divergence theorem to move the gradient inside the integral and transform the volume integral to a surface integral. Maybe you can use a least squares approach to get the gradient in each cell?


5

The accepted answer provides an overview. I'll add a few more details about support in NVIDIA processors. The support I'm describing here is 16 bit, IEEE 754 compliant, floating point arithmetic support, including add, multiply, multiply-add, and conversions to/from other formats. Maxwell (circa 2015) The earliest IEEE 754 FP16 ("binary16" or "half ...


4

You can find out if your hardware supports half-precision via: $ lscpu | grep Flags | grep f16c Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf ...


18

Intel support for IEEE float16 storage format Intel supports IEEE half as a storage type in processors since Ivy Bridge (2013). Storage type means you can get a memory/cache capacity/bandwidth advantage but the compute is done with single precision after converting to and from the IEEE half precision format. https://software.intel.com/content/www/us/en/...


6

In my opinion, not very uniformly. Low precision arithmetic seems to have gained some traction in machine learning, but there's varying definitions for what people mean by low precision. There's the IEEE-754 half (10 bit mantissa, 5 bit exponent, 1 bit sign) but also bfloat16 (7 bit mantissa, 8 bit exponent, 1 bit sign) which favors dynamic range over ...


0

If the constants are positive then $y$ is positive and setting $u=y^2$ you get $$u'=2A\sqrt{B\sqrt{|u|}+C}$$ which is a little more regular and allows the initial value $u(0)=0$ without singularity. This equation is still stiff close to the initial point, which should have consequences for the local error with fixed-step RK4 as long as $u$ is close to zero. ...


1

The integration curves have the overall form as shown in the figure below, they have vertical asymptotes at $y=0$, which certainly creates difficulties for a numerical solver integrating from $y=0$ (x does not matter). This does not necessarily mean the problem is ill posed; that would be the case if the integration curves diverge rapidly as the initial ...


1

Your problem is not well posed. Multiply both sides by $|y|$ to obtain the ODE in the form $$ |y(x)| y'(x) = A \sqrt{By(x)+C}. $$ If your initial condition is $y(0)=0$, then at the initial time you have $$ 0 y'(0) = A\sqrt{C}. $$ This means that if $A\sqrt{C}\neq 0$, no value of $y'(0)$ can satisfy the equation. In other words, your problem is not that ...


4

You write $S(q)$ and $T(q)$ as integrals, but it is easier to think of them as solutions of ODEs: $$ S'(q) = \sin^2\left(\frac{π\Gamma(q)}{2q}\right) $$ with initial conditions $$ S(2) = 0, $$ and similarly for $T(q)$. You can then use any of the common ODE integrators in matlab, mathematica, maple, ..., to solve and plot the solutions so that you can ...


0

I can recommend standard test for Cahn-Hilliard code for Python on https://fenicsproject.org/olddocs/dolfin/1.3.0/python/demo/documented/cahn-hilliard/python/documentation.html# and for Mathematica on https://mathematica.stackexchange.com/questions/202446/solving-cahn-hilliard-equation-linearsolve-linear-equation-encountered-that-ha/202503#202503 ...


3

The only chance you stand to deal with this problem from a numerical perspective is oscillatory integration methods. Filon/Levin-type methods can sometimes handle problems like this, particularly when they are of $\sin$ or $\cos$ type, though the $\Gamma$ function and its run-away growth may be prohibitive for the $q$ you are hoping for. In any case, I was ...


2

There's a closed form solution. For $a,b,c,d,x_0 > 0$, $$ \int_{x_0}^\infty \frac{dx}{x\sqrt{(a+bx)(c+dx)}} = \\ \frac{\log(2 \sqrt{b d (a + b/x_0) (c + d/x_0)} + a d + b c + 2 b d/x_0) - \log(2 \sqrt{b d a c} + a d + b c)}{\sqrt{b d}} $$ a <- 1 b <- 644.153 c <- 4.17e-5 d <- 0.145 x <- 1/1095 (log(2*sqrt(b*d*(a+b*x)*(c+d*x)) + a*d + b*c + ...


1

I think that you don't need a change of variable (yourself) for this problem. Quadpack seems to work just fine for it. It uses a Gauss-Kronrod quadrature. I tried it (in Python) and it seems to work. import numpy as np from scipy.integrate import quad fun = lambda x: 1/(x*np.sqrt((x + 644.153)*(4.15e-5*x + 0.145))) inte, err = quad(fun, 1095, np.inf) ...


4

You are almost there, just put $t$ under the square root, and it will become $ \displaystyle\int_0^{1/1095} {\frac{dt}{\sqrt{(1+644.153t)(4.17 \cdot 10^{-5} + 0.145 t)}}}, $ which eliminates the singularity at $t=0$


9

Up until a couple of decades ago, science was based on two large pillars. Those were theory and actual physical experiments. It is an exciting time to see a third pillar arise with numerical simulations. In between pure theory and expensive real-world experiments, we can now run simulations! When it comes to these simulations, you may observe two types of ...


0

Inspired from this Computational Science SE post: Transform your problem from one with inhomogeneous BC to homogeneous BC. This is done by substracting any function $B(x,t)$ with the right inhomogeneous BC from $u(x,t)$ to create a new function $h(x,t) = u(x,t) - B(x,t)$. For instance, take $B(x,t) = \frac{2v(t)\sin(\pi x/2)}{\pi}$. Your problem becomes $\...


2

That's not a valid system of PDEs. In particular, the equation $$ \nabla n = n\mathbf E $$ implies that you can find a function $n$ whose gradient equals a given vector field (n\mathbf E), but that's not possible for arbitrary vector fields. To see this, apply the curl to both sides: $$ \nabla \times \nabla u = \nabla\times (n\mathbf E) $$ and remember ...


Top 50 recent answers are included