2230 Reputation

19 Badges

4 years, 277 days

MaplePrimes Activity

These are answers submitted by C_R

I have rewritten your worksheet with equations to see what is substituted in the RMS expression. As you can see, value is not effective and convert,unit_free throws the same error you are encountering. This does not look good either.

Attached is a simple example where piecewise integration of constant functions worked well with units. Test wise, instead of constant functions I tried to integrate squared cosine functions and took the square root of it. This is equivalent to your RMS calculation and worked well. So, it is really strange what you are encountering.

I hope my additional observations can give a clue what is going on.  Or you can use my file to start from scratch.



Definition of current functions

eq1 := i__1(t) = piecewise(t < 0.1e-1*Unit('s'), 0*Unit('A'), t >= 0.1e-1*Unit('s'), 3*Unit('A')*cos(2*Pi*t/T))

eq2 := i__2(t) = 3*Unit('A')*cos(2*Pi*t/T)

eq3 := i__3(t) = piecewise(t < 0.1e-1*Unit('s'), 0*Unit('A'), t >= 0.1e-1*Unit('s'), 3*Unit('A')*cos(2*Pi*t/T__3))

param := T = 0.2e-1*Unit('s')

plot(subs(eq1, eq2, param, [i__1(t), i__2(t)]), t = 0 .. .1*Unit('s'), color = [blue, red], legend = [i__1, i__2])


Calculation of RMS values

RMS__1 = sqrt((int(i__1(t)^2, t = 0 .. T))/T)

RMS__1 = ((int(i__1(t)^2, t = 0 .. T))/T)^(1/2)


value(subs(eq1, param, RMS__1 = ((int(i__1(t)^2, t = 0 .. T))/T)^(1/2)))

RMS__1 = 7.071067812*((int(piecewise(t < 0.1e-1*Units:-Unit(s), 0, 0.1e-1*Units:-Unit(s) <= t, 3*Units:-Unit(A)*cos(314.1592654*t/Units:-Unit(s)))^2, t = 0 .. 0.2e-1*Units:-Unit(s)))/Units:-Unit(s))^(1/2)


convert(rhs(RMS__1 = 7.071067812*((int(piecewise(t < 0.1e-1*Units:-Unit(s), 0, 0.1e-1*Units:-Unit(s) <= t, 3*Units:-Unit(A)*cos(314.1592654*t/Units:-Unit(s)))^2, t = 0 .. 0.2e-1*Units:-Unit(s)))/Units:-Unit(s))^(1/2)), units_free)

Error, (in Tools:-IntegrateExpression) units problem, can't make expression piecewise(t < .1e-1*Units:-Unit(s),0,.1e-1*Units:-Unit(s) <= t,3*Units:-Unit(A)*cos(314.1592654*t/Units:-Unit(s)))^2 unit-free with units [t::Units:-Unit(s)]


RMS__2 = sqrt((int(i__2(t)^2, t = 0 .. T))/T)

RMS__2 = ((int(i__2(t)^2, t = 0 .. T))/T)^(1/2)


simplify(subs(eq2, param, RMS__2 = ((int(i__2(t)^2, t = 0 .. T))/T)^(1/2)))

RMS__2 = 2.121320344*Units:-Unit(A)



Download UnitProblem_with_eqs.mw


I missed dharr's answer. Anyway, here is a less specific way that checks for any other function.

expr:=(sin(x)*EllipticF(k, y)/(BesselI(z, l)*arctan(y, x)))^WhittakerW(mu, nu, z) - my_funct(alpha);

(sin(x)*EllipticF(k, y)/(BesselI(z, l)*arctan(y, x)))^WhittakerW(mu, nu, z)-my_funct(alpha)


indets(expr, function);

{BesselI(z, l), arctan(y, x), sin(x), EllipticF(k, y), WhittakerW(mu, nu, z), my_funct(alpha)}


el_funct := {FunctionAdvisor(elementary)[]};

The 26 functions in the "elementary" class are:


{arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, cosh, cot, coth, csc, csch, exp, ln, sec, sech, sin, sinh, tan, tanh}


all_funct := {op(subs({seq(i = op(0, i), i in indets(expr, function))}, indets(expr, function)))};

{BesselI, arctan, sin, EllipticF, WhittakerW, my_funct}


oth_funct:=(el_funct union all_funct) minus el_funct;

{BesselI, EllipticF, WhittakerW, my_funct}


If the set is not empty, there are other than elementary functions in the expression

is(oth_funct = {});




Download check_for_other_than_elementary_functions_1D.mw

Mapleflow allows you to enter Maple commands.

Try the Maple command convert(expr, units, 'N/m^3') on the expression expr with kg/m2s2

For sind:

Try help(Degrees,sind) and open the help page in a worksheet (Crtl O). Then execute the commands to see if sind works.


For RPMs:

Why should the unit be meter per second?

Have you considered using the unwrap option of help(SignalProcessing[Phase])

for your application?

The last statement is the problem. Do not assign a value to wx (which is used in GainQ1). This changes the definition of GainQ1 and thus the output (if you execute the last line again)


I assume that the state equations you posted correspond to the linearization point for the "initial configuration" (see linearization options of the linearisation app of MapleSim).

If you choose a different linearization point (see yellow highlight below), the zeros disappear.

You might find more on the equation export here: help(DynamicSystems[Linearize])

(Update: I could not find a description on the option  "format=all")

If you are interesed in the nonlinear differential equations you can also use the equation extraction app of MapleSim.


If you change the initial conditions of the angular velocity of the revolute joint R_1 to a non zero value you will get accelerating terms in the state equations also for the inital configuration.

So to answer your question: The inital accelation you see in the result window comes from the integration process that uses a linearized model having no "accelerating terms".


Couldn't you use the sampler component to discretize the continuous functions (signals in MapleSim, I assume) and use your working Modellica code?

The general problem I see is that MapleSim does not provide means/components that allow us to see/simulate into the future (e.g. there are no infinite impulse response filters). At which point in time (MapleSim simulation time) do you want to perform the convolution?

What you tried is basically correct. You should have added simply rad to omega1

omega1 := 2*f1*Pi*Unit('rad')

Note that the unit of rad is 1, which is the reason for the inconsistencies in your worksheet

Alternatively, as I would do it, the same without assignemt statement (":="), which requires re-execution of the whole document every time you change parameters.

vel1 = (acc1*arm1)^(1/2)

vel1 = (acc1*arm1)^(1/2)


circ1 = 2*Pi*arm1

circ1 = 2*Pi*arm1


T1 = circ1/vel1

T1 = circ1/vel1


f1 = 1/T1

f1 = 1/T1


omega1 = 2*f1*Pi*Unit('rad')

omega1 = 2*f1*Pi*Units:-Unit(rad)


General solution

subs(f1 = 1/T1, T1 = circ1/vel1, circ1 = 2*Pi*arm1, vel1 = (acc1*arm1)^(1/2), omega1 = 2*f1*Pi*Units:-Unit(rad))

omega1 = (acc1*arm1)^(1/2)*Units:-Unit(rad)/arm1



acc1 = 9.0*Unit('gn'), arm1 = 10.0*Unit('ft')

acc1 = 9.0*Units:-Unit(gn), arm1 = 10.0*Units:-Unit(ft)


subs(acc1 = 9.0*Units:-Unit(gn), arm1 = 10.0*Units:-Unit(ft), omega1 = (acc1*arm1)^(1/2)*Units:-Unit(rad)/arm1)

omega1 = .9486832980*(Units:-Unit(gn)*Units:-Unit(ft))^(1/2)*Units:-Unit(rad)/Units:-Unit(ft)


simplify(omega1 = 5.381137768*Units:-Unit(rad/s))

omega1 = 5.381137768*Units:-Unit(m/(s*m(radius)))


Convert to rad/s (does not work on equations -> complicated command required)

lhs(omega1 = 5.381137768*Units:-Unit(m/(s*m(radius)))) = convert(rhs(omega1 = 5.381137768*Units:-Unit(m/(s*m(radius)))), units, rad/s)

omega1 = 5.381137768*Units:-Unit(rad/s)



Download Conversion_to_rad_per_s.mw

works in Maple 22.

At the first click you get: Waring computation interrupted. At the second click evaluation stops and Maple returns to ready (lower left corner)

If you are using a high resolution screen: Try adjusting the compatibility settings (High dpi) under the properties of maplew.exe (try different settings).

I have done this and Maple In and Output display excellent on a 4K screen (much better than Word and other office applications).

If you are still running a Maple 2020 version: Is the quality as bad? I noticed a difference between the current JDK Java platform and the earlier Java platform.

Note: In high res mode Maple 2022 menus are still a mix of low and high renderings. Changing the display within a session can also degrade the rendering of In and Output

Interesting question and topic!


help(tasks, simulating, advancedSimulationSettings)

I interpreted "plot events" equals 2000 events plotted.

But if you turn on: Solver Diagnostics you will find much more events. (Whatever such events might be?!?)

Zoom into the two plots to find the 40Hz

I would have expected that the "plot without plot events" would match the mean amplitude of the plot "with plot events".

If this your question/assumption: It seems not to be a sampling issue.

If you increase the number of plot point to 20000, plot 2 changes completely.

At this point would inspect the circuit for electronic modeling issues, which is beyond my field of expertise.

On a related topic, I stumbled across this question. You are correct in your assumption. A more realistic IK should alternate between the two solutions. However, with the input variables Tx and Ty, I don't see a simple switching condition as one can guess from the animation.
I would be interested in a better IK as well.


since it seems to work with an ideal opAmp: verify the opAmp parameters and/or set initial conditions of the opAmp

Others have answered your question implicitly by suggesting assumptions. An answer to your title could be: Because Maple does not know where to locate x^2+y^2 in the complex plane. Depending on where it is located the simplified result can differ in sign.
If x and y were imaginary for example, Maple could simplify to something that does not appear equal, such as:

sqrt(1/(x^2+y^2)) = -1/sqrt(x^2+y^2)

(1/(x^2+y^2))^(1/2) = -1/(x^2+y^2)^(1/2)


subs(x = I, y = 2*I)

((1/5)*I)*5^(1/2) = (1/5)*(-5)^(1/2)


is(((1/5)*I)*5^(1/2) = (1/5)*(-5)^(1/2))




In your example simplify with the option symbolic works as well (but assumptions are the safer way, seeQues_Mapleprime_symbolic.mw)

Download root_in_fraction.mw

First 9 10 11 12 Page 11 of 12