Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Here is a system to ODE i am trying to solve:

w(t) = x(t) + x'(t) + w(t-a)

x''(t) = x'(t) + w(t)

How can i solve this kind of ODE with delay in time?

aks.

 

I have found this free library for Maple. It has got a lot of new or improved commands.

http://www.download.com/Aladjev-s-Library-for-Maple/3000-2070_4-10716687.html

 

In a recent blog entry, I proposed an easy way to plot the region between two curves. Later I read from an earlier blog entry that “filled=true” in implicitplot can produce amazing effects for plotting regions. Inspired by the blog entry, I’d like to introduce another easy way to plot the region between two curves.

To plot the region between y=f(x) and y=g(x) (x=a..b), we just need the following code:
with(plots):

f:=x->f(x): g:=x->g(x):

implicitplot(y=0, x=a..b, y=f(x)..g(x), filled=true, coloring=[green,green]);


The key to the success of this code is that Maple 8 allows
varying range for the second variable y (i.e. y=f(x)..g(x)). However I was sorry to find that this is not allowed in Maple 11 (This will be addressed later.) .

 

Example 1  The region between y=x and y=x^2.

with(plots):

f:=x->x:g:=x->x^2:

a:=0: b:=1:

region:=implicitplot(y=0,x=a..b,y=f(x)..g(x),filled=true,coloring=[yellow,yellow]):

F:=plot(f(x),x=a-0.2..b+0.2,thickness=3,color=red):

G:=plot(g(x),x=a-0.2..b+0.2,thickness=3,color=blue):

display(F,G,region,scaling=constrained);

 

 

Example 2 The region between y=sin(x) and y=cos(x).

with(plots):

f:=x->sin(x):g:=x->cos(x):

a:=0: b:=6:

region:=implicitplot(y=0,x=a..b,y=f(x)..g(x),filled=true,coloring=[grey,grey]):

F:=plot(f(x),x=a-0.2..b+0.2,thickness=3,color=red):

G:=plot(g(x),x=a-0.2..b+0.2,thickness=3,color=blue):

display(F,G,region,scaling=constrained);



 

Now if we reverse the order of the range options from “x=a..b, y=f(x)..g(x)” to “y=f(x)..g(x), x=a..b”, some strange but interesting thing will happen (See Example 3.

Example 3

with(plots):

f:=x->sin(x):g:=x->cos(x):

a:=-1: b:=6:

region:=implicitplot(y=0, y=f(x)..g(x),x=a..b, filled=true,coloring=[grey,grey]):

F:=plot(f(x),x=a-0.2..b+0.2,thickness=3,color=red):

G:=plot(g(x),x=a-0.2..b+0.2,thickness=3,color=blue):

display(F,G,region,scaling=constrained);
 


It can be seen that the region in Example 2 has been reflected with respect to the line y=x. But this is not bad because can use this phenomenon to plot regions between curves x=f(y) and x=g(y) (See Example 4).

 

Example 4  The region between x=y^2/2 and x=y^4/4-y^2/2.

with(plots):

f:=y->y^4/4-y^2/2: g:=y->y^2/2:

region:=implicitplot(y=0,x=f(y)..g(y),y=0..2,filled=true,coloring=[grey,grey]):

F:=plot([f(y),y,y=-1..2.3],thickness=3):

G:=plot([g(y),y,y=-1..2.3],thickness=3,color=blue):

display(region,F,G,scaling=constrained);

 

 

 


Finally some questions to be answered or discussed.

    1. Is “coloring” used in the examples an option in the package Plots? But I cannot find it in the Help (Typing ? coloring produces no results.) .
   2. Why the strange but interesting thing happens in Example 3 ?

   3. Why the above method cannot be realized in Maple 11?
   If we input the following code in Maple 11,
with(plots):

implicitplot(y=0,x=0..1,y=x..x^2,filled=true,coloring=[yellow,yellow]);with(plots);
An error warning will occur:
Error, (in plots/implicitplot) invalid input: invalid range for second variable

This means varying range for the second variable y (eg. y=x..x^2) is not allowed in Maple 11 , but which is allowed in Maple 8. If this is true, then I doubt if Maple 11 is really stronger than its earlier versions in all respects.

 

I have a pointplot3d that is running in an infinite loop and I was wondering if there was any way to at the end of my loop show the graph, pause Maple for .1 seconds and delete the graph. Such as in the example:

n:=1;
keepGoing:=1;
 

while keepGoing=1 do
  plot(x^n, x=-5..5);
od;

is there any way I could get Maple to show the graph for .1 seconds then delete the current graph and show the next graph?

 

pHatfield

Dear all: Anybody could tell me how can I obtain this integral with maple? Int(exp^(-a*x^2)*sech(x/2)^2, x=-infinity..infinity); where "a" is positive thank a lot D. Reyes CBPF

suppose i have an ODE dx/dt=x/t how do i draw isoclines? thanks

I have a Maple code which I wrote on a Windows machine. Now I need to run it on a Linux machine. I set the directory by the command

currentdir("C:/example"):

How should I change this if I want it to be /home/user/example ?

and I use

fopen("C:/mydir/examp/example.dat", WRITE):

How should I change this line in Linux if I want it to be in /usr/local/mydir/examp/example.dat?

In a comment to a Mapleprimes thread, Jacques mentioned an old suggestion of Kahan's that numerical computations should return an estimate of conditioning alongside a result.

I mentioned in this comment an approach for numerical estimation of (all) roots of a univariate polynomial with real or complex numeric coeffficients that is based upon computing eigenvalues of a companion matrix. Here below is some rough code to inplement that idea, but which also returns condition number estimates associated with the eigenvalues.

I include an example of the badly conditioned Wilkinson's polynomial. It is possible that better results could be obtained by using a Lagrange basis representation of that polynomial, but I didn't try to figure out how that would work in an analogous way. The standard Maple utility, fsolve, has no problem with this example.

This forum question led to a discussion of a bitwise magazine review that compared Mathematica 5.2 and Maple 10. In that review the author struggled to get the following numeric integral to compute accurately and quickly in Maple.

evalf(Int(BesselJ(0, 50001*x)*x*exp(I*(355*x^2*1/2)), x = .35 .. 1));

Below, I reproduce an attempt at computing an accurate result quickly in Maple. I'm copying it here because that thread got quite long and messy.

hello i was asked to draw direction field and some isoclines for some ODEs Now i have some problems: the equation is t*diff(x(t),t)-x(t)=0 and i use contourplot(x(t)/t,t=-10..10,x=-10..10); to draw the isoclines... however, the output is not quite as i expected, it looks like some curve because if i draw it by hand, i put dx/dt=x/t and set x/t=c ( c is some constants) then the graph should be some straight line what am i doing wrong??

The problem I'm having is that I have a large system of linear equations, the solution to which I know must be integers between 1 and 9. I have tried applying bounds etc., but the problem is that when I use solve, it said 'evaluating' for around half an hour, and still came out with nothing. Does anyone have any ideas as to how to make this faster, because I suspect that it's trying to find all solutions, and then eliminating the ones of the wrong form, rather than only looking for solutions where each variable is an integer between 1 and 9.

Hello Maple experts,

I'm currently trying to get more familiar with semidefinite programs (SDP), i.e. I want to minimize/maximize a linear objective matrix function over linear equality/inequality constraints with a positive semidefinite matrix condition.

It seems that there are a number of Matlab packages available but so far I couldn't really see how I could do this with Maple (which I would prefer to Matlab if there is a reasonable solution...)

I am in a mode with a red arrow on the left.

How do I define f to be an algebraic function of x over C, the complex numbers, such as

f(x)=x+7+I

I want to be able to plug in complex numbers for x and have a complex number

returned, say

f(9-5*I)=16-4*I

In the blog  Plots of twisted ribbons, the author gave an interesting description of plotting twisted ribbons. In this blog , we give a similar description of twisted ribbons and give the geometrical interpretations of this definition.

 

Let r(phi)=[a*cos(phi), a*sin(phi), 0] (phi=0..2*Pi) be a circle in the xy-plane, and P be a point on the circle. Let QR be a line segment (with length of 2) passing through the point P and let P be the middle point of QR. Also, QR is coplanar with the z-axis.

Now let P rotate about the z-axis at the angular velocity of phi, where phi is the angle between OP and the x-axis. At the same time, the line segment QR is rotating about its middle point, P, at the angular velocity of theta (where theta is the angle between PQ and the z-axis and theta is dependent on phi, eg, theta=k*phi). In the whole process, QR will remain coplanar with the z-axis.

 

Apparently, the locus of the line segment QR is a twisted ribbon. When theta=phi/2, we have the Mobius strip.


2. The equation of the twisted ribbon

 

Now we try to find the equation of the surface. Clearly,

vector(OP)= [a*cos(phi), a*sin(phi), 0].

And with some geometrical manipulations, we have

vector(PQ)=[sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta)].

So the vector equation of the twisted ribbon is

V(phi, t)=vector(OP)+t*vector(PQ)

And the parametric equation is
x=a*cos(phi)+t*sin(theta)*cos(phi),
y=a*sin(phi)+t*sin(theta)*sin(phi)

z=t*cos(theta)

(where theta=k*phi (k a constant), phi=0..2*Pi and t=-b..b (b determines the width of the ribbon.))

Or
x=(a+t*sin(k*phi))*cos(phi),
y=(a+t*sin(k*phi))*sin(phi)

z=t*cos(k*phi)

(where k a constant, phi=0..2*Pi and t= -b..b)

When we take k=1/2, 1, 3/2, 2,…, we have different twisted ribbons.

When k=1/2, we have the equation of the Mobius strip:
x=(a+t*sin(phi/2))*cos(phi),
y=(a+t*sin(phi/2))*sin(phi)

z=t*cos(ph)/2

(phi=0..2*Pi and t= -b..b) .

 

k=1

 

k=2

Is there a way to change the background color of a plot viewing area different from the white?

 

 

Thanks!

First 2078 2079 2080 2081 2082 2083 2084 Last Page 2080 of 2234