Linked Questions

159 votes
9 answers
16k views

General strategies to write big code in Mathematica?

I think after six months of exposure to Mathematica and the Wolfram Language I am fairly OK with writing short codes and snippets. However, what are some general strategies to use in order to write ...
Ali Hashmi's user avatar
  • 9,060
52 votes
9 answers
14k views

About multi-root search in Mathematica for transcendental equations

I have some questions for multiroot search for transcendental equations. Is there any clever solution to find all the roots for a transcendental equation in a specific range? Perhaps ...
yulinlinyu's user avatar
  • 4,855
38 votes
2 answers
6k views

Determining which rule NIntegrate selects automatically

I need to numerically integrate a highly oscillatory function over the semi-infinite domain $(0,\infty)$: $$\int_0^\infty \frac{\sin^2(x) \sin^2(1000 x)}{x^{5/2}}\mathrm dx$$ Since the Levin rule (...
user7885's user avatar
  • 381
11 votes
6 answers
840 views

How to calculate this integral with highly oscillating integrand?

I mean $$\int_ 0^{2\pi}\frac {\sin (10050 t)\sin (10251 t)\cos (2022 t)} {\sin (50 t)\sin (51 t)} dt.$$ Here is my unsuccessful trial: ...
user64494's user avatar
  • 29.1k
14 votes
2 answers
3k views

Monte Carlo integration with random numbers generated from a Gaussian distribution

I want to do numerical integration of some functions using the Monte Carlo method. The default setting for the Monte Carlo method is to use a uniform distribution as far as I know. How can I change ...
Veteran's user avatar
  • 449
21 votes
1 answer
509 views

How to implement custom NIntegrate integration strategies?

How can new integration strategies algorithms be used with NIntegrate? This is a different type of extension than the extensions with new integration rules, as ...
Anton Antonov's user avatar
13 votes
1 answer
870 views

How to calculate the numerical integral more efficiently?

Rencently, I ecountered the following numerical intergral: $$ \begin{cases} \mathbf I_1=\displaystyle \int_{t}\mathbf N' {\mathbf N'}^{\text T}{\rm d}t\\ \mathbf I_2=\displaystyle \int_{t}\mathbf N'' {...
xyz's user avatar
  • 655
9 votes
4 answers
428 views

How to avoid repetitive calculation when doing numerical integral?

Suppose I have a function f[x] which is very complicated, together with a function g[f[x]]+h[x] to integrate. That is: ...
an offer can't refuse's user avatar
7 votes
2 answers
339 views

NIntegrate of a vector-valued InterpolatingFunction gives "not numerical"

If I construct a vector-valued InterpolatingFunction, say with f = Interpolation[{{0, {1,1}}, {1, {0,0}}, {2, {0,1}}, {3, {1,0}}}] plotting the result works just ...
Lyle Ramshaw's user avatar
4 votes
2 answers
267 views

Why do I get number with Precision larger than error estimate?

I'm trying to integrate a large function like this ...
Ruslan's user avatar
  • 7,182
4 votes
2 answers
2k views

Numerical Integration Via Adaptive Simpson's Method

I have written a code that uses the Adaptive Simpson's method to approximate integration. For those who are unaware of this Adaptive Simpson's method; Adaptive Simpson's method In my code, I count ...
larry's user avatar
  • 43
3 votes
1 answer
461 views

Understanding difference between `NIntegrate` result and home-cooked Simpson's rule

In this question I am asking about the different results I get between NIntegrate-ing a function of two variables vs. "doing it myself" with my own implementation ...
Marius Ladegård Meyer's user avatar
0 votes
4 answers
278 views

Choosing points of integration in NIntegrate (integrating a function given by a list without interpolation)

When using NIntegrate, say in two-dimensions, is it possible to specify the points of the grid Mathematica will use? For example, if the integrand was a function <...
user135626's user avatar
1 vote
0 answers
155 views

How do I write an integral solver [closed]

How would you write a code that solves $\int Sin(y)dy$ (integral is from 0 to x)? The method it uses for solving doesn't really matter, although my go-to would be the Riemann sum. I need the code to ...
Miko's user avatar
  • 11
1 vote
1 answer
64 views

Can I configure a guaranteed precision for NIntegrate on a monotone function?

I know there are some great posts already about why PrecisionGoal->n doesn't guarantee the result of NIntegrate will actually ...
WillG's user avatar
  • 1,061

15 30 50 per page