nm

11353 Reputation

20 Badges

13 years, 12 days

MaplePrimes Activity


These are replies submitted by nm

@Carl Love 

Yes, I understand why it failed when using curved. I knew it is because it did something different that when the arrow is not curved.

But this is really beside the point. These are internal detailes the user of the software should not care about.

When I write a function that takes two options, and it fails when using option 1 but does not fail when using option 2, then this  is a fault of my function. Not the user for using wrong input.

Software should be robust and not fail like this. For example, if Maple is not able to do it internally using curve arrow for some cases, it should internally handle this. May be not process the curve at that location and leave it empty and go on to the next location. Or may be do something else.

But it should not give an exception.  

 

@Carl Love 

Please see what I wrote above about it failng ONLY when using 'arrows'='curve'. My code works fine using y = -1.6 .. 1.6 when not using the option arrows = 'curve'. That is the whole point of what I am asking.

restart;
ode := diff(y(x), x) - 1/(-x^2 + 1)^(1/2) = 0;
x_range := -0.99 .. 0.99;
DEtools:-DEplot(ode, y(x), x = x_range, y = -1.6 .. 1.6, [y(0) = 0]);

works fine.

restart;
ode := diff(y(x), x) - 1/(-x^2 + 1)^(1/2) = 0;
x_range := -0.99 .. 0.99;
DEtools:-DEplot(ode, y(x), x = x_range, y = -1.6 .. 1.6, [y(0) = 0],arrows = 'curve');

error

So I expect the software to not fail when using arrows = 'curve'

@sursumCorda 

Yes, VectorPlot in Mathematica might be closer to Maple's DEplot. But I was looking for something similar to StreamPlot to make PhasePlot since it looks better than VectorPlot. Using arrow='curve' in Maple's got it a little closer to StreamPlot, but there is a bug with arrow='curve'. 

@C_R 

Yes, I knew that if I change the range randomly the bug will go away. But this is not practical solution. And what will I do for for next 10,000 systems I am processing? Keep trying different ranges each time randomly until I find one that does not crash Maple?

Hopefully Maple will fix this in next version. 

Too many bugs, crashes and hangs in Maple. And it keeps getting worst with each new release.

@Rouben Rostamian  

That is better. I knew about arrowsize=number option and did try before. The problem with this, is that I want to run this code on thousands of systems, and if I hard code it to 1.5, it might look OK for some systems, but might look bad for others.

May be others need arrowsize=1.5 and some need arrowsize=2.0 and so on. I do not know.

It would have been better if Maple had an option to make the lines all connected and put the arrows on them, like with Mathematica's. 

But for now, will try 1.5 and see how it works. The axes=boxed and color='magnitude[legacy]' helped. make it better. thanks.

btw, why on your version the tick labels and the axes labels look bigger and darker than what I get? I am on windows 10, Maple 2023.2. This is what I get

I run your code as is, after restart. It looks like your fonts are different than what I am using. Did you by any chance modify some settings in your Maple before this? Your fonts look better than what I am gettings.

@Joe Riel 

"In module A, s has to be an export, not a local."

I know if I make s global, it ofcourse works.

But the question is why is this needed?? This is a workaround not an explanation. 

Not only this change will break encapsulation, it does not explain the problem to me.

When class B extends class A, they become as one single class. So the new class is as if one have written the following code

module A()
   local s::string:="";
   export foo:=proc()
     local z::string:="something";
     local my_inner_proc:=proc()
            s:=cat(s,z);
     end proc();
     my_inner_proc();
     print(s);
   end proc:
end module:

A:-foo();

And the above works as expected.

s is local to the module and an inner method inside the one of the module methods can access the top module local variable and modify it without s having to be global.  But the above _fails_ when adding option object:

restart;

module A()
   option object;
   local s::string:="";
   export foo::static:=proc(_self,$)
     local z::string:="something";
     local my_inner_proc:=proc()
            _self:-s:=cat(_self:-s,z);
     end proc();
     my_inner_proc():
     print(s);
   end proc:
end module:

A:-foo();

Error, (in anonymous procedure called from anonymous procedure) module `A` does not export `s`
 

My question  is why it fails when the module is object vs. normal module.

If this is a design error in Maple OOP, fine. May be it can be corrected in next version. For now, only workaround I found, while keeping object local variable private, is not to use internal methods inside class methods. 

@C_R 

"The required restriction to a part of the real domain is an indication that the MMA response may be too short for the complex domain."

Not when done in Mathematica?

No assumptions or restriction needed.

@sursumCorda 

 is there a similar sortrows/sortcols in Maple?

you might want to look at ArrayTools[SortBy] which is new added in Maple 2023

@acer 

You didn't write up front that you wanted the names of submodules of such stored modules in the archive

I actually did say that,. I said I wanted same list showed by LibraryTools:-Browse("..../my_file.mla") and that includes all modules (at any level). Top and sub modules.

I wrote

"I can see all the modules using the command LibraryTools:-Browse("..../my_file.mla") then clicking EDIT then VIEW option at top right corner.  Member type is automatically set to MODULE in the lower left corner. So I can see the names of all the modules. And using the slider, I can scrol down. I see 73 modules listed."

I'll just do it manually for now. No problem. I will use LibraryTools:-Browse and copy the list of all the modules to a file and go from there. The list shown by LibraryTools:-Browse  also includes fully qualified modules name, as in A:-B and A:-C and not just B and C as generated by the command exports(A) so it works better for me.

I thought there was a way to obtain same exact output shown by LibraryTools:-Browse but in code.

@acer 

If all what is needed was to do 

currentdir("C:/tmp/"):
libname := "C:/tmp/my_library.mla",libname;
exports(A);

Then what is the other code you showed for? In the above one has to put the name of the top level module A to get all modules it exports.

But using the L method, it still does not work for me. It works for Physica library and for Maple own libraries, but not for my mla as I showed.

L := "C:/tmp/my_library.mla";
L := "my_library.mla";
L := "my_library";
L := my_library;
L := my_library.mla;

None of these work when using the rest of the code

select(type,
  map(proc(m) try nprintf("%s",m[1][1..-3]);
              catch: end try; end proc,
      LibraryTools:-ShowContents(L)), `module`);

My question is: What should my L then be??

It works on Maple own libraries

L := "C:\\Program Files\\Maple 2022\\lib";

select(type,
  map(proc(m) try nprintf("%s",m[1][1..-3]);
              catch: end try; end proc,
      LibraryTools:-ShowContents(L)), `module`);

Again, what should the L be for my own .mla??

@acer 

Did you actually try it your self or is it something you think should work?

If you did actually try, it would be easier to show the exact commands you typed instead of having one guess.

I can't make it work. Just to be clear, I wanted to get a list of all modules in .mla even if submodules. Not just the top level one. The same exact thing that LibraryTools:-Browse("..../my_file.mla")  shows as mentioned in my question.

I attach my_library.mla which have one module A and inside A there are 2 submodules B,C.

I also attach the worksheet showing my attempts. I am using 2022 now since more stable.

I also attach the A.mpl.

If you can make it work, could you please show the exact commands to use with this attached example instead of generic description? 

Explicit is always better than implicit.

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;

currentdir("C:/tmp/"):

print("current directory is ",currentdir());

interface(warnlevel=4);
kernelopts('assertlevel'=2):    

my_libname:="my_library.mla";

FileTools:-Remove(cat(currentdir(),"/",my_libname));
LibraryTools:-Create(cat(currentdir(),"/",my_libname));

read cat(currentdir(),"/A.mpl"):
LibraryTools:-Save('A',my_libname);

"current directory is ", "C:\tmp"

3

"my_library.mla"

currentdir("C:/tmp/"):
L := "my_library.mla";

select(type,
  map(proc(m) try nprintf("%s",m[1][1..-3]);
              catch: end try; end proc,
      LibraryTools:-ShowContents(L)), `module`);

"my_library.mla"

[A]

currentdir("C:/tmp/"):
L := "my_library";

select(type,
  map(proc(m) try nprintf("%s",m[1][1..-3]);
              catch: end try; end proc,
      LibraryTools:-ShowContents(L)), `module`);

"my_library"

Error, (in march) there is no existing archive in "my_library"

restart;

currentdir("C:/tmp/"):
libname := "C:/tmp/my_library.mla",libname;

"C:/tmp/my_library.mla", "C:\Users\Owner\maple\toolbox\2022\Physics Updates\lib", "C:\Program Files\Maple 2022\lib"

exports(A)

B, C

L := my_library;

select(type,
  map(proc(m) try nprintf("%s",m[1][1..-3]);
              catch: end try; end proc,
      LibraryTools:-ShowContents(L)), `module`);

my_library

Warning, grobner is deprecated. Please, use Groebner.

Warning, the GPIOTools package is only supported on the Raspberry Pi platform

[A, Algebraic, AlternatingCFSG, AndProp, AndProp, AndProp, AppellF1, AppellF2, AppellF3, AppellF4, ArithmeticCalendar, ArrayTools, ArrayTools, AudioTools, `_CGLanguageDefinition/Java`, `_CGLanguageDefinition/Swift`, `_CGLanguageDefinition/VisualBasic`, _ImportExport, `algcurves/AbelMap`, `algcurves/CurvePlot`, `algcurves/intersectcurves`, alias, alias, allvalues, asympt, BadiCalendar, BaseDataObject, BoxObject, BranchCutsTutorPlotData, bernoulli, branches, CAD, CFSG, CUDA, Cache, Calendar, ChevalleyCFSG, CivilIslamicCalendar, CodeGeneration, CodeTools, ColorTools, CommandCompletion, Companion, Compiler, ComplexBox, ComplexBox, ComputationalGeometry, ContextMenu, ContextMenu, ConvertODE, CopticCalendar, CurveFitting, CyclicCFSG, `_CGLanguageDefinition/default`, _UIUtils, Clock, codegen, combinat, `combine/binomial`, `combine/units`, `combine/units`, `convert/DGbiform`, `convert/DGform`, `convert/DGtensor`, `convert/DGvector`, `convert/base`, `convert/binary`, `convert/csccot`, `convert/hex`, `convert/hypergeom/FromStandardFunctions`, `convert/list`, `convert/sectan`, `convert/set`, `convert/system`, DEQueue, `DEtools/2F1`, `DEtools/DEplotInteractive`, `DEtools/DRNF`, `DEtools/FindODE`, `DEtools/HypergeomCases`, `DEtools/HypergeomFiveSing`, `DEtools/HypergeomFourSing`, `DEtools/IndicialFunction`, `DEtools/Order2/Same_p_curvature`, `DEtools/Order2/s_equiv`, `DEtools/SolveBessel`, `DEtools/SolveWhittaker`, `DEtools/hypergeometricsols`, `DEtools/polysols`, DataFrame, DataSeries, DataSets, Database, Date, DeepLearning, DeepLearning, Degrees, Describe, DifferentialAlgebra, DifferentialAlgebra, DifferentialGeometry, DifferentialThomas, DiracDefinite, DiracDefinite, DiracDefinite, DiscreteTransforms, DocumentTools, Domains, `_CGLanguageDefinition/CSharp`, `_CGLanguageDefinition/Fortran95`, `_CGLanguageDefinition/Julia`, `_CGLanguageDefinition/Python`, _DBM, depends, `diff/wrt$/SymbolicOrder`, `diff/wrt$/SymbolicOrder`, `diff/wrt$/SymbolicOrder`, `dismantle/module`, `dsn/Generate1DInterpolation`, `dsn/Generate2DInterpolation`, `dsolve/numeric/BasicSimpl`, `dsolve/numeric/DAE/ix1reduce`, `dsolve/numeric/FlattenPiecewise`, `dsolve/numeric/NumericalJacobian`, `dsolve/numeric/ToExternal`, `dsolve/numeric/ToExternal`, `dsolve/numeric/TrigGrob`, EgyptianCalendar, EllipticE, EllipticPi, EnglishConversions, Equate, EssayTools, EthiopianCalendar, EvalfAppell, EvalfGeneralizedPolylog, EvalfHeun, EvalfInttrans, EvalfMultiZeta, ExcelTools, Explore, Explore, ExportMatrix, ExternalCalling, _MapleNetPublish, eBookTools, eBookTools, `eval/int`, `eval/int`, `evala/Factors/efactor`, `evala/Gcd/SparseModular`, `evala/Gcd/alghelper`, `evalf/MeijerG`, `evalf/Sum`, `evalf/hypergeom`, `evalf/int/MultipleInt`, `evalf/int/NAGInt`, `expand/bigpow`, FMUTester, Factorial, FileTools, Finance, Fractals, `factor/mtshl`, fgbrs, floor, fnormal, forget, fracdiff, fsolve, GaussInt, GeneralizedPolylog, Grading, GraphTheory, GraphTheory, GregorianCalendar, GregorianIntercalatedCalendar, Grid, Groebner, GroupTheory, GroupTheory, `_CGLanguageDefinition/Fortran77`, `gcd/LinZip`, genfunc, geom3d, geometry, getassumptions, getassumptions, getassumptions, gfun, grobner, group, HelpTools, HeunB, HeunBPrime, HeunC, HeunCPrime, HeunD, HeunDPrime, HeunG, HeunGPrime, HeunT, HeunTPrime, hashmset, heap, ImageTools, ImageTools, ImportData, ImportMatrix, IncompleteBellB, InertForm, InertNames, InstallerBuilder, IntegerRelations, IntegralTransforms, IntegrationTools, InteractivePlotBuilder, Interpolation, IterativeMaps, Iterator, `_CGLanguageDefinition/Matlab`, identify, `ifactor/QuadraticSieve`, int, `int/definite/ln`, `int/definite/ratpoly`, `int/parallel`, `int/trigell_definite`, interface, intsolve, `inttrans/IntByDiff`, iperfpow, `is/duplicates`, `is/duplicates`, `is/duplicates`, `is/internal/eqns_inds`, `is/internal/eqns_inds`, `is/internal/eqns_inds`, isprime, JSON, JSON, Jacobi, JulianCalendar, `LREtools/Desingularization`, `LREtools/HypergeometricTerm`, `LREtools/RightFactors`, `LREtools/dAlembertian`, LaTeX, LargeExpressions, LibraryTools, LieCFSG, LinearAlgebra, LinearFunctionalSystems, LinearOperators, Logic, LommelFunctions, latex, latex, latex, `latex/old/_DG`, `latex/old/latex/symbol`, libmgb, `limit/hypergeom`, linalg, MPI, MTM, Magma, MapleCalculator, MapleNetWorksheet, MapleTA, Maplets, MathematicalFunctions, MathematicalFunctions, Matlab, MatrixPolynomialObjectImplementation, MmaTranslator, ModularSolver, MultiPolylog, MultiSeries, MultiSet, MultiZeta, MultivariatePowerSeries, MutableSet, _MessageCatalogue, `mod/polyc`, modpn, NInverseJacobi, NJacobi, NielsenPolylog, NormalSeries, NumberTheory, NumericTools, norm, `normal/GAMMA/global/sin_special`, numapprox, numtheory, OpenAPI, Optimization, Optimus, Ordinals, OreTools, Ore_algebra, OrthogonalSeries, `_CGLanguageDefinition/C`, `_CGLanguageDefinition/JavaScript`, `_CGLanguageDefinition/R`, _Inert, `odsolve/S-function`, PDEtools, PDEtools, PDEtools, `PDEtools/U_to_u`, `PDEtools/U_to_u`, `PDEtools/U_to_u`, `PDEtools/u_to_U`, `PDEtools/u_to_U`, `PDEtools/u_to_U`, PackageManagement, PackageTools, PackageTools, PatternMatching, Perm, PersistentTable, Physics, Physics, Physics, PiecewiseTools, Plot, Plot, PlotBuilder, PlotBuilder, PolyhedralSets, PolynomialIdeals, PolynomialTools, ProcessClock, ProcessControl, Python, padic, `pdsolve/BC`, `pdsolve/BC`, `pdsolve/numeric/elliptic`, `pdsolve/series`, `plot/filledplot/built`, plots, `plots/intersectplot`, `plots/merge_inputs`, `plots/merge_inputs`, plottools, polytools, powseries, `print/_DG`, priqueue, procbody, process, `property/Shake`, `property/Shake`, `property/Shake`, `property/min`, `property/min`, `property/min`, QDifferenceEquations, queue, RTableQueryImplementation, RandomTools, RationalNormalForms, RealBox, RealBoxPT, RealDomain, ReasonableDomain, ReasonableDomain, ReeCFSG, RegularChains, RegularChains, `RootOf/RootOf`, PlotThing, realroot, SCSCP, SMTLIB, SNAP, ScientificConstants, ScientificErrorAnalysis, Security, SeriesHeun, SignalProcessing, SignalProcessing, Slode, Sockets, SoftwareMetrics, SolveTools, SphericalY, SporadicCFSG, Spread, StandardContext, StandardContext, Statistics, SteinbergCFSG, StringTools, StringTools, Student, Student, SubgroupSeries, SubnormalSeries, SumTools, SumTools, SumTools, SuzukiCFSG, SystemUTCClock, `_CGLanguageDefinition/KernelExtensionInternalUseOnly`, `_CGLanguageDefinition/Pseudocode`, _RuntimeTools, sdmp, `simpl/eval`, `simplify/D/type`, `simplify/float`, `simplify/piecewise`, `simplify/siderels`, `simplify/siderels`, `simplify/siderels`, sqrt, stack, `subtype/typegraph`, sumtools, surd, TAIClock, Temperature, TestTools, ThermophysicalData, ThreadClock, Threads, Time, TimeSeriesAnalysis, Tolerances, Tutor, TypeTools, Typesetting, Typesetting, Typesetting, `_CGLanguageDefinition/Fortran`, _bing, MatrixPolynomialAlgebra, `tools/ComputationalGeometry`, `tools/JSON`, `tools/ParsePastBind`, `tools/ProcedureToExpression`, `tools/commonfactors`, `tools/htmlparser`, trigsubs, URL, Units, Units, VariationalCalculus, VectorCalculus, VectorSpace, VerifyTools, Worksheet, WorksheetTools, Wright, XMLTools, YAML, YAML, ZernikeR, `_CGLanguageDefinition/IC`, `_CGLanguageDefinition/Perl`, _ImportExport, abnd, BaseCalendar, Bits, binomial, `convert/horner`, `convert/system`, `DEtools/DifferentialClosure`, DocumentTools, DynamicSystems, FormalPowerSeries, GPIOTools, HTTP, Jupyter, LieAlgebrasOfVectorFields, ListTools, MathML, RepublicanCalendar, RootFinding, SubexpressionMenu, _CompilerBenchMarks, ThermophysicalData, TitsCFSG]

restart;

currentdir("C:/tmp/"):
libname := "C:/tmp/my_library.mla",libname;

"C:/tmp/my_library.mla", "C:\Users\Owner\maple\toolbox\2022\Physics Updates\lib", "C:\Program Files\Maple 2022\lib"

exports(A)

B, C

L := [libname][1];

select(type,
  map(proc(m) try nprintf("%s",m[1][1..-3]);
              catch: end try; end proc,
      LibraryTools:-ShowContents(L)), `module`);

"C:/tmp/my_library.mla"

[A]

 


 

Download not_working_june_15_2023.mw

Below is the mla file

my_library.mla

And this is A.mpl file (I can''t upload mpl file so I am putting it here as plain txt

A:=module()

    export B:=module()
      export foo:=proc()
          1;
      end proc;
    end module;

    export C:=module()
      export boo:=proc()
          1;
      end proc;
    end module;
end module;

 

@acer 

I can't get this to work. 

select(type,map(proc(m) try nprintf("%s",m[1][1..-3]);
   catch: end try; end proc,
   L),`module`);

Warning, grobner is deprecated. Please, use Groebner.
Warning, the GPIOTools package is only supported on the Raspberry Pi platform
[Algebraic, AlternatingCFSG, AndProp, AndProp, AndProp, AppellF1, 

  AppellF2, AppellF3, AppellF4, ArithmeticCalendar, ArrayTools, 

  ArrayTools, AudioTools, _CGLanguageDefinition/Swift, 

  _CGLanguageDefinition/VisualBasic, 

  _CGLanguageDefinition/default, _ImportExport, 

  algcurves/AbelMap, algcurves/CurvePlot, 

  algcurves/intersectcurves, alias, alias, allvalues, asympt, 


etc....

These are Maple modules, not the ones in my own mla file. I made sure libname is correct and that plibname][1] is name of my mla.

But will keep trying to see.

@acer 

yes, with your fix it works now. Thanks.

@acer 

I tried your code on Maple 2022 and Maple 2023. It works for system level module such as LinearAlgebra. But when I pass a name of one of my modules, it throws exception

proc(m) local res, oldOM; oldOM := kernelopts(':-opaquemodules' = false); try res := select(p -> type(m[p], procedure), [m:-_pexports()[], op(3, eval(m))]); catch: print(lastexception); res := []; finally kernelopts(':-opaquemodules' = oldOM); end try; res; end proc, "module does not export `%1`", _pexports

I've added print(lastexception); in the catch clause

Does the module need to have special code added to it to make this work? My module all have standard setup

export  A := module() 
   export B:=module()

      export foo:=proc(...)
     end proc;
     ...
 
      local boo:=proc(...)
     end proc;

    etc...
  end module;

#etc.... more modules in separate .mpl files
end module;

I called your H using

          H(A:-B)

Where A is top level module and B is submodule inside A. All submodules are exported also.

So I can do A:-B:-foo(...) and it works. Where foo() is name of a proc inside module B which is inside module A.  

I can make a MWE example if needed. But all my modules are in .mla file and they are on libname path and I can call them with no problem. It is only H() does not seem to work with them for some reason.  

@sursumCorda 

I do not understand.

Could you give an example using my code I showed above? Where will this go? And how to turn it on/off from outside?

I understand better by seeing an actual example. 

If you mean to type trace(foo,statements = false) before making the call, then this does not work. It only turn on tracing for the foo() proc. Not for other proc's it calls.

I want to add tracing showing -->enter <-- exit  for every call made, but limit it to my code.

Here is what I think you meant

foo:=proc(n,m,k)   
   local r;  
   #if DO_TRACE then
   #   option trace=0:
   #fi;
   
   boo(1);
   r:=n:
   NULL;
 end proc:

boo:=proc(n)   
   local r;  
   r:=n:
   NULL;
 end proc:

# and now

trace(foo,statements = false);
foo(1,2,3)

This shows

{--> enter foo, args = 1, 2, 3
<-- exit foo (now at top level) = }

You see. It only showed trace of foo() only.  

So I think I need trace option=0 added explicility in each proc I want to trace.

It goes without saying that listing all the proc names in trace([foo,....],statements = false) is not a real solution. I also tried trace(foo,statements = false,depth=10); but that only traced the proc foo only and not all the other procs called. 

The question is, how to turn that on/off from the outside when I am done debugging.

First 23 24 25 26 27 28 29 Last Page 25 of 91