Preben Alsholm

13743 Reputation

22 Badges

20 years, 335 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@nm Yes, and p is not declared local.

membertype assigns to p.

The sequence of locals:

eval(op(2,eval(Logic:-Satisfy));

       B, vars, foundvars, extravars, i, result, s, u, T, V

@tomleslie Change maxstep=0.1 to stepsize=0.1 in DEplot3d then the result will look like the one you get from odeplot if you use:

sols:=dsolve( desys, numeric, maxfun=0,stiff=true,range=0..1000);
plots:-odeplot(sols,[B[1](t), B[2](t), C(t)], 0..1000,refine=1);




@Carl Love The image in the question is an image of 2-D math input, which I never use. But if I in a worksheet on a new input line write
pi;

Then select it with the mouse, right click and choose Convert to 2-D Math Input then press Enter and finally evalf(%);

then I get 3.141592654.
Yes, just another reason not to use 2-D math input.

# The text version uses commas instead of periods, so was obviously not used by the questioner (Niek).

@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:

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