C_R

3577 Reputation

21 Badges

6 years, 96 days

MaplePrimes Activity


These are replies submitted by C_R

@Carl Love 

The suggestion from the third paragraph only works if one is in the possion of a former version with a different purchase code. I use a commerical version where this is the case. I do not know if other licenses come with the same purchase code for different version.

Using a former version comes with the drawback that an error with the lastest version might not manifest. 

@mmcdara 

I found a solution that works with your proc as is

subsindets(expression_with_many_unit_commands, specfunc(anything, Units:-Unit), UnitFactors_1)

I also submitted a software change request concerning the gramms.

Thanks again & Merry Xmas

@TKChang99 

I don't mind at all. Note, I have only focussed on getting most out of the help system (a bit like a modern Robin Curso on an island with a laptop and a solar pannel). I haven't recommended any books or study guides for the simple reason that I've never read one (probably a missed opportunity).

I forgot one important fact to mention: Maple calculates complex. Results are vaild in the complex domain without restrictions. If there is no result returned, assumptions on variables can make a difference. Complex calculaus is beyond normal programming languages and not only in this sense Maple provides more. Maple is more of a mathematical environment that can be used in a variety of ways, as acer has explained.

@mmcdara 

Starting a blank session:

I would say that this is incorrect since ?Units,SI defines mass as kg.

@mmcdara 

Mass is the only base unit with a prefix. Is is probably not taken into account.

However, simplify simplifies to kg

simplify(Unit(N/m))

This is what I would expect but does not fit to the definition you found. Strange indeed.

@mmcdara 

Actually I was hoping for a way without dedicated procedures. Something using subsindets and a type identifier (maybe HasUnit?) in combination with a transformer (performing the core functionality you demonstrated here) using library commands. However, your answer is valuable as always:

Your first attachment provides the core functionality to expand a Unit expression with compound units

Unit('kg'*'m'/'s'^2);
lprint(%);
UnitFactors_1(%);
lprint(%)

but does not work on subexpressions that are products like:

123.456*Unit('kg'*'m'/'s'^2);
lprint(%);
UnitFactors_1(%);
lprint(%)

If it would, it could be mapped over larger expressions. I have added to my original post an example of a larger expression with units that cannot be simplified without beeing able to expand Unit expressions with compound units.

Your second attachment is valuable to determine unit conversion factors (which I called scaling factors in my attachment) in cases where an a priory knowledge is required. Knowing, for the example, that the input to the transfer function is in Volts one gets

This is similar to what I added in my attachment by hand to get a dimensionless expression that can be plotted. Such a decomposition to base units would be a handy addition to the unit packages to help the user to convert Maple output with units into something that can be more easily interpreted. Maples simplify command must use a decomposition like that internally to simplify units.

Thank you for the answer 👍

Why it did not work:

The left hand side in

(seq('L'[q,  q+1] , q=1..2)) := (0 $ 2);

is resolved to a name but not evaluated to a sequence of Matrix elements.

 

@acer 
Thank you for the detailed reply. I tried to print the operators to see if there is any explict declaration of local variables but instead found interesting differences in attachment 2 and 3 of the first answer from you

 

I don't know if this gives a hint why the above call to fsolve did not work as the call to Maximize did.

@acer 

Among all the things I tried I did not put evalf inside the operator definition. Makes sense now.

What I do not understand is the change of variable names y=Y. Why is

F := y->evalf(Int(unapply(op(1,ig),x),rhs(op(2,ig))));

not working (I tried this as well).

I tried also nested operators which I see at last work.

As always, thank you

Update: In older versions of Maple for the search term `if`a help page is returned that explains `if`. 

https://www.mapleprimes.com/questions/237503-Sum-Of-Proper-Divisors-Procedure#comment298929

@acer 

This one is better but requires special definitions which I try to avoid AMAP. It also requires knowledge of Maple language I do not have.

Am I right that "op" in combination with the statement operator ":" is not documented (in newer versions of Maple)?

In Maple parlance, what kind of operator do you define? I can't find anything on inert operators. Is it unary and/or neutral? According to whatype, N is a procedure (without the use of a proc statement for the definition of N).

What makes it hard to understand is the use of the dito operator %, which can be used followed by exactly one of these characters: + - * . / ^ according to ?neutral.

@Preben Alsholm 

Thank you for both informations.
The first is something I have probably overlooked on the functional operator help page. Maybe it is what the last bullet point want's to adress.

The second is very interesting. It looks to me like the if help page has been updated and now `if` is no longer easy to find (for whatever reason). Kind of a regression.

@Preben Alsholm 

I changed for clarity to ifelse and for the fact that `if` is not searchable in Maple 2023 help system. I could not check for versions that old.

I assume that older versions do not issue the warning about local declaration of i (which I could not turn off in the function definition).

but not really better because it is less clear what the code does.

f:= k -> add({seq(ifelse(floor(k/i)=k/i,i,0),i=1..k-1)});
f(945);

The snippet above creates the set of divisors and adds them up. 

If you are more interested in other ways than in sharing consider asking a question. (A moderator can convert your post to a question if you want).

@acer 

Thank you for the workaround. In the meantime I found annother case where I get an emtpy plot. I will make a software change request that Maplesoft can have a closer look (and use pointplot to keep the units).

First 39 40 41 42 43 44 45 Last Page 41 of 70