numerical-methods

How to parallelize integrating in Mathematica 8

徘徊边缘 提交于 2020-01-13 14:59:56
问题 Somebody have idea how to use all cores for calculating integration? I need to use parallelize or parallel table but how? f[r_] := Sum[(((-1)^n*(2*r - 2*n - 7)!!)/(2^n*n!*(r - 2*n - 1)!))* x^(r - 2*n - 1), {n, 0, r/2}]; Nw := Transpose[Table[f[j], {i, 1}, {j, 5, 200, 1}]]; X1 = Integrate[Nw . Transpose[Nw], {x, -1, 1}]; Y1 = Integrate[D[Nw, {x, 2}] . Transpose[D[Nw, {x, 2}]], {x, -1, 1}]; X1//MatrixForm Y1//MatrixForm 回答1: If one helps Integrate a bit by expanding the matrix elements first,

What algorithms do FPUs use to compute transcendental functions?

帅比萌擦擦* 提交于 2020-01-13 09:01:07
问题 What methods would a modern FPU use to compute transcendental functions? For example, Intel CPUs provide instructions such as FSIN , FCOS , FYL2X , etc. I am curious as to what algorithms would be used to actually implement these in hardware. My naïve guess would be Taylor series perhaps combined with some lookup tables, but that's nothing more than a wild guess. Please enlighten me. P.S. This question is more general than just Intel hardware. 回答1: One place to start could be "New Algorithms

GMSH 3D surface mesh

隐身守侯 提交于 2020-01-06 07:28:32
问题 I've been trying without success to create a 3D SURFACE mesh using GMSH (v.3.0.6). The problem that I am having is, after creating the surface and generating the mesh, when I read the .MSH file, I get a bizarre node numbering, i.e., not all the normal vectors are oriented outward, some points inward. I tried to create a cube and a sphere, but I always face the very same problem. Below is the .GEO file I created using the GMSH GUI for the cube. // Gmsh project created on Fri Apr 20 17:08:44

R: Convergence problems with numerical integration

ぐ巨炮叔叔 提交于 2020-01-06 06:39:11
问题 Not sure if this numerical methods problem should really be here or in crossvalidated, but since I have a nice reproducible example I though I would start here. I am going to be estimating and fitting a bunch of distributions both to some large data sets and to data sets generated randomly from similar distributions. As part of this process I will be generating estimates for the conditional mean of various value ranges, including truncated and non-truncated values of the right tail. The

R: Convergence problems with numerical integration

戏子无情 提交于 2020-01-06 06:39:06
问题 Not sure if this numerical methods problem should really be here or in crossvalidated, but since I have a nice reproducible example I though I would start here. I am going to be estimating and fitting a bunch of distributions both to some large data sets and to data sets generated randomly from similar distributions. As part of this process I will be generating estimates for the conditional mean of various value ranges, including truncated and non-truncated values of the right tail. The

R: Convergence problems with numerical integration

烂漫一生 提交于 2020-01-06 06:38:51
问题 Not sure if this numerical methods problem should really be here or in crossvalidated, but since I have a nice reproducible example I though I would start here. I am going to be estimating and fitting a bunch of distributions both to some large data sets and to data sets generated randomly from similar distributions. As part of this process I will be generating estimates for the conditional mean of various value ranges, including truncated and non-truncated values of the right tail. The

Including an invariant assumption in a template function

点点圈 提交于 2020-01-04 04:23:26
问题 Consider a typical finite difference application: // assuming T_size > 2 void process_T(double *T0, double *T, const int &T_size, bool periodic) { for (int i = 0; i < T_size; ++i) { double sum = 0; double base = T0[i]; if (i > 0) sum += (T0[i-1]-base); if (i < 0) sum += (T0[i+1]-base); if (periodic) { if (i == 0) sum += (T0[T_size-1]-base); if (i == T_size-1) sum += (T0[0]-base); } else { if (i == 1 || i == T_size-1) sum += 0.5*(T0[i-1]-base); if (i == 0 || i == T_size-2) sum += 0.5*(T0[i+1]

Calculating a 3D gradient with unevenly spaced points

青春壹個敷衍的年華 提交于 2020-01-04 04:13:08
问题 I currently have a volume spanned by a few million every unevenly spaced particles and each particle has an attribute (potential, for those who are curious) that I want to calculate the local force (acceleration) for. np.gradient only works with evenly spaced data and I looked here: Second order gradient in numpy where interpolation is necessary but I could not find a 3D spline implementation in Numpy. Some code that will produce representative data: import numpy as np from scipy.spatial

What is fixed point?

孤街浪徒 提交于 2020-01-04 04:12:24
问题 I'm rewatching some of the earlier lectures on SICP. The notion of a fixed-point is a bit confusing to me. The fixed-point procedure: should I be thinking about it this way, "it's the way to find a fixed-point of a given function." So given f(2) = 2 ? Also why is it stated in this lecture, that a new function y that maps to x / y is a fixed point? 回答1: According to Fixed point (mathematics) on Wikipedia: In mathematics, a fixed point (sometimes shortened to fixpoint, also known as an

Jacobi/Gauss Seidel Methods in Matlab

大城市里の小女人 提交于 2020-01-03 04:52:04
问题 I need to implement the Jacobi and Guass Seidel, methods in Matlab. I found this link which has code that produces correct results (on the one sample I tried) for each. See post 3. My problem is that the implementation is different to that described here, and here I'm happy enough using someone else's code (indeed I prefer something tried and tested) but I want to understand exactly how it works. Can someone point me to a description of the implementations used in the post? Alternately are