nm

5961 Reputation

17 Badges

9 years, 140 days

MaplePrimes Activity


These are replies submitted by nm

@Mac Dude 

I must be overlooking something. But there is no "type extension" here. dog() call just returns a module. This module does not even share the attributes of the base class Animal. 

Buster:=Animal:-dog();
Buster:-move();
Buster:-data1;

Error, module does not export `data1`

While when doing   option object(animal); now the new object has access to all base class animal data and methods.

How is this method you showed any better than just making a separate dog class?  As in

dogClass:=module()
   option object;

       export move:=proc(_self,$)
         print("In dog class. moving ....");
       end proc;  
end module;


Buster1:=Object(dogClass);
Buster2:=Object(dogClass);
etc...

But I agree with you in that Maple is not a true OOP language. I now just use Object as a "record" in other langauges (or "struct"). Where I have common data in one place. Then pass this object from one call to another. Just like when one passes a struct between functions in C.

@dharr 

"I think you wanted print(p) in B."

Yes ofcourse. Last minute change, forgot to update. Now typo fixed. The image is still not expored to a file. 

I nerver used interface(plotdevice=ps, etc...) before.  I am following https://maplesoft.com/support/help/maple/view.aspx?path=plotsetup  where it says to use plotsetup.  

But I just tried your suggestion, and it still did not work I am afraid.   now A wil call B1.


 

restart;

currentdir("C:\\tmp\\TEST_MAPLE");
p:=DocumentTools[RunWorksheet]( "B1.mw" , [the_function=sin(x),the_variable=x]  ):
print("Back from calling worksheet B. Here is the result");
p;

"C:\tmp\TEST_MAPLE"

"Back from calling worksheet B. Here is the result"

"OK"

 


 

Download A.mw

This is B1.mw. tried interface(plotdevice=ps, plotoutput=filename );  and interface(plotdevice=postscript, plotoutput=filename );


 

Inputs

 

the_function:=0;

the_variable:=0;


full_file_name:=cat("C:\\tmp\\TEST_MAPLE\\tmp.ps");
interface(plotdevice=postscript, plotoutput=filename );
plot(the_function,the_variable=-2*Pi..2*Pi):
return "OK";

 


 

Download B1.mw

 

@Rouben Rostamian  

"The format of the font specification is defined in ?plot,options under the "font" entry. Your specification axesfont=[12,12] does not fit that specification. Maple does not complain about that in the worksheet mode."

I am getting these errors. May be we are using different versions? (not able to post an image)

plot(sin(x),x=0..2*Pi,axesfont=12);
Error, (in plot) expecting option [axesfont, axes_font] to be of type list but received 12


plot(sin(x),x=0..2*Pi,axesfont=[12,12]);  #works OK
 

 

@vv 

It is not that easy. The issue becomes what value of slope to choose? 

Compare 

restart;
f:= (3 - 2*x)*exp(5*x);
f1:= diff(f, x):
maxslope:=100:
ff:=piecewise(abs(f1) < maxslope, f, undefined):
plot(ff, x=0..2*Pi);

With the result if using slope=5000 say

This choice worked better for this function as it shows more relevent parts.  But I will try setting some large slope value and run the program and see how the plots look like as there are 10's of thousands of functions to plot.  This will take 1-2 days to finish. This looks like a good solution until Maple smart view becomes more smart :)

 

 

 

@ecterrab 

Thanks for the quick fix. I confirm it is fixed in Latest Physics update. It it great job you are doing by giving fixes so quickly in these updates instead of one having to wait a year or so for a new version of Maple to get the fix.

I have found few more problems  elsewhere in Maple 2021.1 in the last 2-3 months, but I send these to technical support in emails already so I did not post them here.

The only main problem that remains for me with using Maple, is that timeout does not always timeout anywhere near the timeout value given all the time. I still see cases where it hangs or takes much much longer than the timeout value.

But I talked about this many times before so will not bring up anymore. I have many examples showing this. I'll wait for Maple 2022 to see if this problem is hopefully finally resolved.

Thanks again for your support.

@Preben Alsholm 

I think you did not get the errors when you simplified the integrand, is because of the call to simplify() being made before int(). This causes something to be loaded and changes memory layout?

To show this, I used the simplified version of the integrand (copied from different worksheet so I do not have to call simplify()) and repeated things, and now it fails.

 

Now repeated the same thing, but used simplify()  like you did, and the error went away.

This tells me that it has nothing to do with the simpler version of the integrand. It is due to the call to simplify() before which caused something to be loaded which had the side effect of removing the error.

To proof this more. I kept the original integrand, but loaded something else. Calendar package. And now i am not able to reproduce the error no matter how many times I tried.

Removing the call to Calender. Closing Maple. Starting again, and now tried it, and got the error back: of course Calender package has nothing to do with int() command. but this shows that it seems to be a memory layout or something related as loading something before, even if not related causes different behavior. These were all done after starting Maple again each time with nothing else running in Maple.