File:Simultaneous equations example 1.svg

Uploaded by Krishnavedala
Upload date 2011-06-10T01:30:22Z
MIME type image/svg+xml
Dimensions 305 × 314 px
File size 60.9 KB

Summary

Description
English: An illustration of how the two example equations in the simultaneous equations entry intersect with each other. Created using python.
Date
Source Own work
Author Krishnavedala
Other versions w:File:Simultaneous_equations_example_1.png
SVG development
InfoField
 The SVG code is valid.
 This plot was created with Matplotlib.

Source Code

from matplotlib.pyplot import *
from numpy import *
from mpl_toolkits.axisartist import *

theta = linspace(-pi,pi,100)
x1, y1 = cos(theta), sin(theta)
x2, y2 = theta, -0.5*theta

def myAxes(this,xlim,ylim,zero=False):
	if zero:
		this.axis[:].set_visible(False)
		this.axis["x"] = ax.new_floating_axis(0,0)
		this.axis["x"].set_axisline_style("-|>")
		this.axis["y"] = ax.new_floating_axis(1,0)
		this.axis["y"].set_axisline_style("-|>")
		this.axis["y"].set_axis_direction("left")
	this.grid(True)
	this.minorticks_on()
	this.set_xlim(-xlim,xlim)
	this.set_ylim(-ylim,ylim)
	this.set_xticks([-1,-.5,.5,1])
	this.set_yticks([-1,-.5,0,.5,1])
	this.set_xticklabels([r"$-1$",r"$-\frac{1}{2}$",r"$\frac{1}{2}$",r"$1$"])
	this.set_yticklabels([r"$-1$",r"$-\frac{1}{2}$",r"$0$",r"$\frac{1}{2}$",r"$1$"])
	this.text(xlim,.1,"x")
	this.text(.1,ylim,"y")
	this.legend(frameon=False, handletextpad=0, \
		labelspacing=.05,bbox_to_anchor=(1.1,1.1))
	setp(this.get_legend().get_texts(),fontsize=12)

fig = figure(figsize=(4,4))
ax = Subplot(fig,"111",axisbg='none')
fig.add_subplot(ax)
ax.plot(x1,y1,'g',linewidth=2,label=r"$x^2+y^2=1$")
ax.plot(x2,y2,'r',linewidth=2,label=r"$2x+4y=0$")
pt1 = (-2.,1.) / sqrt(5.)
pt2 = -pt1
ax.plot([][0],pt2[0],[][1],pt2[1],'o')
ax.annotate(r"$\left(-\frac{2}{\sqrt{5}},\frac{1}{\sqrt{5}} \right)$", \
	xy=pt1, xytext=(-1.5,1),ha='left',arrowprops= \
	dict(arrowstyle="->"),fontsize='large')
ax.annotate(r"$\left(\frac{2}{\sqrt{5}},-\frac{1}{\sqrt{5}} \right)$", \
	xy=pt2, xytext=(1.5,-1),ha='right',arrowprops= \
	dict(arrowstyle="->"),fontsize='large')
myAxes(ax,1.5,1.5,zero=True)

fig.savefig("Simultaneous_equations_example_1.svg",bbox_inches="tight",\
	pad_inches=.15)

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

9 June 2011

Category:Algebraic diagrams Category:CC-BY-SA-3.0 Category:GFDL Category:Images with Python source code Category:License migration redundant Category:Self-published work Category:Valid SVG created with Matplotlib