Details for 724_Pi axes.mw

Download file: 724_Pi axes.mw (View Live Worksheet on MapleNet)
Uploaded by Mariner(Maple Rating 4 562) (View other files uploaded by Mariner)

The HTML version of this file is shown below. To use the contents of this file in a posting, click here to get the source code


PiAxis

J. Tarr

The following procedure was inspired by a contribution by Will to MaplePrimes.

Calling sequence

PiAxis(f(x),range,n)

Parameters

f(x) - function to be plotted

range - x0..x1 - left end point to right end point of horizontal real range

n - positive integer; sets intervals on the horizontal axis to Maple Equation.

Description

The PiAxis(f(x),range,n) calling sequence plots the real function f(x) over the horizontal real range from x0 to x1; divides the horizontal (x) axis into intervals and labels them with multiples of Maple Equation. If n is large, it may be necessary to enlarge the plot area to make the labels readable.

Examples

> restart;

> PiAxis := proc(f,range::range,n::posint)
local k, p, q, r, t, u, v;
r := subs(Pi=1,range);
u := op(1,r):
v := op(2,r):
if type(u,even) then q := n*u else q := 2*n*u end if;
t := [seq(evalf(k/n*Pi) = StringTools[Join]([(convert( (k/n),string)),"p"]),k= q..-1/n),
seq(evalf(k/n*Pi) = StringTools[Join]([(convert( (k/n),string)),"p"]),k=1..v*n) ]:
plot(f,x=range,tickmarks = [t,default],axesfont=[SYMBOL],colour=red );
end proc:

> PiAxis(sin(x),-Pi..Pi,4);

Maple Plot

> PiAxis(cos(x),-2*Pi..2*Pi,3);

Maple Plot

> PiAxis(sin(x),-7..7,2);

Maple Plot

> PiAxis(tan(x),-3*Pi/8..3*Pi/8,8);

Maple Plot

> f(x) := x^2 + 4;

Maple Equation

> PiAxis(f(x),-Pi..Pi,4);

Maple Plot

> PiAxis(,-Pi..Pi,4);

Maple Plot

> circle := x^2 + y^2 = Pi^2;

Maple Equation

> f := x-> sqrt(Pi^2 - x^2);

Maple Equation

> plots[display]([PiAxis(f(x),-Pi..Pi,4),PiAxis(-f(x),-Pi..Pi,4)],title="Circle x^2 + y^2 = Pi^2");

Maple Plot

>

Maple Equation

This post was generated using the MaplePrimes File Manager

View 724_Pi axes.mw on MapleNet or Download 724_Pi axes.mw
View file details


HTML Source Code

Copy this code into any posting to insert this file into a posting on MaplePrimes

IMPORTANT INFORMATION

When pasting this code into a post on MaplePrimes, make sure that you choose the Worksheet HTML input format

Download Link Code

Copy this code into any posting to share this file with other users

}