Tagged Questions

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

102 views

How to obtain a convergent solution iteratively for a linear system of equations

I am working on a problem that requires an iterative procedure to solve a linear system of equations, the system of equations in matrix form is: \underbrace{\begin{bmatrix} r_{11} & r_{12} ...
94 views

Slow application of Outer on a matrix

I have some performance issue with the calculation of a gaussian kernel applied to a not-that-large dataset. I'm not very good with performance tuning in Mma and I have the feeling this one could be ...
55 views

I'm trying to evaluate the following function numerically: $f(A,B)=\frac{2A\pi ^{5/2} (-1)^B}{(A!)^2B!} \, _4\tilde{F}_3\left({\frac{1}{2},1-A,1-A,1-B\atop ... 2answers 105 views Performance in calculating maximum-likelihood- based estimates My probability density function is a complicated one for which numerical estimation is necessary. Here my pdf: ... 1answer 112 views FindFit runs extremely slow for my Function,how do I optimize this? My function is the first order Bessel Function, and I am basically just trying to get this to fit in a way that does not take forever. I define the function as follows, (it seems to work faster if I ... 1answer 246 views How to force numeric evaluation? I need to evaluate the PolyLog function at some points, but I'm interested in numeric values. E.g. PolyLog[3, 2.7] works fine, ... 2answers 360 views Solve a PDE over a region defined by a Bezier patch I am using NDSolve to find the solution to a PDE over an arbitrary domain. The domain is specified by a Bezier patch. ... 1answer 349 views Does NRoots own an abstract counterpart? If not, can we write one? We know when solving linear algebra equations, despite its abstract syntax, LinearSolve is much faster compared to Solve: ... 1answer 196 views NSolve on bounded domain I don't expect NSolve[] to be able to obtain all solutions in generalfor example. In principle there should be an algorithm that finds all solution to$f(x)=0$for ... 1answer 199 views Numerical Integration different in Mathematica version 9 and 10 with same options I have noted that the same function with the same settings gives me different results in Mathematica version 9 and 10. This involves integrating numerically interpolating functions and so on. Here a ... 2answers 115 views Derivative after numerical Integration So I have a function that I want to numerically integrate with respect to temperature, so the integral changes depending on the value of temperature being used as it is one of the bounds. After ... 1answer 62 views Characterising the set of parameters that satisfy a system of non-linear equations I am looking for a solution to the following problem and could not find an answer so far. I have a quintic equation,$f(x;a,b,c,\cdots)-x=0$, where$x$is the variable with respect to which I need the ... 2answers 136 views Accuracy and WorkingPrecision Observe that ... 1answer 78 views My code of plotting a two-variable function is too slow [closed] I have a code in which my complicated function to be plotted is F(x,p). I would like to graph it for 5 values of p equal to 10^7, 10^8, 10^9, 10^10 and 10^11 for x values between 0.01 and 0.99. All ... 1answer 465 views Problem with FindRoot applied to functions I am having difficulty with the error "is not a list of numbers with dimensions..." when using FindRoot (and other numerical routines in Mathematica) to solve equations numerically when the argument ... 1answer 116 views Wrong generalized eigenvalues of large numeric matrices I've been working on a toy model of a variational method of a Hamiltonian H with an overlap matrix S. The point is that when H and S are small enough, Mathematica gives the correct eigenvalues (≈ ... 0answers 26 views why i cannot get appropriate number with my custom precision? [duplicate] why i cannot get appropriate number with my custom precision? In[25]:= N[(1 + Exp[-30])/(1 + Exp[-29.9]), 1000] Out[25]= 1. I expect to see a few digits after ... 1answer 177 views How to properly apply NumericQ or s.th. similar here? - NDSolve inside NMaximize I wrote a function that numerically solves a given Schrodinger equation and returns replacement rules to obtain the time evolution operator. It looks and is used as follows: ... 1answer 74 views Minimizing a coefficient to still get an answer from Solve ... 0answers 166 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 ... 3answers 185 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 ... 3answers 315 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 ... 5answers 330 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: ... 2answers 454 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: ... 1answer 146 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 ... 3answers 252 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 ... 1answer 96 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 ... 2answers 634 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 ... 3answers 900 views Implement the Bisection algorithm elegantly and easily Description: Rencently, I have finished my course Numerical Analysis, so I'd like to implement many algorithm that I have learned from that course.By this practice, I hope that I can improve my ... 2answers 157 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 ... 1answer 100 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: ... 3answers 717 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 ... 3answers 132 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 - ... 1answer 48 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 ... 2answers 1k views Water Hammer - Numerically solving system of PDEs I'm trying to use Mathematica to solve the water hammer effect. ... 2answers 153 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: ... 2answers 147 views Iteration of NDSolve I have a problem with iteration of the result of NDSolve. Namely, the following code works fine ... 1answer 109 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, ...
76 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 ...
201 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 ...
278 views

Mod[1.2, 0.2] is not equal to zero

Why doesn't the following expression evaluate to zero? In[1]:=Mod[1.2, 0.2] Out[1]=0.2 Edit: This is what I wanted to do: ...
212 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: ...
230 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 ...
123 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 ...
636 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 ...
40 views

Apparent issue with derivative of FractionalPart [duplicate]

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 ...
149 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 ...
275 views

Defining an alternative derivative function?

I want to calculate the derivative at a point, but I do not want to use the built-in derivative function D. I began with this definition of the derivative , ...
119 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 ...
73 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 ...