acer

33188 Reputation

29 Badges

20 years, 209 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Parts of your .txt file have 5 columns of float data per line, and parts have only 3 (or 1).

How do you want that imported?

Do you want such differing blocks to be imported into separate Matrices? Or into a single Matrix, with fill-in?

This seems like of one those situations for which a proper specification of the goal would be better.

@nm What do you think of the following, using your sol_1:

odetest(simplify(sol_1),[ode,IC]) assuming t>Pi/2, t<Pi;

  [0, 0, 1/2*Pi]

Issues can also arise if you take other (different) directional limits.

Why do you believe that choosing any arbitrary direction (to approach [0,0] in limit) is valid, even in this context of odes? Do you believe that your two odetest calls above demonstrate a sound and robust approach, ather than your getting lucky?

The answer to your multivariate limit example is undefined, and not the expression you obtained by taking the limits separately.

Consider your approach of taking limits wrt single variables separately. Which do you do first?

eval(limit(limit(sol, _C3=0), _C4=0), t=3*Pi/4);

  -1/16*Pi*2^(1/2)

eval(limit(limit(sol, _C4=0), _C3=0), t=3*Pi/4);

  3/16*Pi*2^(1/2)

Also, consider the limit as _C3 and _C4 approach zero along the line _C4=3*_C3 (ie. after doing a substitution). And now along _C4=7*_C3.  Evaluate as t=3*Pi/4. Those produce different results. See also here.

Now, you might have some other purpose in mind, that you didn't state in your original Question. And that might not even need a correct result for the multvariate limit computation. If that's the case then your Question would be better if it stated its purpose.

@C_R In Maple 2025 the substitution of the Intat within the RootOf might be handled slightly differently. (Below I do eval(subs(...)) but one could also do it with subs[eval] .

And the contents of the RootOf may become the simpler 2*cos(_Z)  rather than the equivalent 4*cos(1/2*_Z)^2-2 .

And then the result from allvalues might become simpler, with fewer _Zn parameters with integer assumptions.  The loop isn't really necessary, with the single _Zn parameter and the formula like Pi*(1/2+_Z1) , since I realize that you can directly imagine the concrete values, but I left it in.

nb. I did not change the sign in this author's Eq.1. I've just re-enabled the flow for your version.

Download Not_Only_Pi_ac2025.mw
or, for M2015 by prodding it for that cos simplification (again, without changing the initial sign),
Not_Only_Pi_ac2015.mw

@C_R Please could you give (here) that "integrating twice" bit, but in 1D plaintext Maple code and without any Equation labels?

@janhardo The axis of rotation is the line that passes through [1,1,1] and [2,2,2].

See the Help page for the rotate command, which explains the calling sequence rotate(Cube,phi,[c]) with the bullet-point and sentence,

   "If the calling sequence is of the form rotate(q, alpha, [pt_3d_1, pt_3d_2]),
    then pt_3d_1 and pt_3d_2 define the axis of rotation.
"

You wrote, "...and I must copy and convert each one individually into LaTeX".

The latex command in your Maple 2024 has several options related to directly writing (or appending!) to external files.

And you also have another choice: using the latex command to generate seperate strings of each expression's LaTeX code, and then sprintf'ing that to an external file.

And it's reasonably straightforward to map that latex command across a list of solutions. There is no need to "...copy and convert each one individually".

You've omitted important details of your desired output format. Is it one text file, or several? If it's multiple files, do you want to specify a common part of filenames (like a prefix)? Do you want the text file to include preamble LaTeX likes like \documentclass{}, \begin{document} etc. You should explain precisely the format you want.

Having Maple's own GUI do all the items in your bullet points doesn't sound like a good way to spend resources, since one can write Maple code to do all that in a 1-10 line procedure.

@elemental cinder Please check for mistakes in this attachment, including transcription errors. I think there are some improvements (ie. re-use of values from previous result without cut&paste, less floats where possible/reasonable, etc).

It's not clear how N(r) could attain a purely real value of 66.6 for some r>0.

I didn't check that the symbolic integration step is producing the right result(s) here. That step can take a while (1-2mins in my Maple 2025). I might get time to check its validity against a purely floating-point numeric integrator (for concrete numeric input).

This forum doesn't render all the 2D Input lines below. The essense of the later plots is that N(r) is non-real for r>1/4, and greater than 500 for 0<r<1/4 .

ps. I used Maple 2024.2, as I find 2D Input mode in M2025/2026 more awkward. Pls let me know if these same results don't attain in your Maple 2025.

restart

"h(x):=sqrt(25-(x-4)^(2)):"NULL

x__1 := 4+5

`V__!1` := Pi*(int(h(x)^2, x = 0 .. x__1)) = 162*PiNULL

"cp(x):=5-sqrt(1-(x-1)^(2)):"

sols0 := [solve(h(x) = cp(x))] = [1, 32/17]NULL

x__h_1 := sols0[1]

1

x__h_2 := sols0[2]

32/17

`V__!2` := Pi*(int(h(x), x = x__h_1 .. x__h_2))-Pi*(int(cp(x), x = x__h_1 .. x__h_2)) = Pi*(348/289+(25/2)*arcsin(3/5)-(25/2)*arcsin(36/85))-Pi*(1215/289-(1/2)*arcsin(15/17))NULL

NULL

evalf(`V__!2`)

.36901057

NULL

"`cp1__up`(x):=sqrt(25/(100) r-(x-25/(10))^(2))+2:"

"`cp1__down`(x):=2-sqrt(25/(100) r-(x-25/(10))^(2)):"

x__2 := 25*(1/10)-r

5/2-r

x__3 := 25*(1/10)+r

5/2+r

`V__!3` := `assuming`([simplify(Pi*(int(cp1__up(x), x = x__2 .. x__3))-Pi*(int(cp1__down(x), x = x__2 .. x__3)))], [r > 0])

Pi*(r*(-4*r^2+r)^(1/2)+(1/2)*r*arctan(2*r/(-4*r^2+r)^(1/2))+2*piecewise(And(-r < -(1/2)*r^(1/2), -(1/2)*r^(1/2) < r), (1/8)*r*Pi, 0)+2*piecewise(And(-r < (1/2)*r^(1/2), (1/2)*r^(1/2) < r), (1/8)*r*Pi, 0))

"f(x):=(9/(10)+log[10](x-4))*r:"

"g(x):=(2*(1-(e)^(x-(10)/(3)*r))r)/(3):"``

T := unapply('fsolve(eval(f(x)/:-r = g(x)/:-r, :-r = R), x)', R, numeric)NULL

x__fg := T(2)

4.490892617

sols := [solve(f(x) = 0)] = [{r = r, x = (1/10)*10^(1/10)+4}, {r = 0, x = x}]NULL

evalf(sols)

[{r = r, x = 4.125892541}, {r = 0., x = x}]

x__f0 := eval(x, sols[1]) = (1/10)*10^(1/10)+4NULL

sols2 := [solve(g(x) = 0)] = [{r = 0, x = x}, {r = r, x = (10/3)*r}]NULL

x__g0 := eval(x, sols2[2]) = (10/3)*rNULL

`V__!4` := Pi*(int(f(x)^2, x = x__f0 .. x__fg))+Pi*(int(g(x)^2, x = x__fg .. x__g0)) =
.1795453606*r^2+Pi*(-.2222222222*r^2*exp(8.981785234-6.666666666*r)+.8888888888*r^2*exp(4.490892617-3.333333333*r)-.4444444444*r^2*ln(exp(4.490892617-3.333333333*r))-(2/3)*r^2)
NULL

"N(r):=`V__!1`-`V__!2`-`V__!3`-`V__!4`"

proc (r) options operator, arrow, function_assign; `V__!1`-`V__!2`-`V__!3`-`V__!4` end proc

I don't see how N(r) can attain a value of 66.6
as it appears to only be real-valued in the range r=0..1/4,
and never less than 500.


NULLNULL

NULL 

 

plot(N(r), r = 0 .. .3)

``

alt := N(r); `assuming`([simplify(convert(%, rational))], [r > 0, r < 1/4])

-(1/2)*r*arctan(2*r^(1/2)/(-4*r+1)^(1/2))*Pi-(8/9)*Pi*r^2*exp(49557/11035-(10/3)*r)+(2/9)*Pi*r^2*exp(94183/10486-(20/3)*r)-r^(3/2)*(-4*r+1)^(1/2)*Pi-(1/2)*arcsin(15/17)*Pi+(25/2)*arcsin(36/85)*Pi-(25/2)*arcsin(3/5)*Pi+(1/297945)*(-441400*r^3+793314*r^2+49160925)*Pi-(39089/217711)*r^2

plot(alt, r = 0. .. .4, thickness = 4, size = [500, 200])

plot(Im(alt), r = 0 .. .3, thickness = 4, size = [500, 200])

plot(([Re, Im])(N(r)), r = 0 .. 6)

NULL

Download MATHprobwithV_ac.mw

This is a correction for the earlier typo. I tried to give the two black-box procedure more pertinent names.

bbox_ex2b.mw

Note that you still haven't actually attached a worksheet file for you latest followup query. So we cannot tell what you mean about units, or what you ment by your references like  `V__!3` etc.

When you upload a .mw file here, using the green uparrow in its editor, you also have to attach it or (better, here) insert a link to it. Those are choices in the pop-up that appears when you upload via the arrow.

@elemental cinder Sorry, if I typo'd.

The ranges passed to help fsolve might need adjustment, on account of that. Or, try looking at the implicitplot to get hints on ranges.

And you should try fsolve rather than solve, since the expressions are not explicit. (ie. a purely numeric solving)

[making dinner for the family right now. I'll revisit in a few hours I hope.]

@Ronan I'm glad that you're able to make some progress.

Soneone changed one of my Replies into an Answer. I have changed it back, to keep the original sequence of posting in their original order (because they logically and textually follow each other.

@Ronan Did you try my suggestion, after adjusting for your typo?

How is the following not doing what your last Comment mentioned? (This is essentially the same as in my previous Reply, but now there is RT:- instead of TN:- )

2026-03-27_Q_Module_Generic_Variables_R1_acc2.mw

 

ps. You just wrote, in a followup Comment, "One other question the arises from this....", with an additional query. But the additional query doesn't seem (to me) so much something revealed in part of the reposnses; it seems more a related (but quite distinct) thing on writing code&modules. Could you not ask all your relevant queries when you first post your Question?

@Ronan My followup point is that you might well want to programatically query current settings (so as to use the results in some test or manipulation). Here's a shot at that.

Note the latter examples, illustrating that you can both set and query values. It's done now to query values after doing the setting, but you could change the order.

I'm not sure if you mean that you want the modules source code to contain TM (literally), and then to be able to utilize it as RationalTrigonometry. Here's something on that too. (If you actually were to keep your source code in plaintext files -- which some people always do for serious projects, and then read them in -- then you could use $define macros.

restart;

kernelopts(version);

`Maple 2026.0, X86 64 LINUX, Mar 05 2026, Build ID 2001916`

use TM=RationalTrigonometry in
TM := module()
  export Cartline,Parmline,Settings;
  local Cartvars:=[:-x,:-y,:-z],Parmvars:=[:-alpha,:-beta,:-rho],
        GeomClr:="Blue",Prntmsg:=true;

  Settings := proc({Cartvars::list:=TM:-Cartvars},{Parmvars::list:=TM:-Parmvars},
                   {GeomClr::string:=TM:-GeomClr},{info::boolean:=TM:-Prntmsg},
                   other::list(identical(:-Cartvars,:-Parmvars,:-info,:-GeomClr)):=[], $)
    (TM:-Cartvars,TM:-Parmvars,TM:-GeomClr,TM:-Prntmsg):=Cartvars,Parmvars,GeomClr,info;
    if _npassed = 0 then
      print("Cartvars ",TM:-Cartvars); print("Parmvars ",TM:-Parmvars);
      print("GeomClr ",TM:-GeomClr); print("Prntmsg ",TM:-Prntmsg);
    end if;
    if other = [] then return NULL;
    else return map[2](`?[]`,TM,`[]`~(subs(:-info=':-Prntmsg',other)));
    end if;
  end proc;

  Cartline := proc(p1::list,p2::list,{vars::list:=TM:-Cartvars},Prntmsg:=TM:-Prntmsg)
    local l:= (p2[2]-p1[2])*vars[1]+(p1[1]-p2[1])*vars[2]
              -p2[2]*p1[1]+p1[2]*p2[1];
    if Prntmsg then print("Cartesian line format"); end if;
    return l;
  end proc;

  Parmline := proc(p1::list,p2::list,{varp:=TM:-Parmvars},Prntmsg:=TM:-Prntmsg)
    local l:= p1+~varp[1]*<p2-p1>;
    if Prntmsg then print("Parametric line format"); end if;
    return l;
  end proc;
end module:
end use;

_m132392360999968

 

RationalTrigonometry:-Cartline([4,3],[-8,4]);

"Cartesian line format"

x+12*y-40

RationalTrigonometry:-Cartline([4,3],[-8,4],vars=[s,t],false);

s+12*t-40

RationalTrigonometry:-Parmline([4,3],[-8,4]);

"Parametric line format"

Vector[column](%id = 36893620539784520636)

RationalTrigonometry:-Parmline([4,3],[-8,4],varp=[Lambda]);

"Parametric line format"

Vector[column](%id = 36893620539784523036)

RationalTrigonometry:-Settings();

"Cartvars ", [x, y, z]

"Parmvars ", [alpha, beta, rho]

"GeomClr ", "Blue"

"Prntmsg ", true

RationalTrigonometry:-Settings(Cartvars=[X,Y,Z],info=false);

RationalTrigonometry:-Settings()

"Cartvars ", [X, Y, Z]

"Parmvars ", [alpha, beta, rho]

"GeomClr ", "Blue"

"Prntmsg ", false

RationalTrigonometry:-Cartline([4,3],[-8,4]);

X+12*Y-40

RationalTrigonometry:-Cartline([4,3],[-8,4],true);

"Cartesian line format"

X+12*Y-40

RationalTrigonometry:-Settings(Parmvars=[varkappa,vartheta,sigma],info=true,Cartvars=[A,B,C])

RationalTrigonometry:-Settings();

"Cartvars ", [A, B, C]

"Parmvars ", [varkappa, vartheta, sigma]

"GeomClr ", "Blue"

"Prntmsg ", true

RationalTrigonometry:-Settings([Cartvars, info, Parmvars]);

[[A, B, C], true, [varkappa, vartheta, sigma]]

RationalTrigonometry:-Settings([Cartvars, GeomClr],
             info=false, Parmvars=[f,g,h]);

[[A, B, C], "Blue"]

RationalTrigonometry:-Settings();

"Cartvars ", [A, B, C]

"Parmvars ", [f, g, h]

"GeomClr ", "Blue"

"Prntmsg ", false

Download 2026-03-27_Q_Module_Generic_Variables_R1_acc.mw

@Ronan For your interest: without dummy parameters, multiple overloads, etc. I'd suggest that this is simpler in structure, and in use.

(nb. sometimes this site displays some Maple 2026.0 outputs as [?], though they can be fine in actual Maple.)

restart;

kernelopts(version);

`Maple 2026.0, X86 64 LINUX, Mar 05 2026, Build ID 2001916`

TM := module()
  export Cartline,Parmline,Settings;
  local Cartvars,Parmvars,GeomClr,Prntmsg;
  Cartvars := [:-x,:-y,:-z];  
  Parmvars := [:-alpha,:-beta,:-rho];
  GeomClr := "Blue";
  Prntmsg := true;

  Settings := proc({Cartvars::list:=TM:-Cartvars},{Parmvars::list:=TM:-Parmvars},
                   {GeomClr::string:=TM:-GeomClr},{info::boolean:=TM:-Prntmsg}, $)
    TM:-Cartvars:=Cartvars;
    TM:-Parmvars:=Parmvars;
    TM:-GeomClr:=GeomClr;
    TM:-Prntmsg:=info;
    if _npassed = 0 then
      print("Cartvars ",TM:-Cartvars);
      print("Parmvars ",TM:-Parmvars);
      print("GeomClr ",TM:-GeomClr);
      print("Prntmsg ",TM:-Prntmsg);
    end if;
    return NULL
  end proc;

  Cartline := proc(p1::list,p2::list,{vars::list:=TM:-Cartvars},Prntmsg:=TM:-Prntmsg)
    local l;
    l := (p2[2]-p1[2])*vars[1]+(p1[1]-p2[1])*vars[2]
         -p2[2]*p1[1]+p1[2]*p2[1];
    if Prntmsg then print("Cartesian line format"); end if;
    return l;
  end proc;

  Parmline := proc(p1::list,p2::list,{varp:=TM:-Parmvars},Prntmsg:=TM:-Prntmsg)
    local l;
    l := p1+~varp[1]*<p2-p1>;
    if Prntmsg then print("Parametric line format"); end if;
    return l;
  end proc;
end module:

 

TM:-Cartline([4,3],[-8,4]);

"Cartesian line format"

x+12*y-40

TM:-Cartline([4,3],[-8,4],vars=[s,t],false);

s+12*t-40

TM:-Parmline([4,3],[-8,4]);

"Parametric line format"

Vector[column](%id = 36893622109376958940)

TM:-Parmline([4,3],[-8,4],varp=[Lambda]);

"Parametric line format"

Vector[column](%id = 36893622109376961340)

TM:-Settings();

"Cartvars ", [x, y, z]

"Parmvars ", [alpha, beta, rho]

"GeomClr ", "Blue"

"Prntmsg ", true

TM:-Settings(Cartvars=[X,Y,Z],info=false);

TM:-Settings()

"Cartvars ", [X, Y, Z]

"Parmvars ", [alpha, beta, rho]

"GeomClr ", "Blue"

"Prntmsg ", false

TM:-Cartline([4,3],[-8,4]);

X+12*Y-40

TM:-Cartline([4,3],[-8,4],true);

"Cartesian line format"

X+12*Y-40

TM:-Settings(Parmvars=[varkappa,vartheta,sigma],info=true,Cartvars=[A,B,C])

TM:-Settings();

"Cartvars ", [A, B, C]

"Parmvars ", [varkappa, vartheta, sigma]

"GeomClr ", "Blue"

"Prntmsg ", true

 

Download 2026-03-27_Q_Module_Generic_Variables_R1_ac.mw

ps. Another finesse that might be programatically useful is the functionality where Settings could also accept one or more of the relevant locals (just as a list of names, say, or as strings) and return their current values. Let me know if you'd be interested; it's just another adjument, I think.

pps. I'm not sure if it's your style, but some of the adjacent lines in the code could be rolled into so-called multiple-assignment. Eg,
   (a,b,c):=A,B,C;
rather than,
    a:=A;
    b:=B;
    c:=C;

@dharr That is interesting. It might be "fun" to discover or prove which patterns of values of the assumed parameters lead to actual solutions.

I see that the following form can be obtained in Maple 2026.0 if using environment variable _EnvAllSolutions rather than the allsolutions option of solve. (That's a bit weird, and I ought to check whether it happens for other kinds of equations...)

[edited: I used a different equation, now corrected]

restart;

kernelopts(version);

`Maple 2026.0, X86 64 LINUX, Mar 05 2026, Build ID 2001916`

ee := x^Pi=Pi^x;

x^Pi = Pi^x

solve(ee,x,allsolutions);

-Pi*LambertW(-ln(Pi)/Pi)/ln(Pi), Pi

_EnvAllSolutions := true:

S := solve(ee,x);

exp(-LambertW(_Z3, -(ln(Pi)+(2*I)*Pi*_Z4)*exp(-(2*I)*_Z1)/Pi)-(2*I)*_Z1)

V := indets(S,suffixed(_Z)):

map(getassumptions,V);

{{_Z1::integer}, {_Z3::integer}, {_Z4::integer}}

Download s_ex2.mw

1 2 3 4 5 6 7 Last Page 2 of 607