Preben Alsholm

13728 Reputation

22 Badges

20 years, 247 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@nm You can find out about option lock here:
?Option lock in Procedures

Yes, certainly sum was available very early, in fact before add.

In Maple 8 I just tried
op(3,eval(sum));
and got
            `Copyright (c) 1995 by the University of Waterloo. All rights reserved.`



To explain the reason for the error we would have to see what L stands for. Presumably it may depend on t. If not diff(L,t) would be zero. You are solving numerically and there is a function eta(r,t). Is that an unknown? In that case pdsolve/numeric would surely complain if there is only one equation. What exactly do you feed to pdsolve?

@MrYouMath In your example given in the reply to Carl we have
b_1=(0,0,a_3,0),b_2=(a_1,a_2,0,0),b_3=(a_1,a_2,a_3,0) and b_4=(0,0,0,a_4).

If a_1, a_2, ..., a_4 are arbitrary constants, then these vectors represent subspaces spanned by:

four sets of vectors B1,B2,B3,B4, where as an example B2 is

These 4 sets of vectors can be put into a matrix T by doing
T:=Matrix(op~([B1,B2,B3,B4]));

The numbers of vectors in the four bases are:
N:=nops~([B1,B2,B3,B4]); #output N := [1, 2, 3, 1]
By doing gaussian elimination we can determine which of the vectors we can thow out and which to keep:
G:=LinearAlgebra:-GaussianElimination(T);

We see immediately that keeping b1, b2, b4 will be fine, and by closer inspection that an alternative is b3,b4.
Had you used another ordering in T as in
T2:=Matrix(op~([B3,B4,B1,B2]));
and proceeded as above, the immediately obvious answer readable from G2:=LinearAlgebra:-GaussianElimination(T2);
and using N2:=nops~([B3,B4,B1,B2]); would be b3, b4.




You say

I'm trying to plt something, I can't see why Maple isn't multiplying these two rows as it should.

Does plt stand for plot? In that case what is it you want to plot?
What type of product is asd*asf meant to be? Elementwise? Then see the answer by ThU.
If a dot product is intended then do DotProduct(asd,asf);

@Christian Wolinski To answer your question:

Why is the output not:
['a', 1 .. 4, x, 'b', 1 .. 4, x, 'c', 1 .. 4, x, 'd', 1 .. 4, x]
and
[a, '1 .. 4', x, b, '1 .. 4', x, c, '1 .. 4', x, d, '1 .. 4', x]

my reply is that you should not expect quotes in the output at all.
Consider the more elaborate version of the first procedure (a::uneval ,b)->'args', now using the syntax in Maple V Release 4.
p:=proc(a::uneval,b) 'args' end;
p(x,y,z); # returns x,y,z in all Maple versions, including Maple V Release 4.
This is as it should be since first args is simply replaced by x,y,z and then evaluation to one level removes the quotes around 'x,y,z'. (Full evaluation would do just the same).

Now to illustrate the effect of the declaration a::uneval, let
xx:=89;
# and try
p(xx,y,z); #Output xx,y,z since evaluation of 'xx,y,z' one level just means removing the unevaluation quotes. (Again: Full evaluation would do just the same, but we are inside a procedure).
# If you continue with
"; # That is % these days.
#  then you get 89,y,z
Now consider instead
q:=proc(a::uneval,b) 'args[1..-1]' end;
q(xx,y,z); #Output (xx,y,z)[1..-1] as it should.
# Again if you continue with
"; # You get full evaluation to 89,y,z

@necron I just tried Digits=100. That helped, but didn't produce the graph you expected.

To your PS: It is even harder to help if there is no worksheet. You gave us images, thus we would have to type the whole thing ourselves.

@torabi With your new data as presented in your worksheet DSOLVE3.mw I had success with using continuation as follows.

1. Proceed from restart until you have defined sys.
2. Then do the following:

indets(sys,specfunc(ln)); #Just to see the culprits
##We try making the ln terms harmless:
sys0:=evalindets(sys,specfunc(ln),x->ln(10));
res0:=dsolve({op(sys0)} union bcs2 union {bcs22}, numeric);
plots:-display(Array([seq(plots:-odeplot(res0,[theta,h(theta)]),h=[h1,h2,h3])]));
## That was fine. Based on that experience we introduce a continuation parameter lambda
## such that lambda=0 gives us sys0 and lambda=1 gives us sys:
sysC:=evalindets(sys,specfunc(ln),x->ln(subs(h3(theta)=lambda*h3(theta),op(1,x))));
## Now use continuation in lambda:
res:=dsolve({op(sysC)} union bcs2 union {bcs22}, numeric,continuation=lambda);
plots:-display(Array([seq(plots:-odeplot(res,[theta,h(theta)]),h=[h1,h2,h3])]));


@torabi In what way does the new version differ from the old. You are using new data, you say. How far are they from the data in the first version? Could you use the solution from that for an approximate solution?
The error message probably is due to the log terms becoming imaginary.

I shall be gone for a week so won't have time for more now.

@tomleslie In his original version, which I used in my answer, I get the output 3 from both of

nops(SYS);
nops(SYS2);

@Carl Love  I saw some examples by Axel Vogt about this, but I don't have the reference.
Here is a contrived example made by me, but I think it catches one of his main points:
kernelopts(floatPi=false);
seq(sin(2*n*Pi+0.5),n=0..10000,1000); #Exactly the same
kernelopts(floatPi=true);
seq(sin(2*n*Pi+0.5),n=0..10000,1000); #Varies as can be expected

## Of course you could make this example more glaring if you began with e.g.  Digits:=5:

@Carl Love I think my primary reason is consistency with the treatment of other constants:

kernelopts(floatPi=true);
Pi+2.;         #float
Catalan+2.; #mix
gamma+2.;  #mix
exp(1)+2.;   #mix
sin(2)+2.;    #mix

@Carl Love It may be relevant to mention that since Maple 2015 the output of input like

2.0 + Pi;

can be controlled by setting
kernelopts(floatPi=true);
or
kernelopts(floatPi=false);

The option is available (but not mentioned) in Maple 2015. Edited:  The default is true, i.e. output is 5.141592654, whereas it is 2.0+Pi in all previous versions of Maple.
The option is available (and mentioned) in Maple 2016. The default is true, i.e. output is 5.141592654.

I have put kernelopts(floatPi=false);  in my maple.ini file.
Added: Actually, because kernelopts(floatPi=false) will generate an error in Maple 18 and earlier versions i have wrapped the statement in  try catch end try:

try kernelopts(floatPi=false) catch: end try:

@nm Actually the help page on pi (?pi) has as its first line:

"For information on 3.14159..., see Pi."

Furthermore, the two relevant examples given on that page uses Pi.

Although I never use 2D math input myself I have noticed that in that context there is some confusion (second-guessing).
Example:
In a fresh worksheet using 1D input (Maple input) I write

a:=pi

Then I select that and right click to bring up a context menu.
I choose Convert To/ 2-D Math Input.
The response is  

as expected because pi and Pi print the same.
When I use
lprint(a);
I get Pi, and when I use
evalf(a);
I get  3.141592654.

First 78 79 80 81 82 83 84 Last Page 80 of 230