acer

32737 Reputation

29 Badges

20 years, 103 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@awass 

Using dsolve/numeric with parameters is not discouraged. Indeed, there is a dedicated and documented mechanism for doing it.

What is now deprecated is calling dsolve/numeric for IVPs that have unassigned global names in them (ie, parameters), and then invoking dsolve's returned solution procedures only after assigning numeric values to those names.

See my Reply below.

@awass Did you see that,

   F(7.0), F(7.1), G(7.0), G(7.1)

return 1D Arrays, whose entries are the numerically solved values y(x) corresponding to the x-values in 1D Array A. (But, for the different parameter values a=7.0 and a=7.1.)

You can always wrap those 1D Arrays in a call to Vector, if you'd much prefer that.

The whole point of the code in my Answer (just as in dharr's) is to compute (for an arbitrary parameter value) a 1D Array of y(x) values that correspond to a forced 1D Array of x-values. We both uses an even spread of x-values.

Otherwise, I don't see what you're requesting.

@sand15 The OP stated that TM1,TM2,TM3 are all positive.

But when Pn=0.2, say, they are all negative for all w=0..1.

Shouldn't the conditions that they are all positive further restrict the regions in your plot?

(...using an extra quadratic, etc, if you are doing it algebraically.).

@AHSAN I cannot say anything about your formula, where you have,

     # Evaluate skin friction at a specific point

etc. How would anyone else know what you mean by your formula, or whether your formula is correct?

You can adjust the 3D plot by zooming in and panning it, in the inlined plotting window. You can do that in the usual way, ie. right-click on the 3D plot, and in the popup menu go down to the "Manipulator" item and toggle it to "Zoom In", or "Pan", end then use the mouse to zoom/pan. Only the actual plot will zoom&pan, so its size&position relative to the color-bar and title can be thusly controlled.

The GUI has its own notion of how large the plot should be, at first, and it depends on the size of the title as well as the presence of the colorbar, and it also depends on the GUI's decision to allow you to rotate the plot without the axes going out-of-view. You can adjust it to your taste, by zooming in/out and panning.

note: zoom effects don't always get retained when the sheet is closed/reopened.
3D_shadow_at_the_base_Help_alt_ac.mw

See the plot3d option axes and axis for choices of the axes-style and location (high, low, etc). Those gray gridlines aren't available with a dedicated option for 3D plots, but you can mimic them easily by adding lines at the edges of your plot's view. You can do that. See also this old posting (or others like it).

You should carefully read the documentation pages relating to the commands and functionality about which you ask.

@Jean-Michel Yes, the subscripts are displayed slightly differently (upright Ronan, versus italic) to provide a visual cue.

It's meant to help perceive what was utilized. Sometimes people use both together, accidentally, while thinking that they're all the same one.

@Jean-Michel After you assign the same expression to both names then your check return true because it's comparing the same assigned values rather than the names to which they're assigned.

@AHSAN Did you try my followup, with a code adjustment for the color-bar's dimensions? I used Maple 2024.2 there, but I'm hoping the effect is the same in your Maple 2025.

Or is your PNG immediately above from my original Answer's code?

@sand15 In my example above I showed colored vertical axes alongside black axis-labels, using a typesetting construction (of which you're already familiar). A similar effect could also be done for the tickmarks, as a different color from the axis-bar.

I don't know of a way to get a linestyle or transparence for the axis-bars, except by faking it with a dedicated line (and supressing the axis proper).

@AHSAN Of course, you could simply get rid of the color-bar altogether, by specifiying colorbar=false instead, in the call to contourplot3d.

But I believe that you could also adjust the original by shortening the color-bar in the substructure, after construction. Eg,

restart;

with(plots):
with(plottools):

paramSet := [x = 0, H = 0.55, We = 0.05, Gr = 0.1, N[r] = 0.3, Nr = 0.2, Rr = 0.3,Nb = 0.1, Nt = 0.2, Qt = 0.2, Le = 0.1, delta = 0.3, E = 0.2,M = 0.2, Pe = 0.2, delta0 = 0.3, Da = 0.1, n = 1]:

sys := {
    diff(psi(y), y$4)*(1 - We*(diff(psi(y), y$2))^2)
    + diff(psi(y), y$3)*(-2*We*diff(psi(y), y$2)*diff(psi(y), y$3))
    - M^2*diff(psi(y), y$2) + Gr*(diff(theta(y), y) - N[r]*diff(phi(y), y) - Rr*diff(chi(y), y)) = 0,
    (1 + 4/(3*Nr))*diff(theta(y), y$2) + Br*(1 - We*(diff(psi(y), y$2))^2)*diff(psi(y), y$3)
    + Nb*diff(theta(y), y)*diff(phi(y), y)+ Nt*(diff(theta(y), y))^2 + Qt*theta(y) = 0,
    diff(phi(y), y$2) + (Nt/Nb)*diff(theta(y), y$2)- Le*Da*phi(y)*(1 + delta*theta(y))^n*exp(-E/(1 + delta*theta(y))) = 0,
    diff(chi(y), y$2) + Pe*(diff(chi(y), y)*diff(phi(y), y) + (chi(y) + delta0)*diff(phi(y), y$2)) = 0,
    # --- Boundary Conditions ---
    D(psi)(-1 - x^2/2) = 1, D(psi)(1 + x^2/2) = -k,
    psi(-1 - x^2/2) = 0, psi(1 + x^2/2) = 2*H,
    theta(-1 - x^2/2) = 0, theta(1 + x^2/2) = 1,
    phi(-1 - x^2/2) = 0, phi(1 + x^2/2) = 1,
    chi(-1 - x^2/2) = 0, chi(1 + x^2/2) = 1
}:

fixed_k := 0.1:

G := proc(mval,brval) local pars,dsol;
  pars := [M = mval, Br = brval, k = fixed_k, op(paramSet)];
  dsol := dsolve(eval(sys, pars), numeric, method = bvp[midrich],
                 maxmesh = 256, initmesh = 64, abserr = 1e-4);
  eval(-diff(theta(y), y), dsol(1));
end proc:

CP3D:=contourplot3d(G, 0.1..0.9, 0.1..0.9, filled,
                 contours=15, grid=[9,9],colorscheme = "turbo", colorbar):

SP3D:=display(CP3D,overrideoptions,style=surface):

CP3Dblack:=display(CP3D,overrideoptions,color=black,thickness=2):

P3Dboth:=display(SP3D,CP3Dblack):

G:=display(P3Dboth, transform((x,y,z)->[x,y,-0.53])(P3Dboth),
        labels = ["M", "Br", "Nu"],
        labelfont = [TIMES, BOLDITALIC, 16],
        title = typeset("Nusselt Number vs M and Br (k = ", fixed_k, ")"),
        titlefont = [TIMES, BOLD, 18], projection = 0.8,
        orientation=[10,75,0], lightmodel = light4):

subsindets(G,specfunc(COLBAR),
           cb->subsindets(cb,specfunc(PLOT),p->display(p,size=[100,400])));
 


Download 3D_shadow_at_the_base_Help_acc.mw

@sand15 That too is nice and visually easy to understand.

[edit: it's more complicated to do, though, and requires adjustment for other data.]

@Carl Love I don't know why it was done that way. Perhaps the author really preferred consistency, or half-expected that some other module locals might be needed later.

There are other appliable module exports of Student:-Calculus1 which are documented/user-level commands of the package. Some have other locals, and some do not. Eg,

op(eval(Student:-Calculus1:-InversePlot));

module () local ModuleApply; end module, ModuleApply

op(eval(Student:-Calculus1:-AntiderivativePlot));

module () local ModuleApply; end module, ModuleApply

op(eval(Student:-Calculus1:-DerivativePlot));

module () local ModuleApply, GetDerivativeOptions; end module, ModuleApply, GetDerivativeOptions

op(eval(Student:-Calculus1:-FunctionPlot));

module () local ModuleApply, NextAft, FunctionChartInfo; end module, ModuleApply, NextAft, FunctionChartInfo


Download SC1_am.mw

The OP has also asked me how I knew that it was such an appliable module, ie. a module with member ModuleApply, which (like a procedure) could be called with arguments.

One answer is simply that having such a module member ModuleApply is the mechanism that allows for that behaviour of a module's being callable like a procedure (ie. which could be applied to arguments).

But I also already knew it because I've worked with that command before.


ps. The printing mechanisms for modules have had a few quirks, over time, as the following shows:

restart;

kernelopts(version);

`Maple 2024.2, X86 64 LINUX, Oct 29 2024, Build ID 1872373`

op(eval(Student:-Calculus1:-InversePlot));

module () local ModuleApply; end module, ModuleApply

convert(eval(Student:-Calculus1:-InversePlot),string);

"module () local ModuleApply; end module"

op(3,eval(Student:-Calculus1:-InversePlot))

InversePlot:-ModuleApply

# same command as earlier!
convert(eval(Student:-Calculus1:-InversePlot),string);

"module () local ModuleApply; ModuleApply := proc (expr::algebraic, myrng::{range, And(name,Not(constant)), And(name,Not(constant)) = range} := NULL, {caption::anything := NULL, functionoptions::list := [], inverseoptions::list := [], lineoptions::list := [], showfunction::truefalse := true, showinverse::truefalse := true, showline::truefalse := true, title::anything := NULL, view::plotview := NULL}) local var, rng, a, b, Options, Function, Inverse, Line, CaptionFunction, mytitle, mycaption, myview, comma, usePiTicks, p, defview, d, i, j; option lock; Options := table([_options]); if myrng <> NULL then Options[1] := myrng; end if; try var, rng := ProcessVisual(expr,Options,{'range'},'true','true',plottools:-getdata(plot(expr,GetVariable(expr),'adaptive' = true),'rangesonly')[1]); catch: error; end try; myview := view; mycaption := caption; mytitle := title; if not type([_rest],'list'('PLOToptions'('`global`'))) then error "unexpected option(s): %0", op(remove('type',[_rest],'PLOToptions'('`global`'))); end if; try GetVariable(expr); catch: error; end try; p := plot(expr,`if`(myrng = NULL or type(myrng,'name'),NULL,var = rng),'adaptive' = true); if 0 < nops(select(type,[op(p)],AXESTICKS('identical'(_PITICKS),'identical'(DEFAULT),'anything'))) then usePiTicks := true; else usePiTicks := false; end if; a, b := op(rng); CaptionFunction := SelectTypesetName(var,'f','F'); if showfunction then Function := plot(expr,var = a .. b,'discont' = 'true','adaptive' = true,'legend' = CaptionFunction(var),'color' = Student:-Colours[1],op(functionoptions)); else Function := NULL; end if; defview := NULL; if myview = NULL then defview := indets(Function,'specfunc'('VIEW')); if nops(defview) <> 1 or op([1, 2],defview) = 'DEFAULT' then d := plottools:-getdata(p); defview := [seq(seq(map2(op,[2, i, j],[d]),j = 1 .. 2),i = 1 .. 2)]; defview := zip((a, b) -> a(op(b)),[min, max, min, max],defview); if type(defview,'list'('numeric')) then defview := min(defview[1],defview[3]) .. max(defview[2],defview[4]); defview := [defview, defview]; end if; else defview := defview[1]; defview := min(op([1, 1],defview),op([2, 1],defview)) .. max(op([1, 2],defview),op([2, 2],defview)); defview := [defview, defview]; end if; end if; if showinverse then Inverse := plottools:-transform((x, y) -> [y, x])(plot(expr,var = a .. b,'discont' = 'true','adaptive' = true,'legend' = 'typeset'(`_MessageCatalogue/GetMessage`("%1 reflected across %2","Maplets"),CaptionFunction(var),'y' = 'x'),'color' = Student:-Colours[2],op(inverseoptions))); else Inverse := NULL; end if; if showline then Line := plot(var,var = `if`(defview = NULL,a .. b,defview[1]),'color' = Student:-Colours[3],'linestyle' = 'DASH','adaptive' = true,op(lineoptions)); else Line := NULL; end if; if mytitle = NULL then mytitle := 'typeset'(`_MessageCatalogue/GetMessage`("Reflection across %1","Maplets"),'y' = 'x'); end if; if mycaption = NULL then mycaption := ""; comma := ""; if showfunction then mycaption := cat(mycaption,`_MessageCatalogue/GetMessage`("A graph of %1.","Maplets")); comma := " "; end if; if showinverse then mycaption := cat(mycaption,comma,`_MessageCatalogue/GetMessage`("The line %2.","Maplets")); comma := " "; end if; if showline then mycaption := cat(mycaption,comma,`_MessageCatalogue/GetMessage`("The reflection of %3 across the line %4.","Maplets")); end if; mycaption := 'typeset'(mycaption,CaptionFunction(var) = expr,'y' = 'x',CaptionFunction(var),'y' = 'x'); end if; if myview <> NULL then SetMessage(sprintf("Using view %a",myview)); end if; AddLegends(plots:-display(Function,Inverse,Line,`if`(title = "",NULL,':-title' = mytitle),`if`(caption = "",NULL,':-caption' = mycaption),`if`(myview = NULL,`if`(defview = NULL,NULL,':-view' = defview),':-view' = myview),`if`(usePiTicks,op([':-axis'[1] = ['tickmarks' = 'piticks'], ':-axis'[2] = ['tickmarks' = 'piticks']]),NULL),':-scaling' = 'constrained',_rest)); end proc; end module"

Download module_hmm.mw

@aroche Thanks, Austin!

I guess I was so hung up on avoiding the OP's earlier use of x>=0 that I was willing to accept R::real, unjustified, like a mirage. Thanks for the correction.

@dharr It seems to me that the OP's sentence,

  "Then,  `-\\infty` to `- + \\infty`."

pertains to the results that attain -- undesirably -- when he executes his original attempt.

And then he mentioned what he wanted,

   "How can I replace \infty with +\infty but keep -\infty unchanged?"

@dharr The temporary shunting aside is indeed a classic trick.

But perhaps you intended just,

    s2 := SubstituteAll(%, "#@#","-\\infty");

2 3 4 5 6 7 8 Last Page 4 of 600