acer

32303 Reputation

29 Badges

19 years, 305 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@nm I use Maple 2024.2 for Linux, with no init file or hidden options.

The plot that you see in my posting is the result of right-click export-to-PNG, which I always do when inlining plots on this forum because the default bahavior of this site's back-end is to show 2D plots with gridlines (if not specified as false, even!) and low-quality jpeg.

@salim-barzani That is offensively inconsiderate to all the member's who have responded.

You could, instead, simply add any new content in a Reply/Comment to a Question.

Deleting the whole Question -- once responded to meaningfully -- is antisocial.

Why did you delete the original of this query, even after janhardo had posted a response with content?

As far as I can tell, you have deleted almost half of your original Questions of the past month or so, even after people have Answered or responded with useful content. Deleting (or editing to remove the content of) a Question, after someone has taken the time to Answer, is incredibly rude.

@Christopher2222 If your case only involves a few integers then why not use the syntax that is more likely to be quickly recognized and understood by you when you look at the code a long time from now.

@dharr fwiw, that could be collapsed to b::identical(10,20,30)

@mmcdara 
1) Starting in Maple 2021 (IIRC) the Warning appears when the local is implicitly declared in the procedure, ie. as of that version, Maple no longer just silently add/declares it. It's more about a reminder to the reader of the code that it's a local, than it is about it being more safe, IMO.

2) As the thickness increases so does the visual/rendered extent of the dashed segments. Once it gets very thick (perhaps relative to the window dimensions, etc), it might no longer appear as dashed.

restart

plots:-setoptions(size=[400,200]);

ecdf := proc(S, {color::string:="blue", thickness::posint:=1})
  local i;
  local N   := numelems(S):
  local M   := sort(S):
  local opt := [':-color'=color, ':-thickness'=thickness]:
  plots:-display(
    plot([ seq(op([[M[i], (i-1)/N], [M[i], i/N], [M[i+1], i/N]]), i=1..N-1) ], opt[])
    , plot([ [M[N], (N-1)/N], [M[N], 1] ], opt[])
    , plot([ [M[N], 1], [(max+(max-min)*0.2)(S), 1] ], opt[], linestyle=3)
    , plot([ [M[1], 0], [(min-(max-min)*0.2)(S), 0] ], opt[], linestyle=3)
  )
end proc:

S := Statistics:-Sample(Uniform(0, 1), 10):

K:=ecdf(S, 'color'="black", 'thickness'=4):

plots:-animate(
  T->subsindets(K,specfunc(THICKNESS),t->THICKNESS(T)),
  [Thickness], Thickness=1.0 .. 4.5);

Download ecdf_acc.mw

@Blanc The command matrix (all lowercase), the linalg package, and the rank command (from linalg) have all been deprecated in Maple for over twenty years. You should not use them.

Instead, you could use Matrix (capital M), the LinearAlgebra package, and its commands such as Rank and NullSpace.

solve( (a-2)*x=4-a^2, x, parametric);

piecewise(a-2 = 0, [{x = x}], a-2 <> 0, [{x = -a-2}])

solve( x^2+(y-2)^2=0, [x,y], real, parametric);

[[x = 0, y = 2]]


Download solve_p_ex.mw

@Carl Love That's like the second example in my Answer, is it not?

You've got,
    Or(x = abs(x), -x = abs(x))
while I had,
    Or(C + abs(C) = 0, C - abs(C) = 0)

I'm sure that you'll know that I got there by something like,
   S := cos(x) + sqrt(1-sin(x)^2) = 0, cos(x) - sqrt(1-sin(x)^2) = 0:
   simplify(Or(S)) assuming x::real;

@janhardo It's part of the DEtools package.

You seem to have forgotten to load (from) that, in your use of the just the short-form name rifsimp.

@JoyDivisionMan It seems that Maple's difficulty stems from the zero point, and that one only has to break it there.

That can be done with two sets of assumptions (as opposed to my previous four), or with a split of the integral form at 0.

restart;

with(IntegrationTools): with(Statistics):

 

r := sqrt(RandomVariable(Uniform(0,1))):
x := cos(RandomVariable(Uniform(0, 2*Pi))):

 

value(Split(PDF(r*x, t, inert), 0));

piecewise(t < -1, 0, t <= 1, 2*sqrt(-t^2+1)/Pi, 1 < t, 0)


Or, using a pair of assumptions,

PDF(r*x, t) assuming t>0;

piecewise(t <= 1, 2*sqrt(-t^2+1)/Pi, 1 < t, 0)

PDF(r*x, t) assuming t<0;

piecewise(t < -1, 0, -1 <= t, 2*sqrt(-t^2+1)/Pi)

Download pdf_RV_02_split.mw 

This now seems like insight into why Maple (2024.2 at least) doesn't get the simple explicit piecewise answer to this problem. It may be that int itself is getting hung up. Ideally it would be able to get the explicit result without the manual split at 0.

ps. It is not necessary to also split at discont of PDF(r,t) and/or PDF(x,t), in order to get the nice explicit piecewise result.
pps. The portions computed from using such assumptions (ie, disjoint sets that cover -inf..inf) can be properly combined into an actual PDF that respects the support. Using assumptions is not necessarily just a trick. It's obvious that a result obtained under some assumptions is only guaranteed to hold under those same assumptions. This is why I used multiple disjoint sets of assumptions, that together cover the reals. How to join the results with piecewise (and why that'd be desired) should be obvious.

@JoyDivisionMan Note that the formula result for t assumed to be in -1..0 is the same as for t assumed to be in 0..1.

I didn't successfully achieve that same nice form directly, if I merged the assumptions into just the simpler combined assumptions x>-1,x<1 . There are other ways to get it from that, but the above seemed less awkward to me.


ps. You don't mark your Questions with your Maple version. Sometimes it makes a difference in what answer may be attained.

@nm I wrote that to only extract the locals from the module because in the previous Question thread you were lamenting issue with locals.

On the ?module Help page it explains that the locals can be had as the 3rd operand of the module, and the exports can be had as the 1st operand. So that code is easily changed to handle both, as a union.

restart;
A := module()
    export main:=proc()
       print("i am in A:-main");
       B:-foo();
    end proc;

    export B :=module()
       export foo:=proc()
          print("in B:-foo()");
       end proc;
    end module;
end module:
kernelopts(opaquemodules=false): #see @acer code
S := subsindets({op(3,eval(A))} union {op(1,eval(A))}, `::`, (L)->convert(lhs(L),`global`)):
S := map(u->parse(cat("A:-",u)), eval(S,1));
Grid:-Set(0, A:-main, op(eval(S,1)));
Grid:-Run(0, A:-main,[  ]);
Grid:-Wait();

{B, main}

"i am in A:-main"

"in B:-foo()"

Download module_locals_and_exports.mw

@Scot Gould I like it.

I suspect that the datatype=float (or float[8]) might be (a necessary) part of why the mapped `<=` works, similar to how true/false become 1/0 under evalhf.

@nm I am wondering why you need to use Grid:-Set, as opposed to having your modules stored in a .mla archive file stored in a location in libname.

If I write an involved "package" (one or more modules, say) and want to use it in multiple sessions then I store it in a .mla file and make it available via libname. That's pretty common and standard usage.

I wouldn't read my module source from .mpl text file, or define it by executing some worksheet code, each and every time I wanted to use it in a run. That's what .mla archives are for.

I'd only re-read/re-instantiate/define/assign my procedures and modules while actively developing them.

Is it not possible for your to use a .mla to make your modules available to each node? I really don't think that you should need to change all your module locals to exports, so as to be able to Grid:-Set everything. Is there some special requirement we haven't yet heard?

First 12 13 14 15 16 17 18 Last Page 14 of 591