Skip to content

Instantly share code, notes, and snippets.

@pneumocystosis
Last active January 19, 2024 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pneumocystosis/20f3e17d2e1eddaf459547f27cb194c7 to your computer and use it in GitHub Desktop.
Save pneumocystosis/20f3e17d2e1eddaf459547f27cb194c7 to your computer and use it in GitHub Desktop.
from math import *
# Python script to display the cheat sheet for particular solutions in second order linear differential equations
cheat_sheet = """
Cheat Sheet: Particular Solutions for 2nd Order Linear Differential Equations
1. Sinusoidal Forcing Functions:
- General Form: y'' + by' + cy = A*cos(gamma*x) + B*sin(gamma*x)
- Particular Solution Guess: p = l*sin(gamma*x) + m*cos(gamma*x)
- Process:
- Find p' and p''
- Substitute p, p', and p'' into the ODE
- Equate coefficients of sin(gamma*x) and cos(gamma*x) to solve for l and m
- Solutions will be fractions where the denominators are (c - a*gamma^2)^2 + b^2*gamma^2
- If gamma is a root of the characteristic equation, multiply the guess by x
2. Exponential Forcing Functions:
- General Form: y'' + by' + cy = e^(mu*x)
- Particular Solution Guess: p = alpha*e^(mu*x)
- Process:
- Find p' and p''
- Substitute p, p', and p'' into the ODE
- Solve for alpha by equating the coefficient of e^(mu*x) from both sides
- If mu is a root of the characteristic equation, multiply the guess by x
- For repeated roots, multiply by x^2
3. Polynomial Forcing Functions:
- General Form: y'' + by' + cy = p0 + p1*x + ... + pn*x^n
- Particular Solution Guess: p = r0 + r1*x + ... + rn*x^n
- Process:
- Find p' and p''
- Substitute p, p', and p'' into the ODE
- Equate coefficients for each power of x to solve for r0, r1, ..., rn
- If the polynomial degree n matches the characteristic equation's roots, multiply the guess by x to a sufficient power to clear any roots
Key Notes:
- The guess for the particular integral must account for terms already present in the homogeneous solution.
- For each type of forcing function, the undetermined coefficients are solved by equating the coefficients of like terms on both sides of the ODE after substitution.
- The particular solution found by this method is then added to the complementary (homogeneous) solution to form the complete solution to the ODE.
"""
# Display the cheat sheet
print(cheat_sheet)

Keybase proof

I hereby claim:

  • I am pneumocystosis on github.
  • I am pneumocystosis (https://keybase.io/pneumocystosis) on keybase.
  • I have a public key ASCfljHaxMoY_q9kFp-Aly4WEu5haynlSyBnrrlkMxKLZAo

To claim this, I am signing this object:

{
  "body": {
    "key": {
      "eldest_kid": "01209f9631dac4ca18feaf64169f80972e1612ee616b29e54b2067aeb96433128b640a",
      "host": "keybase.io",
      "kid": "01209f9631dac4ca18feaf64169f80972e1612ee616b29e54b2067aeb96433128b640a",
      "uid": "bef5cce8ba43c3e0750422e892c67519",
      "username": "pneumocystosis"
    },
    "merkle_root": {
      "ctime": 1643318019,
      "hash": "bbe836d9d6d0b8a9f478c102b6521d1dcb766e051953f8c3118c570df15c229f2738d7a05e0ba3aa2a31bfcd1f9aaa65f9ee97cc93def1eab2b281fbe3a76b34",
      "hash_meta": "d21939ef716ace4b63dc42a8d1b0f7e23d40864b3774c9e0a2ecc266a9ae9572",
      "seqno": 21738640
    },
    "service": {
      "entropy": "qGd9EvSvCecrBsD+kw7PDKjI",
      "name": "github",
      "username": "pneumocystosis"
    },
    "type": "web_service_binding",
    "version": 2
  },
  "client": {
    "name": "keybase.io go client",
    "version": "5.9.0"
  },
  "ctime": 1643318101,
  "expire_in": 504576000,
  "prev": "09f09b3106bfb51d5402aa3976d9dbe3e2d3e69ea3838c663f602f5553c4fb3f",
  "seqno": 4,
  "tag": "signature"
}

with the key ASCfljHaxMoY_q9kFp-Aly4WEu5haynlSyBnrrlkMxKLZAo, yielding the signature:

hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgn5Yx2sTKGP6vZBafgJcuFhLuYWsp5UsgZ665ZDMSi2QKp3BheWxvYWTESpcCBMQgCfCbMQa/tR1UAqo5dtnb4+LT5p6jg4xmP2AvVVPE+z/EIIKTv79MqJrSw7S3HN/1wkb0WZjZoCKDRMZ//q3vjpD7AgHCo3NpZ8RAaR9Kmo9I9xCUeHQiJGajaggEotVi0A5vuw68HG769xPzKfJUWl9QoD2X+WK8BNzg3PP8LLvIk/NJbfvwrg0WDqhzaWdfdHlwZSCkaGFzaIKkdHlwZQildmFsdWXEICf5KvIfiMWvdI/YxxFh5fDyeUEyIAWaHVxqLRQgdz+xo3RhZ80CAqd2ZXJzaW9uAQ==

And finally, I am proving ownership of the github account by posting this as a gist.

My publicly-auditable identity:

https://keybase.io/pneumocystosis

From the command line:

Consider the keybase command line program.

# look me up
keybase id pneumocystosis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment