{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# IPython Notebook for turning in solutions to the problems in the Essentials of Paleomagnetism Textbook by L. Tauxe" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Problems in Chapter 7" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Most of these problems, you should be able to solve on your own. congratulations! you are a programmer now! But here is one hint that will help you out with Problem 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Problem 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Type in here the text for your problem. what is tau? how does it depend on M?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this problem, I want you to use the nice 'tabulate' environment, downloaded from https://pypi.python.org/pypi/tabulate/0.7.2\n", "unzip the downloaded file, change directories into it and type the command\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "pip install tabulate.\n", "\n", "You can use tabulate like this..... " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "------- ------- ------ ---------\n", "mineral M (A/m) B (uT) tau (sec)\n", "------- ------- ------ ---------\n", "------- -------------- ------------- --------------\n", "mineral some number some field some number\n", "mineral another number another field another number\n", "------- -------------- ------------- --------------\n" ] } ], "source": [ "from tabulate import tabulate\n", "header = [[\"mineral\",\"M (A/m)\",\"B (uT)\", \"tau (sec)\"]]\n", "table=[['mineral','some number','some field','some number'],\n", " ['mineral', 'another number','another field','another number']]\n", "print tabulate(header)\n", "print tabulate(table)\n", "# and so on. of course you put in your own data. " ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }