acer

32333 Reputation

29 Badges

19 years, 326 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The attached worksheet contains code (in its Startup Code Region) which will programatically embed an animation (or a sequence of plots) in a Plot Component along with control buttons.

It also provides an example using an option to automatically play the animation when embedding it.

I created this is Maple 2017.2, but it seems to work also in Maple 2015.2 (but it won't work in Maple 18.02 or older, as is).

embedanim01.mw

[edited] Here's a revision with a few more bells and whistles such `width` and `height` options, suppression of Table borders, scaling/zooming (useful for constrained 3D plots),  and examples with suppression of the button controls.

I removed use of the OrthogonalExpansions package, so someone without that could still run the sheet.

embedanim02.mw

 

I'm not really sure what you are trying to obtain.

But is it something like any of these (inside a plot call)?

labels=["x",typeset(Beta[0]=2.345*10^(-``*9)/Unit(cm^3))]
labels=["x",typeset("y", [2.345*10^(-``*9)/Unit(cm^3)])]
labels=["x",typeset(Beta[0]=2.345*10^(-``*9)*Unit(cm)^(-``*3))]

Does the following call (which assigns to res) get you what you want?

restart;

kernelopts(version);

`Maple 16.01, X86 64 LINUX, May 6 2012, Build ID 744592`

result_of_int := int((-5+3*x)^2/(2*x-1)^(7/2),x):

res := cat("",`latex/print`(result_of_int));

"-1/5\,{\frac {41-80\,x+45\,{x}^{2}}{ \left( 2\,x-1 \right) ^{5/2}}}"

printf("%s", res);

-1/5\,{\frac {41-80\,x+45\,{x}^{2}}{ \left( 2\,x-1 \right) ^{5/2}}}

latex(result_of_int);

-1/5\,{\frac {41-80\,x+45\,{x}^{2}}{ \left( 2\,x-1 \right) ^{5/2}}}

 

Download latex16.mw

 

I have some evidence that the result might be approximately -1.413e14  (obtained in about 6 minutes on a fast machine). I have to rush off, but I'll try and upload details, after a few more checks, hopefully this evening.

There have been many reports over the years from Danish students who have encountered worksheet/document corruption problems. I assembed a list a while back, and added it here.

There appears to be at least two sorts of problem:
1) entire loss of content, with saved .mw file becoming all null characters.
2) chopped XML in the .mw file, where the GUI does an imcomplete job of closing all tags reasonably when re-opening. (This can often be ameliorated by editing with a separate program by an expert, to recover more from the trailing chopped portion.)

I have previously submitted the whole set of links as a bug report. I'll also submit this (and another from a week or so ago).

Mapleprimes seems to see such reports soon after the start each school year, as new students get their assignments.

I don't know whether there is one or more causes. Use of Danish characters seems a likely culprit, but clearly that is difficult for the students to avoid. But I have also noticed that many of the "repairable" chopped worksheets contain several very large images, constructed and edited inplace with the drawing canvas functionality of the GUI. I suspect that those large canvas structures may trip up the GUI when saving. It's unclear.

Here is a suggestion for the Danish students. First, turn off auto-save, but save frequently. Save each time to a new and distinct file name, where I mean distinct from all previously saved instances. Each time you save, double-check that the newly saved document is not corrupted, by doing by Close and then re-Open on it. I realize that this would involve a great deal more effort.

expr:=-((-(1/20)*sqrt(5)-1/20)*cos((1/5)*Pi)-(1/20)*sqrt(2)*sqrt(5-sqrt(5))           
      *sin((1/5)*Pi))*24^(1/5)*5^(3/5)-I*((1/20)*sqrt(2)*sqrt(5-sqrt(5))*cos((1/5)*Pi)
      +(-(1/20)*sqrt(5)-1/20)*sin((1/5)*Pi))*24^(1/5)*5^(3/5):
                       
simplify(abs(simplify(expr)));

                            3/5   1/5
                           5    24
                           ----------
                               5

Having said that, Markiyan's suggestion to convert first to radical does very well here. Several commands will produce the short positive radical result for that even without use of the abs command.

simplify(convert(expr,radical));

                             1/5  3/5
                           24    5
                           ----------
                               5

radnormal(convert(expr,radical));

                             1/5  3/5
                           24    5
                           ----------
                               5

evala(convert(expr,radical));

                             1/5  3/5
                           24    5
                           ----------
                               5

This is slightly awakward, and I wouldn't be surprised if there is a much simpler way, but...
 

restart;

kernelopts(version);

`Maple 14.01, X86 64 LINUX, Oct 15 2010, Build ID 535952`

f[0] := sin:

plot( f[0](x), x=-2..2,
      labels=["x",`#mrow(msub(mn("f"),mn("0")),mfenced(mn("x"))`] );

K:=(expr::uneval)->subs(Typesetting:-mi=Typesetting:-mn,
              Typesetting:-mo=Typesetting:-mn,
              Typesetting:-Typeset(expr)):

plot( f[0](x), x=-2..2,
      labels=[K(x), K(f[0](x))] );

plot( f[0](x), x=-2..2,
      labels=[K(x), K(f[0](x))],
      labelfont=["Times", bold, 11] );

 

 

Download upright.mw

restart;

kernelopts(version);

   Maple 2016.2, X86 64 LINUX, Jan 13 2017, Build ID 1194701

SolveTools:-SemiAlgebraic( {x^2+y^2+z^2 = 3, x+y+z = 3} );

                    [[z = 1, y = 1, x = 1]]

solve( {x^2+y^2+z^2 = 3, x+y+z = 3}, real, parametric, allsolutions );

                    [[z = 1, y = 1, x = 1]]

[edit] As for unloading the RealDomain package, try calling,

unwith(RealDomain);

Note that the RealDomain package also exports things like `^`, so it matters if you constructed expressions before you unloaded the package. You can also force use of the so-called global commands, even when that package is loaded, using the colon-dash syntax. (It can get hard to read, though.)   RDstuff.mw

I've been meaning to put this into a Maple 2017 cloud-package, after clean-up, re-factoring, and adding a Help page.

But attached below is a Document with your example.

The code which does the "degree-polar" stuff in in the Startup Region of the Document.

(I have to make some more adjustments, I see, since while revising to handle units in this "version" of it I've managed to make it lose some float-contagion. That just means that it keeps turning floats into exact rationals when combining the quantities. That's why I use evalf below. You could also use the right-click content-menu item "Approximate" when you want to turn results into float approximations. Earlier versions were here.)

In Maple 2017's GUI itself the units display more nicely.

restart

interface(displayprecision = 5)

with(Phasors)

[`∠`]

Units:-UseUnit(Unit('Omega'))

L := 200*`∠`(Unit('mH'), 90)

_m140617803301152

C := 100*`∠`(Unit('`μF`'), 90)

_m140617802022272

R := 30*`∠`(Unit(Unit('Omega')), 0)

_m140617800529312

U := 230.0*Unit('V')

230.0*Units:-Unit(V)

f := 50*Unit('Hz')

50*Units:-Unit(Hz)

XL := evalf(2*Pi*f*L)

_m140617828414208

XC := simplify(evalf(1/(2*Pi*f*C)))

_m140617817951904

Z := R+XC+XL

_m140617809542272

``


Download degreepolarexample.mw

 

Perhaps one of these two (similar) approaches would work for you.

(Sorry, Mapleprimes doesn't seem to want to inline this attachment).

cross.mw

for i from numelems(arr) to 1 by -1 do
    # do something
end do

Or,

for i from numelems(arr) while i>0 by -1 do
    # do something
end do

There are several variations on these ideas. I've tried to do it so that the calls to plot take the argument DV = -5 .. 5 (ie. expression form, rather than operator form with just the range -5 ..5 ).

Note that I use two-argument eval (aka "evalat"), for example to evaluate the set of equations like {x=1.200, y=3.567} to extract the values 1.200 and 3.567. I consider this better than using a few op calls, or rhs of an indexed entry, etc, because it stands up when you change the variables names to things with a different lexicographic ordering, and it's also more clear what it's doing.

DVplot.mw

ee:=3*d^2+f^2-4*e^2+2*t*d^2-4*t*e^2+2*t*f^2+3*f^2+4*t*d^2;

                         2        2        2        2      2      2
                ee := 6 d  t - 4 e  t + 2 f  t + 3 d  - 4 e  + 4 f

collect(ee,[d,e,f]);

                               2               2              2
                    (6 t + 3) d  + (-4 t - 4) e  + (2 t + 4) f

Most Library commands are not thread-safe and will not function properly under the Threads package.

That includes `int` and `evalf/int`.

If your individual pieces are not too fast to compute then you could consider using the Grid package instead.

The problem may be related to entering Qgr in 2D Input mode, but I have yet to narrow it down.

First 191 192 193 194 195 196 197 Last Page 193 of 336