430 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
1
answer
269
views
Why does Newton’s method overshoot on the first deceleration step in my motion profile generator?
I’m porting a Python motion profile generator to C to implement for my STM32H743. The generator produces step timings for a simple acceleration → cruise → deceleration motion profile. See the ...
0
votes
0
answers
94
views
Convergence of differential transformation method (DTM) L/h=20
For the past few weeks, I have been trying to determine the natural frequencies of the vibrations of a Timoshenko beam in FGM using the differential transformation method (DTM). To achieve this, I ...
0
votes
1
answer
78
views
How can I accurately measure small time differences in Python?
I'm working on a project for which I'm analyzing how quickly Newton's method can calculate a zero of a function from different starting points. I've written the program below and everything seems to ...
1
vote
1
answer
100
views
Newton raphson fails to approximate beyond two decimal points
I've written a program which finds roots of a two function system using the Newton Raphson method. Its goal is to solve for two unknowns of a closed vector loop (sketches below). The issue is that it ...
4
votes
1
answer
147
views
How does NumPy solve nth (5 and higher) degree polynomials?
There is a function in NumPy that solves any polynomial with given coefficient (numpy.roots()). So how does NumPy solve it if there is no formula for 5th and higher degree polynomials?
I know about ...
3
votes
1
answer
113
views
Where does SciPy's adaptive step size method for finite differences originate?
Inside the KrylovJacobian class from SciPy, there is this method:
def _update_diff_step(self):
mx = abs(self.x0).max()
mf = abs(self.f0).max()
self.omega = self.rdiff * max(1, mx) / max(1, ...
0
votes
1
answer
112
views
Experimental order of convergence for Newton methods - MATLAB
I'm having problems with a piece of MATLAB code that is supposed to calculate the experimental order of convergence for the modified Newton method and the Truncated newton method.
x_min is the real ...
0
votes
1
answer
135
views
Using Preconditioners in scipy.minimize
Can I use Jacobi Preconditioning for the inner CG step in Truncated Newton Conjugate implementation of scipy?
The options for the TNC solver do not include any support for preconditioning. I'm ...
0
votes
0
answers
59
views
Suspected code error in root-function when optimizing with newton_krylov() from scipy
I'm trying to optimize the following equation using the newton_krylov function from scipy:
## This function is what will be used in the newton_krylov optimization process
def residual_function(...
1
vote
1
answer
597
views
optimize.newton error: Failed to converge after some iterations, value is using an equation that contains norm.cdf
I am using scipy from Python in order to solve an equation that contains norm.cdf.
I have an equation similar to this:
import numpy as np
from scipy.stats import norm
from scipy.misc import derivative
...
4
votes
1
answer
118
views
How to make scipy newton_krylov use a different derivative approximation method
After reading the documentation seems like it uses forward difference as its approximation method, but I can't see any direct way to make it use other method or a custom one.
Using the tools in the ...
4
votes
0
answers
56
views
Why scipy checks abs(q1) < abs(q0) before for loop in Secant method?
scipy.optimize.newton for the Secant method in this line checks the condition:
if abs(q1) < abs(q0):
p0, p1, q0, q1 = p1, p0, q1, q0
Why do they reorder p0 and p1 after that?
As I understand ...
0
votes
2
answers
153
views
python GLM Poisson regression diverges in hand-coded implementation
I'm having trouble with convergence of this R-code translated to Python: statsmodels.GLM gives correct result
import numpy as np
import pandas as pd
from scipy.special import expit # overflow ...
-2
votes
1
answer
67
views
JSON parsing error when reading from URL C#
I am trying to read a JSON file from a URL. The JSON file has a header and some details that I need. Unfortunately, this is my first time doing this, so I would appreciate any guidance you can provide....
2
votes
0
answers
92
views
Speeding Up Newton Step (Jax Neural Network)
I am working on a problem that I can solve with small scale neural networks but need to use a newton like update. I have provided a working example below and wanted to know if anyone can give me some ...