Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Joe Riel A quick read of the code showstat(StringTools:-Readability) shows that the formula actually used by Maple (2016) is not as Samir reported but rather sqrt(...) + 3, exactly as you just suggested.

@_Maxim_ If you want to use bound variables within the plot3d call, it can be done by using an unevaluated return from td when it receives symbolic arguments:

ans:= dsolve({diff(y(t),t$2)=y(t), y(0)=a, D(y)(0)=0}, numeric, parameters= [a]):
td:= proc(x,tt)
option remember;
   if [x,tt]::list(numeric) then
      ans(parameters= [a= x]);
      eval([t, y(t), diff(y(t),t)], ans(tt))
   else
      'procname'(x,tt)
   end if
end proc:

TD:= (k::{1,2,3})-> (x,tt)-> td(x,tt)[k]:
plot3d(TD~([1,2,3])(x,t), x= 0..3, t= 0..3, labels= [t, y, `y'`]);

If you now want to use seq instead of ~, that'll be fine.

@nunavutpanther You are inferring way too much from my statement "It is very inefficient to create large sets by adding elements one at a time because every modification of a set requires the entire set to be moved in memory." What I mean is that if mon is a set with potentially thousands of elements and inside a loop you add potentially thousands more elements, one or a few at a time----THAT is what is very inefficient. Every time that a set or list is changed in any way, the entire set or list, no matter how long, needs to copied to new memory locations. Obviously in a sequentially processing digital computer (the vast majority of computers), the time required for that operation is proportional to the size of the set or list. (Also, the original copy needs to be garbage collected.) Maple tables and rtables (Arrays, Matrices, and Vectors) do not have this problem.

@taro Please execute these four examples. I hope that the output will help you understand what map is for.

map(`*`, [a,b,c], z);
map(f, [a,b,c]);
map(f, [a,b,c], z);
eval(%, f= `*`);

So, map cannot be used to convert a list into something else. If its second argument is a list, then its output will be a list.

@nunavutpanther If you want to create a list in the default set order with no repeats, then you can do that. Note that if L is a list or set then op(L) is equivalent to L[], so your line of code can be replaced by [{L1[], L2[]}[]]. If you don't care about order or repeats, then it's more efficient to simply make a list: [L1[], L2[]]. (Well, at least the creation of it is more efficient.)

HOWEVER, sets are always stored sorted, so checking whether an element is in a set is only time O(log(n)), whereas the same check in a list is O(n) where n is the size of the set or list---a huge difference.

@_Maxim_ Oh, okay. In that case, I withdrawal my comment about simplify.

The most disturbing thing about your example is that simplify returns 0.

Since it's not entirely obvious from the ensuing discussion, I thought that I should point out for less-experienced readers that Maple can ordinarily take the derivative of a definite integral with respect to a variable that occurs both in the integrand and the limits of integration, even if it can't do the integral. For example,

int(exp(-x*(t^3+t)), t= 0..x);
diff(%, x);

The case at hand is special because the integrand can't be evaluated at t= x.

 

@AmusingYeti It's a recent thing; it's been around a few years.

@AmusingYeti Yet sometimes the amount of allocated memory is reduced without restart: Sometimes you see that memory number on the bottom right go down, or you use CodeTools:-Usage and the reported "alloc change" is negative. I don't know how to force this to happen though.

You need to ask yourself Why solve it? If you were to solve it, would it be possible for you to effectively use the solution, which'll probably be 170 very lengthy expressions? Would it perhaps be better to simply resolve the whole system each time that you have numeric values for the parameters, which'd likely only take a fraction of a second?

@Markiyan Hirnyk The problem that you gave to Mathematica is much easier than the original. Your function, considered as a function of a real variable, is continuous and periodic with an irrational period. Thus the limit superior of the discrete sequence is just the maximum of the function considered as a function of a real variable. Maple can do that with

maximize(sin(x)/(3+cos(x)), x= 0..2*Pi);

You may verify that Maple's simplified answer is equivalent to Mathematica's unsimplified one.

@Lime Juice If you make assignments to an indexed (see ?indexed) name (see ?name), E in the case, it turns E into a table (see ?table) (*footnote). In this case, the table's indices are 1, 2, 3; and its entries are the corresponding expressions that you've assigned. The command entries (see ?entries) returns those entries as a sequence.

Let me know if you understand, and feel free to ask other specific questions.

(*footnote) Therefore, it's not safe to assign to an indexed name such as E[n] and then try to use E itself as a variable or to assign to E. Doing so is a very common source of bugs in user code. But it is safe to assign to E, E1, E_1, E__1. The last of these will display as subscripted in the GUI, which is convenient. These name forms (when they're global) can be easily sequenced with the || and cat operators.

@nunavutpanther I updated my code to remove the use of add.

@vv Once again, we had exactly the same idea at the same time! This time, however, my procedure isn't letter-for-letter the same as yours.

First 349 350 351 352 353 354 355 Last Page 351 of 709