Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@kambiz1199 OK, I see. I wish you success.

@memdream Maple's default interface is configured for "2D math" and "Document" mode worksheets.  Some users, including me, much prefer the alternative configuration of "1D math" and "Worksheet" mode interface.  If you have been wise enough to have made that switch, you are in luck, because you may use the Find/Replace (under the Edit menu) to replace all occurrences of phi[c] with phi__c with just once click.

On the other hand, if you are in the default "2D math" interface, I see no immediate solution for you other than what you have already done.

@kambiz I didn't notice that you are attempting to plot the second derivative.  My instructions were for plotting the first derivative.

See vv's answer regarding plotting the second derivative.

@quo Here is an example.  You specify a list of variables that need to be transformed according to your scheme:
L := [x__s, y__s];   # extend the list as needed
Produce a sequence of equalities from it that would be suitable for Maple's subs() command:
rels := seq(cat(tmp,_dot)(t) = diff(tmp(t),t), tmp in L);

Now, suppose that you have the equation

eq := diff(x__s_dot(t),t) + x__s_dot(t) + x__s(t)
      + diff(y__s_dot(t),t) + y__s_dot(t) + y__s(t) = 0;

Apply the previous subsitutions to it:

subs(rels, eq);

This should give you what you want.

Side comment on your revised worksheet:  The ">" signs at the left edge of the worksheet indicate what are called "execution groups" in Maple.  Typically you will want to have one statement (terminated by a semicolor) per execution group.  Placing multiple statements in one execution group, as you have done, makes your worksheet difficult to comprehend and debug.

I am guessing that you constructed your worksheet by copying and pasting from your previous 2D math worksheet, that's why things came out this way.  If you start a worksheet from scratch, this will not happen unless you intentionally force it.  Have a look at my worksheet mw.mw to see what things should looks like.

 

@Ramakrishnan In eq3 in your worksheet, A1 is entered as a constant.  It should be entered as a function of t, as all its other instances are. If you fix that, your worksheet will work fine.

The error you have encountered is a symptom of Maple's 2D-math interface.  Consider switching to 1D-math.  See Configuring Maple for instructions.  That will not fix existing worksheets, but will apply to new worksheets that you may create.

Hi Preben, there is a missing "next" in the first example.  It should be:

restart;
p:=proc(x) 1/x end proc;
for i from -3 to 3 do
  try
    res:=p(i)
  catch:
    printf("Error at i = %d\n",i);
    next;
  end try;
  res
end do;

Calculating the Jacobian is easy—it's a matter calculating derivatives with respect to x and y.  However, the expressions that you have supplied have no x and y in them.  I think you should be a little bit more explicit.

@jinhuili You should find someone who knows something about installing packages on a Mac.  All I know is Linux, I have never used a Mac so I cannot troubleshoot your problem.

Perhaps someone else in this forum who knows something about Macs can comment.

Aside: It appears that FGb is a package for doing calculations with Grobner bases. Maple itself has a large collection of functions for dealing with Grobner bases.  Perhaps you don't need the FGb package at all.

@leafgreen Here is how to animate the motion:

frames := seq(pointplot([A[i], B[i], C[i]],
    color=[red,green,blue],
    symbol=solidcircle, symbolsize=20), i=1..N):
display([frames], insequence);

I haven't checked your calculations beyond what I have commented on already.  You should go over everything carefully to ensure correctness.

In particular note that in most situations the force of attraction is inversely proportional to the square of the distance.  Your formulation assumes that it is inversely proportional to the distance.  Do you mean that?

 

 

@leafgreen You specify the velocities before you enter the for-loop.  Then the for-loop applies the same velocities over and over again.  You need to update the velocities at every time step, no?

@shadi1386 Maybe this is what you want:

restart;
with(plots):
myfont := [bold, "TimesNewRoman", 30];
p := logplot(x^3, x=0..2, axesfont=myfont);
dualaxisplot(p, p, labelfont=myfont);

@tomleslie From what he has right now, it is easy to generate the system's matrix:

sys := seq(eq[i], i=1..k);
A, B := GenerateMatrix([sys], [var], storage=sparse)
;

Thus, the system of equations is A.U=B, where the matrix A and the vector B are obtained above, and the vector of unknowns, U, consists of names defined in the list called var in the spreadsheet.

This is the right setup for solving the heat equations in 2D with finite differences through a backward difference scheme in time.  The solution T[n] at timestep n is obtained recursively through T[n] = C.T[n-1], where C is the inverse of A.

Anyway, that's how it should work if all is well. As I noted in one of my earler replies, I haven't verified OP's work.  His application of the boundary conditions looks a bit loose and I wouldn't put stock in it.

 

A noticeable number of questions asked on MaplePrimes originate from users who are totally confused by the 2D input and the equally unhelpful document-mode interface.  Unfortunately these settings are Maple's defaults.

It seems to me that the push toward 2D input and document-mode interface is driven by a short-sighted marketing strategy.  Those interfaces look sleek and sexy at first glance but users soon find them clumsy and unproductive, and give up on Maple.  The net effect is attrition of Maple users in the long run.

My advice to Maple's marketing is to make the 1D input and the worksheet-mode interface to be the defaults.  Leave the 2D input and the document-mode interface as user-configurable options.  That way, Marketing can still boast about the sexy interface but will not force it upon the users.

Those who choose to switch to the fancy interface and find out that it does not meet their needs, will know how to go back to the sane mode.  Currently they don't have that option because the average user has no idea what the alternative mode looks like.

 

@nm Oops, sorry.  I didn't notice the ".1"     :(

@sarra The worksheet that you have started has several issues which makes it difficult to work with.  Consider the loop:
for i from 1 to 4 do
    whatever;
end do;

After that loop ends, the symbol i has the last value assigned to it in the loop, which is 5 in this case.  From that point on, if you enter something like b[i] in your worksheet, it evaluates to b[5] which is generally not what you want.

There are several ways of getting around that.  The easiest way is not to use for-loops at all.  Look at finite-difference.mw to see how to do that.  You should be able to extend it easily to complete the solution of your problem.

Remarks:

  • I haven't checked the correctness of your mathematics at all.  Check!
  • I have changed beta1, beta2, and gamma to beta[1], beta[2], and beta[3].  The first two are cosmetic.  The third one is important, because gamma is a predefined constant in Maple.  You should avoid using it.
  • I suggest that you use Maple document format for your worksheet and 1D notation for the input because that makes life easier for problems such as yours.  Instructions are given here:
    http://userpages.umbc.edu/~rostamia/math481/config/maple.html

 

First 73 74 75 76 77 78 79 Last Page 75 of 99