SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external libraries.
A blog to record helpful tips/hints/tricks/etc. that I come across during my scientific career regarding science, computers, and research. I love learning and disseminating Knowledge.
Tuesday, January 31, 2012
SymPy - Python library for symbolic mathematics
http://sympy.org/en/index.html
Labels:
Math,
Math Software,
Numerical math,
Python,
SymPy
matplotlib: python plotting
http://matplotlib.sourceforge.net/
matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala MATLAB®* or Mathematica®†), web application servers, and six graphical user interface toolkits. matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. For a sampling, see the screenshots, thumbnail gallery, and examples directory
Labels:
matlibplot,
Numerical math,
Numerical software,
plotting,
Programming,
Python
Sage - 2D plot - simple plot, more than one function on the same plot, axes limits, change color of function in graph
There are many options when plotting in Sage. Here is a simple example.
In Sage, the variable x is automatically known/defined. I then create a simple function similar to how I created alpha and f. I next equal p to the plot since I wanted to change the y axis range manually which you can do through the show command (or this can also be done in the plot command as well).
Here is another example of a 2D plot. This one shows how to plot a couple of functions.
alpha = 30*pi/180 show(alpha) show(float(alpha)) f = (arcsin(alpha))^2 + log(tan(alpha/2)) - arcsin(alpha)*arctan(alpha) show(f) show(float(f)) g = (1/(0.7*sin(x)))*sqrt(1 + ((pi)^(-2))*((0.7*sin(x))^2)*(f - csc(x)*tan(x/2) - log(tan(x/2)))) p = plot(g, (0, alpha)) show(p, ymin = 0, ymax = 20)
In Sage, the variable x is automatically known/defined. I then create a simple function similar to how I created alpha and f. I next equal p to the plot since I wanted to change the y axis range manually which you can do through the show command (or this can also be done in the plot command as well).
Here is another example of a 2D plot. This one shows how to plot a couple of functions.
alpha = 30*pi/180 show(alpha) show(float(alpha)) z = 0.5 r_max = z*tan(alpha) show(r_max) show(float(r_max)) lamb_da = (csc(alpha))^2 - (cot(alpha))*(csc(alpha)) + log(tan(alpha/2)) show(float(lamb_da)) cig_ma_c = 1 r = var('r') psee = (1/2*pi)*(cig_ma_c)*(r^2)*(lamb_da + (z/r)*sqrt(1 + (z/r)^2) - log(sqrt(1 + (z/r)^2) - z/r) - 1 - (z/r)^2) lamb_da_bi = (csc(alpha))^2 - (cot(alpha))*(csc(alpha)) + log(tan(alpha)/2) show(float(lamb_da_bi)) psee_bi = (1/2*pi)*(cig_ma_c)*(r^2)*(lamb_da_bi + (z/r)*sqrt(1 + (z/r)^2) - log(r/(2*z)) - 1 - (z/r)^2) p1 = plot(psee, (r, 0, r_max)) p2 = plot(psee_bi, (r, 0, r_max), color ='green') show(p1 + p2)
Labels:
2D plot,
Math,
Math Software,
plotting,
Sage
Sage - displaying a float decimal point
In Sage, like many other mathematics software, uses either a float command or you can simply put a "." in your value to display decimals.
Screenshot:
f = (arcsin(alpha))^2 + log(tan(alpha/2)) - arcsin(alpha)*arctan(alpha) show(f) show(float(f))
Screenshot:
Labels:
Math,
Math Software,
Sage
Monday, January 30, 2012
Sage - Declaring a value
So first things first. I simply want to declare a value for something. In this case I want alpha to equal some number.
Hit evaluate and it gives: (1/6)*pi It works!
alpha = 30*pi/180 show(alpha)
Hit evaluate and it gives: (1/6)*pi It works!
Labels:
Math,
Math Software,
Numerical software,
Sage
Installing Sage for Windows 7
This is a pretty cool mathematical program/software which is kind of like a combination of MATLAB/Octave, Mathematica, Maple, Maxima, etc. They even say that as a description. I've mentioned Sage before, but now I am going to really give it a go. To install for Windows 7 simply go here http://wiki.sagemath.org/SageAppliance and follow the instructions. First you will need to DL and install VirtualBox, though, here https://www.virtualbox.org/wiki/Downloads and DL the Windows Sage appliance here http://www.sagemath.org/download-windows.html.
Here are my earlier posts about Sage:
http://timothyandrewbarber.blogspot.com/2011/08/sage-open-source-mathematics-software.html
http://timothyandrewbarber.blogspot.com/2011/08/pre-built-binary-install-sage.html <-- Ubuntu install
http://timothyandrewbarber.blogspot.com/2011/08/sage-in-emacs-and-tex.html
Labels:
Math Software,
Sage,
VirtualBox,
Windows
Python for Windows 7
I am going to try to explore using the computer programming language Python. It seems to be "easier" to use than say C or even C++ since, so it seems, a lot of stuff is done upfront like MATLAB/Octave. There is no need to code everything. I'll give some examples later.
In order to install Python on Windows 7, it's pretty simple. Just follow this link, http://python.org/getit/, and download the version you'd like for windows. Run the installer and there you have it.
In order to install Python on Windows 7, it's pretty simple. Just follow this link, http://python.org/getit/, and download the version you'd like for windows. Run the installer and there you have it.
Sunday, January 29, 2012
Maxima and wxMaxima in Windows 7
I am forced to use Windows every now and then, but I have recently found out that some of my favorite software works for Windows and is relatively easy to install. Maxima is very easy, as you just download and run the Windows installer from here: http://www.windows7download.com/win7-maxima/kqcjkmcz.html
Installing Maxima for Windows also installs wxMaxima (and Xmaxima if wanted) and gnuplot. Here is a screenshot.
Installing Maxima for Windows also installs wxMaxima (and Xmaxima if wanted) and gnuplot. Here is a screenshot.
Friday, January 27, 2012
Updated AIAA website
Whoa, check out AIAA's new webpage design.
PPA Installing the latest KDE 4.8 in (K)Ubuntu 11.10
PPA Installing the latest KDE 4.8 in (K)Ubuntu 11.10:
http://kde.org/announcements/4.8/
Looks like a new version of KDE is out.
http://kde.org/announcements/4.8/
Looks like a new version of KDE is out.
Labels:
KDE,
Kubuntu,
Ubuntu 11.10
Please Make A Note: LaTeX: Vertical Spacing in Multiline Equations
Please Make A Note: LaTeX: Vertical Spacing in Multiline Equations: "\setlength{\jot}{12pt}"
Haha, I was searching if \vspace*{} worked or not in the align environment and stumbled across my friend's blog post. This works! However, for local entries I had to put yNot's suggestion from the comments where after the line breaks you put [12 pt], for example.
before:
after:
Haha, I was searching if \vspace*{} worked or not in the align environment and stumbled across my friend's blog post. This works! However, for local entries I had to put yNot's suggestion from the comments where after the line breaks you put [12 pt], for example.
\begin{align}\setlength{\jot}{12pt} \psi_{yyyy} = \alpha &R \left[ \psi_{yyt} + \left( y + \psi_y \right) \psi_{xyy} - \psi_{yyy} \psi_x \right] - 2 \alpha^2 \psi_{xxyy} \nonumber \\[12 pt] &+ \alpha^3 R \left[ \psi_{xxt} + \left( y + \psi_y \right) \psi_{xxx} - \psi_x \psi_{xxy} \right] - \alpha^4 \psi_{xxxx} \end{align}
before:
after:
Monday, January 23, 2012
LaTeX - Math - nth power root
In order to write an nth power root the command is:
\[\sqrt[3]{x}\]
where n is the power of the root and k is the expression within the root symbol.
Found this and also other LaTeX help here: http://web.mit.edu/rsi/www/2003/help/faq/latex/#faq9
\sqrt[n]{k}
\[\sqrt[3]{x}\]
where n is the power of the root and k is the expression within the root symbol.
Found this and also other LaTeX help here: http://web.mit.edu/rsi/www/2003/help/faq/latex/#faq9
Sunday, January 22, 2012
Installing GNOME 3 Shell on Ubuntu 11.10: Update
Now that Gnome 3 has officially been released it is easier than ever to install. Simply go the USC and search for gnome. Should be the top choice as The GNOME Desktop Environment, with extra components.
Update: 2-8-11
I got Gnome 3 to install fine on a desktop. However, my laptop didn't like it.
Here are some links related to Gnome 3:
http://www.techdrivein.com/2011/11/8-things-i-did-after-installing-gnome.html
http://www.techdrivein.com/2011/10/7-best-gnome-shell-extensions-install.html
http://www.techdrivein.com/2011/10/how-to-install-and-manage-gnome-shell.html
http://www.techdrivein.com/2011/09/top-10-gnome-shell-themes.html
Update: 2-8-11
I got Gnome 3 to install fine on a desktop. However, my laptop didn't like it.
Here are some links related to Gnome 3:
http://www.techdrivein.com/2011/11/8-things-i-did-after-installing-gnome.html
http://www.techdrivein.com/2011/10/7-best-gnome-shell-extensions-install.html
http://www.techdrivein.com/2011/10/how-to-install-and-manage-gnome-shell.html
http://www.techdrivein.com/2011/09/top-10-gnome-shell-themes.html
Labels:
GNOME 3,
Ubuntu 11.10
Wednesday, January 18, 2012
Mendeley Desktop Update 1.3.1 - Ubuntu 11.10
A new release just came out for MD. It is version 1.3.1, and update manager in Ubuntu 11.10 automatically installed it this time!
Labels:
Mendeley Desktop,
Ubuntu 11.10
Sunday, January 15, 2012
Mayavi Project - 3D Scientific Data Visualization and Plotting
Mayavi Project - 3D Scientific Data Visualization and Plotting
The Mayavi project includes two related packages for 3-dimensional visualization:
- Mayavi: A tool for easy and interactive visualization of data, with seamless integration with Python scientific libraries.
- TVTK: A Traits-based wrapper for the Visualization Toolkit, a popular open-source visualization library. These libraries operate at different levels of abstraction. TVTK manipulates visualization objects, while Mayavi lets you operate on your data, and then see the results. Most users either use the Mayavi user interface or program to its scripting interface; you probably don't need to interact with TVTK unless you want to create a new Mayavi module.
Mayavi
Mayavi seeks to provide easy and interactive visualization of 3-D data. It offers:
- An (optional) rich user interface with dialogs to interact with all data and objects in the visualization.
- A simple and clean scripting interface in Python, including one-liners, or an object-oriented programming interface. Mayavi integrates seamlessly with numpy and scipy for 3D plotting and can even be used in IPython interactively, similarly to Matplotlib.
- The power of the VTK toolkit, harnessed through these interfaces, without forcing you to learn it. Additionally Mayavi is a reusable tool that can be embedded in your applications in different ways or combined with the Envisage application-building framework to assemble domain-specific tools.
TVTK
TVTK wraps VTK objects to provide a convenient, Pythonic API, while supporting Traits attributes and NumPy/SciPy arrays. TVTK is implemented mostly in pure Python, except for a small extension module. Developers typically use TVTK to write Mayavi modules, and then use Mayavi to interact with visualizations or create applications.Using Mayavi from ipython
The Mayavi application
SciPy and NumPy - Scientific Tools for Python
Scientific Tools for Python
SciPy (pronounced "Sigh Pie") is open-source software for mathematics, science, and engineering. It is also the name of a very popular conference on scientific programming with Python. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation. The SciPy library is built to work with NumPy arrays, and provides many user-friendly and efficient numerical routines such as routines for numerical integration and optimization. Together, they run on all popular operating systems, are quick to install, and are free of charge. NumPy and SciPy are easy to use, but powerful enough to be depended upon by some of the world's leading scientists and engineers. If you need to manipulate numbers on a computer and display or publish the results, give SciPy a try!
Python and Scientific Computing
NumPy and SciPy are two of many open-source packages for scientific computing that use the Python programming language. This website, together with other subdomains of the scipy.org domain, serves as a portal for all scientific computing with Python, not just NumPy and SciPy. The index under Topical Software in the navigation bar lists these domains and other destinations for scientific software using Python.
Good places to start to learn more about SciPy:
- Index of Python packages for scientific computing
- Projects using NumPy / SciPy
- Download NumPy / SciPy
This is a community effort. We seek volunteers at all levels of ability to work on the project, from coding and packaging to documentation, tutorials, recipes, and the web site. Visit the Developer Zone if you are interested in helping out. SciPy is sponsored by Enthought, Inc.SciPy optimization on Ubuntu Linux
NumPy is the fundamental package needed for scientific computing with Python. It contains among other things:
- a powerful N-dimensional array object
- sophisticated (broadcasting) functions
- tools for integrating C/C++ and Fortran code
- useful linear algebra, Fourier transform, and random number capabilities.
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and speedily integrate with a wide variety of databases. Numpy is licensed under the BSD license, enabling reuse with few restrictions.
LaTeX - Table of Contents
Some links to help with a table of contents in LaTeX:
http://www.personal.ceu.hu/tex/toc.htm
http://en.wikibooks.org/wiki/LaTeX/Document_Structure#Table_of_contents
http://en.wikibooks.org/wiki/LaTeX/Indexing#Adding_Index_to_Table_Of_Contents
http://www.andy-roberts.net/writing/latex/contents
http://www.personal.ceu.hu/tex/toc.htm
http://en.wikibooks.org/wiki/LaTeX/Document_Structure#Table_of_contents
http://en.wikibooks.org/wiki/LaTeX/Indexing#Adding_Index_to_Table_Of_Contents
http://www.andy-roberts.net/writing/latex/contents
Labels:
Latex
Saturday, January 14, 2012
LaTeX - KOMA Scripts
Information on KOMA scripts in LaTeX:
http://tex.stackexchange.com/questions/1351/most-useful-additions-in-koma-script
http://tex.stackexchange.com/questions/1351/most-useful-additions-in-koma-script
Labels:
Latex
LaTeX - Subtitles
Helpful links for subtitles in LaTeX:
http://kom.aau.dk/net/guides/latex.html
http://tex.stackexchange.com/questions/5948/subtitle-doesnt-work-in-article-document-class
http://kom.aau.dk/net/guides/latex.html
http://tex.stackexchange.com/questions/5948/subtitle-doesnt-work-in-article-document-class
Labels:
Latex
LaTeX - Document Classes
Some links to help with document classes in LaTeX:
http://en.wikibooks.org/wiki/LaTeX/Basics
http://texblog.org/2007/07/09/documentclassbook-report-article-or-letter/
http://tex.stackexchange.com/questions/4221/what-are-your-favorite-document-classes-and-what-do-you-use-them-for
http://tex.stackexchange.com/questions/782/what-are-the-available-documentclass-types-and-their-uses
http://en.wikibooks.org/wiki/LaTeX/Basics
http://texblog.org/2007/07/09/documentclassbook-report-article-or-letter/
http://tex.stackexchange.com/questions/4221/what-are-your-favorite-document-classes-and-what-do-you-use-them-for
http://tex.stackexchange.com/questions/782/what-are-the-available-documentclass-types-and-their-uses
Labels:
Latex
LaTeX - Appendixes/Appendices
Some links for Appendices in LaTeX:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=appendix
http://en.wikibooks.org/wiki/LaTeX/Document_Structure
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=appendix
http://en.wikibooks.org/wiki/LaTeX/Document_Structure
Labels:
Latex
Monday, January 9, 2012
Updating Mendeley Desktop from version 1.1 to 1.3 in Ubuntu 11.10
Alright, so I was having issues updating MD. I finally figured it out. Stupid mistake by me. I posted this in the Mendeley support forum:
I answered it myself once I figured it out which wasn't long after I posted it!!
Just type sudo dpkg -i mendeleydesktop_1.3_amd64.deb in the terminal but make sure you point it to or are in the right directory. I had to do this since the commands sudo apt-get update and sudo apt-get install mendeleydesktop did not work for me. I think it has something to do with MD not having posted a repository for Ubuntu 11.10 yet (?).
Edit: 1-18-12 A new release just came out for MD, 1.3.1. The update manager automatically installed it this time.
I am having trouble upgrading from MD ver 1.1 to 1.3 in Ubuntu 11.10. I've looked everywhere for help but haven't found any. I noticed there (or I couldn't find it at least) is not an MD repository for Ubuntu 11.10. Is it because there (from what I have noticed) are some problems with dpgk and/or dependcies, etc., especially with new installations? I've tried deleting and re-downloading. I've tried running the update in the terminal, in the update manger, and in the software center. So far, nothing works. I don't want to delete and do a fresh install since Mendeley Desktop does not save preferences/settings for "Document Details" (unless there is a way and I do not know/ haven't found it). Any ideas, thoughts?
I answered it myself once I figured it out which wasn't long after I posted it!!
Ahh, what a sec. I may have found my mistake. I tried "sudo dpkg -i mendeleydesktop_1.3_amd64.deb" but didn't realize, until now, that I didn't specify the directory which is in Downloads in my home folder. I also didn't read the error closely which told me the file wasn't found in the directory I was using!! So I changed the directory and reran the command. Oh yeah, that worked! Doh! Sorry. Well if anyone overlooks stuff like me, then maybe this will help!
Just type sudo dpkg -i mendeleydesktop_1.3_amd64.deb in the terminal but make sure you point it to or are in the right directory. I had to do this since the commands sudo apt-get update and sudo apt-get install mendeleydesktop did not work for me. I think it has something to do with MD not having posted a repository for Ubuntu 11.10 yet (?).
Edit: 1-18-12 A new release just came out for MD, 1.3.1. The update manager automatically installed it this time.
Thursday, January 5, 2012
Inkscape - exporting bitmap (as a .png file) getting rid of unwanted checkered background/hatch fill
Ok, so I've been using Inkscape for awhile for drawing simple images, and I love it. However, I don't know if this is default or what, but when you begin exporting your image using "Export Bitmap" it exports the file fine as a .png except there is this hatched fill or checkered background on the image! I finally found out how to fix this from here: http://www.inkscapeforum.com/viewtopic.php?f=5&t=820 at about halfway down the page.
To fix this, while in Inkscape go to File - Document Properties. Then click on the area where it says background. It should, at least in my case, have half of the bar or strip as white and the other half as checkered. When you click on it, this is really strange, the settings are all on white! However, I clicked on the hatched portion, called Alpha (opacity) and then move it to darker (left) then moved it back to white/lighter (right). Then it disappeared (the checkered area)!
BTW, I tried to fix it manually by going to the object fill and stroke properties, but like above the settings were all on white. I don't think I tried messing with the checkered setting, but I would just do the above steps to fix the whole thing.
I also, before, used, from what I remembered, a white rectangle to cover the area of the figure and set it to the lowest layer. However, I could not get that to work this time so I hunted out this fix.
To fix this, while in Inkscape go to File - Document Properties. Then click on the area where it says background. It should, at least in my case, have half of the bar or strip as white and the other half as checkered. When you click on it, this is really strange, the settings are all on white! However, I clicked on the hatched portion, called Alpha (opacity) and then move it to darker (left) then moved it back to white/lighter (right). Then it disappeared (the checkered area)!
BTW, I tried to fix it manually by going to the object fill and stroke properties, but like above the settings were all on white. I don't think I tried messing with the checkered setting, but I would just do the above steps to fix the whole thing.
I also, before, used, from what I remembered, a white rectangle to cover the area of the figure and set it to the lowest layer. However, I could not get that to work this time so I hunted out this fix.
Labels:
Inkscape
Subscribe to:
Posts (Atom)