Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

 In the memory leak problem with my DStarLepNu simulation program, I did find one cause in that due to normalization errors the accept/reject algorithm in ‘PickAngles’ was executed too many times. This should have just made angle generation inefficient but occasionally, but not always produced very big memory bumps when a large number of trials were needed to pick angles. It’s not clear why these bumps occurred as the code being executed is always the same and is simple.

Fixing this did however not prevent memory crashes or even reduce them much.

I have since turned off accept/rej and calls to ‘arccos’ and more modest spikes remain and crashes still occur!

I don’t understand how Maple memory management works. My B-meson decay prov ‘bDecay’ usually gives  still shows occasional spikes and and there’s a weird correlation between the first (B1) and second (B2) call:

 

DStar3DKinRecoLoopDebugCombo200EventsExportRun2.mw

 

çMemory added by ‘bDecay’ proc on 1st call vs 2nd call in the B1-B2 event loop..

èWhat with the slope and difference in width?

can you help to solve and plot the followng delay ODE

ode:=diff(y(x),x)=1-2*y(x/2)^2;                                                                                                                                                            ics := y(0) = 2    ;            y3:= dsolve({ics, ode},numeric, delaymax = 1.7);  YY5:=odeplot(y3,x=0..10); 

I found the option in this statement

dsn := dsolve(dsys, numeric, differential = true, projection = false, maxfun = 0)

in help("examples/numeric_DAE")

 

I give up searching because

  • the word "differential" occurs so often in dsolve help pages that advanced search does of not filter help topics effectively
  • the option does not seem to be a dsolve[numeric] or rk45 specific option (at least I cannot find anything on the pages)

What does the option do?
How could I have searched better?

How do I set the axis range in a Maple scatter plot. It's not evident to me from the Help.

Please help me how to impliment to solve this problem 

Download dust_practice_code.mw

dust_paper.pdf

Dear Users!

I hope everyone is fine. I want to plot the following sequence in 3d for t=0..1 and x=-pi..pi;

[0., 0.4995839572e-1*sin(x), 0.9966865249e-1*sin(x), .1488899476*sin(x), .1973955598*sin(x), .2449786631*sin(x), .2914567945*sin(x), .3366748194*sin(x), .3805063771*sin(x), .4228539261*sin(x), .4636476090*sin(x), .5028432109*sin(x), .5404195003*sin(x), .5763752206*sin(x), .6107259644*sin(x), .6435011088*sin(x), .6747409422*sin(x), .7044940642*sin(x), .7328151018*sin(x), .7597627549*sin(x), .7853981634*sin(x)];

In the sequence first entry (0) for t=0, second (0.4995839572e-1*sin(x)) for t=0.05, third (0.9966865249e-1*sin(x)) for t= 0.1 and so on the last entry (.7853981634*sin(x)) for t=1. In addition, how do I plot if the number of points exceeds in the sequence for example 100 or 1000 points, but the difference between two consecutive values for t is the same here the difference is Delta*t=0.05.

As my jobs are still crashing with memory leak, I'd like to write results out to files and read them back to add them together.

I see something called 'Export' and something called 'Import'. It didn't work for me. Does the file have to already exist? An example would be nic

I want to plot this function in cylindrical coordinates in a way that it is clear where the function is greater than zero and where it is less that zero. I was wondering what would be the best way to do it. It has two arbritary constants. Usually when I have only one constant, I animate the plot for different values of that constant. But I am not sure what to do for this case.

-2*M^2*sin(theta)^2 - 2*k*r^2

The Maple Conference will be starting in two weeks! The detailed agenda, which includes abstracts of invited and contributed talks, is available here: https://www.maplesoft.com/mapleconference/2023/full-program.aspx.

Please join us on October 26 and 27 for two days of presentations from our staff members and the larger Maple community, a look at our Art Gallery and Creative Showcase, opportunities for networking with other Maple enthusiasts, and more! The conference is virtual and free of charge, and you can register at https://www.maplesoft.com/mapleconference/2023/.

We look forward to seeing you at the conference!

eq1 := diff(f(x), x, x, x)+(1/2)*x*cos(alpha)*(diff(f(x), x, x))+(1/2)*sin(alpha)*f(x)*(diff(f(x), x, x))+G[r]*theta(x)+G[m]*phi(x) = 0;

eq2 := diff(theta(x), x, x)+(1/2)*Pr*cos(alpha)*x*(diff(theta(x), x))+sin(alpha)*f(x)*(diff(theta(x), x))+N[b]*(diff(theta(x), x))*(diff(phi(x), x))+N[t]*(diff(theta(x), x))^2 = 0;

eq3 := diff(phi(x), x, x)+(1/2)*Le*cos(alpha)*x*(diff(phi(x), x))+sin(alpha)*f(x)*(diff(phi(x), x))+N[t]*(diff(theta(x), x, x))/N[b] = 0;

ics := f(0) = 0, (D(f))(0) = gamma*((D@@2)(f))(0), theta(0) = 1+tau*(D(theta))(0), phi(0) = 1;

bcs := (D(f))(infty) = 0, theta(infty) = 0, phi(infty) = 0;

Parameters := G[r] = 5, G[m] = 3, Pr = 7, N[b] = .1, N[t] = .1, Le = 1, gamma = .2, tau = .1, alpha = 30*degree;

Hi Everyone, 

I have a numeric integral which I hope to evaluate (ideally over a infinite domain) that for some reason is giving me difficulty and I cannot seem to find a work around. I want to use method = _d01amc in the integral as a means to speed up the process - I am motivating this by the answer i recieved from @acer in https://www.mapleprimes.com/questions/236772-Any-Ideas-On-How-To-Speed-Upimprove - however I keep recieving an error indicating overflow. 

This seems rather strange to me due to the fact that if I omit a method and just let Maple do its own thing it will eventually spit out an answer albeit slower then I would prefer for the procedure I am going to eventually impliment. 

My integrand and attempts/confusion can be seen in the attached worksheet. 

Any thoughts appreciated. 

OverflowError.mw

The sequence A161786 consists of “primes with at least one digit appearing exactly four times in the decimal expansion”. Below is the Maple program given in that OEIS page:

The code above picks out primes having exactly four identical digits (determined by ) from the first 10,000 prime numbers. However, it's easy to check that this program is rather slow (It takes about 2.6s to execute it!). 
Actually, I would like to select such primes from pn, pn+1, pn+2, …, pn+m-1 (typically, n=1,000,000 and m=1,000,000), where pk denotes the k-th prime number, yet the original program failes to do so in twenty minutes. Part of the reason is that for long sequences, the efficiency can be critical. Therefore I make a slight modification to the original code: 

A161786__0 := proc(m::nonnegint, n::posint := 1, ` $`)::'Vector'(prime):
	#(*
	    kernelopts(opaquemodules = false):
	# *)
	local p := ifelse(n = 1, 1, ithprime(n - 1)), vec := Vector('datatype' = prime);
	to m do
		if ormap(`=`, MultiSet(`convert/base`:-MakeSplit(length((p := nextprime(p))), 1, 10)(p)):-hash, 4) then
			vec ,= p
		fi
	od;
	vec
end:

Nevertheless, this version is still inefficient: 

time[real](A161786__0(10**6, 10**6));
 = 
                            182.414

Another choice is converting each of integers into a string: 

A161786__1 := proc(m::nonnegint, n::posint := 1, ` $`)::'Vector'(prime):
	options no_options:
	local p := ifelse(n = 1, 1, ithprime(n - 1)), vec := DEQueue();
	to m do
		if member(4, rhs~({StringTools['CharacterFrequencies'](nprintf("%d", (p := nextprime(p))), 'digit')})) then
			vec ,= p
		fi
	od;
	Vector([vec[]], 'datatype' = prime)
end:

This time the elapsed time is reduced to nearly two minutes: 

time[real](A161786__1(10**6, 10**6));
 = 
                            118.409

But can this task be accomplished within (a quarter of) a minute in modern Maple? In other words, is there a way to make further improvement on the performance? (Note that the reference time is mesured using a adjusted version (i.e., ) of the Mma code provided in that OEIS page.) 

How would you solve this equation System:

x+|y+1|=1

y+|z+2|=1

z+|x-2|=1

I have no idea what to do, van please someone help me?

Hi,

I am looking for a code to randomly generate 10 equations (powers and radicals) of this type. Any ideas? Thank you.

Note: I would -prefer an answer for Maple 2015, but I can accommodate an answer for a more recent version.

I have a function Gpdf from IR2 to IR+ of class C1 (this comes from the way this function is built).
Although its level curves are continuous, their display show discontinuities for some level values. 

The reason is that  Gpdf contains a term whose denominator vanishes and so, even if the left and right limits of Gpdf are the same at the vanishing point, the resulting plot is dicontinuous.

More details are given in the attached file Discontinuous_contours.mw.

I have tried to adjust the plotting grid, or even to superimpose contours drawn in domains containing no singularities, but I wasn't capable to get continuous drawings (see the attached file).

Do you have any idea to achieve this?

TIA

First 162 163 164 165 166 167 168 Last Page 164 of 2217