acer

32405 Reputation

29 Badges

19 years, 351 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Are you trying to accomplish something similar to this? I am not sure whether I properly understand your integration syntax (z and z').

(I have little idea what is your scale, or accuracy requirements, because you didn't bother to say.)

HH := 5*log[10]((c/H_0)*Int(1/(A*(1+zp)^4+B*(1+z)^3+C)^(1/2)/10,
                            zp=0..z,
                            method=_d01ajc, epsilon=1e-5)):

plot(eval(HH,[A=2, B=3, C=4, H_0=1, c=299792458]), z=1e-7 .. 1.0,
     thickness=3, color=red, smartview=false);

int(convert(1/tanh(u),sincos),u);

                   ln(sinh(u))

[edit] Also, if you're ok with it...

res := int(1/tanh(u),u):

   ln(tanh(u))-1/2*ln(tanh(u)-1)-1/2*ln(tanh(u)+1)

simplify(combine(combine(res,symbolic),symbolic),symbolic):

                1/2*I*Pi + ln(sinh(u))

There is a new command in Maple 2020, called ListTools:-Slice, which can split a list into n parts.

If it's not fast enough then tell us the performance/timing you want.

Also related is the (older) command ListTools:-LengthSplit.

 

I am interpreting your question to mean that you don't want to see any float approximations of multiples of Pi, but only want to see the rational multiples like Pi/3, 0, Pi/6, etc.

Here are two ways, one with Explore and one as a conventional animation.

You can of course adjust what plots are included, slow it down with duplicate frames, etc. I figured that the key thing is how the parameter value gets rendered, as mentioned.

I have used a textplot rather than a caption or title for the parameter info, because I dislike even the smallest amount of jitter in the display (as 0*Pi=0 which renders shorter, and other special cases).

There is no way to have the running value of a controller (Slider, etc) be displayed other than as an integer or float, as it appears beside the controller. So I suppress the alpha controller altogether, leaving only the animating slider shown.

(The Explore components look nicer in the actual Maple GUI, but this site's backend doesn't render those so well.)

restart

a := 4; b := 5; x0 := -3; y0 := -4

P1 := plot([a*cos(t)+x0, b*sin(t)+y0, t = 0 .. 2*Pi], scaling = constrained, gridlines, thickness = 3, size = [400, 400])

F := proc (n, N) local p; p := convert(n/N, rational)*Pi; plots:-display(P1, plot([a*cos(t)*cos(p)-b*sin(t)*sin(p)+x0, a*cos(t)*sin(p)+b*sin(t)*cos(p)+y0, t = 0 .. 2*Pi], scaling = constrained, gridlines, thickness = 3, color = red), plots:-textplot([-4, -4.5, ':-alpha' = Typesetting:-Typeset(Typesetting:-EV(p))], align = {right}, color = blue, font = [Times, 16]), view = [-9 .. 3, -10 .. 1]) end proc

Explore(F(n, 12), parameters = [[n = 0 .. 12, shown = false, animate]], frames = 13)

 

 

 

 

 

 

 

 

plots:-animate(F, [n, 12], n = 0 .. 12, frames = 13, paraminfo = false)

NULL

ROTATIONConiquesEllipseAnimation_ac.mw

[edit] In case you want an easy way (at the expense of size) to slow down the conventional animation by duplicating frames:

   plots:-display(seq(F(i, 12)$4, i = 0 .. 12), insequence = true)

If you add the option explicit to that solve call then those implicit RootOfs (of 4th degree polynomials?) may be expressed as (large) explicit expressions involving radicals. (The image is blurry; I find it difficult to see it well.) I mean,

   solve({f1,f2,f3}, [x,y1,y2], explicit);

In both 1D Maple Notation and 2D Input, the code that looks like x(2+1) and x(sin(y)) are function calls. It doesn't matter whether x has been assign a procedure or not -- those both still denote function application.

An unevaluated function call is a perfectly sensible and proper expression in Maple, and can be used for symbolic computation. Your two examples are equally as valid as function calls as f(x) or f(2+1) or f(sin(y)) are, even when f has not been assigned.

If you want to express a multiplication then you have to use valid syntax in the language that denotes it. And the examples you gave denote function application and not multiplication in the Maple language.

Note that for your example (with floats for both mantissa and exponent) the infix call to `^` gets automatically simplified by the kernel (its evalutation cannot be delayed or prevented using uneval quotes, which in some ways is analogous to its "happening early").

In contrast, the prefix form for `^` does not get automatically simplified.

I posit that the infix form gets automatically simplified (and computed at the current working precision) before the working precision gets set in the scope of the indexed call to evalf[n],

restart;
Digits := 10;
                          Digits := 10

# automatically simplification
'3.0^(1.2)';
                          3.737192819

# no automatic simplification
'`^`(3.0,1.2)';
                          ^(3.0, 1.2)

evalf[30](3.0^(1.2));
                          3.737192819

evalf[30](`^`(3.0,1.2));
                3.73719281884655197790004100992

# The behavior isn't caused by evalf's remember tables.
evalf[30](3.0^(1.2));
                          3.737192819

And, with the working precision already set to 30, we get the following. (I used evalf[300] just to demonstrate the same effect in the higher working precision.)

restart;

Digits:=30;
                          Digits := 30

evalf[300](3.0^(1.2));
                3.73719281884655197790004100992

When I trace through the 2D Input case then it seems to me that the prefix form is being used, once the 2D Parser processes it. (I vaguely recall once or twice having found a few other quirks along these lines, due to similar parsing differences.)

Find one of the appropriate terminal Application on your ubuntu. There should be several. I used the application named Konsole .  (There should be others, with names like Terminal, Xterm, UXterm, etc.)

You can easily find may answers to this with a simple web search. See here, for example. Here, let me Google that for you.

So, open a Linux terminal session.

Next, figure out where you Maple is installed. You launch the command-line interface for Maple using the file  bin/maple  located under the Maple installation.

For example, suppose that your Maple 2020 is installed here:

    /usr/local/maple/maple2020

Of course, the particular location of the installation depends on what was chosen by the person who installed it. We cannot tell you what was chosen. If you installed personally then it might also be here,

   /home/lisa/maple2020

And if you installed it as Linux user "root" then it might be here,

   /opt/maple2020

And if it was installed by your Linux systems administrator then you might have to ask them where they installed it.

In that case you can start the command-line interface by issuing the command:

    /usr/local/maple/maple2020/bin/maple

You can see various options for the Maple command-line interface here (but you may not need any).

You could also look at the Command-line Maple section of the readme.txt file located in your Maple 2020 folder.

I will mention up front that -- since omega[rK] only appears in subterms when it is multiplied by sigma^2 -- you could instead make the simple and direct subs call:

    subs(omega[rK]=tt/sigma^2, Is_square);

You may have already realized that works, directly, for your example.

But you may also wonder why the algsubs attempt did not work, so let's discuss that.

As explained on the algsubs help page, negative powers have to be treated separately. So, the following double call ought to work.

   algsubs(1/(omega[rK]*sigma^2)=1/tt,
        algsubs(omega[rK]*sigma^2=tt, Is_square));

Unfortunately the outer call gets confused by the coincidental presence of sigma in the name L[sigma] in the Is_square expression, and it runs amok.

If you changed the name L[sigma] to L__sigma then that double call would succeed. But you shouldn't need to make such an arbitrary substitution, especially manually.

It is possible to work the double algsubs call more methodically, by replacing the problematic indexed name (actually, here, all names) temporarily. I use freeze for that, with a dummy function call twist to force it.

Is_square := M[dmax]*(sigma^2*omega[rK]^2 + omega[r]^2)
             *L[sigma]/(3*p*omega[r]*omega[rK]*L[mu]^2*sigma^2);

(1/3)*M[dmax]*(sigma^2*omega[rK]^2+omega[r]^2)*L[sigma]/(p*omega[r]*omega[rK]*L[mu]^2*sigma^2)

F := ee -> subsindets(ee,name,u->freeze(__K(u))):

new := eval(thaw(algsubs(F(omega[rK]*sigma^2)=tt,
                 algsubs(F(1/(omega[rK]*sigma^2)=1/tt),F(Is_square)))),
            __K=(u->u));

(1/3)*M[dmax]*L[sigma]*(tt*omega[rK]+omega[r]^2)/(p*omega[r]*L[mu]^2*tt)

Download algsubs_ex.mw

Issue this command, exactly, to see what the current working directory is in Maple:

   currentdir();

Don't pass it any arguments. (The argument should be a forlder name, only passed if you want to change it. It's wrong and invalid to try and pass it the name of a file.)

The result should show you where your data file is being saved.

 

No it is not a different s. It is the same s. That's the problem.

Is you don't need to subsequently substitute for the subscripts the you could use literal subscripts instead. Eg,

   omega__s1    and   omega__s

which prettyprint as subscripted names.

You called it a "user initialization file", ie. your own personal Maple initialization file, unrelated to the location where Linux is installed.

There is not one, by default.

Simply create/edit a file called .mapleinit in your Linux home directory, using your favorite Linux text editor.

It should contain Maple source code.

If you enter initialization into the search bar of Maple's Help system you could see that this is documented. See here, for the online page.

I am taking your description to mean that a can be any algebraic expression not depending on t, and that b can be any algebraic expression depending on t.

If you don't like depends you could change it to has. I don't know how you want to treat the cases where t is used as a dummy variable (of integration, etc).

I'm pretty sure that even if I've overlooked some corner case (or misinterpreted your definition) this could still be fixed up easily.

restart;

F := proc(ee::algebraic, nm::name)
       local s,o;
       if not ee::`*` then return false; end if;
       (s,o) := selectremove(depends,[op(ee)],nm);
       if nops(s)=0 or nops(o)=0 then false;
       else true; end if;
end proc:

F( (a+b)*(t^2+y), t );

true

F( (a+b)*(t^2+y)*t^5, t );

true

F( (t^2+y)*t^5, t );

false

F( (a+b)*c*(t^2+y)*t^5, t );

true

F( 3*t,t );

true

F( a*b*c, t );

false

F( a+b+c, t );

false

 

Download starchk.mw

It would be pretty straightforward to turn that into a type check instead. (I usually go for the easiest or first reasonable predicate I think of, instead of labouring over a slick structured type check that I may not immediately understand when I look at the code again in 3 years.) I don't know how exactly you intend on using it, whether performance is a key concern at huge scale, etc.

[edit] I don't recall seeing patmatch used robustly for a key role in a major project.

Here is another way, without hard-coded writing out of the trig/trigh terms' particular arguments.

You could also add the step to assign the _D names, but it wasn't clear to me that you wanted to.

restart;

sol := W(x) = _C1*(cosh(alpha*x) - sinh(alpha*x))
              + _C2*(cosh(alpha*x) + sinh(alpha*x))
              + _C3*sin(alpha*x) + _C4*cos(alpha*x):

L := [indets(sol,specfunc({sinh,cosh,sin,cos}))[]]:

temp := collect(sol,[sinh,cosh,sin,cos]):

CL := [coeffs(rhs(temp),L)]:

R:=[seq(cat(_D,i)=CL[i], i=1..nops(CL))];

[_D1 = _C1+_C2, _D2 = -_C1+_C2, _D3 = _C3, _D4 = _C4]

subs((rhs=lhs)~(R), temp);

W(x) = _D2*sinh(alpha*x)+_D1*cosh(alpha*x)+_D3*sin(alpha*x)+_D4*cos(alpha*x)

Download subsex.mw

If you don't need R for any other purpose then the last two of those statement could be combined together into this:

    subs(seq(CL[i]=cat(_D,i), i=1..nops(CL)), temp);

[edit] I'll point out that, as I see it, the order of the trig/trigh terms appearing in sol are rather arbitrary since in Maple those are can vary by session and the method of construction. Relying on that particular order of subterms in the sum seems like sloppy programming that might lead to later error, to me. Having said that, I don't see why one could not accept other terse variants such as the following (and it could be made shorter still).

   L := [indets(sol,specfunc({sinh,cosh,sin,cos}))[]]:
   temp := collect(sol,L):
   subs(seq(coeff(rhs(temp),L[i])=cat(_D,i), i=1..nops(L)),temp);

Of course, anyone is free to disagree with my rationale.

The authors of the package have stated steps here:
     https://www-polsys.lip6.fr/~jcf/FGb/FGb/x86_64_linux/index.html

Did you follow those steps?

(By the way, how do you think that relates to the version that is bundled in Maple 2020? Are you look for that site's specific version because of instructions for compatibility with another 3rd party package? It might help more if you described the full background of the query.)

First 119 120 121 122 123 124 125 Last Page 121 of 336