Skip to content

nickmccleery/autodiff-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Background

This project contains an incredibly simple example of automatic differentation as applied to the computation of an I-section beam's second moment of area.

The example file, src/example.py, computes the second moment of area for an I-section beam, while also using the auto-diff package to compute the partial derivatives of the beam's second moment of area with respect to the beam's dimensions.

Environment Setup

Use of pyenv for is recommended for the management of multiple Python versions. To install pyenv on a Unix-based system then configure the desired version for this project (3.11), steps are follows:

  1. Install pyenv:
  2. Install python version: pyenv install 3.11
  3. Set local environment in working directory pyenv local 3.11.

This will create a .python-version file in the working directory.

Use a virtual environment is also recommended. To achieve this with venv, follow the steps below:

  1. Install venv:
    • sudo apt-get install python3-venv
  2. Create a virtual environment:
    • python3 -m venv environment/venv/development
  3. Activate the virtual environment:
    • source environment/venv/development/bin/activate
  4. Install the project dependencies:
    • pip install -r environment/requirements.txt

VSCode Usage

If using VSCode, it will also be necessary to set the Python interpreter to the local environment. This can be achieved by launching the command palette (Ctrl+Shift+P or F1) and searching for Python: Select Interpreter. Select the file at environment/venv/development/bin/python to set the interpreter.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages