Preben Alsholm

MaplePrimes Activity

These are replies submitted by Preben Alsholm

It is quite noticeable.

@mmcdara Yes, I do that routinely.
E.g. in a procedure using results from a dsolve/numeric/parameters defined outside the procedure.

Note 3 to my answer:
You can handle 0.005..0.995 if you split it:

res1:=evalf(Int(z(q1, q2), q1=0.1..0.9, q2=0.1..0.9));
  res2:=evalf(Int(z(q1, q2), q1=0.005...0.1, q2=0.005...0.1))+
        evalf(Int(z(q1, q2), q1=0.9...0.995, q2=0.9...0.995));

J2() returns 1.742509218.

@mmcdara Thanks for clarifying the situation!

You are posting an image. That would require any responder to type those 6 equations himself.
Give us text we can copy and paste into Maple.
The syntax doesn't have to be perfect. I see one syntax error right away: You cannot use square brackets as if they were parentheses.

@Kitonum and MB86.

Using Kitonum's code I tried this:


sys_ode := diff(x(t), t) = -x(t)^2/(4*Pi*y(t)*(x(t)^2 + y(t)^2)), diff(y(t), t) = y(t)^2/(4*Pi*x(t)*(x(t)^2 + y(t)^2));
ics := x(0) = 1, y(0) = 1:

plot(rhs(sol),x=1/sqrt(2)..5,y=0..3,color=red); p1:=%: #Saving the plot

Sol := dsolve({sys_ode, ics}, {x(t),y(t)}, numeric);

plots:-odeplot(Sol,[x(t),y(t)], t=-45..45, color=blue,view=0..3);  p2:=%: # Saving the plot
plots:-display(p1,p2); # blue
plots:-display(p2,p1); #red except at the end

If you use this events version you make sure that x(t) stops at 5.

Sol := dsolve({sys_ode, ics}, {x(t),y(t)}, numeric,events=[[x(t)=5,halt]]);


@Carl Love Thanks Carl.
Two comments:
I was just now looking at the help page for type/satisfies. It says:

"Predicates are expected to return normally, without raising exceptions."
My predicates don't meet that condition.


The example of the use of overload(callseq_only) in the help page for overload is AppendUnique, which has nothing to do with jumping from procedure 1 to procedure 2 as the statement in help page talks about.


@Carl Love Thanks for commenting on this.

Here is the example:

@Ronan I have submitted an SCR about option overload(callseq_only).
I made an admittedly contrived example, where an exception (i.e. error) is raised in the parameter checking phase.
The execution didn't proceed from p1 to p2.

@Ronan I'm beginning to see that your original foo1 is behaving correctly, though not as you intended:

                     option overload;
                     print("3 lists");
                  end proc,

                     option overload;
                     print("2 lists");
                  end proc
foo1([1,2],[3,4]); #Output correct because P1 and P2 are lists

Now, however, I don't see any need for using option overload(callseq_only).
I have been looking for examples in the documentation, but have not found any.

@Ronan Yes your example foo3 is puzzling.

Contrast the example with this:

end proc;

p1([1,2],[3,4]); # Error message

But if the body of the procedure p1 doesn't make use of P3 there will be no error.

foo3 didn't produce an error message, it just jumped to the second procedure.

@Prakash J As I said above, dsolve/numeric/bvp uses a finite difference method.
So what more do you want?
To follow a little of what's happening you can try setting


just before executing dsolve/numeric/bvp

The initial mesh is by default 8. To see what happens when you set that value yourself, try

@dharr Maybe you are right:
Anyway I had fun making the animations over two ranges for inf.
There are some ranges where dsolve/numeric/bvp doesn't converge. That is why there are two animations.


@Thomas Richard I noticed that simplify remembers:

f := (BesselI(0, alpha)*alpha - 2*BesselI(1, alpha))/(BesselK(0, alpha)*BesselI(1, alpha)*BesselI(0, alpha)*alpha^2 + BesselK(1, alpha)*BesselI(0, alpha)^2*alpha^2 - 2*BesselI(1, alpha));
simplify(f, 'wronskian'); # Not 1
f := (BesselI(0, alpha)*alpha - 2*BesselI(1, alpha))/(BesselK(0, alpha)*BesselI(1, alpha)*BesselI(0, alpha)*alpha^2 + BesselK(1, alpha)*BesselI(0, alpha)^2*alpha^2 - 2*BesselI(1, alpha));
simplify(f, 'wronskian'); # 1

I tried forget(simplify);  just after simplify(f);  but it doesn't seem to work (at least not consistently).
Note: I was using Maple 2023.2.

@acer Thank you very much acer.
Setting _EnvUsePlotThing:=false:  produces a nice plot in Maple 2023.2.
I will put it into my maple.ini file.

Maple 2022.2 also sets _EnvUsePlotThing:=false in `plots/animate`, but it appears not necessary in this case with plot(x*exp(-x),x=0..20) with Digits set very high.
The speed is affected a lot, though, as you also point out.
I tried this in Maple 2022.2:

CodeTools:-Usage([seq(plot(x^n*exp(-x),x=0..20),n=1..20)]): # Roughly 10 times faster.

@fnavarro It is a really bad idea to use plot as a toy model.
As dharr is pointing out there is nothing wrong with evaluation, but plot is rather special for the reasons I mentioned.
Take a look at this code.

max(V); # 0.3678794411714423215955237701614608674458
min(V); # 0.
1 2 3 4 5 6 7 Last Page 1 of 223