C_R

1960 Reputation

19 Badges

5 years, 280 days

MaplePrimes Activity


These are answers submitted by C_R

The Custom Component Template has a section to define ports and it has a section to preview the code. To place ports, (dummy) variables for signals must be defined in the equation list "eq" of the template.

Modelica code with port definitions can be copied after previewing the code.

The latest version of the template allows some customization. There is probably no need to disassemble already existing components.

 

Not the exact desired but shorter
 

restart;

with(LinearAlgebra):

interface(imaginaryunit=j):

Amat := Matrix(2, 2, [[-0.1428571428*K__D, -0.1081971238], [376.9911185, 0]]);

Matrix(2, 2, {(1, 1) = -.1428571428*`#msub(mi("K"),mi("D",fontstyle = "normal"))`, (1, 2) = -.1081971238, (2, 1) = 376.9911185, (2, 2) = 0})

(1)

Eigenvalues(Amat);

Vector[column](%id = 18446744074196840070)

(2)

`~`[`@`(`@`(identify, expand), factor)](Vector(2, {(1) = -0.7142857140e-1*`#msub(mi("K"),mi("D",fontstyle = "normal"))`+0.2000000000e-9*sqrt(0.1275510203e18*`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-0.1019733868e22), (2) = -0.7142857140e-1*`#msub(mi("K"),mi("D",fontstyle = "normal"))`-0.2000000000e-9*sqrt(0.1275510203e18*`#msub(mi("K"),mi("D",fontstyle = "normal"))`^2-0.1019733868e22)}))

Vector[column](%id = 36893489817495032044)

(3)


 

Download Q20230110_m1_short.mw

For both expressions, when plotted separately, smartplot seems to determine the range with the criteria that values become complex. For me it looks like that assumptions are ignored.


 

smartplot(`assuming`([sqrt((1/3)*x*(2-x))], [0 <= x and x <= 1]))

 

`assuming`([smartplot(1-sqrt((-x^2+1)*(1/3)))], [0 <= x and x <= 1])

 

NULL


 

Download smartplot.mw

The main difference in your results comes from the cross section you need to rotate. I have done this in the attached document. Note that the width b is defined in the y-direction and the height in the z-direction (see the help page).  Alternatively, you can also orient the direction of gravity in the z-direction. Below you can see the effect of the elastic coordinates, which "only" contribute to 25% less deflection than expected.  

EC1 is a valuable option if you are interested in fast calculations and resonnant frequencies. In the linear case (small deflections) these are only about half of the 25% higher than expected.

Konzola-_rotated.msim

inserts a new execution group before the cursor.

For pasted text you could try F3 to split the text at the postition of the cursor.

from the menu should also work.

 

Expand the document block (right click where the red cross is then show command) reveals that fsolve was used which stops at the first root encountered.

 

This can have many reasons. To start I would check this

https://faq.maplesoft.com/s/article/Scaling-issues-when-using-high-resolution-monitors-on-a-Windows-machine?language=en_US

Here is a screen shot from my 4k setting (32'' monitor, compatibility settings in the program properties are all default, 150% font scaling in Windows display settings, no special Maple settings).

Do you get the tiny fonts right after starting Maple?

(Display resolution changes during a Maple session could be a cause. E.g. change of monitor).

Hope this helps for a start. If not, you might want to post details of your hardware and operating system settings.

I have noticed an improvement with Windows updates (i.e. i have not seen what you are showing for a while).

For test purposes you could change the display resolution to 2k and check if the font proportions are better.

For the background:

https://www.mapleprimes.com/questions/37691-How-Do-I-Change-The-Background-Colour

Since this one is old and not related to 4K you might want to ask a separate question.

Because there is an infinite number of solutions. Try

solve({sin(x)/x = 0}, AllSolutions = true)

to get the general solution.

For the plot of g, try increasing the number of ploted points with the plot option numpoints.


 

The unit issue is simple to solve once you know it, but less simple to understand (at least it was for me).

I had the same intention to convert a result of the form magnitude_name=value*unit as you.

Cr = (2.532634930*10^(-7))*Unit('F')

Cr = 0.2532634930e-6*Units:-Unit(F)

(1)

This input

convert(Cr = 0.2532634930e-6*Units:-Unit(F), 'units', F, nF)

1000000000*Cr = 253.2634930*Units:-Unit(F)

(2)

converts only the value by the ratio of F/nF=10^9 but leaves the units untouched. This is equivalent to

10^9*(Cr = 0.2532634930e-6*Units[Unit](F))

1000000000*Cr = 253.2634930*Units:-Unit(F)

(3)


If you try instead

convert(Cr = 0.2532634930e-6*Units[Unit](F), 'units', 'nF')

Error, (in convert/units) unable to convert `1` to `nF`

 

Maple throws an error because it can't find on the left hand side a unit to a) compute the ratio to change the value and b) substitute F by nF.
Conversion has to be done piece by piece as you have seen in Tom's answer.

convert(rhs(Cr = 0.2532634930e-6*Units[Unit](F)), 'units', 'nF')

253.2634930*Units:-Unit(nF)

(4)

In other words Maple currently cannot convert a result in the form of an equation.
If you try the context panel (Convert Output Units) on the Output (1) you will get an error. If you try it on

rhs(Cr = 0.2532634930e-6*Units[Unit](F))

0.2532634930e-6*Units:-Unit(F)

(5)

it will work (the right click context menu did not work on my installation 2022.2).

I have already suggested to Maplesoft to make a conversion of such simple equations possible with a simpler command structure and hopefully also with the context panel.

Deriving results in the form of an equation is not uncommon in science and technology.
Good to see that there is annother Maple user who want's to do it.


 

Download Unit_convertion_of_results.mw

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.

restart

 

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)

(1)

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)

(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)

(3)

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

RMS__2 = 2.121320344*Units:-Unit(A)

(4)

NULL

Download UnitProblem_with_eqs.mw

simple_piecewise_integration_with_units.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)

(1)

indets(expr, function);

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

(2)

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}

(3)

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

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

(4)

oth_funct:=(el_funct union all_funct) minus el_funct;

{BesselI, EllipticF, WhittakerW, my_funct}

(5)

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

is(oth_funct = {});

false

(6)

NULL

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)

 

First 7 8 9 10 Page 9 of 10