Mac Dude

1496 Reputation

17 Badges

10 years, 208 days

MaplePrimes Activity

These are questions asked by Mac Dude

I have the following expression (result of a calculation):


Rather obviously the common factor 1/1296 can be factored out, except I cannot get Maple to factor the 1/1296 without also factoring out N, which I do not want. My desired end result is this:


I don't seem to be able to coerce Maple to do this. I can freeze the tStartRamp*f__SR/N term (leaving the 1/1296 unfrozen), but in that case I don't get Maple to pull the 1/1296 factor out at all.

Any hint would be appreciated. I am doing this on Maple 2015. It is really a bit cosmetic, but sometimes I use Maple to write "smart" documentation & then I'd like to end up with a somewhat polished result.

Mac Dude

I am working on a modelling (simulation) program for an rf system involving DDSs, rf mixers and other components. Each component is programmed as a submodule with methods (procs) and other exports, the whole shebang wrapped into a main package loaded using with(). A loop simulates a number of scenarios with differing starting conditions. Most calculations are numeric in nature.

The code runs but is too slow and in addition seems to keep allocating memory as the main loop runs. I suspect these two are related. I am using profile() to get an idea where the time is spent and where the memory gets eaten up.

I am doing the following:

profile(DDS__Boo:-SetTW,rf__Boo:-cycles,rf__SR:-cycles); # profile these three methods (procs):
# the main loop:
# Loop over injection cycles

for cycle from 1 to Cycles do

  for ii from 0 to Points-1 do
  end do:

  BooRfPeriodsList[cycle]:=BooRfPeriods-evalf(rf__Boo:-cycles(c__B0/f__SR)); # rf periods cB0 to extr.
  evalf(BooRfPeriodsList[cycle])/432; # Booster turns c__B0 to extr  
  targetErrors[cycle]:=(%-round(%))*432; # targeting error in bucket width
end do:
# end loop

function           depth    calls     time    time%         bytes   bytes%
SetTW                  1    10240  230.877    51.52   22851828384    72.80
cycles                 1      110  108.607    24.24    4269176160    13.60
cycles                 1      110  108.607    24.24    4269176160    13.60
total:                 3    10460  448.091   100.00   31390180704   100.00

My question is: how do I interpret the table of results?

"time" is in seconds? (this should really be written in the Help files). Also, SetTW() and cycles() call other routines from the package, are they included in the times reported or not?

"bytes" is my biggest concern. "SetTW" has a whopping 22 GB against it. Since the total allocation goes up to about 290 MB in this particular run (per Maple's info line) this cannot be the total memory used. Can this be the total allocation (and most of it ending up as garbage and cleaned out)?? Even the 4 GB against cycles seems out-of-line.

The two lines for "cycles" are exactly the same even though the routines differ (belong to different instances of the module and operate on differnt parameters). Is profile aware of that, or not?

I realize that people like to see the whole program or worksheet; but given that this is dependent on a large-ish package and the sheet itself is of some size and difficult to penetrate for the uninitiated I want to spare you from trying to read it. Right now I need to understand what showprofile() is reporting. Once I better understand profiling, and if I need more help, I will try to make a MWE, but I am not that far yet. I did check the Programming Guide but I did not find the info I am looking for.

Thanks much for any insight you can share.

Mac Dude.

I need to declare a whole set of variables as local. The variable names are generates algorithmically using assign. Like so:


Stand-alone, this works and creates all these Vectors for later use. But this:

local seq(seq(assign(cat(S,i,j)=Vector(datatype=float)),i=1..9),j=1..9);

does not work; I get an "error; '(' unexpected".

I really do not want to type all these by hand... on the other hand, if I do not declare these as local I get 99 warnings about implicit local declaration; not nice.

Is there a way to do this?



PS: I do not upload as the one line really is all that is needed. At the lowest level one does not get the implicit-declaration warning, but with "local" it still fails.

I am interested in the inner workings of SignalProcessing:-Convolution. I know I can list it with a higher setting of verboseproc:

interface(verboseproc=3); # actually, 2 is enough here...

and get

Obviously the real work happens in IPP:-Convolution, but that seems unknown. How can I list that??


Mac Dude

In a calculation I am encountering expressions of the following kind:


As is known, for epsilon < Pi-0.12, the two terms are equal but opposite in sign and the result should be zero (ok, maybe a few 1E-15 for round-off). But for the heck of it I cannot get Maple to simplify this with the assumption e.g. epsilon < 0.1.

This can probably be simplified by squaring the two terms and then subtracting them, but that can possibly lead to other "interesting" effects and besides is a bit cumbersome.

Has anybody found a good way of  doing this?



1 2 3 4 5 6 7 Last Page 1 of 23