acer

32405 Reputation

29 Badges

19 years, 350 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

If you (correctly) change the
  with(plots)
inside the procedure to instead be
  uses plots;
then you still need to call plots:-display properly outside that procedure.

In the attachment, I call it using its long-form name, plots:-display.

V8_Calculation_of_pH_from_known_values_of_Vb_(Document)_ac.mw

I made some other adjustments. (I changed how the .m file is found, for my own convenience to avoid the Maplet. You can undo that.)
- I added a restart at the start of the Document. A good practice to show check/ensure that the Document runs properly when fully run, to-to-bottom, upon reopening. (We've mentioned this to you before, as a reasonable practice.)
- I moved the definition of the procedure to above (ie. before, under normal execution) the call to it. (We've mentioned this to you before as a reasonable practice.)

note: I think that it would be better programming if your prodecure returned the plot, instead of its declaring A as global. You could make the assignment when calling it. See this additional attachment: V8_Calculation_of_pH_from_known_values_of_Vb_(Document)_ac2.mw

ps. I changed your Question here so it is marked as Product "Maple", but removed the check of the box for Product "Mapleprimes". The Question is about using Maple, and not about using the forum itself.

Try this.

(It could be more efficient.)

restart;

C := proc(A)
  (op@ListTools:-Reverse)~(map(Bits:-Split,
                               convert(A,':-compose',
                                       ':-ByteArray',list)[[4,3,2,1]],
                               ':-bits'=8));
end proc:

f1 := Array([-1.4853515625*2^26], datatype = float[4]):
C(f1);

    [1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0,
     0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

f2 := Array([1.4140625*2^88], datatype = float[4]):
C(f2);

    [0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Your Document calls myProc before it defines myProc as a procedure, going from top to bottom. So if you rerun the whole thing (!!! from the menubar, say) twice that call will work unless you add a restart.

If you add in the restart then the call to myProc will return unevaluated if you are executing from top to bottom.

I suggest that you move the definition of myProc to some place above where you attempt to call it.

Btw, on my Maple 2022.2 the parser does not like the semicolon (statement terminator) that follows immediately after  proc(pA).

You ought to be able to use the context-panel item,

    Solve -> Numerically Solve (w/complex)

on your example. That makes it call fsolve(..., complex) which gets all three roots.

And, if I retype it into a new paragraph/Document-Block then that approach works as it's supposed to.

But for some reason your worksheet's problematic 2D Input line in question only inserts,
      fsolve(...)
which computes just the real roots (the're only 1). That happens even if I choose the appropriate context-panel items I mentioned at top. It also happens if I remove the previous output. I don't know how it got into that weird state.

It works fine without needing rtable_eval or another special command. (In fact Carl's suggestion to wrap with a call to rtable_eval doesn't solve your problem.)

Your mistake is that your eval call is substituting for _t__3 (which will appear subscripted in 2D Input). But the solution Vector actually contains _t[3], which is an indexed name that also pretty-prints as a subscripted name.

subintomatrix_ac.mw

You can enter an indexed name in its subscripted form (in 2D Input) by using the keyboard shortcut  Ctl-Alt-b  . See here for more of such shortcuts.

[edit] the original version of my answer contains a call to indets that shows you one way to extract the indexed name here. You could then use that for your substitution. It also shows that you can use lprint to line-print it and see how it's actually formed.

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

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