acer

32333 Reputation

29 Badges

19 years, 326 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@lcz I don't understand exactly what you mean, about executable files.

You can compile (externally, or as a system call) files from Maple procedures that can be completely handled by CodeGeneration[C].

Alternatively, when you use Compiler:-Compile on a Maple procedure (with option inmem=false, with no callbacks to any non-C Maple function) then the generated, external, shared object library (.dll, .so) has an outer and an inner function. The outer function admits Maple structures as arguments. The inner function admits pure C structures, and may be used by other external programs. See also with its undocumented option keeptemps=false, files under /tmp say...

Or are you taking about using OpenMaple?

I can't tell which you mean, sorry.

@Ali Hassani That specfunc(T) is a structured type. I used it inside indets, to get a set of all the calls to T(...) in the expression.

Then I mapped the coeff command (with your expression) elementwise over that.

Your followup query could be handled as follows. (I do some of the steps separately, to try and make it more understandable for you...)

restart;

eq := 2*ln(x)*diff(y(x),x,x)+2*x*diff(y(x),x)+sin(x)*x^2*y(x);

2*ln(x)*(diff(diff(y(x), x), x))+2*x*(diff(y(x), x))+sin(x)*x^2*y(x)

type( diff(y(x),x,x), specfunc(diff) );

true

indets(eq, specfunc(diff));

{diff(diff(y(x), x), x), diff(y(x), x)}

indets(eq, specfunc(diff)) union {y(x)};

{diff(diff(y(x), x), x), diff(y(x), x), y(x)}

frontend(coeff, [eq, diff(y(x),x,x)]);

2*ln(x)

frontend(coeff, [eq, diff(y(x),x)]);

2*x


Now, as a one-liner,

[seq([u,frontend(coeff,[eq,u])], u=indets(eq, specfunc(diff)) union {y(x)})];

[[diff(diff(y(x), x), x), 2*ln(x)], [diff(y(x), x), 2*x], [y(x), sin(x)*x^2]]

Download coeffs_diff.mw

@lcz There is some information via,

showstat(GraphTheory::AllPairsDistanceImpl);

But if _EnvDisableExt <> true (ie. default) then that may call AllPairsDistanceExt which is externally compiled and not visible as source.

@Earl In Maple 2020.2 try adding the option factor=true to the implicitplot call.

restart:

kernelopts(version);

`Maple 2020.2, X86 64 LINUX, Nov 11 2020, Build ID 1502365`

WattEq:= r^2 - (b^2 - (a*sin(theta) + sqrt(c^2 - a^2*cos(theta)^2))^2):

params:= [a= 3.1, b= 1.1, c= 3.]:  rng:= -1.2..1.2:

W:= (evala @ Norm @ eval[recurse])(
    WattEq,
    #polar to cartesian:
    [r= sqrt(x^2+y^2), (cos,sin)(theta)=~ (x,y)/~r]
):

plots:-implicitplot(eval(W, params), (x,y)=~ rng,
                    scaling= constrained, factor=true);

Download Earl_impl.mw

@Lana That looks like a flaw in the InertForm:-Parse handling of angle-bracket constructor syntax, to me.

I'd be tempted to first correct the generated inert form, and then call value on the targeted inert constructor calls.

restart;

Str := "1/3*<3^(1/2), -3^(1/2), 3^(1/2), 0> -1/3*<3^(1/2), 3^(1/2), 3^(1/2), 0>+ <2,1,1,0>":
Set := {op(InertForm:-Parse( Str ))}:

Set := subs(`%\`<,>\``=`%<,>`,Set);

{-`%*`(`%/`(1, 3), `%<,>`(`%^`(3, `%/`(1, 2)), `%^`(3, `%/`(1, 2)), `%^`(3, `%/`(1, 2)), 0)), `%*`(`%/`(1, 3), `%<,>`(`%^`(3, `%/`(1, 2)), -`%^`(3, `%/`(1, 2)), `%^`(3, `%/`(1, 2)), 0)), `%<,>`(2, 1, 1, 0)}

subsindets(Set, specfunc(`%<,>`), value);

{-`%*`(`%/`(1, 3), Vector(4, {(1) = sqrt(3), (2) = sqrt(3), (3) = sqrt(3), (4) = 0})), `%*`(`%/`(1, 3), Vector(4, {(1) = sqrt(3), (2) = -sqrt(3), (3) = sqrt(3), (4) = 0})), Vector(4, {(1) = 2, (2) = 1, (3) = 1, (4) = 0})}

Download InertForm_angleconst.mw

[edit] I am supposing that you have some reason for not simply constructing your set of inert multiples of Vectors directly, using inert `%*` along with active calls to Vector. That would be simpler and more efficient than all this parsing of strings, etc, which you must currently be generating somehow. My guess is that you want the uniquification that %Vector calls have within a set -- and which actual Vectors do not have. Do you have a specific reason?

ps. I have submitted that generation of `%\`<,>\`` by InertForm:-Parse in a bug report.

@tomleslie Or perhaps,

indets(expr,       
       'specfunc'(anything,  
                  convert(FunctionAdvisor(':-known_functions',
                                          quiet),set)));

@AHSAN I'll try and help your understanding -- I've edited the worksheet to no longer show a call to the ApproximateInt command, since it does not show the same output as that command.

The procedure show produces intermediate steps -- which I based on part of your images.

Perhaps you'd be more content coding everything shown in your images.

I have deleted a duplicate of this Question.

You can add followup details or followup queries here, for this problem. Please don't submit new and separate Question threads for it.

I advise you to provide code that reproduces the problem. You could upload and attach a worksheet using the green up-arrow in the Mapleprimes editor.

What does it mean to you, for a plot to have a transparent background?

Do you mean it in the context of exporting, eg. as .GIF file?

What would the contour represent?

(Once you answer that first query) How many such contours do you think there are?

@AmirHosein Sadeghimanesh 

This user repeatedly asks Questions here without mentioning that he is using the older version Maple 2019. (I have now marked this Question with that version number.)

In Maple 2019 the Student:-Basics package did not contain the FactorSteps, SolveSteps, or SimplifiySteps commands.

Using a single left-quoted name as first argument to nprintf is technically weaker because it can be broken by the obscure possibility of prior assignment to that name.  As unlikely as that is possibility is, it is more defensive programming to prevent that breakage.

A string is the simplest, safer alternative. The alternative of a left single-quoted reference to the global right single-quoted is more complicated. In your example with curry that defensive alternative may require nested single left-quotes for such protective safety, at which point the process is far more complicated than simply using double-quotes. Eg,

restart;
`#mo("%s",mathcolor="%a");`:=oof:

cprint:= curry(nprintf, '':-`#mo("%s",mathcolor="%a");`''):

cprint("This is green", green);
cprint("This is green", red);

note: I know that Carl is well aware of all this. I mention it for the general readership.

@nm You might consider using the "Branch" icon at the bottom of your Question body (next to Reply/Answer.).

That should create a separate Question thread, but with cross-reference link added automatically.

The OP's attached worksheet executes without error for me in both Maple 2022.0 and Maple 2022.1 for Linux.

First 103 104 105 106 107 108 109 Last Page 105 of 592