Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

I don't see an option for that.  I have often wished that there was one.

@acer Thanks for the further elaboration.  It looks like InertForm:-Display works better than Typesetting:-Typesett in the following example.

restart;

with(Typesetting):

expr := 1 + x^2;

x^2+1

InertForm:-Display(sqrt(expr));

sqrt(x^2+1)

Typeset(EV(sqrt(expr)));

sqrt(expr)

@acer Thanks for pointing to the Typeset and EV exports of Typesetting (both undocumented).  These can come handy in some situations and it's good to have them in one's toolbox.

@acer You wrote "I prefer the technique of using, Typsetting:-Typeset".  I am unable to find a help page on Typsetting:-Typeset.  Can you tell me where it is documented?

I see that you have a system of three first order differential equations in three unknowns.  The system involves eight unspecified coefficients aS, mu1, mu4, etc.  No initial conditions are specified.

You specify data which is a collection of four lists of four numbers each.  It's not clear how data is meant to be related to the system of differential equations.

I cannot make sense of the rest of the worksheet.  To get any help, you should explain in words, as I have done above, what it is that you want to achieve.

@Dkunb The next step still depends on what you want to do with rho_1 and rho_2.  Suppose you have calculated rho_1 and rho_2.  How are you going to use them?

By the way, I don't know the meanings of the superscripts T, *, and †.  I suppose T stands for transpose.  I don't know what the other two mean.

@Dkunb When the size of a result exceeds a set limit, Maple calculates but does not display it because displaying such large expressions would be generally useless to anyone.  It is possible to raise or completely eliminate the limiting ceiling through Maple's configuration options, but I don't see a point in doing that under the circumstances.

Based on what we see in the toy example, we expect your dsol to be a list of the form
     [ z[0,1(t)=...,  z[0,2](t)=...,  z[1,1](t)=..., z[1,2](t)=... ]
To see what your z[0,1(t) looks like, do
subs(dsol, z[0,1](t));

You will see that z[0,1(t) is a HUGE expression involving things like RootOf(_Z^4, ...).  That's because you are solving a linear system of four first order differential equations.  The characteristic polynomial of such a system is a 4th degree polynomial whose roots do not have nicely presentable forms.  (It was just lucky that things worked out neatly for the toy problem.) Things get worse as you increase the size of n.   The prudent thing to do then is to solve the system numerically.  Maple can do that, but how you would organize the code depends on what you want to do with the result.

So, to go any further, let's ask the question:  Suppose you have obtained the solution Z(t).  What are you going to do with it?

@acer Thanks for checking.  Mine was done in Maple 2023. 

One way of making the code work in Maple 2021 is to load the Physics package as you have noted.  A better solution is to change the definition of the IC to

IC := eval(Z, t=0) =
	Array(0..n-1, 0..n-1, (i,j) -> `if`(i=j,1,0));

which will work in Maple 2021 without loading the Physics package.

@Dkunb What kind of object is Z(t) in dz?  Is it a scalar, a vector, a matrix?  The expression you have for dz makes no sense under any of those interpreations.  Perhaps you have something else in mind?

I am fond of following Polya's advice which in effect says if you don't know how to solve a problem, do a simpler one first.  In your case, can you just drop all those messy preliminaries?  Just make up a simple example, such as:

de := diff( < z[1](t), z[2](t) >, t) = < 1, 2; 3, 4 > . < z[1](t), z[2](t) >;

(Vector(2, {(1) = diff(z[1](t), t), (2) = diff(z[2](t), t)})) = (Vector(2, {(1) = z[1](t)+2*z[2](t), (2) = 3*z[1](t)+4*z[2](t)}))

ic := z[1](0) = 1, z[2](0) = 2;

z[1](0) = 1, z[2](0) = 2

I am not saying that this is a suitable example since I have no idea what you have in mind for your dz.  Change that example to make it similar, in essence, to your dz.  Add extra complications only after you get that cartoon model to work.

How do you expect to solve a differential equation numerically when some of the parameters have no numerical values?  Do:

indets(eq1, name);

to see what eq1 depends on.  Maple responds with:
        {M, N, m, mu, n, nu, t, KroneckerDelta[m, n], KroneckerDelta[mu, nu]}

Furthermore, it looks like the purpose of your zint array is to supply initial conditions to the differential equation.  But the initial conditions should like like z(m,nu,0)=something.  Yours doesn't do that.

I suggest forgetting about the array for the moment. That's the least of your problems.  Just solve one of your differential equations.  Once you figure out how that works, only then you will worry about the array.

@C_R I still don't see what your ultimate goal is.  Are you hoping to get an explicit solution to that differential equation in in terms elementary functions?  I assume that you already know that the pendulum equation does not have a solution in terms of elementary functions.  So what is it that you are looking for?

You have asked quite a few questions in MaplePrimes involving differential equations but it appears that you still don't know how to express a derivative in Maple.  The expression dy/dx is definitely not how one does that.

For practice, calculate the derivative of x2 in Maple.  And if you succeed, then try expressing the derivative of y, where y is an unspecified function of x. If you don't know how to do those things, then it's too soon for you to get involved with differential equations.

@Anthrazit You may simulate a double-headed arrow like this.

restart;

with(plots):

A, B := [0, 0], [3,2];

[0, 0], [3, 2]

C := (A+B)/2;

[3/2, 1]

display(arrow(C, [A-C,B-C]), scaling=constrained);

Download mw.mw

The actions you take depend on your ultimate goals.  Are you going to keep the image in a Maple worksheet or are you going to export it to be used elsewhere?

If you are going to keep the images solely within a Maple worksheet.  You can use plots:-arrow or plottools:-arrow to do something like what you want.  Or you can use plottoos:-line and plottools:-polygon to build your own arrows and arrowheads from scratch, and use plots:-textplot to add labels.

If you are going to export the image as something like PNG or EPS, then there are better tools for inserting additional elements in images.  Again that depends on your ultimate goal.  In my case, I frequently export drawings from Maple to include them in PDF documents produced by LaTeX, and use LaTeX's TikZ package for adding arrows and text on drawings.  Others may have other suggestions for doing such things but it's hard to recommend something specific unless you explain what you intend to do with those images.

In addition to responding to acer's question, you may want to make some clarifications:

  1. You say "square matrix M of m rows and n columns".  Does that mean m=n?
  2. Does "below the main diagonal" include the diagonal itself?
  3. Regarding "returns the smallest element" -- what if there are several such elements.  What should the procedure return?
1 2 3 4 5 6 7 Last Page 3 of 89