Skip to content
| Marketplace
Sign in
Visual Studio Code>Themes>Monokai XNew to Visual Studio Code? Get it now.
Monokai X

Monokai X

Say OL

|
430 installs
| (2) | Free
Modification of Monokai Aora
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Monokai X

Install Jetbrains Mono Font

Some monospace fonts from Google Fonts. For instance, to make JetBrains Mono font family available for Visual Studio Code editor, you have to download and install into your system by follow below instructions:

  • Download Jetbrains Mono from Google Fonts
  • Extract contents from JetBrains_Mono.zip
  • Install all static fonts from ./JetBrains_Mono/static

Install Additional Extensions

Python users may be pleased to test the flavor of the following extensions:

  1. Code Runner by Jun Han
  2. CodeSnap by adpyke
  3. Error Lens by Alexander
  4. Excel Viewer by GrapeCity
  5. FontSize Viewer by Foss & Haas
  6. indent-rainbow by oderwat
  7. IntelliCode Completions by Microsoft
  8. Jupyter by Microsoft
  9. Jupyter Cell Tags by Microsoft
  10. Jupyter Keymap by Microsoft
  11. Jupyter Notebook Rederers by Microsoft
  12. Jupyter Slide Show by Microsoft
  13. Material Icon Theme by Philipp Kief
  14. Pylance by Microsoft
  15. Python by Microsoft
  16. Rainbow CSV by cechatroner
  17. vscode-pdf by romoki207

Install Additional Kernels

To use the Jupyter Notebook and Code Formatter, Python users have to install ipykernel and autopep8. To achieve this, launch Terminal or Command Prompt and run the following commands.

  1. pip install autopep8
  2. pip install ipykernel

Configure Additional Settings

  1. Shortcut key: Ctrl+Shift+P to open Command Pallete
  2. Input >Preferences: open user settings (JSON)
  3. Add the following customizations to settings.json:
{
    "git.autofetch": true,
    "window.commandCenter": true,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
    "files.autoSave": "afterDelay",
    "workbench.colorTheme": "Monokai X",
    "workbench.iconTheme": "material-icon-theme",
    "fontshortcuts.step": 2,
    "fontshortcuts.defaultFontSize": 18,
    "fontshortcuts.defaultTerminalFontSize": 18,
    "editor.fontSize": 18,
    "editor.lineHeight": 30,
    "editor.fontFamily": "JetBrains Mono",
    "editor.fontLigatures": false,
    "editor.fontWeight": 400,
    "editor.letterSpacing": 1,
    "editor.tabSize": 4,
    "editor.mouseWheelZoom": false,
    "editor.glyphMargin": false,
    "editor.lineNumbers": "on",
    "editor.minimap.enabled": false,
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "editor.hover.enabled": true,
    "editor.tabCompletion": "on",
    "editor.renderLineHighlight": "gutter",
    "editor.parameterHints.enabled": false,
    "editor.accessibilitySupport": "on",
    "editor.cursorBlinking": "expand",
    "editor.cursorWidth": 4,
    "jupyter.interactiveWindow.creationMode": "perFile",
    "notebook.output.textLineLimit": 120,
    "notebook.output.lineHeight": 0,
    "notebook.markup.fontSize": 16,
    "notebook.output.fontSize": 16,
    "notebook.output.scrolling": true,
    "notebook.formatOnSave.enabled": true,
    "notebook.lineNumbers": "on",
    "notebook.insertToolbarLocation": "both",
    "notebook.cellToolbarLocation": {
        "default": "hidden"
    },
    "[python]": {
        "editor.defaultFormatter": "ms-python.python"
    },
    "python.formatting.provider": "autopep8",
    "python.formatting.autopep8Args": [
        "--experimental",
        "--max-line-length=120"
    ],
    "indentRainbow.indicatorStyle": "classic",
    "indentRainbow.ignoreErrorLanguages": [
        "python"
    ],
    "indentRainbow.colors": [
        "rgba(255,255,64,0.2)",
        "rgba(127,255,127,0.2)",
        "rgba(255,127,255,0.2)",
        "rgba(79,236,236,0.2)"
    ],
    "codesnap.target": "window",
    "codesnap.roundedCorners": true,
    "codesnap.showWindowTitle": true,
    "codesnap.realLineNumbers": true,
    "codesnap.containerPadding": "1em",
    "code-runner.clearPreviousOutput": true,
    "[code-runner-output]": {
        "editor.fontSize": 16,
    },
    "audioCues.volume": 50,
    "audioCues.notebookCellCompleted": "off",
    "audioCues.notebookCellFailed": "off",
    "audioCues.diffLineDeleted": "off",
    "audioCues.diffLineInserted": "off",
    "audioCues.diffLineModified": "off",
    "audioCues.lineHasBreakpoint": "off",
    "audioCues.lineHasError": "off",
    "audioCues.lineHasFoldedArea": "off",
    "audioCues.lineHasInlineSuggestion": "off",
    "audioCues.noInlayHints": "off",
    "audioCues.onDebugBreak": "off",
    "audioCues.taskCompleted": "off",
    "audioCues.taskFailed": "off",
    "audioCues.terminalCommandFailed": "off",
    "audioCues.terminalQuickFix": "off",
}

Screenshot

After following above instruction, your Visual Studion Code should look like:

Screenshot

Sample Code

This is RungeKutta2.py sample code.

import numpy as np
import pandas as pd
from collections.abc import Callable
from typing import Literal


def RungeKutta2(f: Callable[[np.float64, np.float64], np.float64],
                t_span: np.ndarray,
                y_init: np.float64,
                n: int,
                method: Literal["Midpoint", "Heun", "Ralston"]
                ) -> pd.DataFrame:
    if method == "Midpoint":
        c = np.array(object=[0, 1/2], dtype=np.float64)
        a = np.array(object=[[0, 0],
                             [1/2, 0]],
                     dtype=np.float64)
        b = np.array(object=[0, 1], dtype=np.float64)
    elif method == "Heun":
        c = np.array(object=[0, 1], dtype=np.float64)
        a = np.array(object=[[0, 0],
                             [1, 0]],
                     dtype=np.float64)
        b = np.array(object=[1/2, 1/2], dtype=np.float64)
    elif method == "Ralston":
        c = np.array(object=[0, 2/3], dtype=np.float64)
        a = np.array(object=[[0, 0],
                             [2/3, 0]],
                     dtype=np.float64)
        b = np.array(object=[1/4, 3/4], dtype=np.float64)
    h = (t_span[1]-t_span[0]) / n
    t = np.linspace(start=t_span[0], stop=t_span[1], num=n+1, dtype=np.float64)
    y = np.full_like(a=t, fill_value=np.nan, dtype=np.float64)
    y[0] = y_init
    for i in range(0, n, 1):
        k0 = f(t[i], y[i])
        k1 = f(t[i]+c[1]*h, y[i]+(a[1, 0]*k0)*h)
        y[i+1] = y[i] + h*(b[0]*k0 + b[1]*k1)
    df = pd.DataFrame(data={"t": t, "y": y}, dtype=np.float64)
    return df


if __name__ == '__main__':
    def f(t: np.float64, y: np.float64) -> np.float64:
        return 2*(1-t*y) / (t**2+1)
    t_span = np.array(object=[0, 1], dtype=np.float64)
    y_init = 1.0
    n = 10

    def y(t: np.float64) -> np.float64:
        return (2*t+1) / (t**2+1)
    t = np.linspace(start=t_span[0],
                    stop=t_span[1],
                    num=n+1,
                    dtype=np.float64)
    df = pd.DataFrame(data={"t": t}, dtype=np.float64)
    df["y_exact"] = df["t"].apply(func=y)
    methods = ["Midpoint", "Heun", "Ralston"]
    for method in methods:
        df_method = RungeKutta2(f=f,
                                t_span=t_span,
                                y_init=y_init,
                                n=n,
                                method=method)
        df_method.rename(columns={"y": f"y_{method}"},
                         inplace=True)
        df_method[f"e_{method}"] = abs(df["y_exact"]-df_method[f"y_{method}"])
        df = pd.concat(objs=(df, df_method[[f"y_{method}", f"e_{method}"]]),
                       axis="columns")
    pd.options.display.float_format = "{:.10f}".format
    print(df)
    df.style.format(precision=10).to_latex("RungeKutta2.tex")

YouTube Video

Click the screenshot to watch the video.

Numerical Analysis :: Runge Kutta Method of Order 2 ( Python3 )

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft