acer

29189 Reputation

29 Badges

18 years, 70 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Scot Gould It might also be possible to construct an appliable module which accepts two arguments. Through Explore, its first argument could be hooked up to a Slider while its second argument could be hooked up to a listbox/combobox/radio-button.

The Slider might provide 1 or 2 digits (to the right of the decimal mark) at a time, while the other control might specify the current scale. The appliable module could store the running total, eg. a+b/100+c/10000 or what have you.

That might be done reasonably cleanly, and tightly, hopefully easy to use.

I suppose that a neat and tidy set of such dymanic controls might (ideally? one day) customize any Explore Slider, with a hidden State component storing the running values of each scale.

@sand15 Yes, this is the very kind of thing that I meant when I referred to splitting a parameter.

I suspect that if the Sliders were long enough (and maybe snap-to-ticks) then one might be able to usefully & reliably get two powers of 10 (ie. two digits) from each.

So that'd allow for pinpoint specification of 10e-4 precision with just a pair, and might be quite nice.

I have another idea, but it'll have to wait until tonight...

In your old Maple 13 you might also look at something like, say,

   numtheory[sigma](n) - n

You should be able to use the following attachment to investigate alpha>0 and beta>0, without having to wait too long.

I am not seeing any parameter vaues in the quadrant alpha>0 and beta>0 where eq7 > eq8.  You can extend the ranges out further (eg. alpha=0..2,beta-0..3, etc), but when I tried that the results were similar.

I've only gone out as far positive as alpha=1 and beta=1, below, just so that I can get finer plot3d detail without having to raise the grid size too much.

You can manually rotate the plot3d result, to get more of a visual feel for it.

You can get rid of the max/min in the plot3d call, if you want. I put those in just to get better GUI behavior (eg. less flashing) when forcing a restricted view in the case of extremely high +/- values.

restart;

eq1:=diff(a(t),t)/a(t)=alpha*t-beta*t^3:

eq2:=dsolve({eq1,a(0)=1}):

eq3:=diff(lambda(t),t)=rhs(eq2):

eq4:=dsolve({eq3,lambda(0)=0}):

sm:=exp(-lambda^2/(2*tau^2))*1/(sqrt(2*Pi)*tau):

eq5:=sm*diff(rhs(eq1),t)/rhs(eq2):

eq6:=combine(eval(eq5,[lambda=rhs(eq4),tau=eval(rhs(eq4),t=1)])):

eq7:=subs(Int(exp(-_z1^2*(_z1^2*beta - 2*alpha)/4), _z1 = 0 .. 1)=L,eq6):
eq7 := subsindets(eq6, specfunc(Int),
                  u->op(0,u)(op(u), digits=15, epsilon=1e-6, method=_d01ajc));

(1/2)*2^(1/2)*(-3*beta*t^2+alpha)*exp(-(1/2)*(Int(exp(-(1/4)*_z1^2*(_z1^2*beta-2*alpha)), _z1 = 0 .. t, digits = 15, epsilon = 0.1e-5, method = _d01ajc))^2/(Int(exp(-(1/4)*_z1^2*(_z1^2*beta-2*alpha)), _z1 = 0 .. 1, digits = 15, epsilon = 0.1e-5, method = _d01ajc))^2+(1/4)*t^2*(beta*t^2-2*alpha))/(Pi^(1/2)*(Int(exp(-(1/4)*_z1^2*(_z1^2*beta-2*alpha)), _z1 = 0 .. 1, digits = 15, epsilon = 0.1e-5, method = _d01ajc)))

GG:=Int(exp(-_z1^2*(_z1^2*beta - 2*alpha)/4), _z1 = 0 .. 1, digits=15, epsilon=1e-11, method=_d01ajc);

Int(exp(-(1/4)*_z1^2*(_z1^2*beta-2*alpha)), _z1 = 0 .. 1, digits = 15, epsilon = 0.1e-10, method = _d01ajc)

eq8:=1/(8*L^2);

(1/8)/L^2

HH := proc(a,b) option remember; local res;
  if not [a,b]::list(numeric) then return 'procname'(args); end if;
  res := evalf(eval(Int(eval(eval(eq7,L=GG),[:-alpha=a,:-beta=b]), t=-25..25,

                        digits=15, epsilon=1e-2, method=_Dexp))
               - eval(GG,[:-alpha=a,:-beta=b]));
  #if res::extended_numeric then evalf[5](res); else undefined; end if;
end proc:

 

UseHardwareFloats:=false:
CodeTools:-Usage(
  plots:-inequal(HH(alpha,beta)>=0
         , alpha=-2..1, beta=-2..1
         , optionsimplicit=[gridrefine=1]
         )
);

memory used=18.41GiB, alloc change=226.31MiB, cpu time=4.38m, real time=3.94m, gc time=39.58s

UseHardwareFloats:=false:
CodeTools:-Usage(
  plot3d(min(4,max(-4,Re(HH(alpha,beta))))
         , alpha=-2..1, beta=-2..1, adaptmesh=false
         , color=[piecewise(HH(alpha,beta)<-4,1,1/5+(2+signum(HH(alpha,beta)))/5),
                  piecewise(HH(alpha,beta)<-4,1,1/5+(2+signum(alpha)+signum(beta))/5),
                  piecewise(HH(alpha,beta)<-4,1,1), colortype=HSV]
         , grid=[30,30], lightmodel=none
         , view=-5e0 .. 5e0, orientation=[-90,0,0]
         )
);

memory used=9.08GiB, alloc change=39.99MiB, cpu time=2.36m, real time=2.12m, gc time=21.75s

 

Download NestedError_accc2.mw

@Hullzie16 

I can have a look at alpha=0..1.5 and beta=0..2.

Originally you were looking at alpha=0..1 and beta=0..1, effectively? I mean, 1e-9..1e-0, and 1e-5..1e-0 . I switched the ranges because it seemed to me at the time that that's where the plot got interesting.

The epsilon is not a stepsize. It is an accuracy tolerance for evalf/Int. (If one only needs a plot, then usually that's enough accuracy...)

@C_R The functionality for handling units in some plotting commands, fsolve, int, etc, has been growing. It's relatively new, and there are still quirks.

I didn't have the time to figure out precisely why that one example (that involved units) failed in your followup attachment. (Offhand, I'd guess that something is checking for names but not being careful to sieve that though depends.)

But here is a workaround for that example: Gaussian_integration_ac_mov_pdf_ac.mw

It was certainly not deleted as "spam", since the spam-identification & removal mechanism would have deactivated your account. So that's a typo/mistake in the message generator.

I noticed that you had already asked another Question with that same query embedded in it (amongst other things), ie, "I can load an image in Sketcher and draw lines on it, but can't figure out how to access the lengths of those lines".

That second Question was posted before the first one was deleted.

Why are you posting duplicate Question threads!?

 

[(cough) Some people believe that there was only one Question asked on that fateful day, and discount the very existence of a so-called second Question.]

The .maple workbook filename extension is not handled properly by this site.

It could be put in an uploaded &attached .zip file instead.

@C_R Your slow (5 secs on my machine) plot was set up with int instead of Int. But that's not really what made it so slow, because when plot pumps in float values for r__mx then int will get a float range and in consequence attempt numeric rather than integration.

I believe that the slowness comes from the underlying evalf/Int process attempting to find discontinuities of the integrand expression when no special method is forced. There are two ways around that:
1) Make the integrand an operator, which sidesteps that check because it's now a "black box". It's a little tricky here since you also want to subs values for sigma and the running plotting variable r__mx into that operator-form integrand.
Gaussian_integration_ac2.mw

2) Force a special method. Going this route you should not call evalf on the Int expression, because that does nothing (the parameters are not yet numeric) good, and it even strips off the method!
Gaussian_integration_ac2.mw

I believe that my original answer did both 1) and 2).

ps. When you pass numpoints=10 to plot it will still compute at more points than that. If you only want exactly 10 points sampled then you'd also need to pass adaptive=false.

notes: Such hybrid symbolic-numeric quadrature approaches are well-intentioned. Applying a numeric quadrature rule across discontinuities might otherwise result in wrong or inaccurate results, hence a search for where to split the range, etc.

A (new) dedicated and documented option to forcibly disable continuity checking would be more user-friendly than operator-form for the integrand, which can be tricky to code. Eg. it can be problematic in the presence of nested integrals, or when having to shoehorn in values for additional parameters (like the value taken by a plotting variable, your case).

The NAG methods like _d01ajc are for purely real-valued integrands. Sometimes (but not always) forcing method=_Dexp can also disable potentially costly symbolic analysis, and that can handle complex-valued integrands.

@Scot Gould The OP has clarified to us that in actual Maple he did in fact make an assignment using := (ie, colon-equals). He replied that his writing of = (ie. equals) in the Question text was a mere typo, ie. not what he did in Maple itself.

That's why he was otherwise able to get it to work by a variant on the plotting command.

What I find weird is the way that the Java GUI's error message has the word "maplets" in it. I don't know offhand if that means that the maplet plot driver is being tried (as one can trigger from TTY CLI Maple, etc.) I don't understand what was going on in the OP's system, or even how he was originally using and launching Maple, etc.

@jganding He almost certainly already did that (a proper assignment), since he wrote that another variant worked. Also, he should have just got a plot of a straight line, if expr were not assigned.

So it must be something else.

It's an unusual error message. Is the plotdevice inline? Something in an initialization file? Etc...

I have deleted a duplicate Question thread by you, on this.

Please add your extra details or close followup queries and development on this here, instead of spawning wholly separate new Question threads for it.

unapply is the same procedure as MakeFunction, so the latter logically cannot be the greatest procedure "created in decades", because that procedure has already existed in Maple for decades.

Please put your close followup queries here, instead of in a wholly separate new Question thread.

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