acer

32373 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

If you are using a (deprecated) lowercase matrix then you could try applying evalm or eval to the name, following the read from .m format. A lowercase matrix follows Maple's last name evaluation rules.

I recommend using the capitalized Matrix command instead of the deprecated matrix command, if at all possible. That should work with save&read with .m format, in a way that may be less surprising to you.

Download saveread_matrix.mw

If you are already using the capitalized Matrix command, and are having some other kind of problem, then upload and attach an actual worksheet that reproduces the problem.

The RootOf is a placeholder, an implicit representation of the radical solution(s).

If you want the radical solutions expressed explicitly then you can pass the explicit option to the solve command.

Unrolling the cylinder and applying the Pythagorean theorem, is it, A) 72.6 which is an approximation of,

  5 + sqrt( (2*Pi*10)^2 + (30-5)^2 )

Since a table has last-name-eval behaviour, I don't understand how your line,

   Original["calculations"]["loadcases"]["1"] := loadcase

could be successful after Save/Close/Reopen. It stores & restores the name.

But you want the actual table stored & restored. So why not, instead,

   Original["calculations"]["loadcases"]["1"] := eval(loadcase)

StoreBetweenSessions_ac.mw

Here's one way:

x := omega1*exp(omega1*t1*I) + omega1/exp(omega1*t1*I);

        omega1*exp(I*omega1*t1)+omega1/exp(I*omega1*t1)

evalindets(x, specfunc(exp), u->eval(u,omega1=omega2));

        omega1*exp(I*omega2*t1)+omega1/exp(I*omega2*t1)

subs_spec.mw

One possible alternative is to pass in A & B and have the procedure itself assign to them in the case that the return value is not FAIL.

You could optionally leave A & B alone in the FAIL case, or unassign them if you're into forging your own path.

restart;
interface(warnlevel=4):
kernelopts('assertlevel'=2):

foo:=proc(n, X::evaln,Y::evaln)::{identical(NULL),identical(FAIL)};
      local f := rand(1..1000):
      if n = 0 then
         unassign(X), unassign(Y); # optional, you could leave them unchanged
         return FAIL;
      else
         assign(X,f()); assign(Y,f());
         return NULL;
      fi;
end proc:

ret := foo(13, A, B);

            ret := ()

A,B;

             861, 759

ret := foo(0, A, B);

            ret := FAIL

A, B;

                A, B

ret := foo(17, A, B);

              ret := ()

A,B;

              751, 890

If you are using 2D Input mode then you could do it as,

    tot := tot + z;

From the Compatibility section at the bottom of the Help page for topic assignment:

"Compatibility
Assignments as expressions and operator assignments are currently not supported in 2-D math input in the Standard Interface. They are supported in 1-D math input in the Standard Interface, as well as in all forms of input and output in the Command-line user interface."

@panke In order to extend the library path, you might begin by reading the Help page on `libname`, or the relevent section of the Programming Manual.

The main structural difference between a Worksheet and a Document is that the latter has at least one "Document Block".

A so-called Document can have Document Blocks (structurally a container of Execution Groups, which affects their appearance and behaviour). But a Document can also have traditional/plain Execution Groups on their own, each with the red prompt and red 1D plaintext code or black 2D Input.

If you use the menubar's Edit -> Document Blocks -> Create Document Block you can inject that into a Worksheet, and in such a way turn it into a Document -- which happens to have both Document Block(s) as well as Execution Groups proper.

IIRC there is no GUI easy one-shot facility for turning plain Execution Groups (red prompt) into Document Blocks.

If you use that Edit->... concoction from a plain Execution Group then you can subsequently cut&paste its input in as the newly created Document Block's input. (But I don't think that your can cut&paste both input&output together of such an Execution Group without its simply pasting back again in as a plain Execution Group.)

note: Hopefully you are not confusing Worksheet/Document with 1D/2D input mode. I've guessed that you are not.

note: Since a Document can have both Document Blocks as well as plain (solo) Execution groups, the conversion of Worksheet->Document is not strictly unique. Of course, you may want all plain execution Groups turned into Document Blocks. Such a conversion mechanism could be encoded in a reusable Maple procedure -- but not by me in the next few weeks.

note: I'd agree that the terminology is muddled. I find it better to always (and only) capitalize these words when using them in a Maple technical sense.

Note that the following happens if that target result of yours gets evaluated (without faking it via inert operators or similar):

(10/(3*t + 1250))^(1/3);

                             (1/3)
           (1/3) /    1     \     
         10      |----------|     
                 \3 t + 1250/     

Here are a few alternative approaches. (I could have used assumptions, but since you don't appear to be very concerned about whether the "simplification" is always correct I used the symbolic option.)

Download de_ac.mw

There are several t-values at which abs(u2) tends to infinity with x=0. For example, EllipticK(1/2)/2.

You can fsolve for the six t-values in t=-5..5, for x=0.

The attachment shows how Optimization:-Maximize can be used get some approximate values out, hence to illustrate/hint at that.

It also shows fsolve (and solve, for one exact root) acting on the denominator.

plot_ac.mw

Why would you have thought that? Please explain your thinking.

Take x=Pi/4, and take its sin value.  Now take x=2*Pi+Pi/4, and take its sin value. You should get sqrt(2)/2 or approximately .707 for both.

Now consider how to compute arcsin(sin(2*Pi+Pi/4)).

Do you think that the result ought to be 2*Pi+Pi/4? The arcsin command is just going to recieve sqrt(2)/2 from being passed sin(2*Pi+Pi/4).

Here's the kicker: how do you expect arcsin to know whether the sqrt(2)/2 it receives came from sin(2*Pi+Pi/4) or sin(Pi/4)?

You might review some of the basic concepts of trig functions and their inverses -- paying attention to the restricted ranges of the inverse trig functions.

simplify(arcsin(sin(x))) assuming -Pi/2<=x, x<=Pi/2;

         x

sin(arcsin(x));

         x

There are several ways to correct your use of NLPSolve.

Download 4.6_ac.mw

[edit] Your code numerically computes a minimum of an abs call, at a discrete number of N points. You could also plot the smooth curve of the continuous zero-crossing. (Again, there are several ways; I show three ways in the following attachment, one of them using implicitplot.)  4.6_acc.mw
Here is the overlay of that with your 10-point plot:

Even if I "optimize" the size in stored memory of the plotted 2D polygons, the 3D animation can still be quite a burden on GUI resources.

Download IdeaVolume_ac.mw

By "optimizing" the 2D polygons I mean ensuring that each non-empty-area POLYGONS substructure contains only data for the 4 corner points (and not more, ugh), and that the edges of the polygons arise from its style and not from unnecessary line segments. All the subsindets stuff in the attached worksheet is there to try and keep each frame smaller in memory. And the resolution of the extrusion can (reasonably) be kept smaller for smaller rotation, by having it be a function of the angle.

Hard on the GUI. Perform manual rotation at your own risk; I suggest bumping down the partition and frames numbers, then rotating to taste, then reverting and relying on plot-persistence to retain the orientation.  Programmatically specified orientation in animations is a mess.

@zenterix It should not be "obvious" (your word) to you that the two might produce the same plot, since the inputs are not similar at all.

In the example, plot(i, i=1..5), the first argument is a continuous function of i.

In your second example, plot(l[i], i=1..5), the first argument is a list reference which only produces values at a discrete set of integer values.

There are various ways to infom the plot command to sample the second example's first argument at only a fixed number of positive integer values of the independent variable i. But your second example makes use of no such option. The failure is not the fault of the plot command.

First 56 57 58 59 60 61 62 Last Page 58 of 336