7 votes

Matlab, Mathematica & LAPACK returning 3 different eigenvectors

Seems that you have a duplicate eigenvalue. Thus, you have two eigenpairs $(\lambda_1, x_1)$ and $(\lambda_2, x_2)$ where $\lambda_1 = \lambda_2$. Denote $\lambda = \lambda_1 = \lambda_2$. Let $\alpha$...
knl's user avatar
  • 2,096
6 votes

Numerically solving differential equations, the domain is very long, [0, +10^6), so the calculating time is very long

Actuallly you can scale the variable of the problem into a different interval. Transform $ x \in [0,a]$ where ($a=10^6$) to $\xi \in [0,1]$ by the formula $ \xi = \frac{x}{a} $. Thus, using the chain ...
tqviet's user avatar
  • 151
5 votes

What are these oscillations?

I want to mention another idea in case it helps. The truncation error of replacing $\int_{-\infty}^{\infty}$ with $\int_{-L}^L$ is on the order of $$\begin{aligned} \int_L^\infty \cos(tx)g(x)\,\...
Kirill's user avatar
  • 11.4k
5 votes

Numerically Recovering Imaginary Part of Analytic Continuation from Real Part

Note: I'm somewhat worried at this point that the integral values Mathematica gives me are bogus. I thought it was working because it gave a sensible-looking result in a short time, but it might be ...
Kirill's user avatar
  • 11.4k
5 votes

Writing a programming code directly from the mathematical formula?

Julia's macros and string macro are made for doing this kind of thing. You can define a domain-specific language (DSL) within a macro scope and use that as a way to define problems. One example of ...
Chris Rackauckas's user avatar
4 votes
Accepted

Wrong Boundary Conditions Result Using Wavelet Collocation

This problem can be solved with the Shooting method for inverse function $x(z)$ as follows ...
Alex Trounev's user avatar
4 votes

Problems with the time-dependent Schrödinger equation solutions

First, you're solving the Schrödinger equation not in a box, but rather you apply periodic boundary conditions. That is, it's more like solving the TDSE on a ring. But this just as a comment and ...
davidhigh's user avatar
  • 3,127
4 votes

Numerically solving differential equations, the domain is very long, [0, +10^6), so the calculating time is very long

@tqviet already says this in a some way, but let me phrase it differently: $10^6$ is not a large end time by itself. It seems like a large number because it has 6 zeros at the end, but it all depends ...
Wolfgang Bangerth's user avatar
4 votes

How to compute the Helmholtz decomposition of 2D and 3D vector fields?

The short answer is "It depends". Certainly, you can try to find the Helmholtz decomposition on your sampled data, and find your irrotational and solenoidal components. However, there are certain ...
Anton Menshov's user avatar
  • 8,672
3 votes

Calculate the derivative of the finite-difference method result

In my version of Mathematica it appears that the NDSolve solution is returning a cubic Hermite spline, though I have no idea what order it is using internally to ...
helloworld922's user avatar
3 votes

Matlab, Mathematica & LAPACK returning 3 different eigenvectors

There are two possible issues going on here. Firstly as noted in the answer by knl any linear combination of eigenvectors corresponding to degenerate eigenvalues is also an eigenvector, as shown in ...
Ian Bush's user avatar
  • 616
3 votes

How to remove singularit​ies/discon​tinuities on 3D plots in Matlab?

MATLAB doesn’t plot where there are NaNs, so you can replace some of your data with NaNs to make a clean jump. I don’t know which is a bigger lie, a clean jump or a strange wiggle. That’s up to your ...
Bill Barth's user avatar
  • 10.9k
3 votes
Accepted

Is there a way we can compute my sum involving `subsets` more efficiently?

Just a cheap observation because I did not follow the whole notation, but maybe you can use the fact that for any set $S$ (with distinct elements) $$\sum_{X \in \mathcal{P}(S)} (\prod_{x\in X} x) = \...
Federico Poloni's user avatar
2 votes
Accepted

Apply method of manufactured solution into fractional order compartment model

Your problem can be rewritten as $$\mathbf{x}' = A \mathbf{x}\, .$$ Nevertheless, to apply the method of manufactured solutions you need a system of the form $$\mathbf{x}' = A \mathbf{x} + \mathbf{b}\...
nicoguaro's user avatar
  • 8,510
2 votes

How can I learn Scientific Python?

Since you already know Matlab and Mathematica, I would go with SciPy Lecture notes. It is a course on using Python for Scientific purposes. Gael Varoquaux, Valentin Haenel, Pierre de Buyl, Gert-Ludwig ...
nicoguaro's user avatar
  • 8,510
2 votes

How can I learn Scientific Python?

One the most useful things I found myself when converting from matlab to numpy/scipy was this page NumPy for MATLAB users. I even look at this every once in awhile to remind myself even to this day. ...
Kyle Mandli's user avatar
2 votes

Calculate the derivative of the finite-difference method result

Here is another, more analytical view on your problem: You can also rewrite your equation as $$ y^{\prime\prime} + \frac32 (y^2)^\prime = 0 $$ and thus reduce one derivative term: $$ y^{\prime} + \...
davidhigh's user avatar
  • 3,127
1 vote
Accepted

Is there a number base where pi is a rational number?

No, not for any integer base. Irrational doesn't only mean it has infinitely repeating digits (whatever the base may be), it also means that that number cannot be expressed as a ratio of two integers ...
programmar's user avatar
1 vote

Question re Maxima, Magma and/or Sage computational language capabilities

I am happy to report that the problem is solved in Mathematica by Christoph Koutschan by using his add-on package "HolonomicFunctions" (https://www3.risc.jku.at/research/combinat/software/...
Alex's user avatar
  • 73
1 vote
Accepted

ISING2D with Mathematica. Searching a correct way to compute the heat capacity (mean values over several iterations)

Unfortunately I am not a Mathematica whiz. and in general do not encourage the use of Mathematica for extensive numerical simulations like Ising model or the likes. So I will post some answers ...
Nox's user avatar
  • 351
1 vote

Can a second-order ODE be "inconsistent" with its boundary conditions?

It is impossible that finite element or finite difference violate their boundary condition that you imposed. It is not related to the physics of your problem and it's just an issue with your ...
GGG's user avatar
  • 173
1 vote

Writing a programming code directly from the mathematical formula?

One problem with converting Tex syntax to equations is that it can be ambiguous - the main goal with TeX is typesetting the look, not the actual meaning. If you have many formulas already in TeX, ...
Mark Dewing's user avatar
1 vote
Accepted

Numerical solution of nonlinear thermoconductivity equation

You got good advices in comments, but as it is only 1D problem, you can manage it using fully explicit method with very small time steps. I checked your code in Mathematica and there are several ...
Peter Frolkovič's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible