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

learn more… | top users | synonyms (1)

0
votes
0answers
24 views

Boundary Conditions that depend on each other

I have to numerically solve some 4th order differential equations: B''''(r)=f(r,B,B',B'',B''',S,S'), S''(r)=g(r,B,B',S,S') I'm trying to use the shooting method ...
3
votes
0answers
61 views

Low accuracy while solving a multi-variable equation numerically

My question is as following: I was trying to make a function Vs2[r] with two parameters fit a set of conditions. Vs2[r]: ...
0
votes
0answers
43 views

Unable to plot higher order polynomial equation using NSolve and contourplot

I have a polynomial equation in 'a,b' and I am trying to plot a curve between 'a' and 'b'. Both NSolve and ContourPlot works well upto 'a=15' , but after that the plot has scattered points. Is this ...
3
votes
1answer
61 views

Split Boundary Value Problems win Algebraic Equations

Is it possible at all to solve with NDSolve (or other built in function) a split boundary value problem with algebraic equations? Please look at the following example: ...
0
votes
1answer
39 views

Plotting a function based on complicated integral

I have this function : f[Lambda_] := K Integrate[x Exp[- x^2-Lambda x] HypergeometricU[-Lambda,1/2,(x+ Lambda/2+2)^2],{x,0,Infinity}]; where ...
3
votes
2answers
239 views

Rotating an Interpolating Function

I have used the following code to generate eigenfunctions of a PDE: ...
12
votes
1answer
192 views

Non Standard Eigenfunction Plots of the Laplacian Over the Unit Square

I have recently been plotting eigenfunctions of the laplacian over the unit square using the NDEigensystem command. However, I have noticed something in the plots ...
0
votes
0answers
73 views

Errro in plotting the results of FindRoot [on hold]

I would like to plot the results of FindRoot over certain range of one input. First of all I am sorry that the equation is a bit long and messy. I have tried to ...
3
votes
0answers
70 views

Classification problem using SVM methods

I am running SVM on mathematica and I a used this code with classes: ...
2
votes
1answer
86 views

Basic 2D convolution with mathematica

Can anyone tell me why the following keeps burning my CPU without ever producing the desired plot? ...
21
votes
3answers
757 views

Exponential fitting - isn't actually a BUG there?

There are many questions on this site about wrong exponential fitting in Mathematica but no one considers this well-known problem as a potential bug. Usually people suggest well-known workarounds ...
1
vote
0answers
74 views

Numerically Solving Helmholtz over the Rectangle - Why does this code only give eigenfunctions of the form $u_{m1}$ [closed]

I have been following the method for numerically solving the Helmholtz equation in this example (the answer by User21) and have come across two problems. I have been implementing the method for a 2x1 ...
2
votes
3answers
70 views

Smooth initial data

I need something that produce pseudorandom smooth initial data for modelling phase separation equations (Cahn-Hilliard and simular). Generator code for now: ...
4
votes
1answer
53 views

Computing the logarithmic spectral norm rapidly

I wish to compute the logarithmic spectral norm of a square matrix $A$, which is defined by \begin{equation} \mu_2[A]=\lim_{t\downarrow0}\frac{\|I+tA\|_2-1}{t}. \end{equation} Hence, I simply code ...
0
votes
0answers
29 views

How do I numerically integrate the result of NDSolve if it depends on several variables?

I am trying to numerically integrate solution of NDSolve. I am trying to integrate my result of NDsolve in line 97 of my notebook, but am getting the error ...
0
votes
1answer
90 views

How to fit parameters, not functions?

Given a set of parameters ...
0
votes
0answers
62 views

Solving numerically a system of equations using different methods

I will use, as an example, the simple Henon-Heiles potential ...
1
vote
1answer
51 views

Paramter Scans and $\chi^2$ Test in Mathematica

Is there any in-built function or a recommended package that enables one to find, say, 10 Parameters, which are used as boundary conditions in NDSolve, that minimize $\chi^2$? ...
1
vote
1answer
38 views

Differential equation for a list with parameter dependent function

I am having a differential equation: y' = (1 - y) - f[y, mu] y; f is a hysteretic function that depends on y and on the derivative of y: ...
3
votes
0answers
86 views

Constructing the coefficient matrix in discretization of a PDE

In order to solve the following two dimensional PDE $$\frac{\partial u(x,y,t)}{\partial t}-\frac{1}{2} \sigma _1^2 x^2 \frac{\partial ^2u(x,y,t)}{\partial x\, \partial x}-\frac{1}{2} \sigma _2^2 y^2 ...
0
votes
1answer
54 views

Integrate over FindRoot solutions

I have a function of bivariate normal PDF and its marginals defined as ...
5
votes
1answer
168 views

Trouble with shooting method for a 4th-order stiff ODE

The ODE I need to solve is $$\left(y^3y^{\prime\prime\prime}\right)^\prime+\frac{5}{8}xy^\prime-\frac{1}{2}y+\frac{c}{y}=0$$ where $\prime$ denotes differentiation, $c$ is a constant and ...
0
votes
1answer
37 views

LinearSolve on non-square matrices?

I just came across a strange behaviour for LinearSolve (on Mathematica 8.0.0.0). Consider the following definitions: ...
4
votes
6answers
872 views

Randomly Multiply OR Divide by a Random Number?

I want that Mathematica decides randomly if a given variable, gets multiplied or divided by a random number in a given range. The "naive" idea to just use ...
2
votes
1answer
196 views

Maximized value of a function as an additional constraint on a variable

I want to maximize a function $f(b, h)$ with respect to its arguments and subject to some additional constraints. If these constraints are satisfied, $f$ is increasing in $h$. I then want to find an ...
3
votes
1answer
362 views

Wrong result of simple math calculation. Is it possibly a bug of the program? [closed]

I encounter the following issue accidentally (shown in the screenshot) which is very odd to me. The output[4] and [5] is obviously wrong. But with the input value of 991.91, it turns out to be right ...
5
votes
0answers
62 views

How does Plus work on machine precision Real arguments?

I thought Kahan's summation method would make a nice example for students to use to think about round-off error [W. Kahan, Pracniques: Further Remarks on Reducing Truncation Errors, Commun. ACM 8  ...
1
vote
1answer
84 views

How can I increase the precision of my computation?

How can I increase precision up to 15 digits for the results (EC, and that of FindRoot) computed below? ...
3
votes
3answers
115 views

Chopping matrix elements, real or imaginary

An undesired shape of a matrix has the following form: which is created by ...
6
votes
1answer
168 views

Trouble with shooting method for a 4th-order differential equation

I'm trying to solve the following forth-order ODE with the shooting method: $$\frac{1}{5}(y-2xy^\prime)=\frac{1}{x}\left\{\frac{xy^\prime}{y}+xy^3 \left[\frac{(xy^\prime)^\prime}{x} \right]^\prime ...
6
votes
3answers
243 views

Labeling solutions of an Eigenvalue equation involving Bessel functions

I'm solving the Schrödinger equation for a particle in an annular geometry with hard wall boundary conditions and I've reduced it to the following equation: $$J_m(k\,R_1)\,Y_m(k\,R_2) - ...
3
votes
2answers
104 views

Unexpected behavior from Accuracy

This is my code Table[With[{x = 10^n + 1/17}, N[x, {Infinity, 5}]], {n, 0, 5}] // Column Or like this ...
1
vote
1answer
43 views

System of ODEs - NDSolve issues

I am a self-taught beginner trying to use Mathematica for the first time. If you wouldn't mind, I would like to ask for help with the code I am working on as I keep running into multiple issues when ...
5
votes
1answer
93 views

Compilation, square roots, and integers

After looking at this question, particularly this answer, I wrote my own performance test, using the two functions ...
4
votes
1answer
125 views

Saved InterpolatingFunction behaving badly

Bug introduced in 10 and persists through 10.3.1 or later I created this InterpolatingFunction, and NIntegrate gives an ...
8
votes
3answers
350 views

Bug: Wrong results from NSolve on coupled polynomials. WorkingPrecision->Automatic fails

OP UPDATE: I received an email from WR on 1-18-2016: "...It does appear that the NSolve function is not behaving properly in this case and I have forwarded an incident report to our developers with ...
0
votes
0answers
57 views

Error message when using a compiled function in NSum [duplicate]

Below is a simple example to illustrate the problem test = Compile[{{n, _Integer}}, n] Now, Table works fine ...
3
votes
3answers
65 views

EvenQ not working properly on IntegerPart[real number]

Something fascinating is happening at the moment. ...
1
vote
1answer
70 views

singularity in boundary value problem

I am trying to solve a non linear differential equation with variable parameter. ...
13
votes
2answers
445 views

more numerically accurate inverse matrix

I encountered the following matrix mat = {{2, 2.161209223472559` + 1.682941969615793` I}, {2.161209223472559` - 1.682941969615793` I, 2}} and ...
1
vote
0answers
41 views

Rescale large numerical factors in rational functions

Given a rational function $$ f(x_1,x_2) = \dfrac{r_1 x_1^2 + r_2 x_2}{r_3 x_1 + r_4 x_2}, $$ with $r_i$ arbitrary real or complex numbers, is there a built-in function to get Mathemtica to rewrite as ...
3
votes
2answers
55 views

Solving an integral equation for upper boundary

I am reading a paper on High Harmonics Generation (HHG) and a Lewenstein model The paper is here. I would like to reproduce some results but I am stuck at the following problem. I have: ...
5
votes
2answers
284 views

Inverse Laplace transform

Let $r=\mu = 0.15; \sigma = 0.05; T = 1; S_0 = 100; K = 95;$ Let $\nu:=\frac{2\mu}{\sigma^2}-1$ and $\eta \equiv\eta(\alpha):=-\frac{\nu}{2}+\frac{1}{2}\sqrt{\nu^2+\frac{8\alpha}{\sigma^2}}$. ...
10
votes
2answers
215 views

Demonstrating the behavior of a function as its independent variable approaches zero

I have several questions regarding the function $$f(x)=\frac{\sqrt{x^2+9}-3}{x^2}$$ that I would like to help my students with in the upcoming semester. Now, the limit as $x\to 0$ is 1/6. ...
3
votes
1answer
37 views

How can I perform arithmetic on a list integers and some other exact numbers and get decimal numbers in the result?

I want to do a simple calculation with a list with Pi and 10^-6 and get a list of decimal numbers as the result. ...
0
votes
0answers
34 views

Handling a matrix with components greater than machine precision

I have four quantities stemming from a 4th order differential equation. I can represent these as a vector which is a product of a 4X4 matrix $$ M=\left\{v,\frac{\partial v}{\partial x},\frac{\partial ...
1
vote
0answers
67 views

Problem setting boundary conditions with NDSolve

I have the following system of PDEs for which I have given parameters $\gamma, \tau$ and $\mu$, $$\begin{align} T_t = &\ \gamma\,(L +\tau F-T)\\ F_t = & -F_x-(F-LT)\\ L_t = &\ \mu ...
3
votes
1answer
87 views

Fast evaluation of a function in many points

I need to feed to an external program a number of points (in Complex128 format) generated from the numerical evaluation of some function, e.g. $e^{i ...
0
votes
0answers
36 views

Multi-Precision [duplicate]

I have read in some numerical Laplace inversion papers that we can take advantage of multi-precision environment in Mathematica , Maple and etc.Can someone please explain it for me why it is not ...
2
votes
1answer
69 views

FiniteDifferenceDerivative of complex function in 2D--bug?

I want to compute partial derivatives of complex functions via finite difference approximation on two dimensional grid using NDsolve`FiniteDifferenceDerivative ...