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

learn more… | top users | synonyms (1)

2
votes
2answers
80 views

WorkingPrecision causes issue in the NIntegrate

I really can't figure out why my code sometimes is not working. My integrals involve two variables (k and kz). The integration ...
3
votes
0answers
85 views

Numerical integration: complicated 2D integral seems to be poorly estimated

In the course of some physics research I've been working on, a very annoying integral has appeared that I'm having difficulty evaluating numerically. Any help you could offer would be greatly ...
18
votes
3answers
887 views

Can Mathematica Handle Open Intervals? Interval complements?

Open Intervals Following up on this question, I was wondering whether Mma can handle open intervals. For example, the union of the intervals, $$1<x<5$$ and $$5<x<8$$ should not ...
20
votes
3answers
419 views

Real Numbers in the Wolfram Language

Epilog: Much of the discussion in the answers below revolves around the distinction between Real as a data type and real numbers as a domain or class of numbers (irrespective of the form in which ...
9
votes
3answers
207 views

Why is (-1.)^2. a complex number

Why (-1.)^2. in Mathematica returns a complex number? It looks like in both C and Fortran it returns 1. Why does Mathematica behave differently than the other ...
0
votes
1answer
90 views

Writing a Code to plot a function that includes a double integral [closed]

I am trying to write a code in Mathematica. Here are my steps: F[u_] = Some nontrivial and long expression in terms of u; Umax[x_, y_] = Some expression in terms of x and y; W[x_, y_] := integral ...
1
vote
2answers
99 views

Plot a bunch of lines in 3D from point data

I have a 12*25 array, wherein each entry is of the form $\{x,y,z\}$. So 12 different $x$ values, 25 different $y$ values and 12*15 $z$ values in all. I'd like to plot 12 curves of various $x$ values ...
15
votes
2answers
373 views

Why is my data 10 times slower than random data when doing matrix multiplication

I have some data generated from some program, and it appears that matrix multiplication on these data are about 10 times slower than on some random data: ...
6
votes
4answers
216 views

Function for a series of joined slopes

I need a function for a series of joined slopes and my solution feels a bit kludgy. Is there a better way? A list of pairs of transition points and slopes: ...
1
vote
1answer
65 views

Efficient method of raising matrix to a variable power?

I have a $2 \times 2$ matrix $A$, where each element is a 12th order polynomial in a parameter $a$. I need to raise this matrix $A$ to the $-t/T$ power, where $T$ is a known scalar (for this ...
1
vote
3answers
74 views

Speed up NIntegrate, which takes eigenvalues from another function

I have simplified my problem here, in my actual problem the matrix is much bigger which makes it impossible to find eigenvalues analytically. So, I chose standard BCS problem (2x2 matrix) to ...
23
votes
1answer
743 views

Fast Spherical Harmonics radiative transfer

This is a rather specific question and I apologize for spamming you with some lengthy code. But it could be interesting for some reader and maybe you can help out, so please bear with me. I am using ...
2
votes
1answer
72 views

How to make N apply to exponent?

For example, I want to covert y+Sqrt[x] to y+x^0.5, where y and ...
1
vote
2answers
163 views

NDSolve with Explicit, Implicit Euler and Trapezoidal method

I am using Mathematica 9.0 both on Linux and Windows and I would like to integrate the Van der Pol equation numerically using various techniques such as Explicit and Implicit Euler and Trapezoidal ...
0
votes
1answer
47 views

DSolve for first order nonlinear equation is solution numerical or analytical?

Hi I'm new to mathematica so I may have a somewhat trivial question. my code below solves and plots the results of a first order nonlinear ODE. The solutions mathematica gives me contains & and #1 ...
1
vote
1answer
194 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 ...
1
vote
0answers
61 views

The problem (time) caused by ?NumericQ

In here, I asked a related (similar) question. Using ?NumericQ seems have slowed down the entire calculation. But I now have a more serious problem: ...
4
votes
2answers
91 views

How to speed up Min of DateObjects?

I'm in version 10.0.1 using a Dataset to do some plots and things. For one of the plots I need to get the minimum date of a some filtered set of the ...
1
vote
3answers
79 views

How can I use the command `Minimize` of this trigonometric function? [duplicate]

I want to find the minimum of the function $\sin^6 x + \cos^6 x$. I tried Minimize[{Sin[x]^6 + Cos[x]^6, 0 <= x <= 2 Pi}, x] I got {Cos[2 ArcTan[1 - ...
7
votes
2answers
703 views

Function to subdivide interval into n evenly-spaced points

[This post needs better tags than I could come up with. Edits to the tags would be particularly welcome.] I realize that it is trivial to define a function that takes an interval (i.e. two ...
0
votes
1answer
161 views

Help Please : Error in plotting the solutions of FindRoot

I want to find the roots of an equation using FindRoot as a function of a real parameter K and then plot the real and imaginary solutions vs. the parameter K. The function I'm trying to find the ...
3
votes
1answer
37 views

How shortening argument test when declaring functions?

When defining some functions which depend in many arguments sometimes we need to include question Q constraints to diminish processing time. My question is simple, there is a way to shorten a long ...
9
votes
2answers
315 views

Water Hammer - Numerically solving system of PDEs

I'm trying to use Mathematica to solve the water hammer effect. ...
20
votes
2answers
229 views

BitShiftRight produces incorrect results in Version 10

fixed in 10.0.2 With Mathematica 10 for Mac, BitShiftRight works properly on lists of up to 100000 numbers, but appears to give incorrect results when threaded ...
1
vote
2answers
108 views

Increasing number of decimal places with FixedPoint

I've tried: In[169]:= newton3[x_] := N[1/2 (x + 3/x)]; FixedPointList[newton3, 1.0] Out[170]= {1., 2., 1.75, 1.73214, 1.73205, 1.73205, 1.73205} Of course: ...
0
votes
2answers
61 views

Iteration of NDSolve

I have a problem with iteration of the result of NDSolve. Namely, the following code works fine ...
5
votes
1answer
94 views

Changing the definition of N: unexpected $RecursionLimit::reclim error

I have some objects represented as follows: Object[data, param] data is a list of numbers, ...
1
vote
1answer
108 views

Find Numerical Derivatives (With Errors) given some data

I have a question. Suposse I have some data with their respective errors: ...
2
votes
1answer
57 views

Breaking out of NDSolve

I am solving a coupled set of differential equations with NDSolve for 6 unknown functions of time. At a certain point in time, the system hits a singular point where the potential governing the ...
2
votes
0answers
116 views

Volterra integral equation

I have to find an approximate numerical solution for the equation $$ F(x) - \lambda \int\limits_1^{x} \text{d}s \;s^2 F(s) Z(x-s) = G(x) $$ $$Z(s) = (\psi''(1-2\ h\ i\ s)- 0.5 \psi''(1-2\ h\ i\ s))$$ ...
0
votes
0answers
24 views

Why numerical functions can't digest InterpolatingFunction with units?

Answering this question gave me the idea that I must be missing something.. In brief, numerical functions generally 'understand' units: ...
0
votes
0answers
45 views

plotting the stable and unstable manifolds of a difference equation

I have a 2D non-linear system of difference equations for variables x and y defined as follows: ...
1
vote
3answers
2k views

Tricks for solving (lots of) coupled nonlinear equations numerically?

I have a system of 6 non-linear (quadratic) coupled equations with 6 complex unknowns \begin{align*} |x_1|^2 + |x_2|^2 + |x_3|^2 &= a\\ x_1 x_4^* + x_3 x_5^* &= b + c i\\ x_1 ...
0
votes
1answer
78 views

Fitting data with inclusion of constraints

How do I find a fit for the dataS (see below) with the constraint that the parameter np is an integer, and that the parameters la+lc = 100. A weak attempt at this is provided below for a specific ...
0
votes
1answer
688 views

how to solve second order nonlinear coupled differential equations using NDSolve with hyperbolic function

i have to solve some solitons scattering through this coupled equations. i need to get two different graph, but still the graph did not come out. and also the equations quite complicated containing ...
3
votes
2answers
119 views

NMinimize/NMaximize is unable to generate initial points

Mathematica 10 generates a warning that it is unable to generate initial points for numerical optimization problems. I picked a particularly simple example. The problem goes away when ...
1
vote
0answers
27 views

Apparent issue with derivative of FractionalPart

This issue came to my attention from Math.SE: http://math.stackexchange.com/questions/1015325/is-the-derivative-of-x-on-0-1-always-equal-to-1/1015342#1015342 To summarize, it appears that ...
-1
votes
3answers
200 views

Challenge — Defining an ORIGINAL second derivative function?

UPDATE: I do not want to use the Derivative or D functions. – I began with this definition of the derivative , which resulted in: Limit[ #, h -> 0] & /@ { (f[x + h, y] - f[x, y])/ h. But, I ...
2
votes
2answers
84 views

How to prevent Round with hided fractions

I found a strange behavior in Round. If we try: ToString[Round[4.811, 0.01], InputForm] we get: 4.8100000000000005 When I expected 4.81 In order to ...
1
vote
1answer
60 views

Series expansion of InterpolatingFunction obtained from NDSolve

I am trying to obtain a series expansion of the numerical solution of a differential equation. I encounter difficulties going beyond first-order expansions which I believe might be due to my inability ...
1
vote
0answers
55 views

Symbolic and numeric calculations (and plots) simultanuosly

I use Mathematica to do a bunch of symbolic calculations (integrals, ...). This is good because I found that sometimes, if I plug in numeric values, Mathematica takes much longer. However, sometimes ...
2
votes
0answers
62 views

How can I use 'NIntegrate' to show the error?

I have to compute a very complicated integral, which is a 16-dimension one, so NIntegrate use Monte-Carlo. I have set Method -> "AdaptiveMonteCarlo, when I run ...
0
votes
0answers
68 views

Solving an ODE, where the coefficients are implicit functions of time, not in closed form [duplicate]

I have an ODE, say of the first order for simplicity, and of the form, $A.x'[t] =B$. The coefficients are functions of time and x[t], not in closed form. I can define the coefficients, $A$ and $B$, ...
0
votes
1answer
59 views

Multidimensional NIntegrate problem of the function decaying as 1/x^2

The function I am trying to integrate is more complicated but I can simply write the function as (I had made a typo error, sorry. The '+' sign in front of the r should be '-'): $f(\omega ) = \int ...
1
vote
1answer
87 views
0
votes
0answers
49 views

Handling Accuracy and Simplifying

I have the following problem. I have a system of non-linear equations that I log-linearize around a certain point, let's call it point A, using a function that I ...
0
votes
3answers
72 views

High-Precision NSolve

I need to calculate the intersection of two curves f1[x_] := ((Zl ρ ) Exp[-x]) f2[x_] := (α k e^2 /x^2) Where ...
1
vote
0answers
34 views

How to make a real number parameter go 2 decimal precision? [duplicate]

I'm new at community and I'm starting with Mathematica. I'm now having a trouble with a very simple problem which for many of you might be really obvious. In documentation ...
9
votes
2answers
2k views

How to discretize a nonlinear PDE fast?

I wish to numerically solve the following PDE. Although there are some complete discussions for solving PDEs in tutorial/NDSolvePDE, there is no hint for the nonlinear case by discretization. Thus, I ...