C_R

2582 Reputation

19 Badges

4 years, 364 days

MaplePrimes Activity


These are replies submitted by C_R

@Carl Love mods does not work on real numbers ("analog")

mods(11.5, 10);
Error, invalid argument for modp or mods
NULL;

I object using frem because it took quite a while to figure out how to get a MapleSim (or other languages) style mod. Next time I need it I will probably not remember straight away (for compatibilty and code exchange reasons I have stopped making custom commands).

Therefore fmod would be a nice extension to Maple commands. I will suggest this

@dharr 

I was not clear. Imagine you have some code to review. Somewhere in the code

sol:=dsolve({odes,ics},numeric,...)

If sol was a module I could ask for the exports. Since sol is a procedure I cannot ask which variables are returned.

Take for example this code from one man 1.mw
and enter

sln(0.1);
interface(verboseproc = 2);
print(sln);
showstat(sln);

after execution of the worksheet

@WD0HHU 

I do not think that this is a bug. It is a general weakness of variable step solvers.

There is an option that should enforce an event with variable step solvers. Have a look here

?dsolve,numeric,Events

I had to abandon rewriting the mass equation with events because I could not immediately spot an example/description that fitted your case.

Could you share a screen shot of the final trajectory?

By the way, I was wondering if such simulations could not profit from the Physics package which allows for a vectorial description of the problem which could save some lines of code.

@GFY 

This question is often asked.
I have only read the programming guide that comes with Maple. It's not really a book for learning.

Try searching here on MaplePrimes, and if you don't find anything, ask here, with topics that interest you.

@Scot Gould @Carl Love
Thank you for the clarification.

I overlooked that mod works on more than numbers. I also did not pay attention to the fact that mod works for "digital clocks" only but not for "analog clocks". I could not find an equivalent command that works on floats. Do I really have to do something like this

fmod := (t, modul) -> frem(t - 1/2*modul, 10) + 1/2*modul;
plot(fmod(t, 10), t = 0 .. 100);