Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 36 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

The first two statements of procedure p need to be 

YP[1]:= Y[2];
YP[3]:= Y[4];

You have equal signs instead. This doesn't make it run any faster, but the results are total garbage without this change.

Regardless of the making the change, it gets stuck in an infinite loop at t = .27728275. The error message indicates that it thinks that this is a delay differential equation. I don't understand that. Anyway, you should be able to plot t = 0..0.27 with no problem. To get the error message, hit the stop button during the odeplot computations.

@nadjet 

You're only seeing Ex[1] because it's the only value set only one level deep in a for loop. By default, Maple doesn't show the results of statements nested two or more levels deep. If you want to see the contents of Ex and Hy, then after the loops do:

interface(rtablesize= 21):
Ex;
Hy;

@Mac Dude 

It's not the GUI. Any further manipulation of the result from convert at the command line (as opposed to in a procedure) in any GUI will result in the full evaluation of the variables. 

What does t = (t^1, t^2) mean? What does 1_\alpha mean?

@adel-00 

I said to add maxfux= 0 as an option to the dsolve command, not to the odeplot command!!

Could you be more specific? Is there a particular recurrence that you want solved and plotted? Could you indicate a specific part of your paper?

@Markiyan Hirnyk I can't duplicate this effect of typesetting= extended. Are you sure that you did a restart? If the variables already have assigned values at the time that they are put into the Vector, then there's no question that the convert will return fully evaluated.

restart:
interface(typesetting= extended):
A:= <a>:  a:= 1:  convert(A,list);

     [a]

It makes no difference whether I set the tyesetting option from the Tools menu.

@Kitonum The returned by your procedure is a global name (as it should be). It is traditional in Maple code that if a procedure needs to return a global name that isn't specified in the procedure's arguments---in other words, the procedure needs to "make up" the global name---that that made-up name begin with an underscore, such as _m. In order for this tradition to be useful, it is also traditional to never assign values to global names that begin with underscores.

@Markiyan Hirnyk The phenomenon that you show (an extra evaluation caused by the use of nested= true) is an unintended and undocumented side effect of that option. You can see this by executing the code inside a procedure, where the option will not have that effect.

restart:
proc()
local A,a;
     A:= <a>;
     a:= 1;
     convert(A,list), convert(A, list, nested= true)
end proc();

     [a], [a]

The only intended purpose of the nested option is to determine how multi-dimensional rtables (and older-style arrays) are handled.

@Kitonum If you re-execute your code after a restart, you'll see that your assignment to B makes no difference---you'll still get [a,b,c].

@Joe Riel 

Thank you for the example. Yes, I already understood what "return an unevaluated call to a constructor" meant. What I am asking for is an example of a practical use of the parsing of that unevaluated call. (I guess that I emphasized the wrong sentence.)

@Prashanth Please post code as plaintext, not pictures.

I'm not sure, but I don't think that parametric and piecewise can be used together.

You do not have any Array. Your f is a table. An Array must be explicitly created or declared. Making assignments to subscripted entries of an undeclared variable creates a table. Whether it's a table or an Array, the number of elements can be found with numelems.

@Kitonum You raise an important point. For the case of polynomial systems (your first counterexample), the problem can still be handled by a single call to solve (but multiple calls to eval), if you use the parametric option, which returns a piecewise solution. Thus:

solve({b*x+y=1, x+b*y=1}, {x,y}, parametric= full);

     piecewise(b-1 = 0, [{x = -y+1, y = y}], b+1 = 0, [],
     And(b-1 <> 0, b+1 <> 0), [{x = 1/(b+1), y = 1/(b+1)}])

Thus, a solution of this form can be sequenced by 

{b=j, 'eval'(solve({b*x+y=1, x+b*y=1}, {x,y}, parametric= full), b= j)[][]} $ j= -2..2;

     {b = -2, x = -1, y = -1}, {b = -1},
     {b = 0, x = 1, y = 1}, {b = 1, x = -y+1, y = y}, {b = 2, x = 1/3, y = 1/3}

The absence of and y in the b=-1 term indicates that there's no solution for b=-1. And, of course, note the special form of the b=1 term. The unevaluation quotes around eval force it to be evaluated for every value of j.

@yader

There are much easier and better ways to make a procedure distribute over container classes (lists, sets, tables, rtables (Vectors, Matrices, Arrays)). The easiest way is to use the elementwise operator ~ (see ?elementwise). So, for example, if is a Vector, do

Cancel10s~(A);

If isn't a container, then the above command behaves just like Cancel10s(A).

The command map is more general in its definition of "container" (see ?map):

map(Candel10s, A);

There is an inplace option for map so that it operates on rtables (Vectors, Matrices, and Arrays) without making a copy:

map[inplace](Cancel10s, A);

The above command alters itself, so there's no need to assign the result to a variable.

Regarding copy-and-paste of plaintext code: The preservation of indentation seems browser dependent. My experience is that it is preserved in Firefox and lines are left-justified in Chrome. My most common use modality is to use Chrome and manually re-add the indentation (because, on my favorite computer, I can't post at all with Firefox). Regardless, it is nearly worthless to your readers to post Maple input as a picture unless you also attach a worksheet.

First 469 470 471 472 473 474 475 Last Page 471 of 709