Questions tagged [numerics]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
36 views

Looking for intuition as to what numerical issue makes this solution of NDSove blow up unphysically

I am solving the spherically symmetric wave equation in 3 dimensions on $r\in[0,2\pi]$ $$(\partial_t^2 - \frac{1}{r^2} \partial_r r^2 \partial_r) \theta(t,r)=0$$ with initial conditions $\theta(0,r)=e^...
4
votes
0answers
43 views

Inconsistent behaviour between Active and Inactive forms of PDEs (finite element method)

I have been using the finite element tools in Mathematica version 13.0 to solve eigenvalue problems in physics (Schrödinger equation) using NDEigensystem, but I am having some issues with non-...
1
vote
2answers
68 views

Parallelize elements of a vector or array

Suppose I want to calculate a vector or an array (say, for simplicity a 4-by-1 vector), but each element contains independent numerically evaluated functions $f_1,f_2,f_3,f_4$ and each takes long time....
0
votes
1answer
47 views

NIntegrate giving different results after a change of variables

When I compute numerically the following double integral: \begin{equation} f(x,y)=\int_{-\infty}^{+\infty}da\int_{-\infty}^{+\infty}db\, \cosh\left[\frac{\sinh^{-1}(a)-\sinh^{-1}(b)}{2}\right]\, \exp\...
0
votes
1answer
55 views

Tips and tricks for minimization problem

I am quite new to Mathematica and would like to use it for a minimization problem. The function I like to minimize is: ...
0
votes
1answer
59 views

Formalization of one optimization problem or solution of inequalities - Part №2

Continuing the question: Formalization of one optimization problem or solution of inequalities Let's consider a more complex problem. We have two polynomial: $p_1=A_2t^2+A_1t+A_0$ $p_2=B_2t^2+B_1t+B_0$...
4
votes
2answers
235 views

Using NDSolveValue for Solving a parabolic PDE numerically

Inspired by this question I am trying to solve the following PDE numerically on $x \in [-3, 3]$ and $t \in [0, 0.5]$ using NDSolveValue: $$ \frac{\partial p}{\partial t} = (12x^2-4) p + \left[4x(x^2-1)...
2
votes
1answer
68 views

Formalization of one optimization problem or solution of inequalities

I have polynomial: $p=A_2t^2+A_1t+A_0$ $A_0=(x^2-y^2)+xz$ $A_1=x^2+y^2+z^2+\sin(x)$ $A_2=x^4+y^3+z^2$ $x,y,z$ - parameters, moreover $z$ - the value of which varies in the range $[0,1]$. Polynomial $p$...
1
vote
1answer
56 views

How to set Initial Points for optimization problems

How to set Initial Points for optimization problems in MMA? In this case,we do not need to set the range of the variable x1, x2. ...
1
vote
1answer
73 views

Smart way to do a numeric integral of a recursive function defined by symbolic integration

I have a little question. I need a smart way to compute a numerical integral. The standard way to compute a numerical integral, in multiple variables, is, for example, the following: ...
4
votes
1answer
59 views

How to accelerate numerial inverse laplace transform for pdes of Euler-Bernoulli beam problem

Happy new year! :) Recently, I am practicing laplace transform technique for solving pdes. In this extemely helpful post, @xzczd mentioned that "The last step is to transform the solution back, ...
4
votes
1answer
113 views

ParallelTable/ParallelDo for Newton's Method doesn't work [closed]

We run such ParallelTable based on @Syed https://mathematica.stackexchange.com/a/261603/54516. ...
2
votes
3answers
169 views

Eigenvalue problem with NDSolve

I am trying to solve the following system of linear ODEs. It is an eigenvalue problem. ...
3
votes
0answers
126 views

Using new FoxH function to solve a trinomial equation. Possible issue?

There is a possible issue on solving the following trinomial equation $$x^\alpha+x=y$$ for real $x,y,\alpha$. From Belkic [1], it is known that for $\alpha>1$ a solution is found using the ...
0
votes
1answer
76 views

How do I integrate and plot the function $\int\int e^{-x\cdot y}dx dy$ numerically? [closed]

I would like to integrate the function $e^{-x\cdot y}$ numerically (in the fictitious assumption that there would be no closed form for it). As a result a plot should come out that looks as follows: ...
0
votes
1answer
118 views

Mathematica refuses to plot this interesting graph [closed]

I am trying to plot this function $f$ which satisfies $f$ bounded, monotone, $C^\infty$, but $f'(x) \nrightarrow 0$ as $x\rightarrow\infty$. I am running a linux computer with mathematica 12.3. My ...
3
votes
1answer
56 views

Which one is more accurate Solve or NSolve? How can I get the same result as Solve using NSolve in the given code?

I am using this code to calculate the quantity $sol$. Using Solve, I get the result $9.8598$ ...
27
votes
8answers
1k views

Speed up Do loops in MMA 13.0

How to speed up Do loop in MMA 13. We consider the following Benchmark test (4 kernels, i7, win10): In MMA 13: ...
2
votes
1answer
99 views

Solving boundary value problem with coupled odes at interface

I am trying to get the eigenvalues of the following differential system ...
-1
votes
1answer
143 views

Why Mathematica giving me wrong result for such basic calculation [closed]

Why I am getting the wrong result using Do Loop. It is a very simple calculation the answer should be 1.1111... a = 1.11111111111111111; Do[a = 2 a - a, {35}]; a ...
0
votes
1answer
39 views

FindRoot with Quantities throws error FindRoot::nlnq

I have a fluid mechanics problem, but when I try to solve an equation to get the flow rate Q (m^3/s) it throws an error that I can't track ...
1
vote
1answer
84 views

Plot a function inside of another function [closed]

I want to plot y[x] vs. x[t]: ...
1
vote
1answer
81 views

Passing RootSearch through NIntegrate?

I am trying to integrate a function that is itself a function of RootSearch (from the Wolfram Library Archive). Specifically, for a given value of parameter ...
4
votes
1answer
118 views

Numeric evaluation of a matrix product integral

Working on a problem in quantum mechanics, I rediscovered a notion of a product integral, which I was not familiar with before. In a simple case, when the integrand is a real-valued scalar function, ...
7
votes
3answers
171 views

Integrating a ParametricNDSolve solution whose initial conditions are determined by another ParametricNDSolve function?

I am trying integrate a ParametricNDSolve output (System2) whose initial conditions vary according to another ParametricNDSolve function (System1). The code I have so far is as follows. ...
4
votes
1answer
168 views

Different results from NDSolve of v9 and v11

When using NDSolve to solve 2 pdes with different version of Mathematica, I obtained totally different results. The code is as follows. ...
1
vote
3answers
115 views

Root finding in a non-rectangular solution region

If I want to find a root $(x^*,y^*)$ of functions $f(x,y),g(x,y)$ in the rectangular region ${\cal R}=[x_i,x_f]\times [y_i,y_f]$ I can write ...
2
votes
2answers
81 views

Plotting NDSolve solutions for an ODE with a variable parameter

Quick question! I'm supposed to plot solution curves for the ODE y'(t)+nty(t) = 0, y(0) = 3 with integer n varying from 1 to 6 inclusive. In the process, I have to use interpolated functions obtained ...
0
votes
0answers
74 views

Why does Mathematica store numerical values in a fresh kernel?

For some reason, when I try to do a computation in a fresh kernel, MM remembers the "old" values from the old kernel, is there a way to stop this?
1
vote
0answers
124 views

How to numerically solve this system?

Our system: \begin{align} \dot S &= \mu -\beta_1 S I_2 -\beta_2 S J-\beta_3 S A - \nu S\\[2ex] \dot {I_1} &= p \beta_1 S I_1 +q \beta_2 S J +r \beta_3 S A + \xi_1 J- b_1 I_1 \\[2ex] \dot{...
0
votes
1answer
41 views

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.` [closed]

I am unable to get a numerical solution to a system of two coupled second order differential equations using NDSolve. These coupled ODEs are for a physical phenomenon known as a looping pendulum, and ...
0
votes
1answer
93 views

Two problems with ConjugateGradient

I am trying to solve a maximization problem for which I give you the code and try to step by step show you were it broke down. The first issue is that I have a constrained problem, which I try to ...
1
vote
0answers
25 views

N on equation with numbered variables [duplicate]

Say I have a system of polynomial equations in the variables x[1],...,x[n]. Sometimes want to make such equations numerical (as in: the coefficients become floats) ...
0
votes
1answer
79 views

Solving Second Order Differential Equation with Discrete Time Data

Given the Second Order Differential Equation: $$ m\ddot{x}+c\dot{x}+kx = \mathrm{F}_{external}^{} $$ where $ m, c, k $ are constants and $\mathrm{F}_{external}^{}$ is buffer of external force taken ...
0
votes
0answers
30 views

Mean error of finite differences derivative

I wrote a module that computes the 4-th order finite difference derivative of a function at $N$ equidistant points of an interval and the difference between the exact and numerical value at those ...
-1
votes
1answer
95 views

A No-linear differential equation

I'm recently figuring out how to make this equation solved but Mathematica does not solve this??!! DSolve[{ y'[t]== ((3 a)/2 (y[t] - b/(2 a))^2 + k ((3 a)/2 - 1) t^-2 - ((a f)/2 + (3 b^2)/(8 a)))/(t ...
4
votes
3answers
167 views

How to use Findroot in a loop

Consider: i = 0.1; While[ i < 0.9, y[x_] := y /. FindRoot[{u/(1 - u) (x + Log[y]) - 1 /. u -> i}, {y, 3}]; Plot[y[x], {x, 0, 4}]; i = i + 0.1] I want ...
1
vote
1answer
51 views

Problem with numerical ConjugateTranspose?

Suppose I have a normalized numerical array, B1, ...
4
votes
1answer
70 views

Using the result of NIntegrate as a potential in NDEigensysem

I am trying to find the eigenvalues and eigenstates of a Hamiltonian with a potential which cannot be analytically defined. In particular, it is the integral of the product between two functions: <...
2
votes
1answer
60 views

Strange behavior of NDSolve (Error NDSolve::ntdvdae)

i discovered a weird behavior using ```NDSolve``` to solve a set of differential equations. Let me outline my problem: I need to solve a set of differential equations. These are equations of motion ...
0
votes
0answers
36 views
0
votes
0answers
55 views

A case for matrix multiplication (a.b).c unequal to a.(b.c) in mathematica 12.0.0.0, why?

The motivation of my calculation is to get the inverse for the following matrix ...
1
vote
2answers
77 views

How to Plot an Equation, based on another plot [closed]

I've been struggling with this problem That I have an equation with two variables. One of them has a defined interval. Like this: ...
0
votes
1answer
81 views

Plotting a phase plane portrait of an oscillatory system?

I am trying to plot a phase plane portrait of the following system: dQ/dt = v*(z - Q)*(w^2 + Q^2)/(1 + Q^2) - Q dz/dt = k - Q where v = 1, k = 0.2, and w = 0.05. So far, I have the following: ...
4
votes
1answer
213 views

Fit: Experimental`NumericalFunction error when fitting a black-box function

Bug appearing in at least 12.0.0 and 12.3.1 I'm trying some multidimensional Chebyshev fits. First, define a wrapper to prevent premature symbolic evaluation (I don't want a power series result): <...
-1
votes
1answer
104 views

How to solve that logarithmic equation? [closed]

I mean an equation $$ \log _{2 \sqrt{\sqrt{3}+2}}\left(x^2-2 x-2\right)=\log _{\sqrt{3}+2}\left(x^2-2 x-3\right).$$ The result of ...
27
votes
1answer
711 views

Efficient multidimensional optimization while constraining some coordinates

I have a function f[x] with a high-dimensional vector input and a scalar output. I am looking to minimize this function while constraining some of the components of ...
1
vote
2answers
105 views

NMinimize incorrectly says "The problem is unbounded"

I am solving some quadratic optimization problems in Mathematica 12.2 using NMinimize. Mathematica incorrectly gives the error ...
5
votes
4answers
257 views

Any Mathematica techniques to calculate time takes to reach the equilibrium of a PDE solution

I am solving this PDE numerically (dimensions: spatial variable x and time t). I know how to solve my problem numerically (for a given range of time). The solution reaches its equilibrium after a ...

1
2 3 4 5
38