jaytreiman

273 Reputation

12 Badges

20 years, 40 days

MaplePrimes Activity


These are answers submitted by jaytreiman

I mostly agree with itsme.  There are some other factors that you might want to consider.

1)  I find that the eps graphics mess with fonts and locations.   It is not consistent with either the GUI or the other plotting formats.  EPS also does not work with transparency.  If you want 3d plots, use something else.

2)  When setting a size for a plot, height= and width= , you need to assume that a printed document is done with at least 300dpi.  Since the default units in Maple plots are pixels, you should use at least 900 by 900 for a 3in by 3in plot to get a high quality result.

3)  The jpeg compression is strong enough that it leaves visible artifacts around 2d graphs of functions.  These are eliminated by using png. 

4)  If you want rotatable 3d graphs in pdf's, look elsewhere.  Unless you have a large sum of money to buy comercial software, you will have trouble translating any of the 3d formats from Maple into either the u3d format or the prc format.

If you need to do this, it may be easier and more stable to put a virtual machine with your favorite flavor of Linux on your Windows machine.  Then one installs Maple in the usual way on your virtual machine.

I have this setup on a laptop since the laptop will not run Linux effectively.  (Intel graphics)

What you are actually doing is solving  the differential equation diff(x(t),t)=f(t) .  A better method than plotting the integral of your function is to use DEplot from the DEtools package.  The code below will do the plot using the plot command and using DEplot.   Below that are the two plots.  The difference in the plots is clear.  (The time commands will give an idea of the time it takes to do the plots.)


restart:
with(DEtools):

f := x -> (x-floor(x));

time();
plot(z -> Int(f,0..z),-4..4);
time();

time();
DEtools[DEplot](diff(x(t),t)=f(t),{x(t)},t=-4..4,[x(0)=0],arrows=none,linecolor=black);
time();

 


Download IntPlot2.mw

One can use the axis[i]=[...] option combined with setting the vertical range to get something that may work.  The help for this is at plot,axis.

Attached is an example.  Unfortunately, the axis moved when I saved the file.  Try it in Maple 16 and see it you get the desired result.

plot(z^2-2,z=-4..4,y=-5..14,axis[1]=[location=low],axis[2]=[location=origin]);

 

 

 

Download MoveAxis1.mw

It is rather simple, once one know the trick.  One simply puts the definite integral in single quotes.  It is a slow process, but it works.

The attached worksheet demonstrates how it works.

f := z -> int(exp(-x^2),x=0..z);
plot('f(z)',z=-4..4);

proc (z) options operator, arrow; int(exp(-x^2), x = 0 .. z) end proc

 

 

 


Download IntPlot.mw

When you add questions to an assignemnt there is an option to add questions as a group.  If you add your 10-15 questions as a group, you will have a choice of how many from the group to include in the assignment.  (I believe the default is 1.)  MapleTA will then randomly include 1 or more of the 10-15 questions in an individual assignment.

 

Since I am using MapleTA 8, I will not try to answer the first question for MapleTA 9.  In 8 when you save the question MapleTA asks which group the question should be in.  If you have not set up your group/directory structure for questions, doing that might help.

The Linear Solve command is usually a better way of solving a matrix equation.  In your case the Maple code looks like

A := Matrix([[1,1],[tan(Pi*alphadeg/180),tan(Pi*betadeg/180)]]):
b := Vector(([F*sin(gamma),F*cos(gamma)])):
LinearAlgebra:-LinearSolve(A,b);

 

If you are not going to change the problem beyond randomly changing some variables, it might be better to simply precompute the answer:

.

I get the same results as Carl Love.  See the attached worksheet.  Part of the problem with an omega0 near 2 is that at omega0=2 you have resonance.  You may not see it in your plots, but you should be getting a varying amplitude.  This is illustrated in the plot with omega0=1.95.

restart;
with(DEtools):

Q := 1/2;
omega0 := 1.8*Pi;
a := 0;
eqd := [diff(y1(t),t)+a1*omega01*y1(t)/Q+omega01^2*y(t) = cos(2*Pi*t),diff(y(t),t)=y1(t)];
eqd1 := subs({a1=0,omega01=1.8*Pi},eqd);

1/2

 

1.8*Pi

 

0

 

[diff(y1(t), t)+2*a1*omega01*y1(t)+omega01^2*y(t) = cos(2*Pi*t), diff(y(t), t) = y1(t)]

 

[diff(y1(t), t)+3.24*Pi^2*y(t) = cos(2*Pi*t), diff(y(t), t) = y1(t)]

(1)

DEplot(eqd1,[y(t),y1(t)],t=-10..10,[[y(0)=1/2,y1(0)=0]],stepsize=0.01,linecolor=blue,thickness=1);

 

DEtools[phaseportrait](eqd1, [y(t), y1(t)], t = -10 .. 10, [[y(0) = .5, y1(0) = 0]], scene = [y(t), y1(t)], stepsize = .01, linecolor = black, thickness = 1);

 

eqd2 := subs({omega01 = 1.99*Pi,a1 = 0},eqd);
DEplot(eqd2, [y(t), y1(t)], t = 0 .. 20, [[y(0) = .5, y1(0) = 0]], scene = [y(t), y1(t)], stepsize = .01, linecolor = black, thickness = 1);
DEplot(eqd2, [y(t), y1(t)], t = 0 .. 40, [[y(0) = .5, y1(0) = 0]], scene = [t,y(t)], stepsize = .05, linecolor = black, thickness = 1);

[diff(y1(t), t)+3.9601*Pi^2*y(t) = cos(2*Pi*t), diff(y(t), t) = y1(t)]

 

 

 

eqd2 := subs({omega01 = 1.95*Pi,a1 = 0},eqd);
DEplot(eqd2, [y(t), y1(t)], t = 0 .. 40, [[y(0) = .5, y1(0) = 0]], scene = [t,y(t)], stepsize = .05, linecolor = black, thickness = 1);

[diff(y1(t), t)+3.8025*Pi^2*y(t) = cos(2*Pi*t), diff(y(t), t) = y1(t)]

 

 

 


Download Resonance1.mw

As Kitonu showed, you can do this with a parametrized curve in the plot command.  A couple other things that you can do are turn the plot into a function of a and b or use the Explore command to get a plot with sliders to change the a and b values.  A worksheet demonstrating these is attached.

Is one of these what you had in mind?

 

P1 := (a,b)-> plot([a*cos(t),b*sin(t),t=0..2*Pi],x=-10..10,y=-10..10,scaling=constrained);

proc (a, b) options operator, arrow; plot([a*cos(t), b*sin(t), t = 0 .. 2*Pi], x = -10 .. 10, y = -10 .. 10, scaling = constrained) end proc

(1)

P1(2,4);

 

Explore(P1(a,b));

a:

b:

 

 

``


Download EllipsePlot1.mw

I did not get your first result in either document mode or worksheet mode in Maple 17.  Attached are the files.  Maybe someone knows if this is an interface problem.

 

Do you want to work with the a's as functions of the k's?

 

a[1] = (k[1]+1)/(1-k[1])

a[1] = (k[1]+1)/(1-k[1])

(1)

a[1]

a[1]

(2)

``

``

 

Download Subscript1.mw

restart;

a[i]=(1+k[i])/(1-k[i]);

a[i] = (1+k[i])/(1-k[i])

(1)

a[1];

a[1]

(2)

 

 

Download Subscript2.mw

The attached will give one tableau form.  It is a little long to post the content here.  One must adapt the LP in many cases.

GetFinalTableau_1.mw

I am certain that it can be simplified, but I will leave that for the experts.

Warning, I do not have time to try this now.  I have exported an animated gif from Maple.  GIMP has a plugin, GAP, that works with animations. (I have used this on animated gifs from Maple.)  According to http://www.ehow.com/how_12186436_convert-animated-gif-mpeg-gimp.html , you can output mpeg files from GIMP-GAP.  Look at http://pages.uoregon.edu/noeckel/PDFmovie.html to find instructions on geting your mpeg animation into a PDF using the media9 package for LaTeX.

Good luck.

Using the popups for Maple 16 I got the following.  Maybe this is a bug in Maple 17.


(x+y)^18;

(x+y)^18

(1)

expand( (1) );

y^18+18*x*y^17+153*x^2*y^16+816*x^3*y^15+3060*x^4*y^14+8568*x^5*y^13+18564*x^6*y^12+31824*x^7*y^11+43758*x^8*y^10+48620*x^9*y^9+43758*x^10*y^8+31824*x^11*y^7+18564*x^12*y^6+8568*x^13*y^5+3060*x^14*y^4+816*x^15*y^3+153*x^16*y^2+18*x^17*y+x^18

(2)

# collect recursive (x+y)^18
collect((x+y)^18,{x, y},recursive);

y^18+18*x*y^17+153*x^2*y^16+816*x^3*y^15+3060*x^4*y^14+8568*x^5*y^13+18564*x^6*y^12+31824*x^7*y^11+43758*x^8*y^10+48620*x^9*y^9+43758*x^10*y^8+31824*x^11*y^7+18564*x^12*y^6+8568*x^13*y^5+3060*x^14*y^4+816*x^15*y^3+153*x^16*y^2+18*x^17*y+x^18

(3)

(x+y)^19;

(x+y)^19

(4)

expand( (4) );

y^19+19*x*y^18+171*x^2*y^17+969*x^3*y^16+3876*x^4*y^15+11628*x^5*y^14+27132*x^6*y^13+50388*x^7*y^12+75582*x^8*y^11+92378*x^9*y^10+92378*x^10*y^9+75582*x^11*y^8+50388*x^12*y^7+27132*x^13*y^6+11628*x^14*y^5+3876*x^15*y^4+969*x^16*y^3+171*x^17*y^2+19*x^18*y+x^19

(5)

# collect recursive (x+y)^19
collect((x+y)^19,{x, y},recursive);

y^19+19*x*y^18+171*x^2*y^17+969*x^3*y^16+3876*x^4*y^15+11628*x^5*y^14+27132*x^6*y^13+50388*x^7*y^12+75582*x^8*y^11+92378*x^9*y^10+92378*x^10*y^9+75582*x^11*y^8+50388*x^12*y^7+27132*x^13*y^6+11628*x^14*y^5+3876*x^15*y^4+969*x^16*y^3+171*x^17*y^2+19*x^18*y+x^19

(6)

 


Download expand_popup_M16.mw

If you want to use a vector with components it is easy to use the ideas in the attached worksheet.  Once you get rid of the component labels life is easy.

restart;

Put in the function.

F(x,y,z):= 6*x^2 + 3*x*y^2 - 1.5*z^3;

6*x^2+3*x*y^2-1.5*z^3

(1)

Change the variables to components of a vector w and turn F into a function of a vector or list w.

F := unapply(subs({x=w[1],y=w[2],z=w[3]},F(x,y,z)),w);

proc (w) options operator, arrow; 6*w[1]^2+3*w[1]*w[2]^2-1.5*w[3]^3 end proc

(2)

Use the standard matrix formula for the Hessian to make the Hessian of F a function of x.

HF := unapply(Matrix(3,3,(i,j)->diff(F(x),x[i],x[j])),x);

proc (x) options operator, arrow; rtable(1 .. 3, 1 .. 3, {(1, 1) = 12, (1, 2) = 6*x[2], (2, 1) = 6*x[2], (2, 2) = 6*x[1], (3, 3) = -9.0*x[3]}, datatype = anything, subtype = Matrix, storage = rectangular, order = Fortran_order) end proc

(3)

One can then simply evaluate F and HF on a list of points or vectors.

(You can also do this with a loop.)

Points1 := [<1,1,1>,<2,3,4>,<3,4,5>];
map(F,Points1);
map(HF,Points1);

Points1 := [Vector(3, {(1) = 1, (2) = 1, (3) = 1}), Vector(3, {(1) = 2, (2) = 3, (3) = 4}), Vector(3, {(1) = 3, (2) = 4, (3) = 5})]

 

[[Typesetting:-mn("7.5", mathvariant = "normal"), Typesetting:-mrow(Typesetting:-mo("&uminus0;", mathvariant = "normal", fence = "false", separator = "false", stretchy = "false", symmetric = "false", largeop = "false", movablelimits = "false", accent = "false", lspace = "0.2222222em", rspace = "0.2222222em"), Typesetting:-mn("18.0", mathvariant = "normal")), Typesetting:-mn("10.5", mathvariant = "normal")]]

 

[Matrix(3, 3, {(1, 1) = 12, (1, 2) = 6, (1, 3) = 0, (2, 1) = 6, (2, 2) = 6, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -9.0}), Matrix(3, 3, {(1, 1) = 12, (1, 2) = 18, (1, 3) = 0, (2, 1) = 18, (2, 2) = 12, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -36.0}), Matrix(3, 3, {(1, 1) = 12, (1, 2) = 24, (1, 3) = 0, (2, 1) = 24, (2, 2) = 18, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -45.0})]

(4)

The gradient is also easy once you have the F.

gradientF := unapply(Vector(3,i->diff(F(x),x[i])),x);

proc (x) options operator, arrow; rtable(1 .. 3, {1 = 12*x[1]+3*x[2]^2, 2 = 6*x[1]*x[2], 3 = -4.5*x[3]^2}, datatype = anything, subtype = Vector[column], storage = rectangular, order = Fortran_order) end proc

(5)

map(gradientF,Points1);

[Vector(3, {(1) = 15, (2) = 6, (3) = -4.5}), Vector(3, {(1) = 51, (2) = 36, (3) = -72.0}), Vector(3, {(1) = 84, (2) = 72, (3) = -112.5})]

(6)

 



Download Hessian_1.mw

Java is slow and loading a Java aplet from a remote site is even slower.  That explains why loading the equation editor is slow.  As for the certificate problem, that is a Maplesoft or local IT problem.  Using a local server with its own certificate does not give me errors.

The way to edit an equation that is already in a problem with the equation editor is to double click on the box containing the equation.  That works for me every time.

Since I am frequently using Maple to randomly generate functions, I hardly ever use the equation editor when writing problems.  Using the MathML package in Maple has never given me problems, after I learned how to remove the double quotes.

1 2 3 4 5 Page 1 of 5