Rouben Rostamian

MaplePrimes Activity


These are answers submitted by Rouben Rostamian

restart;

The Fibonacci sequence { f(n) : n = 0,1,2,...} is defined through recurrence relation f(n+2) = f(n+1) + f(n), with the initial conditions f(0)=0, f(1)=1.. The leading terms of the sequence are 0,1,1,2,3,5,8,13,21,34,... If you know a little about mathematical induction, you will have no difficulty showing that
"A^(n)=[[[f(n+1),f(n)],[f(n),f(n-1)]]]."

The largest entry in A^n is its (1,1) term, that is, f(n+1).  Therefore your question is equivalent to asking: For which n is f(n+1) larger than 2019?

 

To answer that, we call Maple's rsolve() (recurrence solver) to calculate a general formula for f(n) as follows.

rsolve({F(n+2)=F(n+1)+F(n), F(0)=0, F(1)=1}, F):
f := unapply(%, n);

proc (n) options operator, arrow; (1/5)*5^(1/2)*((1/2)*5^(1/2)+1/2)^n-(1/5)*5^(1/2)*(-(1/2)*5^(1/2)+1/2)^n end proc

We need to solve f(n+1) > 2019.  Maple's solve() function is able to solve some inequalities, but not this one.  The difficulty lies in that although f(n) evaluates to an integer when the argument n is an integer, it evaluates to a complex number when n is other than an integer.  We get around that by looking at the real part of f(n).  Thus we do:

fsolve(Re(f(n+1)=2019));

-21.57274597

Oops, a negative solution is not interesting.  Let's limit the range of n:

fsolve(Re(f(n+1)=2019), n=1..30);

16.48726057

Aha, that's good.  We conclude that n=16 is too small but n=17 is good:

simplify(f(16+1));

1597

simplify(f(17+1));

2584

Producing a good-looking graph with implicitplot3d() requires a fine mesh which is not the most efficient way of plotting a surface and I avoid that whenever possible.  In your case each of the three surfaces may be expressed as a simple function of w, so why not do it with plot3d()?

solve~([f=0, g=0, Op=0], w);
plot3d(%, x=0..2, z=0..2, view=0..2, plotlist, color = ["Red", "Blue", "Green"]);

 

I have attached an edited version of your worksheet.  It does not solve your problem but contains comments and pointers that can be useful for making progress.

HAM_build-comments.mw

 

The program still works in Maple 2018.  All I did was to comment out a few lines near the top of the file exam_wkptest.mws which specify a hard-coded path to the library.  Here is the edited version:

restart:
#libname:=`i:\\ptest`,libname;
#march(create,libname[1],100);
#read`i:\\ptest\\wkptest_cpc`;
read "wkptest_cpc";
with(wkptest);

This assumes that the files exam_wkptest.mws and wkptest_cpc are placed in the same folder/directory.

 

restart;
with(plots):
L := ListTools:-Rotate([$-10..10], 11);
animate(plot,[m*x,x=-10..10],m=L,
    scaling=constrained, view=[-1..1, -1..1]);

 

You need a couple of fixes to get your code to work.

First, we note that your system of equations is of the 3rd order in u and 4th order in w.  Therefore you need to supply seven boundary conditions but you have supplied only six.  Check what is missing.  Perhaps D(u)(1)=0?

Second, your ode1 is of the second order in u and 3rd order in w.  Differentiate it once in order to put it on a comparable footing with ode2.

Thus, we do:

ode1_new := diff(ode1,r);
ics := ics, D(u)(1)=0;   # change as needed
dsolve({ode1_new,ode2} union {ics},{w(r),u(r)},numeric);

 

 

You are attempting to solve the set of three differential equations Eq1, Eq2, Eq3 on the interval [−d, l] but that's not what you really want. What you want is to solve Eq1, Eq2, Eq3 on the three consecutive intervals [−d, 0], [0, p], and [p, l], and connect their solutions through the prescribed interface conditions. In the attached worksheet I show how to do that. Here is the resulting graph of the temperature on the overall interval [−d, l]. The middle interval [0, p] is too tiny to be visible in this graph since p=0.001.

Worksheet:  zz.mw

You have

Phi2:=(t)->Array([seq(...

The error arises when you use Phi2 as if it were a Vector, but Arrays and Vectors are not the same thing in Maple.

Additionally, you should know that if u and v are vectors of length n each, then to calculate their dot product you need to multiply the transpose of u by v, which is written "u^+ . v" (without the quotes).   For that reason,  if A is an nxn matrix, then the bilinear form is "u^+ . (A . v)".  In several places in your code you have written that as the equivalent of u . A . v which is another source of error.

Advice:

Before writing a large and complex code, test small fragments of it elsewhere and only then incorporate that in your final program.  It's easier to catch errors that way.  That's what experienced programmers do.

It's simple.  Just do
 

pde := diff(u(x,t),t,t)-c^2*(diff(u(x,t),x,x)) = 0;
pdsolve(pde);

The result is u(x,t) = _F1(c*t+x) + _F2(c*t-x), where _F1 and _F2 are arbitrary functions.  For instance, you may take _F1 to be the sine function, and _F2 to be the cosine function, but certainly you are not limited to those.

Look at the standard expansion of exp(x) in the power series.  Between the terms insert fracttional powers of x with zero coefficients, as in
1 + 0*x^(1/2) + 1/1!*x^(2/2) + 0*x^(3/2) + 1/2!*x^(4/2) + 0*x^(5/2) + 1/3!*x^(6/2) + O(x^(7/2));

Of course the result is the same as the standard expansion -- the fractional powers have no effect.

 

What you observe as the parameter "a" changes sign is not a bifurcation.  The system's critical point, that is, (0,0), remains the sole critical point before and after the transition.  What you have here is a loss of stability.  The point (0,0) is a stable equilibrium when a<0 and an unstable equilibrium when a>0.

A bifurcation occurs when an equilibrium splits into multuple equilibria.  A Hopf bifurcation occurs when an equilibrium spawns a periodic orbit.  Admittedly, at a=0 you do get periodic orbits in your case, but that is not what is understood by Hopf bifurcation.  Your system is linear.  A bifurcation is a strictly nonlinear phenomenon.

 

I am not certain as to what precisely you want to do.  If you need something that looks like a velodrome, perhaps this will do:Worksheet: mw.mw

What you are asking is not difficult for someone with a moderate amount of familiarity with Maple, however it will be difficult if you have no experience with Maple at all.  I will list here a few items that jump at me in your post.

  • As with all programming languages, the input syntax in Maple calls for serious attention.  For instance, the expression sin[ax+b] may be quite understandable to you as a human, but it is not acceptable in Maple.  Is "ax" the name of a variable or is it the product of two variables?  Additionally, a pair of square brackets has a special meaning in Maple.  The proper syntax for that expression would be sin(a*x+b).
  • You have things like kf1 and kf2 in your proposed solution.  However those symbols do not appear in the PDE.  What are they and how are they related to the coefficients of the PDE?
  • Your solution looks like u = u(1) + u(2) + u(3) + … . If you were to check this solution by hand (not Maple), what would you substitute for the "…"?  What do you expect Maple to substitute for it?

In order to give you an idea of what needs to be done, let me show you a very simpified version of your problem.

Here is a PDE:

pde := diff(u(x,y),x,x) + diff(u(x,y),y,y) = 0;

diff(diff(u(x, y), x), x)+diff(diff(u(x, y), y), y) = 0

We look for a solution of the form u = u__1+u__2, where

u1 := sin(x)*cosh(y);

sin(x)*cosh(y)

u2 := exp(x)*sin(y);

exp(x)*sin(y)

Let's test whether u = u__1+u__2 is a solution.  A zero result means that
the answer is "yes":

pdetest(u(x,y)=u1+u2, pde);

0

On the other hand, if we add an incorrect term, such as:

u3 := sin(x)*cos(x);

sin(x)*cos(x)

then the result of the test is nonzero, which tells us that

 u = u__1+u__2+u__3 is not a solution:

pdetest(u(x,y)=u1+u2+u3, pde);

-2*sin(2*x)

Student[Precalculus][CompleteSquare](a);

n := 0:
for z from -1 to 1 by 0.1 do
  filename := sprintf("fig%03d.gif", n);
  plot(x^2 + z, x=-1..1, view=[-1..1, -1..2]);
  plottools:-exportplot(filename, %);
  n := n + 1;
end do:

This will export the individual frames of your animation to files named figxxx.gif.  I know nothing about IrfanView, but most graphics manipulation packages will enable you to put the frames together and display the resulting animation.

First 26 27 28 29 30 31 32 Last Page 28 of 53