acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Bennyjay You're welcome. We all make mistakes now and then.

By the way, if you're looking for a solution with all values nonnegative,

eqs := {Why, Do, It, Today, When, Its, Due, Tomorrow}:
vars := indets({Why, Do, It, Today, When, Its, Due, Tomorrow},name):
solve(eqs union (vars>=~0));

   {Cl = .8562628337e-2, H = .6579879116e-8, H2PO4 = .9122851784e-3,
    H3PO4 = .7913134254e-9, HPO4 = .8548948565e-2, Na = .2657618944e-1,
    OH = .1519784760e-5, PO4 = .6218631025e-6}

@FDS You are welcome. There's no reason to apologize, and I don't think that is was a basic query. The file is unusual.

@FDS The code that I provided works fine for me, even if the original input file has no filename extension.

As far as I can see, your issue isn't caused by the filename extension (or lack of it). Rather, it's caused by having all the text characters in your input file be separated by null characters, which may confuse some import mechanisms. I show a way to remove them. There are other ways.

(In contrast, your older Question thread had an example in which every character was separated by a space, which is different.)

The initial commands below import the data from the extensionless file, get rid of the null separators, and then write out the remaining content to a new plaintext file which can be imported in usual ways.

For example,

restart;
interface(rtablesize=100):

U:=FileTools:-Binary:-ReadFile("Spiking2011622"):
Q:=Array(remove(type,convert(U,list),0),datatype = integer[1]):
FileTools:-Binary:-WriteFile("Spiking2011622Q.txt",Q):

M:=ImportMatrix("Spiking2011622Q.txt"):

# And now the Matrix may be split by groups of rows,
# at the headers.
L:=[ListTools:-SearchAll("Id",convert(M[..,1],list))];
numelems(L);
All:=[seq(M[L[i]..L[i+1]-1,..],i=1..nops(L)-1)]:
map(numelems,All);
All[5][1..10,..], All[16][1..11,..];
All[5][11..,..], All[16][12..,..];

I have submitted a bug report.

A shorter example that fails the first time, in my Maple 2023.0:

restart;
expr := (x^2)^(1/2)/((x+y)*sqrt(x^2+1)+x^2*(1/2*y^2-1))^2:

simplify(expr);
Error, (in simplify/size/collect_and_recurse) invalid arguments to coeffs

In my Maple 2022.2 (64bit Linux) this example and the OP's worksheet run without error.

@MDD You could create a re-usable procedure (to handle the entries individually, via map, or which itself maps across F).

Such a procedure could accept a list of names, L, so that the sort could be done with plex(op(L)).

Let me know if you'd like the whole thing shown.

@C_R Why do you write it as , "new options" in the context of your example? Your smaller example works in many older versions.

How would you use your suggestion of convert (sincos and/or tan, etc) to handle the OP's original example to get a form as he expected?

@C_R I meant what I wrote in the first snippet, addressing the OP's actual example and literal query about cot(90 - alpha/2).

I wrote only the second snippet because I wasn't sure whether the "-90" was intentional (in radians).

@MANUTTM Why didn't you mention this goal at the beginning?

Why do you keep starting separate Question threads on the same underlying problem?

@MANUTTM I don't know what accuracy you'll be needing, both for the estimated roots as well as following substitution of such solutions into other expressions (or the original equation). You might need to adjust the working precision according to what you later do with the computed roots.

If you substitute values for i into K2 then its values may become very large (positive or negative) if you allow a wide a range for t2. And (as a function of t2) it can be very steep near the root, relative to when t2 is far from the root, which can make the numeric root-finding more difficult. By using a restricted range for t2 the root-finding process can do better.

@ludvigpujsek Sorry, I meant to write unapply, not unassign. Oof.

I'll correct it in my Answer.

@MANUTTM A different range is required for t2.

Download q3m_ac_t2.mw

@mmcdara Yes, and content also has a Help page, which can be directly queried.

The content command has been in Maple for a long time.

The rhs of sort's key option isn't necessarily part of only the sort command. It can be something more general; in this case another command.

It is a shame that the OP's original example is so vague. We cannot know from it even simple aspects such as whether the sign of the coefficient matters.

@mmcdara The key option is explained in the Description section of the sort Help page.

That option was available in Maple 16.02 (released 2012). I don't think of that as "recent". I don't recall when it first appeared.

@dharr From the Options subsection of the Description section of the rtable Help page (emphasis, mine):

"The fill value is only used to fill those elements of the rtable that are unspecified in spite of the indexing function. For instance, the fill value is not used to fill the lower triangle of an upper triangular Matrix. For a sparse rtable, the fill value is always ignored."

First 77 78 79 80 81 82 83 Last Page 79 of 591