Skip to main content

All Questions

Tagged with
0 votes
0 answers
35 views

Jacobi method converges faster than Gauss-Seidel in case of Laplace equation

It is need to solve the problem using the Jacobi method: d^T/dx^2 + d^2T/dy^2 = 0 with conditions at the boundaries of the square: T(0, y) = 1, T(x, 1) = 1, dT/dx(1, y) = 1 - y, dT/dy(x, 0) = x. ...
ulyannaaa's user avatar
0 votes
1 answer
73 views

polynomial evaluation producing non-differentiable behavior in Python

I'm trying to evaluate a polynomial of degree 61. However, around the point sqrt(2) I get some weird behavior. The graph of the polynomial becomes erratic. What could be the reason for this. The ...
Olof R's user avatar
  • 113
1 vote
1 answer
47 views

Unexplained gain in my code when solving coupled differential equations using solve_ivp() in python

I am trying to solve two coupled differential equations in python using the solve:ivp() function from scipy.integrate but I get an unexplained gain on one of my terms that breaks the equation. It is ...
Lucas Leal Abadi's user avatar
0 votes
0 answers
35 views

Optimizing a numerical integration that involves matrices using sympy

The expression I'm integrating is Where the latent variables are sampled from the a multivariate distribution as following: And the random variables w_n given a latent variable is sampled from a ...
Mea12's user avatar
  • 71
1 vote
2 answers
81 views

Simple 1 D dispersion equation numerical solution

I am new to coding and trying to solve a simple 1D dispersion equation. The equation and boundary conditions: adC/dx = bd^2C/dx^2 x = hj, C = C0; x = - inf, C =0 The analytical solution is C = C0 * ...
user28866182's user avatar
2 votes
1 answer
86 views

How can I approximate 255/sqrt(x) using Newton's method?

I am trying to approximate 255 / sqrt(x) using Newton's method to avoid using division or the sqrt() operation on an architecture where those operations are expensive. My derivation is: y = 255 / sqrt(...
the five states's user avatar
1 vote
0 answers
56 views

How to efficiently integrate over a hexagonal region using Cubature in python?

I need to integrate a two-variable function numerically using the Cubature package in Python. The two-dimensional region over which I want to integrate is a hexagon. Integrating it in a circular ...
Rinchen Sherpa's user avatar
1 vote
2 answers
205 views

vectorize an Ax=b solver

A lot of numerical solvers (such as this one), for some reason, only supports solving Ax=b where x, b are vectors. What if I want to solve AX = B, where X and B are matrices. I know numerically one ...
Taylor Fang's user avatar
0 votes
1 answer
103 views

How to evaluating solutions to Coupled Nonlinear Elliptic ODEs with Relaxation Method?

I would like to determine the following system of coupled, nonlinear, elliptic ODEs of second order with boundary conditions f(0) = h(0) = 0, f(1) = h(1) = 1. I used a relaxation method to solve the ...
Hendriksdf5's user avatar
0 votes
3 answers
108 views

running sum of np.array with widely varying elements

I need to calculate the running sum of np.array. Let's say a is a given np.array of length l and n is an integer step, then I need an array b of length l - n + 1, where b= [a[0]+a[1]+...+a[n-1], a[1]+...
Oleg's user avatar
  • 19
2 votes
1 answer
539 views

Solving coupled 2nd order ODE, numerical in Python

I would like to solve the following DGL system numerically in python: The procedure should be the same as always. I have 2 coupled differential equations of the 2nd order and I use the substitution g'...
Hendriksdf5's user avatar
2 votes
1 answer
60 views

Problems to solve non-linear coupled dgl in python (numerical)

I have the following problem. I would like to solve the following DGL system numerically in python: $$ \begin{align*} &g'' + \frac{2}{r} g' - \frac{2}{r^2} g - \frac{3}{r} e g^2 - e^2 g^3 - \frac{...
Hendriksdf5's user avatar
0 votes
0 answers
35 views

Custom Riemann solver

I have written my own Riemann solver for a specific problem. Unfortunately, I am unable to update the solution over time and create a simulation using PyClaw. I am quite new to PyClaw and have tried ...
user25209335's user avatar
0 votes
0 answers
71 views

Apply Crank-Nicolson method to wave equation with np.linalg.solve

I want to solve a system of equations, where x,y are the vectors which I want the solutions. And c,d are the solutions. A,B are matrix x-y=c+d y-Ax=Bd+c The full problem which I tried to summarize ...
Guillermo Fuentes's user avatar
-1 votes
1 answer
593 views

using pandas to number and coerce to force values to ints and still not working

Confused when I am trying to coerce dataframe to numeric. It appears to work when I look at structure but then I still get errors: TypeError: unsupported operand type(s) for +: 'int' and 'str' Code: ...
user3120266's user avatar

15 30 50 per page
1
2 3 4 5
28