Questions on the numerical functions of Mathematica, implementing numerical methods and numerical computing with Mathematica.

learn more… | top users | synonyms (1)

0
votes
1answer
75 views

Find exact value

I want to know exact x'[t] value where z[t]=0 I know approximate x'[t] value is 107 but I cannot find how to find exact x'[t] value ...
1
vote
1answer
124 views

FindRoot with vector functions

I'm trying to solve a system of non-linear equations with FindRoot, and I get the answer, but also a ...
0
votes
0answers
39 views

NIntegrate Issue: Changing integration limits makes calculation time extremely long

After a long time developing some code in mathematica and finally getting it to work, I have unfortunately encountered an odd problem: When I change the limits of integration (and shift the function ...
1
vote
0answers
92 views

Solve set of non-linear equations with least-squares-fitting - constrain results?

I'm trying to solve a set of functions to determine the material properties from a set of measurement values. (To set up this method I just want to fit my model with some already calculated data). My ...
6
votes
3answers
383 views

RK4 Gravity Simulator

I have the following RK4 solver which splits the two 2nd order ODEs, used to calculate x and y positions under the influence of a gravitating body where $$x''(t)=\frac{G m ...
9
votes
3answers
3k views

How can I differentiate Numerically?

Mathematica has two ways to integrate: Integrate and NIntegrate. But what about D? ...
17
votes
2answers
314 views

Symbolic derivatives are being calculated numerically

Just found the following while debugging a problem. Mathematica is calculating the derivative of IntegerPart[x] in some odd way: ...
2
votes
1answer
213 views

Euler's method for a 2nd order ODE

This is my first post on this site. Also, I'm new to Mathematica. I'm trying to solve my first problem with Mathematica. It's about solving a 2nd order differential equation. I dont have the explicit ...
1
vote
0answers
58 views

How to find a scaling parameter in matrix inversion process by MMA?

I simply would like to find the inverse of a given matrix $A$ by the iterative method $X_{k+1}=X_k(2I-AX_k)$ using $X_0=\frac{1}{\sigma_{max}^2}A^*$. An example is as follows ...
0
votes
2answers
185 views

find the real root

I have the following equation: \begin{equation} (y-1)^{b1} - C~~ y~~ \exp(a x)=0 \end{equation} where $a, b$ are real constants, $C$ may be a complex number. I need to find the real solution of the ...
5
votes
3answers
262 views

Numerical evaluation of a sum

I am trying to compute numerically NSum[(-1)^n/n^3, {n, 1, Infinity}]. Of course, using first Sum would work here, but often ...
0
votes
1answer
162 views

Solving for the time-evolution operator in a periodically driven system

I am looking at the Hamiltonian $$H(t)=\begin{pmatrix} 0 & e^{i\Omega t}\\ e^{-i\Omega t}& 0\end{pmatrix}$$ I am trying to solve for the unitary operator $U(t,0)=\mathcal{T}\exp(-i\int_0^t ...
0
votes
1answer
84 views

Numerical vs Symbolic Integration: Loss of precision

I am trying to integrate the following expression over the time interval $0\leq t \leq \text{period}$. ...
1
vote
1answer
306 views

Runge-Kutta 2nd Order ODE Solver

Suppose I have a 2nd order ODE of the form y''(t) = 1/y with y(0) = 0 and y'(0) = 10, and ...
4
votes
3answers
802 views

Creating a 3D List Line Plot From Discrete Points

Given the following Runge-Kutta ODE solver and the graphical output below, how do I get a 3D line plot instead of a 3D point plot? I see that there is no ListLinePlot3D function, so I thought it might ...
0
votes
2answers
163 views

Numeric mixed derivatives

In short I need NumericCalculus`ND extended to mixed partial derivatives. This can be done by nesting them, but care has to be taken to evaluate underling ND only when the parameters become numeric. ...
0
votes
0answers
52 views

Ideas for NDSolve?

I'm currently trying to find a numerical solution to a differential equation of the form: D[W[X], {X, 4}] ==(-(1/(delta + G - (G X)/L)^2) + 1/(delta + (G X)/L)^2) ...
0
votes
1answer
93 views

How to implement the second loop

Here I have a problem that probably needs two loops, but I am not sure how to implement them together. The code calculates M for various values of parameter ...
14
votes
1answer
261 views

How to create internally optimized expression for computing with high WorkingPrecision?

I have large dataset and need to fit rather complicated function on it with different values of one of its parameters (this parameter must be fixed in every fit). I use the ...
0
votes
0answers
105 views

Mean Squared Deviation for Population Data

I've been using the Lotka-Volterra equation to estimate population sizes and need to find the MAD (mean absolute deviation), MSD (mean squared deviation) and mape (mean absolute percentage error) for ...
26
votes
2answers
1k views

Meaning of backtick in floating-point literal

If I compute, say, 1/3//N, Mathematica displays 0.333333 as the result. When I copy that output to use elsewhere, the paste ...
4
votes
1answer
131 views

NDSolve - sampling for result during the computation

I am using NDSolve for a Langevin dynamics problem. I want to the know long term behaviour of my system ($t>1$) but it has to be simulated with very small time steps ($dt\sim 10^{-9}$). An example ...
2
votes
0answers
63 views

Complicated output from simple Eigenvalues problem

I have code that uses Eigenvalues on matrices of various sizes. But the output of what should be a very simple problem, namely finding the eigenvalue of a 1x1 matrix, is overly complicated. ...
0
votes
1answer
137 views

NMinimize holding problem

I have a function that I want to minimize numerically through an NMinimize command (because it's very complicated analytically). The minimizer call looks as follows: ...
43
votes
8answers
2k views

Updating Wagon's FindAllCrossings2D[] function

Stan Wagon's Mathematica in Action (second edition; I haven't read the third edition and I'm hoping to eventually see it), demonstrates a nifty function called ...
2
votes
1answer
194 views

Area between Contours in ContourPlot

I feel slightly foolish for asking this because I am so close, but I'm having trouble, so I will anyway. I asked this question two days ago regarding finding the lengths of contours. Now, I'd like to ...
4
votes
1answer
189 views

Find lengths of contours in a ContourPlot

I am trying to find the lengths of different contours in the following plot: It is a complicated piecewise function evaluated on the unit disk. I am hoping there is an easy, generalized way to ...
0
votes
0answers
51 views

Numeric function not fully evaluating

I'm running into an issue where it seems Mathematica is not fully evaluating the output of my function h[t_]. I included the definition of phi[t_] just to demonstrate that it is a numerically defined ...
2
votes
1answer
291 views

Different Poincaré maps for same Equation

I've seen the Wolfram Poincaré example. I'd like to modify this sample in order to have a list of Poincaré maps. In the example the event is captured only when ...
0
votes
0answers
95 views

complicated Numerical Integration, FEM application

I am trying to calculate a 2d Integral which has another 2d integral in the integrands. here is the setup: ...
2
votes
1answer
45 views

Results of ArgMax as a function of a parameter with InterpolatingFunctions

I would like to obtain a function and its derivatives, where the function is defined as the solution to a maximization problem. The obvious approach ...
0
votes
0answers
40 views

NMaximize not satisfying binary constraint

I'm solving an optimization problem in Mathematica with binary integer constraints. It works alright with other constraints. But the only problem is that both NMaximize and NArgMax are not treating ...
0
votes
0answers
67 views

FindRoot with units error: Message text not found

This is sort of embarrassing. I'm working on a document to extol the virtues of Mathematica, and I can't get it to solve a relatively simple system of equations involving units. In this code, when I ...
0
votes
1answer
71 views

NIntegrate and NumericQ [closed]

I need to do numerical integration --> differentiation --> numerical integration. I tried to apply the technique described in the accepted answer to a similar question: ...
0
votes
1answer
104 views

Scaling the time axis of an interpolated function (as in a solution from NDSolve)

I'm wondering how I can change the units of the x (time) axis when plotting a solution from NDSolve. I have obtained three solutions to a system of differential equations, all of which exist over the ...
70
votes
2answers
877 views

Why are numeric division and subtraction not handled better in Mathematica?

There is something that has been troubling me for a while. At least in version 7, the performance of a / b and a - b is not ...
2
votes
2answers
178 views

How to solve this numerically?

May I ask what is the best way to evaluate ...
4
votes
1answer
430 views

Why IntegerPart[x/(x/2)]=1?

Consider this code x = 0.109354682484; IntegerPart[x/(x/2)] (* 1 *) Precision[x] (* MachinePrecision *) Why does it give 1 ? Version number: 9.0 on Mac 10.9.2 ...
5
votes
1answer
95 views

How to enforce numerical precision throughout a package

I developed a big package that does quite a bit of numerics. Is there a way to enforce that all numerical computations are done with a pre-defined accuracy? For example, can one use something like ...
1
vote
1answer
114 views

Discrete sampling of interpolating function returned by NDSolve

When solving an ODE with NDSolve, Mathematica returns an interpolation function. I need a discrete sampling of this function however. Naively, I can write this as (example): ...
0
votes
1answer
293 views

Heat Transfer equation by numerical methods

I want to solve the following heat conduction equation using numerical methods: D[u[x, t], t] -alpha*D[u[x, t], {x, 2}] == 0 u[x, 0] == 1/(1 + x^2)^0.25, u[-10, t] == u[10, t] == 0, ...
1
vote
0answers
37 views

How to find discretezation error of NDSolve

Is there a way to find out how large the truncation, round-off, and other errors that occur from discretizing a differential equation are while using the default settings in NDSolve? Or would I have ...
0
votes
0answers
56 views

FindRoot to find numerical solution of a given index

I want to find solutions of a system of multivariate nonlinear equations of a specific index (i.e., the no. of positive eigenvalues of the Jacobian evaluated at the solution). I know the FindRoot ...
17
votes
2answers
2k views

How to fit 3 data sets to a model of 4 differential equations?

I'm a biologist and a newbie in Mathematica. I want to fit three data sets to a model consisting of four differential equations and 10 parameters. I want to find the parameters best fitting to my ...
1
vote
2answers
174 views

Mathematica can't minimize a function

Mathematica seems not to be able to minimize this univariate function over integer arguments, $r>2, r \in \mathbb{Z}$. ...
1
vote
1answer
119 views

Numerically solving an ODE for a parameter

My equation is as follows: sol = ParametricNDSolve[{(f'[r]^2 - 1) f'[r] r == 6.2 (f'[1])^2/1000, f[1] == a}, {f}, {r, 1, 3}, {a}] where the function ...
1
vote
1answer
171 views

Numerical Instability?

Current Status Please skip ahead to Update 2: the key questions are now: 1/ Why does Mma generally fail to find the minimum for a well behaved function when the function does not have infinite ...
16
votes
2answers
855 views

How to compute the inverse CDF properly?

Note: this has been fixed in version 9. I want to compute the CDF and inverse CDF of the hyperbolic distribution: ...
0
votes
0answers
142 views

Boundary Value Problem- using NDSolve or another method

I am trying to solve a set of coupled partial differential equations, with defined boundary conditions using mathematica. Here are the equations and the boundary conditions. ...