acer

32303 Reputation

29 Badges

19 years, 309 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Your code calls plottools:-arrow, and it passes 0.4 as its fourth argument. That specifies the width of the arrow head, in an absolute scale.

But the scale of your plot is 0 to 900.  On that scale 0.4 is so tiny that you cannot see the arrow head.

Compare what happens if you simply change your call to, say,

   arrow([0, 0], [725, 350], 0.1, 10.0, 0.1, arrow, color = red, legend = "Vector v")

In the (undocumented?) calling sequence you tried, it has removed all characters from the second argument that are present in the first argument.

The "(", the ")", and the "2" are characters present in the first string, and instances of those characters are removed from the second string.

This seems to make sense and -- even though the first argument is not a predicate as in the documentation -- it's acting analogously by testing each character in the second string. The documentation describes this command as acting individually on all the characters in the second string, ie. it's not just looking for one full contiguous match.

Perhaps you wanted the following, instead. The Substitute command replaces the first instance of an exactly matching substring. (SubstituteAll replaces all such full matches.) Below, I replace the matching substring with the empty string.

L1 := "Methionine = (S)-2-amino-4-(methylsulfanyl)-butanoic acid (2.13)";
acid1 := "Methionine = (S)-2-amino-4-(methylsulfanyl)-butanoic acid ";

StringTools:-SubstituteAll(L1, acid1, "");

                 "(2.13)"

# or even this,
StringTools:-Substitute(L1, acid1, "");

                 "(2.13)"

Perhaps you could first run,

    mint -S -q test.txt

and bail out if there was any output.

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."

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