acer

32405 Reputation

29 Badges

19 years, 351 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You can get the comparison using Units:-Simple instead of Units:-Standard, although zero meters is still just zero.

restart

with(Units:-Simple)

a := 15*Unit('m')

15*Units:-Unit(m)

b := 13000*Unit('mm')

13000*Units:-Unit(mm)

min(a, b)

13*Units:-Unit(m)

c := 0*Unit('m')

0

min(a, c)

0

NULL

Download UnitsStandardCompare_ac.mw

[edited] I've deleted my answer using the CenterOfMass command, as I overlooked the coordinate system and made an unfortunate choice for the integration bounds (related to the square).

Tom's done it in his own Answer, now.

Let me know if this is close to what you are after (or if it needs adjustment).

restart;

F:=proc(p::polynom(anything,x), n) local d;
  d := degree(p,x);
  if n<=d then
    error "n=%1 is not greater than degree=%2 of polynomial in x",n,d;
  end if;
  Matrix(n-d,n,'scan'=':-band'[0,d],
         [seq([coeff(p,x,i)$(n-d)],i=0..d)]);
end proc:

F(x^4+3*x^3+x^2+2*x+1, 10);

_rtable[18446883698950820438]

F(x^5+11*x^2-3*x, 10);

_rtable[18446883698955243518]

F(x^5+11*x^2-3*x, 5);

Error, (in F) n=5 is not greater than degree=5 of polynomial in x

F(x^5+11*x^2-3*x, 6);

_rtable[18446883698955249894]

F(x^5+11*x^2-3*x, 8);

_rtable[18446883698955250974]

 

Download mat_polycoeff.mw

Perhaps this will help. (I'm not sure whether it is good for your purposes...)

restart

with(XMLTools)

xmltree := XMLElement("database", ["version" = "test"])

_XML_Element(_XML_ElementType("database"), [_XML_Attribute(_XML_AttrName("version"), _XML_AttrValue("test"))], [])

xmlmaterial := XMLElement("materials")

_XML_Element(_XML_ElementType("materials"), [], [])

xmltree := AddChild(xmltree, xmlmaterial, 0)

_XML_Element(_XML_ElementType("database"), [_XML_Attribute(_XML_AttrName("version"), _XML_AttrValue("test"))], [_XML_Element(_XML_ElementType("materials"), [], [])])

 

HasChild(xmltree, XMLElement("materials"))

true

xmldoc := XMLDocument(xmltree); xmldocA := subsindets(xmldoc, function, proc (s) options operator, arrow; setattribute(s, ':-inert') end proc)

_XML_Document(_XML_Element(_XML_ElementType("database"), [_XML_Attribute(_XML_AttrName("version"), _XML_AttrValue("test"))], [_XML_Element(_XML_ElementType("materials"), [], [])]))

 

readxmltree := ParseString(ToString(xmltree)); readxmltreeA := subsindets(readxmltree, function, proc (s) options operator, arrow; setattribute(s, ':-inert') end proc)

_XML_Document(_XML_Element(_XML_ElementType("database"), [_XML_Attribute(_XML_AttrName("version"), _XML_AttrValue("test"))], [_XML_Element(_XML_ElementType("materials"), [], [])]))

NULL

HasChild(xmldocA, XMLElement("materials"))

true

``

FirstChild(xmldocA)

_XML_Element(_XML_ElementType("materials"), [], [])

HasChild(readxmltreeA, XMLElement("materials"))

true

FirstChild(readxmltreeA)

_XML_Element(_XML_ElementType("materials"), [], [])

``

Download HasChild_ac.mw

Here is one way,

restart;

PMSM_v_eq := V__alphabeta(t) = R__s * i__alphabeta(t)
                               + L__s*diff(i__alphabeta(t), t)
                               + diff(lambda__alphabeta(t), t);

V__alphabeta(t) = R__s*i__alphabeta(t)+L__s*(diff(i__alphabeta(t), t))+diff(lambda__alphabeta(t), t)

eq_desired := lambda__alphabeta(t) = int(V__alphabeta(t) - R__s * i__alphabeta(t), t)
                                     - L__s*i__alphabeta(t);

lambda__alphabeta(t) = int(V__alphabeta(t)-R__s*i__alphabeta(t), t)-L__s*i__alphabeta(t)

with(IntegrationTools):

Combine(value(Expand(dsolve(PMSM_v_eq, {lambda__alphabeta(t)}))));

lambda__alphabeta(t) = int(V__alphabeta(t)-R__s*i__alphabeta(t), t)-L__s*i__alphabeta(t)+_C1

evalindets(%,suffixed(_C),()->0);

lambda__alphabeta(t) = int(V__alphabeta(t)-R__s*i__alphabeta(t), t)-L__s*i__alphabeta(t)

 

Download PMSM_eq_ac.mw

[edit] The following is shorter (only because it avoids having to dispel the constant of integration), but it seems slightly odd (to me) to ignore the dsolve command entirely.

IntegrationTools:-Combine(solve(value(map(int,PMSM_v_eq,t)),
                                {lambda__alphabeta(t)})[]);

It's not clear from your question how you want to treat multiple (or nested) solutions coming out of solve, as your only example is simple. I could guess...

sol:={v[1]=t,v[2]=3/2*t,v[3]=v[3]};

{v[1] = t, v[2] = (3/2)*t, v[3] = v[3]}

subsindets(sol,And(`=`,':-satisfies'(s->(lhs=rhs)(s))),()->NULL);

{v[1] = t, v[2] = (3/2)*t}

Download solve_removal.mw

@coopersj The default behaviour of the 2D Input  ||V||  should match the current context's behaviour of Norm(V) , in the case where neither explicitly specifies a particular norm.

Of course, each should always be available -- if provided explicitly -- so as to clarify the situation if the nature of the worksheet's material and content make the context non-obvious. And so they are. I used command-completion on the word "Norm" whilst in 2D Input mode, to select a specified norm from the popup menu.

restart

with(LinearAlgebra)

V := `<,>`(2, 2, 2)

Vector[column](%id = 18446883978238448574)

LinearAlgebra[Norm](V)

2

LinearAlgebra[Norm](V, 2)

2*3^(1/2)

LinearAlgebra[Norm](V, infinity)

2

restart

with(VectorCalculus)

V := `<,>`(2, 2, 2)

Vector(3, {(1) = 2, (2) = 2, (3) = 2})

LinearAlgebra[Norm](V)

2*3^(1/2)

LinearAlgebra[Norm](V, 2)

2*3^(1/2)

LinearAlgebra[Norm](V, infinity)

2

 

Download norm_LAVC.mw

One way to get the results without the x is to change how you call fsolve, ie.,

f := x^2-x+0.25:

fsolve({f=0}, x=0..1);

     {x = 0.5000000000}, {x = 0.5000000000}

[fsolve(f=0, x=0..1)];                          

         [0.5000000000, 0.5000000000]

Your first question about "storing" the results is unclear. If you assign the last result about to S then you can access each root by indexing, eg,

S := [fsolve(f=0, x=0..1)];

          S := [0.5000000000, 0.5000000000]

S[1];

                  0.5000000000

S[2];

                  0.5000000000

Under the location of my Linux installation of Maple 2020.1 there is a file (relative path):
   bin/Maple2020.png

That is a 1-layer 48x48 pixel RGB color space PNG image, at 72x72 ppi and a print size of 16.93x16.93 mm.

You could try scaling that up in size (after making a copy of the original file).

Of course, the final behavior is up to your twm window manager.

The simplest way to switch the orientation roles is to use the parametric calling sequence of the plot command.

plot([y^2, y, y = -3 .. 3],
     color=blue, thickness=3, title="T1.1 x=y^2 [ECE]",
     view=[-5..5, -5..5]);

I don't care so much for the three choices Tom mentioned. The rotate example involves more typing, a little extra computing, generates a temporary plot as collectible garbage, but is otherwise ok. Solving/inverting the expression analytically for all branches is problematic in general. And implicitplot is inefficient (compared to a direct plot).

Try closing the context-panel, by which I mean the right-hand window in which context menu operations appear.

The problem may be the so-called smart-popup operations (a plot, etc) that appear at the top of that right-hand panel.

 

You have `u` as an expression in `y`, but then you call it like u(y) inside diff(u(y),y) as if it were an operator.

That's a mismatch.

Either differentiate like diff(u,y) or make `u` an operator/procedure of one parameter, eg. u:=u->expression_in_y .

But don't change both, or they'll still be mismatched.

Here is one way, a short edit from your code,

restart;

expr := exp(x)^3*sin(x)+3/(exp(x)^n):

subsindets(expr,'exp(anything)^anything',
           f->combine(f,exp,symbolic)):

       exp(3*x)*sin(x)+3/exp(x*n)

By the way, the "problem" was not that the exp call was in the denominator. The difference was the name n as outer power.

expr:=exp(x)^3*sin(x)+3/(exp(x)^3);

(exp(x))^3*sin(x)+3/(exp(x))^3

subsindets(expr,'exp(anything)^anything',f->simplify(f,exp));

exp(3*x)*sin(x)+3*exp(-3*x)

expr:=exp(x)^n*sin(x)+3/(exp(x)^n);

(exp(x))^n*sin(x)+3/(exp(x))^n

subsindets(expr,'exp(anything)^anything',f->simplify(f,exp));

(exp(x))^n*sin(x)+3/(exp(x))^n

subsindets(expr,'exp(anything)^anything',f->combine(f,exp,symbolic));

exp(x*n)*sin(x)+3/exp(x*n)

Download exp_comb.mw

[edit] I am supposing that you know that the identity is not true for all complex values of the parameters. However you might have had the following in mind,

subsindets(expr,'exp(anything)^anything',
           f->combine(f,exp)) assuming x::real;

       exp(x*n)*sin(x)+3/exp(x*n)

The location of the preferences file is platform specific, and you haven't mentioned your platform.

You can set the preference for input mode in the main menu, from item,
   Tools->Options->Display
and toggle the combo-box "Input Display" to "Maple Notation".

You can set the default for new sheets to Worksheet  in the main menu, from item,
   Tools->Options->Interface
and toggle the combo-box "Default format for new worksheets" to "Worksheet".

If you then click the "Apply Globally" button in the preferences popup then it should write out and save those values in the preferences file.


restart

f := 9.765625000*10^(-6)*(-6671.221362*(x^2+2)^5*sqrt(2)*arctan((1/2)*x*sqrt(2))*x-555.9351135*(x^2+2)^6/((1/2)*x^2+1)-10479.13001*(x^2+2)^5*sqrt(2)*x-(374220*(0.297116730e-1*x^9+.269385824*x^7+.99643086*x^5+5.18951288*x^3+4.42867382*x))*x-1111.870227*x^10-12601.19538*x^8-62147.39274*x^6-485504.8775*x^4-828649.1585*x^2-788850.2769)/(x^2+2)^6-(0.1171875000e-3*(-555.9351135*(x^2+2)^6*sqrt(2)*arctan((1/2)*x*sqrt(2))-873.2608343*(x^2+2)^6*sqrt(2)-(374220*(0.29711673e-2*x^10+0.33673228e-1*x^8+.16607181*x^6+1.29737822*x^4+2.21433691*x^2+2.107985348))*x))*x/(x^2+2)^7+(3.484800000*sqrt(2)*(x^2+2)*arctan((1/2)*x*sqrt(2))*x+.8712000000*(x^2+2)^2/((1/2)*x^2+1)+(5.473911040*(x^2+2))*sqrt(2)*x+5.227200000*x^2-22.99200001)/(16*(x^2+2)^2)-(.8712000000*sqrt(2)*(x^2+2)^2*arctan((1/2)*x*sqrt(2))+1.368477760*sqrt(2)*(x^2+2)^2-36*x*(-0.484000000e-1*x^2+.638666667))*x/(4*(x^2+2)^3)

Digits := 15

15

ip := select(type, [solve(f = 0, x)], realcons)

[.654041130071197, -.654041130089551, -6252.01029859155]

[fsolve(numer(f) = 0, x = -10000 .. 1, maxsols = 4)]

[-6252.01031084807, -.654041130089551, .654041130071197]

[fsolve(f = 0, x = -10000 .. 1, maxsols = 4)]

[-6252.01029859155, -.654041130089551, .654041130071197]

plot(numer(f), x = -1 .. 1, size = [400, 200])

plot(numer(f), x = -6500 .. 1, size = [400, 200])

plot(f, x = -1 .. 1, size = [400, 200])

plot(f, x = -7000 .. -5000, size = [400, 200])

 

Download help_fsolve_real_root_acc.mw

First 105 106 107 108 109 110 111 Last Page 107 of 336