mmcdara

5274 Reputation

17 Badges

7 years, 119 days

MaplePrimes Activity


These are replies submitted by mmcdara

Here is your complete worksheet in WORKSHEET-MODE style

EulerLagrange.mw


Don't be afraid if the copy-paste operation transforms the first line into the second one ... the results are the same

 

 

If you want to build the solution "sol2" from t=1000 to t=3000, the simplest way is to set the IC equal to sol(1000) and solve in the range 1000..3000.
If you do this (brown code in the attached file), you will see that sol2 is equal to sol in the range 1000..3000

aa_problem_MWE2.mw

 

 

I did not analyze your code for solution "sol2".

But, if you try to solve the same problem from t=1000 to t=3000, the only thing tou have to do is to set the new IC at t=1000 equal to sol(1000) and solve in the range 1000..3000
If you do this, sol2 returns the solution sol gave in the range 1000..3000 (see the code in brown in the attached file).

By the way, I added legend=... in the graphs for a smarter plot and change method=rkf45 (default choice) ny method=rosenbrock (to hande potential stiff problems).

So I guess your code for "sol2" could contain some mistake(s) ?


aa_problem_MWE2.mw
 

I did not analyze your code for solution "sol2".

But, if you try to solve the same problem from t=1000 to t=3000, the only thing tou have to do is to set the new IC at t=1000 equal to sol(1000) and solve in the range 1000..3000
If you do this, sol2 returns the solution sol gave in the range 1000..3000 (see the code in brown in the attached file).

By the way, I added legend=... in the graphs for a smarter plot and change method=rkf45 (default choice) ny method=rosenbrock (to hande potential stiff problems).

So I guess your code for "sol2" could contain some mistake(s) ?


aa_problem_MWE2.mw
 

@acer 
(from sand15's home-alias)

The example given in the help pages, even with a legend on the first plot, works perfectly at home

Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895
(imac)

 

@Preben Alsholm 

Unfortunately  I'll be unavaliable for two days to study your reply.
I'll will contact you again as soon as possible.

Thanks for the help

@vv 

 

Do you mean: why do I do this

ff:=x->2*x+3;
M := module()
  option package;
  export f;
  f:=eval(:-ff);
end module:

instead of this  

M := module()
  option package;
  export f;
  f:=eval(:-ff);
end module:
ff:=x->2*x+3:

?

The answer is: just because I found this method somewhere here, years ago.

However I'll be unavaliable for two days to investigate this point further.
I'll will contact you again as soon as possible to clarify this.

Thanks for the help

@vv 
(different lognames but the same person, now out from my office)

I have tested your coding and I understand the different results it gives.
But it seems (maybe I did not examine the results with enough attention) that 

ff:=x->2*x+3;
M := module()
  option package;
  export f;
  f:=eval(:-ff);
end module:
#ff:=x->2*x+3:

returns the same things  ...

More of this, if the definitions of ff and M are done in a specific worksheet ending with the creation on an archive M.mla, and if M is used in a separate worksheet through the command with(M) (libname having been instanciated correctly), which is my case, should I have to expect 

#ff:=x->2*x+3;
M := module()
  option package;
  export f;
  f:=eval(:-ff);
end module:
ff:=x->2*x+3:

and 

ff:=x->2*x+3;
M := module()
  option package;
  export f;
  f:=eval(:-ff);
end module:
#ff:=x->2*x+3:


to behave differently ?

Thanks four your involvement
 

@Preben Alsholm 

(different lognames but the same person, now out from my office)

 

I proceed exactly as I understand you do.

More precisely : 

 

1/ I open an interactive Maple session (Maple 2015, Windows 7)

 

2/  I open the file MyModule.mw in worksheet W1 

     and the file Test.mw in a separate worksheet W2

     W1 is aimed to develop the package MyModule

     The code in W2 contains  the call to the procedure MyProc included in  MyModule

 

3/ W2 begins this way : 

     restart:

     MyLib := ….                           # the directory which contains  MyModule.mla 

     libname := MyLib, libname;    # should I have write lib name := libname, MyLib,  ?

     with(MyModule):

 

4/ W1 begins with a « restart » command and is organized this way :

     * the codes corresponding to the N procedures MyModule contains (each of them in a separate block)

     * a new block where the module MyModule is defined

     * a last block where the archive MyModule.mla  is created in the directory Mylib (the same name used in W2)

     

5/ Once MyModule.mla has been generated I return to W2.

 

    5.0/ I execute W1 up to the command MyProc(…), where MyProc is one of the N procedures MyModule contains.

           I’m not happy with the result it returns, so:

 

     5.1/ I go back to W1

     5.2/ I modify MyProc

     5.3/ I execute (!!!) the whole W1 worksheet 

            If MyLib already contains MyModule.mla, which is generally the case, this archive is destroyed 

            before a new might be created

            I verified in a third worksheet that MyModule.mla contains the modified procedure MyProc

 

     5.4/ I go back to W2.

            I insert a new block just after the one which contains the call to MyProc.

            This block contains 

                  unwith(MyModule);

                  package();             # to insure that MyModule has been « unwithed » … which is the case (***, see below)

                  with(MyModule);

 

            The command showstat(MyProc) keeps displaying the unmodified MyProc loaded by the first with(MyModule) 

             (point 3/ above).

            It all goes as if unwith(MyModule) + with(MyModule) was ineffective.

 

            *** More surprisingly, if I  execute the command MyProc(…) after unwith(MyModule) , I do not obtain the output 

                 MyProc(…) which would signify that  MyProc is unknown, but the same result I obtained at point 5.0 !?!?

 

 

PS : it is of course not a blocking situation for I can always execute the W2 worksheet from its first « restart » command to the MyProc(…).

        It’ is more something which is troubling me...

@Mariusz Iwaniuk 

Thank you, 

best regards

@Mariusz Iwaniuk 

 

S := (a,d) -> sum((a+d*k)^(r), k=1..infinity):
S(a, d) - S(f0, f1)

Nevertheless I'm surprised by the opposite signs of d*n in

Zeta(0, -r, (d*n+a+d)/d)

between Mathematica and I : probably some mistake on my side ???

Best regards

 

@John SREH 

English not being my native language I didn't truly understand the meaning of "you're smart as bait" (translators seem to suggest it could even be insulting).

Whatever !
Adapt this to your specific needs

LX   := 1:
LY   := 1:
NX   := 20:
NY   := 20:

p    := pds:-plot3d(x=0..LX,y=0..LY, grid=[NX, NY]):
data := plottools:-getdata(p)[3];

Xgrid := Vector[column](NX*NY, [evalf(seq(seq(0..LX, LX/(NX-1)), k=1..NY))] );
Ygrid := Vector[column](NX*NY, [evalf(seq(seq(k, m=1..NY), k=1..NX))] ); 

DATA := < Xgrid | Ygrid | convert(data, Vector[column]) >


Next use writedata, ExportMatrix, save, or whatever you want to write the matrix DATA in some file

 

@Kitonum 

You inderstood the question as "find the solution of an ODE over some range [h, R0], given 2 Dirichlet boundary conditions".
Maybe it is what the OP asked for, but it's written 

So you can also interpret the question this way : find a function which "passes" by the points (h, U1) and (R0, U2), such that
in r=h and r=R0.
Some kind of "spline interpolation" problem. But an ill posed one because there exist an infinity of solutions while the class the function belongs has not been fixed.

For instance: assume h < R0 and c is such that h < c < R0
Then the function u(r) = U1 if r < c and U2 if r > 0 is a solution of the problem.


The original question is not at all clear.

PS : 
In your "ODE interpretation", the formal solution of 
is u(r) = A*log(r)+B where A and B are suitable constants (isotropic Laplace's equation in polar coordinates, no need to Maple to find the solution).
A and B are found by solving the system  A*log(h)+B=U1, A*log(R0)+B=U2.
If U1=U2 then A=0 and u(r)  is a constant function of value U1
If U1=U2=0 then u(r) is the nul function
 

Do you mean you're interested in the Sobol method for generating low discrepancy sequences ?

If it's the case there is no such algorithm in "public" Maple.
I'have coded something like that but for the Faure's Method (as you probably know there are several low discrepancy sequences algorithms and Sobol's is just one of them).

Let me know if you're interested in it.
Just a point : could this wait until Monday for I'm in weekend now ?

@Preben Alsholm 
 

It works perfectly well.
One more ime, thank you so much

First 105 106 107 108 109 110 111 Page 107 of 113