Linked Questions

130
votes
9answers
11k 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 ...
44
votes
8answers
10k 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 ...
32
votes
2answers
4k 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 (...
10
votes
2answers
2k 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 ...
19
votes
1answer
365 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 ...
9
votes
4answers
315 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: ...
13
votes
1answer
677 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'' {...
4
votes
2answers
148 views

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

I'm trying to integrate a large function like this ...
3
votes
2answers
1k 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 ...
6
votes
2answers
156 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 ...
3
votes
1answer
342 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 ...
1
vote
0answers
126 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 ...
7
votes
0answers
49 views

Is it possible to extend the graph layout framework with our own methods?

The GraphLayout specification can take complex forms, where we can specify separate vertex layouts, edge layout and packing layouts. Often each of these takes more ...