acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@vv If g has already been defined then I don't see why you'd want to incur the cost of having dgdx invoke D each time it gets called, instead of simply assigning,

   dgdx := D[1](g);

@FDS What I gave originally was 4x1 Matrix. I've edited it to return a column Vector.

@mehran rajabi You could upload and attach the worksheet in which the plot is not displayed for those commands...

@Carl Love For no reason except that I think this looks nifty.

(edit: one reason is that shading=xyz can convey some depth, which is less clear with a monochromatic curve.)

Done in Maple 2018.2 for Linux.

restart:

with(DocumentTools): with(DocumentTools:-Layout):
with(DocumentTools:-Components): with(plots,display):

Rev:=proc(P::specfunc(PLOT3D))
       InsertContent(Worksheet(Table(
         alignment=center,width=380,widthmode=pixels,Column(),
         Row(Cell(Textfield(InlinePlot(scale=1.3,height=550,width=650,ytrans=3.5,
                                       display(P,axis=[color="DarkGrey"]),
                                       fillcolor="Black",showborders=false)),
                  fillcolor="Black")))));
         NULL;
end proc:

 

Digits:=15:

V:=[x,y,z]:

eqs:=diff~(V(t),t)=~[35*(y-x),-x*z-7*x+28*y,x*y-3*z](t);

[diff(x(t), t) = 35*y(t)-35*x(t), diff(y(t), t) = -x(t)*z(t)-7*x(t)+28*y(t), diff(z(t), t) = x(t)*y(t)-3*z(t)]

sol:=dsolve({eqs[], (V(0)=~ V||~0)[]},numeric,maxfun=-1,parameters=V||~0):

sol(parameters=['rand(0.0..1.)()'$3]);

[x0 = .107335941150510, y0 = .767616132399701, z0 = .244155091492448]

P:=subsindets(
     subsindets(plots:-odeplot(sol,V(t),t=0..50,numpoints=15000,
                               thickness=0,transparency=0.5,axes=frame,
                               axis=[thickness=0],orientation=[-70,70,0]),
                specfunc({COLOUR,AXESLABELS}),()->NULL),
     specfunc(THICKNESS),()->THICKNESS(0.1)):

 

Rev(P);

Download deplot3drev.mw

@dvilla It is possible to programmatically embed a plot with a specified zoom scaling (zoom) factor and adjusted vertical (or horizontal) offset within the inlined plotting window. In other words, to take the burden off of the end-user, and to allow you to enforce the initial aspect.

In the following worksheet the plots get "displayed" (even from scratch) just as shown. I appreciate such programatic vertical trimming of blank white space, if I do not intend to rotate the 3D plot head-over-heels.

prog_zoomtrans.mw

Unfortunately this forum's backend baulks as rendering this worksheet.

Those wrapping commands which force the scaling/offset/etc could easily be made into a reusable procedure, which could also be optionally hidden -- say in the Startup region of the worksheet.

An alternative is to rescale the formula and then force new tickmarks, but it can get complicated to implement robustly as a general mechanism. 

I used Maple 2022.1, and got no disk artefact. But that's a separate issue to getting the zoom, offset, aspect ration, etc, just as you want.

@dvilla Do you know that if you right-click on a plot then you get a menu?

One of the items on the menu is "Manipulator". Selecting that gets to a submenu, with "Zoom in" as a checkbox. If you select that checkbox then you can rescale the plot, within its window. You can either click-and-drag the left mouse button, vertically, or you can scroll the mouse wheel.

Also, I don't get that separated disk, that you show in your image.

Why don't you mark your Question with your Maple version (in the editor of the Question, as the "Product" combobox), or at the very least tell us which version you're using? 

Why don't you upload and attach your actual worksheet, using the green up-arrow in the Mapleprimes editor?

I changed both of your recent Posts into Questions.

In future, please the form for submiting a new Question, for distinct new queries. It's right there on the Mapleprimes front page, as a big green rectangle/button.

Are you all using the very same Operating System?

Does the file's name have any special (eg. non-alphanumeric) characters, apart from a period (".")?

Has she tried importing the data using either the command Import, or the package command ExcelTools:-Import?

You might consider stating the specific OS, and then uploading and attaching a zipped file containing the data file. Then others might be able to reproduce the issue, and possibly debug the problem.

@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.

First 102 103 104 105 106 107 108 Last Page 104 of 591