acer

32303 Reputation

29 Badges

19 years, 307 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@adam25185 Could you please upload and attach your full worksheet file, using the green up-arrow in the Mapleprimes editor?

@salim-barzani You're very welcome.

Please note that I put a line,

   indets(F, function)

into the sheet. That sort of thing can be useful, as a kind of check. In the original, it showed the long expressions that were just function calls of l and m.

You can also do it as,

   lprint(indets(F, function))

and get its result line-printed as 1-D code, if that helps diagnosis.

Please put your close followup queries here (or use the Branch button), rather than spawning another wholly separate Question thread for this.

You had a followup in which pointplot complained about non-numeric entries.
  Bifurcation_MaplePrimes_Oct_17.mw
The problem there is that not all the used entries of A (and L2) have (real,finite) numeric value as second element. Some have Float(infinity)+Float(infinity)*I, which your Maple 2018's pointplot doesn't like. Leaving the rest of your method the same, one possible adjustment is to replace non-numeric values by undefined as they occur.
  Bifurcation_MaplePrimes_Oct_17_ac.mw

ps. Another way to deal with such might be pare the final L2, right before calling pointplot. I didn't check which might be better, or add any bailout efficiencies. One you have it all working you might want to focus on its performance, and have it run under evalhf.

@WA573 I didn't at first understand that you were now wanting to deal with just this "new" example, and not the original example.

You can simply pass the explicit option to solve, to avoid any RootOf here.

Below I also show that you can verify the elements of those explicit solutions, after backsubstituting. (This simplification incantation is for this problem, not for all problems.)

restart

s := 32*exp(-3*t)*(delta1-delta2)*((delta1^2-5*delta1*delta2+(7/4)*delta2^2)*exp((4*I)*exp(-t)*((-(1/2)*delta1^2+delta2^2)*exp(-t)+x*(delta1-2*delta2)))-3*exp(-(2*I)*exp(-t)*(2*exp(-t)*delta1^2-3*exp(-t)*delta2^2-4*delta1*x+6*delta2*x))*delta1^2*(1/4)+((7/4)*delta1^2-5*delta1*delta2+delta2^2)*exp(-(4*I)*delta2*(-(1/2)*exp(-t)*delta2+x)*exp(-t))-3*exp(-(4*I)*delta1*(-(1/2)*exp(-t)*delta1+x)*exp(-t))*delta2^2*(1/4))/((exp(-(2*I)*exp(-t)*(delta1-delta2)*(exp(-t)*delta2+exp(-t)*delta1-2*x))+1)^3*(exp((2*I)*exp(-t)*(delta1-delta2)*(exp(-t)*delta2+exp(-t)*delta1-2*x))+1))

s1 := simplify(subs({delta1 = (1/2)*delta2}, s))

exp(-3*t)*delta2^3*(8*exp(((1/2)*I)*exp(-t)*delta2*(7*exp(-t)*delta2-12*x))+3*exp(-(8*I)*delta2*exp(-t)*(-(5/8)*exp(-t)*delta2+x))+17*exp(-(4*I)*delta2*(-(1/2)*exp(-t)*delta2+x)*exp(-t))+12*exp(-(2*I)*delta2*(-(1/4)*exp(-t)*delta2+x)*exp(-t)))/((exp(-(2*I)*delta2*(-(3/4)*exp(-t)*delta2+x)*exp(-t))+1)^3*(exp((2*I)*delta2*(-(3/4)*exp(-t)*delta2+x)*exp(-t))+1))


Now, using the explicit option to the solve command
G := solve({numer(s1) = 0, denom(s1) <> 0}, [delta2], explicit)

[[delta2 = 0], [delta2 = ((2/3)*x+(1/3)*(4*x^2-(6*I)*ln(-5/6+((1/6)*I)*119^(1/2)))^(1/2))*exp(t)], [delta2 = ((2/3)*x-(1/3)*(4*x^2-(6*I)*ln(-5/6+((1/6)*I)*119^(1/2)))^(1/2))*exp(t)], [delta2 = ((2/3)*x+(1/3)*(4*x^2-(6*I)*ln(-5/6-((1/6)*I)*119^(1/2)))^(1/2))*exp(t)], [delta2 = ((2/3)*x-(1/3)*(4*x^2-(6*I)*ln(-5/6-((1/6)*I)*119^(1/2)))^(1/2))*exp(t)]]

seq(simplify(expand(eval(s1, GG))), GG = G)

0, 0, 0, 0, 0

NULL

Download ss_root_ac.mw


ps. The solve+allvalues approach given by mmcdara seems unnecessarily complicated, given that the introduction of RootOf can be avoided here.

I was only unsure whether you were still talking about this Question thread's original example, or just your issues with the followup example.

@WA573 It's not clear what you're now asking.

@Aixleft math If solving for {h, v1, t} then which of two solutions forms you might accept for positive t would depend on signum(g).

You've indicated in a followup Reply that you want positive t. Do you know anything about g?

@Michael 

1) I terminated my commands with a full colon in a few places, deliberately. I was trying to focus on the way the entries and procedure were displayed, without any distracting visual effects. This included:

   a) After definition of my variant on a procedure to read and then print a list of what changed in anames. That input line of code provides as much insight as would any displayed output of that same proc. I terminated that defining statement with a full colon to avoid such repetitious clutter.

   b) After my interface call. I set interface(verboseproc=2) higher than its default value of 1, so that procedures get displayed more usefully here. Note that here we want procedure bodies to be displayed in full even if they are read in from a dotm file or Library archive. When the interface command is used to set an option then its return-value is the old setting. I terminated that statement with a full colon so that you would not be distracted by that aspect.

   c) After my map[2] call. That call invokes printf on each entry in a list assigned to res. The printf effect is what I wanted you to see, ie. a plaintext display of your procedure, with line-breaking. But that printf display is a visual side-effect; the programmatic return-value from printf is NULL, and the return-value from that map[2] call is thus [] an emtpy list. I terminated my statement with a full colon so that you would not be distracted or thrown off by the output [] an empty list being printed at the very end.

2) Line-feeds are not part of a procedure structure, as stored by Maple. When a procedure is pretty-printed it gets displayed with some line-breaks, but not as many as you would like, it seems. There are a variety of ways to display the code of a procedure, and they display it in different ways. Not everyone else wants what you happen to want here, all the time.

ps. Here are some varieties of ways to display a procedure body. Since I'm doing it here on a proc that I define in the session (and not reading from Library archive or .m file) I don't need verboseproc=2.

Note that the first two examples below render differently in Maple 2024.1 than they do when the worksheet is inlined in this forum, ie. the outer procedure body may not get displayed with line-breaks. But your issue -- that the inner proc body is displayed in a single line -- is the same there.

Using lprint[2] is an alternative way to render display of the nested procedure with statement line-breaks and indentation.

restart;

F := proc(t)
  local foo, x, y;
  x := sin(t);
  y := cos(t);
  foo := proc(r::posint) local i, temp;
            temp := add(x^i, i=1..r);
            return temp + sqrt(y);
         end proc;
  return foo;
end proc;

proc (t) local foo, x, y; x := sin(t); y := cos(t); foo := proc (r::posint) local i, temp; temp := add(x^i, i = 1 .. r); return temp+sqrt(y) end proc; return foo end proc


Some pretty-printing

print(F);

proc (t) local foo, x, y; x := sin(t); y := cos(t); foo := proc (r::posint) local i, temp; temp := add(x^i, i = 1 .. r); return temp+sqrt(y) end proc; return foo end proc


Plaintext line-printing

printf("%a", eval(F));

proc (t) local foo, x, y; x := sin(t); y := cos(t); foo := proc (r::posint) local i, temp; temp := add(x^i,i = 1 .. r); return temp+sqrt(y); end proc; return foo; end proc


Plaintext line-printing, with a formatted page-width

lprint(eval(F));

proc (t) local foo, x, y; x := sin(t); y := cos(t); foo := proc (r::posint)
local i, temp; temp := add(x^i,i = 1 .. r); return temp+sqrt(y); end proc;
return foo; end proc


Plaintext line-printing, with a formatted page-width, and line-breaks

lprint[2](eval(F));

proc( t )
    local foo, x, y;
    x := sin(t);
    y := cos(t);
    foo := proc( r::posint )
        local i, temp;
        temp := add(x^i,i = 1 .. r);
        return temp+sqrt(y);
    end proc;
    return foo;
end proc


Plaintext line-printing, in the manner you wanted

printf("%P", eval(F));

proc(t)
    local foo, x, y;
    x := sin(t);
    y := cos(t);
    foo := proc(r::posint)
            local i, temp;
            temp := add(x^i, i = 1 .. r);
            return temp + sqrt(y);
        end proc;
    return foo;
end proc


With line-breaks as well as line-numbers

showstat(F);


F := proc(t)
local foo, x, y;
   1   x := sin(t);
   2   y := cos(t);
   3   foo := proc( r::posint )
           local i, temp;
           temp := add(x^i,i = 1 .. r);
           return temp+sqrt(y);
       end proc;
   4   return foo
end proc
 

 

 

Download disp_ex.mw

pps. Up until Maple 2018.2 the first example above would actually render with both inner and outer proc displayed with line-breaks (statement by statement), if one had the setting interface(prettyprint=1). But that no longer has that effect.

The %P modifier for printf was introduced in Maple 2019. The ability to add display a proc with line-breaks using lprint[2] was introduced in Maple 2019.

Starting in Maple 2022 the first example above even the outer proc would get less line-breaks during normal print rendering.

Also, since you're interpolating the data for the "density" plots then you might also want to use that same interpolating process for the contour lines (which then become smoother in places). It's just an idea.

For example,  Help_4_acc.mw

@salim-barzani I asked earlier what you meant by "export", but you still haven't explained either that or what you mean by "template".

Does template just mean a re-usable example that you could understand? Or does it mean a reusable procedure to help automate the process? Or something else? I don't understand why you keep mentioning it without explaining it in detail.

Are you hoping to export the numeric data, eg. a 2D Matrix after a plot3d call? mat_ex_3d.mw

Please don't post wholly separate duplicate/followup Question threads for this problem.

Instead, you can add your followup attempts and queries here, or use the Branch button from here.

Duplicate threads get flagged as such, and may be deleted.

@salim-barzani Your attempt,

   [abs]([s1, s2])

is not the right syntax here.

You can use the elementwise syntax,

   abs~([s1, s2])

to apply abs to both entries of the list [s1,s2].

Or you can use the map command to get the same result.

   map(abs, [s1, s2])

plot_of_2_function_of_one_type_ac.mw

@salim-barzani Here is an example. The two ways can produce the same combine result. It's your choice.

graph_in_simple_shape_acK.mw


Are you also wanting to annotate the various surfaces, in the combined plot, like with a legend for 2D plots? If that is so then you might look here.

@salim-barzani Four days ago I already showed you that you can construct a 3D combined plot of real and imaginary parts of an expression like so,

plot3d([Re, Im](s1), t = 0 .. 0.5, x = 0 .. 5, color = [red, blue])

But you've since deleted that entire Question thread, so I cannot make a working link to my Replies that contained it.

Of course, you can add other options to that call, eg.
   view = -15 .. 15, grid = [500, 500], style = surface, etc.

Note that for options such as color, style, etc, you can either use a single value which then gets applied for all the surfaces, or you can use a list of as many choices as there are surfaces. Eg, you can do either of these:

# to have all the surfaces get the same style
plot3d( [e1, e2, e3, e4], ...,
        style=surface );

# or, to get different styles for some of the surfaces,
plot3d( [e1, e2, e3, e4], ...,
        style=[surface,contour,surface,point] );


nb. In the special case of three expressions there is some ambiguity between whether those represent three different surfaces or three (x, y, and z) components of a single parametric surface. The default is to interpret a list of three expressions as denoting the parametric form. So, if you actually want three different surfaces then you also need the extra option,
  plotlist = true
For example,

plot3d( [Re, Im, abs](s1), t = 0 .. 0.5, x = 0 .. 5, 
        color = [red, blue, green],
        style = [surface, surface, point],
        plotlist = true )

Note that,
   [Re, Im, abs](s1)
is a shorter way to enter,
   [Re(s1), Im(s1), abs(s1)]


ps. You're sentences about a "template" are still opaque. You're not being clear about exactly what it is that you want.

Hi, sorry for adding this here; my link to contact a Member via message is not working.

Another Question by you (about Oct 2nd) was just deleted. I had an Answer in it relating to Explore. (I found your Explore usage followup goal -- about programmatic access to current parameter values -- so interesting that I wonder whether it might even make for a new Explore option, or at least a Help-page Example.)

Anyway, that whole Question thread has disappeared. Did you delete it, deliberately? If not, I might ask admin to reinstate it.

@Carl Love There are some chunks of right-click popup (or right-panel) menus which are purely GUI-generated.

Much of the remaining right-click popup menu items are pure GUI items, with all the items generated by the ContextMenu package appearing in the right-panel in modern versions.

The ContextMenu package is used to generate most of the menus of actions that appear in the right-panel in modern versions.

But even in the right-panel there are some items (appearing above the CM items, but below SubexpressionMenu items) which are GUI generated/related.

First 25 26 27 28 29 30 31 Last Page 27 of 591