Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Without knowing the book by Robert Lopez I think you will be in for some problems using it with Maple 2020.

I have in my hand right now another book prepared using Maple V  Release 3: Robert M. Corless, Essential Maple (1995).
If you are just starting out using Maple, don't use the book now, but put it on the shelf for another time.
If you are well versed in Maple already you probably wouldn't be asking the question. Surely, you can learn something from the book, but you will have to know that important changes have happened since that release.
Among the important ones and not necessarily in sequence of priority:
1. The ditto (") in Release 3 is now (%). This happened when actual strings were introduced.
2. The linalg package has been superseded by the LinearAlgebra package, but is still availabe in 2020.
3. The appearance of readlib commands may confuse you. Not used anymore.
4. The default graphical user interface (GUI) is now set to Document mode and 2-D math input. This I advise you to set to Worksheet mode and 1-D mat input (aka. Maple input) . That way the GUI in 2020 looks more like the GUI in Release 3.

But, obviously, lots of other changes, enlargements, and improvements have been made since Release 3.

PS. Another book on my shelf, Robert B. Israel: Calculus The Maple Way has the following footnote in its Preface: " Note, however, that Release 4 requires at least 8 MB of RAM, while Release 3 can manage fairly well with 4 MB."  (Yes MB, not GB).

@Carl Love 
(Notes:
1. Actually just using ``(F) with an active * should do it.
2. To use %* in general in 2D it seems that the function form is necessary:

?)

Both you and Tom use 1D input.
I tried in 2D writing what I thought was exactly the same and got this mildly amusing result:

The total number of constants of integration is 4. I guess we agree about that. Had it been otherwise something went wrong.

@nm The code producing the result very likely uses the order of the unknown functions deps.
When given as a list that is the order. When not given or given as a set the order is lexicographic.

Stiff methods in Maple are restricted to initial value problems. So you could try your system with some appropriate initial conditions to learn if it is stiff.
Have a look at ?dsolve, stiffness.

@ecterrab You wrote:

"The change I am still in doubt is to return value'd when the result is a constant, e.g. 
simplify( %int(sqrt(x^2), x = 0..1) ); # 1/2  "

By the term "constant" you obviously don't mean the mathematical term constant. The integral simplified in the following example is certainly a constant mathematically speaking, but the integral cannot be expressed in terms of functions known to Maple.
 

simplify(%int(1/(1+exp(sin(x))),x=0..Pi));

So there is no simplification possible. But in this next example there is:
 

A:=%int(erf(x),x=0..1);
simplify(A);

We can make examples of integrals that can be computed and are constants in the sense that type(simplify(A),constant) returns true, but where simplify(A) is extremely huge.
I prefer the way Int with simplify has been working: No computation of the integral even if if could be done and results in a constant in the Maple sense. Let value do the job.

@acer I agree with you if I understand you correctly.
I think that Int, Diff, and Sum basically have behaved as I like inert versions of int, diff, and sum do.
As for simplifying Int, simplifications should be done on the integrand, on the range, and very general properties of integrals used. This allows for pulling out constant (always correct for integrals), but not for expanding an integral over a sum of terms (not always correct, e.g. because of cancellations of singularities).
Examples (my Physics update hasn't been done because of the Windows problems), so this doesn't reflect any possible changes):

restart;
Int(0,x=a..b);
simplify(%); # 0: Fine
simplify(Int(f(x),x=a..a)); # 0. Fine.
A:=Int(a*sqrt(x^2)+a*sin(x),x=0..4^(1/2));
simplify(A); # Fine
B:=Int(a*sqrt(x^2)+a*x^2,x=0..4^(1/2));
simplify(B); # Needs an extra simplify:
simplify(%);


 

@ecterrab I was surprised to find that simplify on %int(f(x),x=0..1) actually returns the value of the integral when f is known and the integral can be evaluated, whereas simplify on Int doesn´t. Somehow I missed that difference until now. Why combine simplify with value?
Example:

restart;
%int(sqrt(x^2),x=0..1);
simplify(%); # 1/2
Int(sqrt(x^2),x=0..1);
simplify(%); 
op(0,%); # Int
####
simplify(%int(1/(1+exp(sin(x))),x=0..Pi));
op(0,%); # %int

 

@janhardo If diff(f(x,y),x) = 0 for all x and y then f(x,y) = h(y) for some function h.
To illustrate just plot in 3D any function of y you like.

h:=(x,y)->sin(y^2); # Example
plot3d(h(x,y),x=-3..3,y=-3..3);

 

@janhardo 
Let (y0,z0) be a point for which the function f given by f(y) = g(y,z0) is defined in a y-interval for which y0 is an interior point.

If that function f (of the one variable y) is differentiable at y0 then by definition g is said to have a partial derivative w.r.t. y at (y0,z0) and f'(y0) is called the partial derivative of g at (y0,z0). In Maple denoted by D[1](g)(y0,z0).

If f as given above is differentiable at y0 with f'(y0) = 0 then clearly also the function p given by p(y) = f(y) + C (C any constant ) is differentiable at y0 and p'(y0) = 0. Expressed in terms of g:
If  D[1](g)(y0,z0) = 0 then the function q given by q(y,z) = g(y,z) + h(z)  (any h of one variable) has a partial derivative at (y0,z0) and D[1](q)(y0,z0) = 0.
That part is very simple.
For a converse statement: Assume that g(y,z0) has a partial derivative for all y in an open interval I containing y0 and that D[1](g)(y,z0) = 0 for all y in I. Expressed in terms of f this means that f is differentiable in I and f'(y) = 0 in I.
Then we know that f must be constant in I. Thus g(y,z0) is a constant for y in I. That constant could depend on z0. Thus we may write  g(y, z0) = h(z0) where by h(z0) is simply meant a constant that may depend on which z0 we are talking about. Depending on g that function h could be nasty, e.g. discontinuous at any point z0.

@Thomas Richard 

Here we get formal power series:

Ssol:=dsolve(cde,y(x),formal_series);

Under the assumption that p is an integer we get:
 

Ssol2:=dsolve(cde,y(x),formal_series) assuming p::integer;

which, however, is no better than the previous since we just get the trivial zero solution.
 

limit~([Ssol2],p=7);
limit~([Ssol],p=7);

Compare with:
 

eval(cde,p=7);
sol7:=dsolve(%);
series(rhs(sol7),x,6) assuming x>-1,x<1;

 

@Rouben Rostamian  In 2D in versions before Maple 2016 a dialogue box comes up when you do

f(x):=x^2

In that box it says that parts of the expression are ambiguous and asks the user to choose between function definition and remember table or rtable assignment. Function definition is first and preselected, so just hitting Enter would choose that.

This box disappeared in Maple 2016 where a function definition is the result, but there is no option function_assign.
Same in Maple 2017. Putting in option function_assign happened in Maple 2018.
Removing the dialogue box may have been done (?) because it annoyed users of 2D, but could be brought back I suppose.

The current situation isn't all that bad, I think. If you start by using the arrow definition as in f:= x -> x^2 then it is now possible to make a remember table assignment to f as in f(Pi):=1. If x is just a name (and not a constant like Pi), however, assigning f(t):=t^4  to the remember table for f doesn't make much sense to me, so here a dialogue box could (should) pop up asking the user to choose.

With all that said I never use 2D math input myself, so don't have any of those problems.
 

 

By doing
 

f:=subsop(3=(operator,arrow, function_assign),eval(f));

after having done f:=x->sqrt(x), the 2D assignment f(x):=x^2*sin(x) works as desired.
This is revealed in the help page for Typesetting, Settings, where it states:

When a function is created for the first time using this syntax, the generated procedure will contain the option function_assign. This results in any subsequent assignments involving  "f(args)"  to be interpreted as function assignments. If f has already been defined as a procedure but does not have option function_assign, then any assignment with "f(args)"  on the left-hand side is interpreted as a remember-table assignment regardless of the functionassign setting.[my emphasis].

I guess that that means: If you start by using the "arrow" definition for a given function f, stick to it if you decide to change the definition of f. You can't have it both ways. If you define a new function g by using g(x):=whatever(x), then that will result in a procedure (by default).
 

@acer I like your version. It easily allows extension to include c__ (double underscore) instead of c[]:
 

replace_all_C:=proc(expr::anything,c::name,{useindex::truefalse:=false})
  if useindex then
    subsindets(expr, ':-suffixed(_C, posint)',
           u->c[parse(convert(u,string)[3..])])
  else
    subsindets(expr, ':-suffixed(_C, posint)',
           u->cat(c,"__",parse(convert(u,string)[3..])))
  end if
end proc:

Examples:
 

sol:=dsolve(diff(x(t),t$3) = x(t));
replace_all_C(sol,a)
replace_all_C(sol,c,useindex);

While this allows for different symbols for different outputs from dsolve it doesn't change the numbering. This could easily be added:
 

replace_all_C:=proc(expr::anything,c::name,{useindex::truefalse:=false,add::posint:=0})
  if useindex then
    subsindets(expr, ':-suffixed(_C, posint)',
           u->c[parse(convert(u,string)[3..])+add])
  else
    subsindets(expr, ':-suffixed(_C, posint)',
           u->cat(c,"__",parse(convert(u,string)[3..])+add))
  end if
end proc:

Examples:
 

replace_all_C(sol,a,add=3);
replace_all_C(sol,a,useindex,add=3);

 

@tomleslie I don't know anything about skin friction or Nusselt number, but certainly you can plot the solution in phase space:
 

plots:-odeplot(sol,[theta(eta),g(eta),f(eta)],0..10);

Whether that is anywhere near what he is thinking about is another question.

First 10 11 12 13 14 15 16 Last Page 12 of 215