Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8646271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:45:51+00:00 2026-06-12T12:45:51+00:00

I have the following python MWE (code is explained below) #!/usr/bin/python from scipy import

  • 0

I have the following python MWE (code is explained below)

#!/usr/bin/python
from scipy import integrate
from math import *
import numpy
import matplotlib.pyplot as plt

def base_equations(y,t,center):
    return [5*exp(-(t-center)**2/3),-5*exp(-(t-center)**2/3)]

def eqexec1(y,t):
    return base_equations(y,t,30)

def eqexec2(y,t):
    return base_equations(y,t,60)

inits=[0.5, 0.5]

trange=numpy.arange(0,100,0.1)
print trange

y1=integrate.odeint(eqexec1,inits, trange, full_output=0, printmessg=1)
y2=integrate.odeint(eqexec2,inits, trange, full_output=0, printmessg=1)
plt.plot(trange,y1,trange,y2)
plt.legend(["y1a","y1b","y2a","y2b"])
plt.xlabel("Time")
plt.show()

As you can see, I’m integrating a set of equations (base_equations) which are, in essence, a Gaussian pulse. I use odeint to numerically solve these equations for two center points of the pulse (30 and 60).

For the first center point (t=30), equation y1 yields expected behavior: the pulse is visible.

For the second center point (t=60), equation y2 yields unexpected behavior: no pulse is visible at all!

The switch between working and not working occurs between 47 and 48.

Graphical output is as below. The expected output is that lines y2a and y2b will show a dramatic change around 60, but they do not.

Image showing a single Gaussian pulse when there should be two.

Any thoughts as to what might be going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:45:52+00:00Added an answer on June 12, 2026 at 12:45 pm

    The integrator increases its step size in the initial region where the derivative is vanishing, and the steps become so large that it steps over the gaussian peak never seeing it.

    You can to tell the integrator to not increase the step size too much:

    y2 = integrate.odeint(eqexec2,inits, trange, full_output=0, printmessg=1,hmax=1.0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following Python code: #!/usr/bin/python # -*- coding: utf-8 -*- import
I have the following code in python from selenium import webdriver from selenium.webdriver.common.by import
I have the following python code: import pty import subprocess os=subprocess.os from subprocess import
I have the following Python (3.2) code: from pygame import * class Application: def
I have the following Python code: #!/usr/bin/env python2.6 class container(object): name = 'container' configuration
I have the following python code: from django.db import models from datetime import datetime
I have following python code: def scrapeSite(urlToCheck): html = urllib2.urlopen(urlToCheck).read() from BeautifulSoup import BeautifulSoup
For the following Python 2.7 code: #!/usr/bin/python def func_a(): print "func_a" c = 0
I have the following python code... import Tkinter root = Tkinter.Tk() root.tk.eval('puts {printed by
I have the following Python 2.7/PyGObject 3.0/PyGST 0.10 module: from gi.repository import Gtk, Gdk,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.