MaplePrimes Commons General Technical Discussions

The primary forum for technical discussions.

As some of you may have noticed, MaplePrimes was down for a few days, and some customers may have encountered a few problems with our web site, as well.

As you can see, MaplePrimes is up and running again. We are still experiencing a few lingering issues on our main web site, but we expect these will be resolved shortly.

Apologies to those who were inconvenienced by the outage. We appreciate your patience.

After a long chat with ChatGPT I finally received a fully working code for a proc for a generalized Woodbury Identity for the inversion of the sum of two or more positive definite matrices.
I was inspired by a family member who is a trained professional programmer, who told me that in his professional work he uses ChatGTP for an initial draft of his program.  
I did find out that ChatGTP makes errors: from simple ones like writing 'Simplify' instead of 'simplify' to serious conceptual errors, for example in recursive loops. However, ChatGTP seems to 'understand' the error after given specific feedback. Although, this does not mean that the next proposal does not contain the same logical error. But after a long chat I received a nice proc that seems to work. 
My second surprise was that Gemini suggested a formula for the generalized Woodbury lemma that was unknown to me, and I was unable to find on Scholar Google or https://math.stackexchange.com. Based on a special case of that formula, I was able to write the second proc myself. 
In conclusion, to start working it can be helpful to collaborate with AI friend, a little patience may help, AI may not be astute as someone on Mapleprimes wrote, but neither am I. I am now retired, and it is fun to play with Maple and AI. 
By the way, the search term Woodbury did not give a single hit on Mapleprimes.With_a_little_help_from_my_friends.mw
kind regards,Harry 

 

Major deficiency in Physics[Vectors]; Distinct sets of basis vectors are not recognized!

You can't define vectors in alternative bases like: {\hat{i}',\hat{j}',\hat{k}'} or {\hat{i}_{1},\hat{j}_{2},\hat{k}_{3}}.

This deficiency has been around for a while. I have found other posts regarding this problem.

The deficiency greatly reduces the allowable calculations with Physics[Vector].

Are there any plans to fix this?

Here is my example which shows this deficiency in more detail.

physics_vectors_and_multiple_unit_vectors.mw
 

restart

NULL

NULL

with(Physics[Vectors])

[`&x`, `+`, `.`, Assume, ChangeBasis, ChangeCoordinates, CompactDisplay, Component, Curl, DirectionalDiff, Divergence, Gradient, Identify, Laplacian, Nabla, Norm, ParametrizeCurve, ParametrizeSurface, ParametrizeVolume, Setup, Simplify, `^`, diff, int]

(1)

NULL

Crucial Deficiency in Physics[Vectors]

 

NULL

I can only guess the purpose of the Physics[Vectors] package from reviewing it's corresponding help documentation. My interpretation of the documentation leads me to believe that the package is best used for generating vector equation formulas in different coordinate bases of a SINGLE coordinate system.

 

This means one can easily generate position vector expressions such as:

 

r_ = _i*x+_j*y+_k*z

r_ = _i*x+_j*y+_k*z

(1.1)

Cylindrical Position Vector

 

The position vector in a cylindrical basis is given by:

 

r_ = ChangeBasis(rhs(r_ = _i*x+_j*y+_k*z), 2)

r_ = (x*cos(phi)+y*sin(phi))*_rho+(cos(phi)*y-sin(phi)*x)*_phi+z*_k

(1.1.1)

r_ = ChangeBasis(rhs(r_ = _i*x+_j*y+_k*z), 2, alsocomponents)

r_ = _k*z+_rho*rho

(1.1.2)

NULL

NULLNULLNULL

Spherical Position Vector

 

NULL

r_ = ChangeBasis(rhs(r_ = _i*x+_j*y+_k*z), 3)

r_ = (y*sin(phi)*sin(theta)+x*sin(theta)*cos(phi)+z*cos(theta))*_r+(y*sin(phi)*cos(theta)+x*cos(phi)*cos(theta)-z*sin(theta))*_theta+(cos(phi)*y-sin(phi)*x)*_phi

(1.2.1)

r_ = ChangeBasis(rhs(r_ = _i*x+_j*y+_k*z), 3, alsocomponents)

r_ = r*_r

(1.2.2)

NULL

NULL

As is known from the vector analysis of curvilinear coordinate systems the basis vectors can depend on the coordinates in question.

 

In cylindrical, the basis vectors are

 

_rho = ChangeBasis(_rho, 1)

_rho = _i*cos(phi)+sin(phi)*_j

(1.2)

_phi = ChangeBasis(_phi, 1)

_phi = -sin(phi)*_i+cos(phi)*_j

(1.3)

and in spherical, the basis vectors are

 

_r = ChangeBasis(_r, 1)

_r = sin(theta)*cos(phi)*_i+sin(theta)*sin(phi)*_j+cos(theta)*_k

(1.4)

_theta = ChangeBasis(_theta, 1)

_theta = cos(theta)*cos(phi)*_i+cos(theta)*sin(phi)*_j-sin(theta)*_k

(1.5)

_phi = ChangeBasis(_phi, 1)

_phi = -sin(phi)*_i+cos(phi)*_j

(1.6)

NULL

NULL

NULL

Example of this Deficiency using Biot-Savart Law

 

NULL

Biot-Savart law can be used to calculate a magnetic field due to a current carrying wire. The deficiency in question can be observed by explicity constructing the integrand in the Biot-Savart integral defined below.

NULL

NULL

NULL

In electrodynamics, quantum mechanics and applied mathematics, it is common practice to define a position of observation by a vector `#mover(mi("r"),mo("→"))` and a position of the source responsible for generating the field by a vector diff(`#mover(mi("r"),mo("→"))`(x), x).

 

It is just as common to define the difference in these vectors as

 

l_ = r_-(diff(r(x), x))*_

l_ = r_-`r'_`

(1.3.1)

and thus

 

dl_ = dr_-(diff(dr(x), x))*_

dl_ = dr_-`dr'_`

(1.3.2)

as found in the integrand of the Biot-Savart integral.

NULL

It suffices to consider `#mover(mi("l"),mo("→"))` = `#mover(mi("r"),mo("→"))`-`#mover(mi("r'"),mo("→"))` in a cylindrical basis for this argument.

 

The observation position is:

 

`#mover(mi("r"),mo("→"))` = rho*`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`+z*`#mover(mi("k"),mo("∧"))`

NULL

The source position is:

 

diff(`#mover(mi("r"),mo("→"))`(x), x) = (diff(z(x), x))*(diff(`#mover(mi("k"),mo("∧"))`(x), x))+(diff(rho(x), x))*(diff(`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`(x), x))

NULL

`#mover(mi("l"),mo("→"))` = `#mover(mi("r"),mo("→"))`-(diff(`#mover(mi("r"),mo("→"))`(x), x)) and `#mover(mi("r"),mo("→"))`-(diff(`#mover(mi("r"),mo("→"))`(x), x)) = z(x)*`#mover(mi("k"),mo("∧"))`-(diff(z(x), x))*(diff(`#mover(mi("k"),mo("∧"))`(x), x))+rho*`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`-(diff(rho(x), x))*(diff(`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`(x), x))

NULL

The deficiency in question arises because MAPLE cannot define multiple unit vectors in distinct bases such as {`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`, diff(`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`(x), x)} or {`#mscripts(mi("ρ",fontstyle = "normal"),mn("1"),none(),none(),mo("∧"),none(),none())`, `#mscripts(mi("ρ",fontstyle = "normal"),mn("2"),none(),none(),mo("∧"),none(),none())`}.  These pairs of unit vectors arise naturally, as shown above in Biot-Savart law.

NULL

If we look at `#mover(mi("ρ",fontstyle = "normal"),mo("ˆ"))` and  diff(`#mover(mi("ρ",fontstyle = "normal"),mo("ˆ"))`(x), x) generally, they look like:

NULL

`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))` = `#mover(mi("i"),mo("∧"))`*cos(phi)+sin(phi)*`#mover(mi("j"),mo("∧"))`

NULL

diff(`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`(x), x) = (diff(`#mover(mi("i"),mo("∧"))`(x), x))*cos(diff(phi(x), x))+sin(diff(phi(x), x))*(diff(`#mover(mi("j"),mo("∧"))`(x), x))

NULL

If the bases vectors {`#mover(mi("i"),mo("∧"))`, `#mover(mi("j"),mo("∧"))`, `#mover(mi("k"),mo("∧"))`} and {diff(`#mover(mi("i"),mo("∧"))`(x), x), diff(`#mover(mi("j"),mo("∧"))`(x), x), diff(`#mover(mi("k"),mo("∧"))`(x), x)} are Cartesian and are not related related through rotations so that

NULL

"(i)*i' =(|i|)*|i'|*cos(0)=1"``NULL

NULL

"(j)*(j)' =(|j|)*|(j)'|*cos(0)=1"NULL

NULL

"(k)*(k)' =(|k|)*|(k)'|*cos(0)=1 "

NULL

and so,NULL

 

`#mover(mi("i"),mo("ˆ"))` = diff(`#mover(mi("i"),mo("ˆ"))`(x), x)

NULL

`#mover(mi("j"),mo("ˆ"))` = diff(`#mover(mi("j"),mo("ˆ"))`(x), x)

NULL

`#mover(mi("k"),mo("ˆ"))` = diff(`#mover(mi("k"),mo("ˆ"))`(x), x)

NULL

the radial unit vectors in cylindrical are then,

 

`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))` = `#mover(mi("i"),mo("∧"))`*cos(phi)+sin(phi)*`#mover(mi("j"),mo("∧"))`

NULL

diff(`#mover(mi("ρ",fontstyle = "normal"),mo("∧"))`(x), x) = `#mover(mi("i"),mo("∧"))`*cos(diff(phi(x), x))+sin(diff(phi(x), x))*`#mover(mi("j"),mo("∧"))`

NULL

In typical problems, the anglular location of the observation point, φ, is distinct from the angular location of the source, diff(phi(x), x) and so under this condition, `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` <> diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(x), x).

 

Consider the classic problem of the magnetic field due to a circular current carrying wire. Surely, the angular coordinate of one location of the current carrying wire  is different from the angular coordinate  of an observation point hovering above and off-axis on the other side of the current carrying wire. See figure below.

NULL

NULL

NULL

NULL

Therefore,

 

`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))` <> diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(x), x)

NULL

NULL

What happens in MAPLE when you try to define a second distinct unit vector diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(x), x)?

NULL

One can easily find `#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`.

NULL

_rho

_rho

(1.3.3)

NULL

NULLIf you try to define diff(`#mover(mi("&rho;",fontstyle = "normal"),mo("&and;"))`(x), x) ...

 

 

diff(_rho(x), x)

`_rho'`

(1.3.4)

So using a prime doesn't work.

NULL

You could try a numbered subscript...

`_&rho;__2`

_rho__2

(1.3.5)

but that doesn't work.

 

You could try an indexed unit vector...

NULL

_rho[2]

_rho[2]

(1.3.6)

which can be define but is not recognized by Physics[Vectors] since...

 

NULL

ChangeBasis(_rho[2], 1)

Error, (in Physics:-Vectors:-Identify) incorrect indexed use of a unit vector: _rho[2]

 

NULL

And so it's just not possible with the current implementation.

``

``

NULL

NULL


 

Download physics_vectors_and_multiple_unit_vectors.mw

 

 

Maple Transactions has just published the Autumn 2024 issue at mapletransactions.org

From the header:

This Autumn Issue contains a "Puzzles" section, with some recherché questions, which we hope you will find to be fun to think about.  The Borwein integral (not the Borwein integral of XKCD fame, another one) set out in that section is, so far as we know, open: we "know" the value of the integral because how could the identity be true for thousands of digits but yet not be really true? Even if there is no proof.  But, Jon and Peter Borwein had this wonderful paper on Strange Series and High Precision Fraud showing examples of just that kind of trickery.  So, we don't know.  Maybe you will be the one to prove it! (Or prove it false.)

We also have some historical papers (one by a student, discussing the work of his great grandfather), and another paper describing what I think is a fun use of Maple not only to compute integrals (and to compute them very rapidly) but which actually required us to make an improvement to a well-known tool in asymptotic evaluation of integrals, namely Watson's Lemma, just to explain why Maple is so successful here.

Finally, we have an important paper on rational interpolation, which tells you how to deal well with interpolation points that are not so well distributed.

Enjoy the issue, and keep your contributions coming.

This is another attempt to tell about one way to solve the problem of inverse kinematics of a manipulator.  
We have a flat three-link manipulator. Its movement is determined by changing three angles - these are three control parameters. 1. the first link rotates around the black fixed point, 2. the second link rotates around the extreme movable point of the first link, 3. the third link − around the last point of the second link. These movable points are red. (The order of the links is from thick to thin.) The working point is green. For example, we need it to move along a circle. But the manipulator has one extra mobility (degree of freedom), that is, the problem has an infinite number of solutions. We have the ability to remove this extra degree of freedom mathematically. And this can also be done in an infinite number of ways.
Let us give two examples where the same manipulator performs the same movement of the working point in different ways. In one case the last red point moves in a straight line, and in the other case it moves in an ellipse. The result is the same. In the corresponding program texts, the manipulator model is described by a system of nonlinear equations f1, f2, f3, f4, f5 relative to the coordinates of the ends of the links (very easy to understand). The specific additional connection that takes away one degree of freedom is highlighted in blue. Equation of a circle in red color.

1.mw

2.mw


And as an elective. The same circle was obtained using a spatial 3-link manipulator with 5 degrees of freedom. In the last text, blue and red colors perform the same functions as in the previous texts.
3.mw

 

VerifyTools is a package that has been available in Maple for roughly 24 years, but until now it has never been documented, as it was originally intended for internal use only. Documentation for it will be included in the next release of Maple. Here is a preview:

VerifyTools is similar to the TypeTools package. A type is essentially a predicate that a single expression can either satisfy or not. Analogously, a verification is a predicate that applies to a pair of expressions, comparing them. Just as types can be combined to produce compound types, verifications can also be combined to produce compund verifications. New types can be created, retrieved, queried, or deleted using the commands AddType, GetType (or GetTypes), Exists, and RemoveType, respectively. Similarly in the VerifyTools package we can create, retrieve, query or delete verifications using AddVerification, GetVerification (or GetVerifications), Exists, and RemoveVerification.

The package command VerifyTools:-Verify is also available as the top-level Maple command verify which should already be familiar to expert Maple users. Similarly, the command VerifyTools:-IsVerification is also available as a type, that is,

VerifyTools:-IsVerification(ver);

will return the same as

type(ver, 'verification');

The following examples show what can be done with these commands. Note that in each example where the Verify command is used, it is equivalent to the top-level Maple command verify. (Also note that VerifyTools commands shown below will be slightly different compared to the Maple2024 version):

with(VerifyTools):

Suppose we want to create a verification which will checks that the length of a result has not increased compared to the expected result. We can do this using the AddVerification command:

AddVerification(length_not_increased, (a, b) -> evalb(length(a) <= length(b)));

First, we can check the existence of our new verification and get its value:

Exists(length_not_increased);

true

GetVerification(length_not_increased);

proc (a, b) options operator, arrow; evalb(length(a) <= length(b)) end proc

For named verifications, IsVerification is equivalent to Exists (since names are only recognized as verifications if an entry exists for them in the verification database):

IsVerification(length_not_increased);

true

On the other hand, a nontrivial structured verification can be checked with IsVerification,

IsVerification(boolean = length_not_increased);

true

whereas Exists only accepts names:

Exists(boolean = length_not_increased);

Error, invalid input: VerifyTools:-Exists expects its 1st argument, x, to be of type symbol, but received boolean = length_not_increased

The preceding command using Exists is also equivalent to the following type call:

type(boolean = length_not_increased, verification);

true

Now, let's use the new verification:

Verify(x + 1/x, (x^2 + 1)/x, length_not_increased);

true

Verify((x^2 + 1)/x, x + 1/x, length_not_increased);

false

Finally, let's remove the verification:

RemoveVerification(length_not_increased);

Exists(length_not_increased);

false

GetVerification(length_not_increased);

Error, (in VerifyTools:-GetVerification) length_not_increased is not a recognized verification

GetVerifications returns the list of all verifications known to the system:

GetVerifications();

[Array, FAIL, FrobeniusGroupId, Global, Matrix, MultiSet, PermGroup, RootOf, SmallGroupId, Vector, address, after, approx, array, as_list, as_multiset, as_set, attributes, boolean, box, cbox, curve, curves, dataframe, dataseries, default, default, dummyvariable, equal, evala, evalc, expand, false, float, function, function_bounds, function_curve, function_shells, greater_equal, greater_than, in_convex_polygon, indef_int, interval, less_equal, less_than, list, listlist, matrix, member, multiset, neighborhood, neighbourhood, normal, permute_elements, plot, plot3d, plot_distance, plotthing_compile_result, polynom, procedure, ptbox, range, rational, record, relation, reverse, rifset, rifsimp, rtable, set, sign, simplify, sublist, `subset`, subtype, superlist, superset, supertype, symbol, table, table_indices, testeq, text, true, truefalse, type, undefined, units, vector, verifyfunc, wildcard, xmltree, xvm]

Download VerificationTools_blogpost.mw

Austin Roche
Software Architect
Mathematical Software
Maplesoft

We are pleased to announce that the registration for the Maple Conference 2024 is now open.

Like the last few years, this year’s conference will be a free virtual event. Please visit the conference page for more information on how to register.

This year we are offering a number of new sessions, including more product training options and an Audience Choice session.
You can find an overview of the program on the Sessions page. Those who register before September 10th, 2024 will have a chance to vote for the topics they want to learn more about during the Audience Choice session.

We hope to see you there!

This is a reminder that presentation applications for the Maple Conference are due July 17, 2024.

The conference is a a free virtual event and will be held on October 24 and 25, 2024.

We are inviting submissions of presentation proposals on a range of topics related to Maple, including Maple in education, algorithms and software, and applications. We also encourage submission of proposals related to Maple Learn. You can find more information about the themes of the conference and how to submit a presentation proposal at the Call for Participation page.

I encourage all of you here in the Maple Primes community to consider joining us for this event, whether as a presenter or an attendee!

Kaska Kowalska
Contributed Program Co-Chair

 

The Proceedings of the Maple Conference 2023 is now out, at

mapletransactions.org

The presentations these are based on (and more) can be found at https://www.maplesoft.com/mapleconference/2023/full-program.aspx#schedule .

There are several math research papers using Maple, an application paper by an undergraduate student, an engineering application paper, and an interesting geometry teaching paper.

Please have a look, and don't forget to register for the Maple Conference 2024.

We are happy to announce another Maple Conference to be held October 24 and 25, 2024!

It will be a free virtual event again this year, and it will be an excellent opportunity to meet other members of the Maple community and get the latest news about our products. More importantly, it's a chance for you to share the work you've been doing with Maple and Maple Learn. 

We have just opened the Call for Participation. We are inviting submissions of presentation proposals on a range of topics related to Maple, including Maple in education, algorithms and software, and applications. We also encourage submission of proposals related to Maple Learn. 

You can find more information about the themes of the conference and how to submit a presentation proposal at the Call for Participation page. Applications are due July 17, 2024.

Presenters will have the option to submit papers and articles to a special Maple Conference issue of the Maple Transactions journal after the conference.

Registration for attending the conference will open in July.  Watch for further announcements in the coming weeks.

I encourage all of you here in the Maple Primes community to consider joining us for this event, whether as a presenter or an attendee!

Kaska Kowalska
Contributed Program Co-Chair

A blue triangle with white text

Description automatically generated

 

Attention Maple enthusiasts! It gives me great pleasure to announce Maple 2024! Maple 2024 brings together a collection of new features and enhancements carefully designed to enrich your mathematical explorations. Maple 2024 is the result of a lot of hard work by a lot of people, and there is far more in it than I can cover here. But I’d like to share with you some of my favorite features in this release.

 

AI Formula Assistant

The AI Formula Assistant in Maple 2024 is undoubtedly the feature that excites me the most, especially considering how often I’m asked the question: 'When will Maple include AI features?' This assistant serves as your new mathematical companion and will change the way you look up and enter formulas and equations. Driven by advanced AI technology, it presents a range of relevant options based on your search query. Alongside suggestions, you'll also receive detailed explanations for each formula and its parameters so you can select the one you need, and then you can insert the formula into your document at a click of a button, as a proper Maple expression.

A screenshot of a computer

Description automatically generated

 

 

NaturalLanguage Package

The Formula Assistant is built on top of the new NaturalLanguage package, which integrates powerful language models like GPT-4 and ChatGPT from OpenAI into Maple. With this feature, you can leverage large language models to process natural language within Maple. Ask the AI to explain concepts, provide additional details, find specific Maple commands, and more. Of course, since this is a Maple package, you can also use it as a basis to build your own AI-powered applications inside Maple. We’re really looking forward to seeing what you will do with it!

 

A close-up of a document

Description automatically generated

 

 

Argument Completion
We’ve had a lot of requests from people who wanted Maple’s command completion features to do even more, and I’m happy to say that Maple 2024 delivers. The new argument completion feature in Maple 2024 is poised to significantly enhance your experience with commands. For many users, including myself, not being aware of all the options a command takes is a challenge, often leading me to refer to help pages for clarification. With argument completion, that's no longer a concern. Just enter the command with the help of the existing command completion feature, then automatic argument completion takes over to guide you through the rest. Give it a try with the 'plot' command!

A screenshot of a computer

Description automatically generated

 

Check My Work

A personal favorite feature that's gotten even better in Maple 2024 is Check My Work. As someone who has tutored students, I vividly recall their stress before exams, often receiving emails and text messages from them seeking last-minute help. At the time, I found myself wishing the students had a way to check their work themselves, so we would all be less stressed! So I was super excited when we added the first Check My Work feature a couple of years ago, and am very happy that it gets better ever year. In Maple 2024, we’ve expanded its capabilities to support problems involving factoring, simplification, and limits.

A screenshot of a computer

Description automatically generated

Scrollable Matrices:
This feature will definitely resonate with many of the engineers in the Maple Primes community. If you're someone who works with worksheets containing large matrices, you've likely wished that you could scroll the matrices inside your document instead of having to launch a separate matrix browser. With Maple 2024, your wish has come true.

 

A white sheet with numbers and lines

Description automatically generated with medium confidence

 

Color Bars

And finally, for those of you who appreciated the addition of color bars in Maple 2023 but wanted to see them extended to more 2D and 3D plots, you'll be delighted to know that this is exactly what we’ve done. We’ve also added new customization options, providing you with greater control over appearance.

 

A close-up of a graph

Description automatically generated

 

This is just a partial glimpse of what's new in Maple 2024. For a comprehensive overview, visit What’s New in Maple 2024.

Maple Transactions frequently gets submissions that contain Maple code.  The papers (or videos, or Maple documents, or Jupyter notebooks) that we get are, if the author wants a refereed submission, sent to referees by a fairly usual academic process.  We look for well-written papers on topics of interest to the Maple community.

But we could use some help in reviewing code, for some of the submissions.  Usually the snippets are short, but sometimes the packages involved are more substantial.

If you would be interested in having your name on the list of potential code reviewers, please email me (or Paulina Chin, or Jürgen Gerhard) and we will gratefully add you.  You might not get called on immediately---it depends on what we have in the queue.

Thank you very much, in advance, for sharing your expertise.

Rob

There appears to be a bug with Maple 2023.2 which will remove units from physical constants.

AddConstant(Solar_equatorial_radius, symbol = r[e,Sol], value = 696342., uncertainty = 65., units = km) :

AddConstant(Solar_flattening, symbol = f[Sol], value = 0.000009) :

AddConstant(Solar_polar_radius, symbol = r[p,Sol], derive = -r[e,Sol]*(f[Sol] - 1)) :

AddConstant(Solar_nonradius, symbol = x[Sol], derive = f[Sol]*r[e,Sol]) :

In the example here, "GetUnit(Constant(r[p,Sol]))" will return "1" and "GetUnit(Constant(x[Sol]))" will return "m".

The only workaround is to not save dimensionless quantities as physical constants or otherwise at least some constants derived from a dimensionless constant will also be dimensionless.

Adding "units = 1" to "AddConstant" does not help.

I'm an engineer and when showing results of calculations, some values will display as fractions, and I would prefer that instead floating numbers are displayed.  Also, there is kind of a quirk where if the multiplier of a unit is 1, the result displays as a unit only. I would prefer to see 1*A rather than A.

I wrote this simple proc to convert a value with or without attached unit to a floating point number if it is a fraction or if it has a unit and the coefficient is 1.

Let me know if there is a more elegant way to do this or you have any suggestions or questions.

   unrationalize := proc(x)
        local 
            returnval,
            localcoeff,
            localunit
        ;
        description
            "Converts a fractional number to float",
            "Units are supported"
        ;
        if type(x, fraction) or type(x, with_unit(fraction)) then 
            returnval := evalf(x)
        elif type(x, with_unit(1, 'localcoeff', 'localunit')) then
            returnval :=  evalf(localcoeff)*localunit
        else 
            returnval := x;
        end if;
        return returnval;
    end  proc;
# Testing the proc
list1 := [1/2, 1/2*Unit(('A')/('V')), 1, Unit('A')];
listDescription := ["Fraction", "Fraction with Unit", "Unity", "Unity with Unit"];
for i, myValue in list1 do
    [listDescription[i], "evalf:", evalf(myValue), "unrationalize:", unrationalize(myValue)];
end do;

My friend and colleague Nic Fillion and I are writing another book, this one on perturbation methods using backward error analysis (and Maple).  We have decided to make the supporting materials available by means of Jupyter notebooks with a Maple kernel (there are some Maple worksheets and workbooks already, but going forward we will use Jupyter).

The presentation style is meant to aid reproducibility, and to allow others to solve related problems by changing the scripts as needed.

The first one is up at 

https://github.com/rcorless/Perturbation-Methods-in-Maple

Comments very welcome.  This particular method is a bit advanced in theory (but it's very simple in practice, for weakly nonlinear oscillators).  I haven't coded for efficiency and there may be some improvements possible ("may" he says, sheesh).  Comments on that are also welcome.

-r

1 2 3 4 5 6 7 Last Page 1 of 79