Git Product home page Git Product logo

magnets2's Introduction

Magnetic Field Strength vs Distance

PHY 2049 Lab Report 2

Written in Python 3.8 by Alex C.

The best way to install the jupyter notebook dependencies is to install conda and activate the provided environment using conda env create -f environment.yml

To utilize the environment and ensure the code runs on your computer, download miniconda from conda.io.

Data

The data was taken through Google Science Journal on iOS 14. Each test was run for 5 seconds 5 times, and then exported to a .csv file. The trials were conducted at lengths of 0-10 cm. The raw files are in the directory ./magnet-data/.

The gathered data was analyzed using matplotlib.pyplot, numpy, and scipy.stats.

Expected vs Observed Outcome

For point electric charges like monopoles, the electric field strength decreases as the distance from the source increases, following Coulomb's law: equation

Linear regression model fitting did not work, and with the small amount of data points, fitting to Coulomb's law was not as effective as a wider array of points. The function was best plotted using the lambda expression for reverse exponential regression:

lambda t, a, b: a * np.exp(b * t)

Outputs

Check ./figs/ for .png files of the data from each of the results. The subdirectory ./out/ contains csv files of each dataset where the first row is the mean, the second row is the standard deviation, and the third row is the chisquared values.

Reproducing the Outputs

In a bash/zsh/sh shell with conda installed run:

git clone https://github.com/doc-ock/magnets.git 
cd magnets
conda env create -f environment.yml
conda activate magnets

Once you are in an environment that has the required packages installed, open the jupyter notebook:

jupyter notebook

magnets2's People

Contributors

minifold avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.