acer

32348 Reputation

29 Badges

19 years, 330 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@janhardo You are mixing up diff and D.

For an expression use the diff command. For an operator use the D command. (You accidentally tried to use D on an expression.)

restart;

f3:=x->4*sin(x^3)-x^2;

proc (x) options operator, arrow; 4*sin(x^3)-x^2 end proc

ans1 := D(f3);

proc (x) options operator, arrow; 12*x^2*cos(x^3)-2*x end proc

ans1(2.3);

53.88449890

ans2 := diff(f3(x),x);

12*x^2*cos(x^3)-2*x

eval(ans2, x=2.3);

53.88449890

 

Download set1_task4_comment.mw

Don't use the term function in the Maple context as you did above, as it's ambiguous and will confuse people. Use the term operator or procedure instead, which makes it completely clear that it is in contrast to an expression.

The Diff command provides an inert form of the diff command.

@AHSAN Your use of names is not good. You define lambda as a procedure, and then you define x as a polynomial in the name lambda. That confusion is going to cause you problems.

What is the domain over which you want your new polynomial to approximate your original rational polynomial? It may be difficult to produce such a single polynomial with 15-digit coefficients, that can approximate so closely both the domain -3..3 as well as the tails. (The numapprox package might serve better than just a polynomial fit.)

Why is a piecewise polynomial not adequate for your eventual task? You still have not informed us of where this original came from, or to what exact purposes you need to use the new approximation. Brief words don't help.

You appear to be stuck on the details of how to implement a scheme of your own devising to accomplish a goal that you won't explain. Maybe something other than your scheme could do better.

@AmirHosein Sadeghimanesh I only made one suggestion. The second thing I mentioned is something not to do.

You wrote, "I converted several 'ed variables into atomic variables."

What was the intended purpose of doing that? Was it a mistake?

Is one problem that you didn't keep a copy of the document from before you did that?

Do you intend on continuing to do that? Does that include copy&paste?

@AHSAN You didn't provide most of the details for which I asked.

I have deleted yet another duplicate of this question thread by you. Stop spamming this site with duplicates. Put your followup details here, instead of in a new Question.

@AmirHosein Sadeghimanesh 

Try this instead:

Typesetting:-Typeset(log[10](sigma^2))

I don't recommend the following approach, using uneval quotes -- the evaluation is only delayed, and the effect is undone by inadvertant, subsequent evaluation (which makes it fragile):

plot([[0,0]], labels=[ typeset('log[10](sigma^2)'), "y" ]);
%;

In another thread you mentioned this in relation to solving an ODE (numerically, presumably).

Why would you want a polynomial fit to that? Is it for export to use elsewhere? If a piecewise polynomial interpolant is wanted then you might be better off extracting that from the solution procedures that dsolve/numeric itself can return.

You should explain properly, clearly, and completely what you're trying to do.

(And please stop submitting multiple posts and questions for this query.)

@Lisa6 I downloaded it, followed my instructions above and appended libname with its explicit location in a string, and got the following.

What did you try? Did you use a string with the location you put it on your machine?

restart;

fn := cat(kernelopts(homedir),"/mapleprimes/convex.mla"):
#march(list, fn);

libname:=libname,fn:

with(FAN);

  [&<, &<=, &=, &x, _create, _el, _maximal_list, _new, _print,
   _shift, ambientdim, codim, contains, convert/PCOMPLEX,
   convert/affine, dim, flagf, flagh, fvector, genhpolynomial,
   genhvector, homology, hplanes, hvector, image, iscomplete,
   ispointed, ispolytopal, isquasipolytopal, isregular,
   issimplicial, lines, maximal, minimal, preimage, rays,
   regularpart, regularsubdiv, simplicialsubdiv,
   simplicialsubdiv/subdivide, skeleton, stellarsubdiv, support,
   traverse, traverse2]

with(convex);

  Convex version 1.2.0, Copyright (C) 1999-2016 Matthias Franz
  This package is distributed under the GNU General Public License
  See http://www.math.uwo.ca/~mfranz/convex/ for more information

  [affinehull, ambientdim, arecompatible, barycenter, boundary,
   codim, contains, containsrelint, convhull, corank, corners,
   crosspolytope, cube, cyclicpolytope, delaunay, dim, directsum,
   distance, domain, dotprod, draw, dual, edges, emptypcomplex,
   emptypolyhedron, emptypolytope, facefan, faces, facets, fan,
   flagf, flagh, fullcone, fullpolyhedron, furthestdelaunay,
   fvector, genhpolynomial, genhvector, hilbertbasis, homology,
   hplanes, hspacenos, hspaces, hvector, image, incidencematrix,
   incidentfacets, incidentrays, intersection, isaffine,
   isbounded, iscomplete, iscontained, isempty, isface, isfulldim,
   islinear, ispointed, ispolytopal, isquasipolytopal, isregular,
   issimple, issimplex, issimplicial, issimplicial1, join,
   lensspace, lineality, linearhull, lines, maximal, maximum,
   minimal, minimum, minkowskisum, modz, newtonpolytope,
   normalfan, pcomplex, permutahedron, plotdata, polar, poshull,
   posorthant, pred, preimage, projspace, proximum,
   randompolytope, rank, raynos, rays, readpoly, recession,
   regularpart, regularsubdiv, relint, simplicialsubdiv, skeleton,
   stdsimplex, stellarsubdiv, succ, support, surface, torsion,
   transversalfan, traverse, traverse2, vertexnos, vertices,
   volume, voronoi, wprojspace, writepoly, zerocone, zerofan]

I don't understand why you wait until the third message to provide the link to the file. It's not very helpful.

@Lisa6 I don't understand what you're trying to say.

Is this a duplicate of your earlier question about the 3rd party package?

It's not evident what you actually tried here, with libname. What string did you use? What's in the .mla file? I won't be able to guess those things.

@Anthrazit The Units:-UseUnit facility allows the kernel session to actually generate expressions with the preferred units. Under the hood, this works by utilizing a modification of the SI system.

The units-formatting facility of the GUI allows it to customize the units (of equivalent dimension) in the prettyprinting of the expressions (regardless of which form they actually contain).

So, if you force the units-formatting facility of the GUI to utilize its notion of the SI units then that appears -- visually -- to override the effect of the Units:-UseUnit (or convert(...,units,...) expression contructions.

So you might keep units-formatting off (set to "none"), if utilizing UseUnit. Or you might possibly be able to get the kN/m effect with units-formatting alone. But it might be problematic to have the two mechanisms work together.

 

@Anthrazit I see two problems.

The first is a mistake on your part. You have used just the name mm for the expressions assigned to b amd h. That's not the same as Unit(mm), or what you get from the Units palette. A visual cue is that the plain name mm appears in italics, whereas the units get typeset in upright font.

The second problem rakets to so-called unit-formatting in the Document. Your Document seems to have output unit formatting set to SI as default for the sheet. That overrides the conversions I showed -- the values of the expressions is in terms of the desired kN/m but (rightly or wrongly) the GUI prettyprints it using SI default units. It works fine for me in a new Document or Worksheet, or if I toggle unit-formatting off in an output area of yours. You might choose to avoid such a blanket default for your Document (since individually changing various outputs formatting back again would of course be the tedious effort to avoid).

@Grigoriy Yashin You have not given any clear description of what you mean by "optimize", and without such it is unreasonable to expect a programmatic approach for attaining it. What is your definition?

I cannot tell whether you prefer E1 or E2 below (or the variant Kitonum showed), and why.

restart

M := proc (expr) [length(expr), MmaTranslator:-Mma:-LeafCount(expr), `simplify/size/size`(expr)] end proc

PDEtools[declare](`&theta;__si`(t), `&beta;__si`(t), psi(t), x(t), z(t)); PDEtools[declare](prime = t)

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

V__1six := diff(x(t), t)-l__1c*sin(`&theta;__si`(t))*cos(psi(t))*(diff(psi(t), t))-sin(psi(t))*l__1c*cos(`&theta;__si`(t))*(diff(`&theta;__si`(t), t)); V__1siy := -l__1c*sin(`&theta;__si`(t))*(diff(`&theta;__si`(t), t)); V__1siz := diff(z(t), t)+l__1c*sin(`&theta;__si`(t))*sin(psi(t))*(diff(psi(t), t))-cos(psi(t))*l__1c*cos(`&theta;__si`(t))*(diff(`&theta;__si`(t), t))

diff(z(t), t)+l__1c*sin(theta__si(t))*sin(psi(t))*(diff(psi(t), t))-cos(psi(t))*l__1c*cos(theta__si(t))*(diff(theta__si(t), t))

E1 := simplify(V__1six^2+V__1siy^2+V__1siz^2, size)

(diff(x(t), t)-l__1c*sin(theta__si(t))*cos(psi(t))*(diff(psi(t), t))-sin(psi(t))*l__1c*cos(theta__si(t))*(diff(theta__si(t), t)))^2+l__1c^2*sin(theta__si(t))^2*(diff(theta__si(t), t))^2+(diff(z(t), t)+l__1c*sin(theta__si(t))*sin(psi(t))*(diff(psi(t), t))-cos(psi(t))*l__1c*cos(theta__si(t))*(diff(theta__si(t), t)))^2

M(E1)

[462, 81, 160]

E2 := collect(simplify(V__1six^2+V__1siy^2+V__1siz^2), [diff(`&theta;__si`(t), t), diff(psi(t), t), l__1c], simplify)

(diff(theta__si(t), t))^2*l__1c^2-2*cos(theta__si(t))*l__1c*((diff(z(t), t))*cos(psi(t))+sin(psi(t))*(diff(x(t), t)))*(diff(theta__si(t), t))+sin(theta__si(t))^2*l__1c^2*(diff(psi(t), t))^2+2*sin(theta__si(t))*l__1c*((diff(z(t), t))*sin(psi(t))-cos(psi(t))*(diff(x(t), t)))*(diff(psi(t), t))+(diff(z(t), t))^2+(diff(x(t), t))^2

M(E2)

[469, 93, 203]

``

Download trigon_acc.mw

@Carl Love It's quite possible that I am misunderstanding your definitions.  Is this supposed to be covered by it?

restart;
{ x+z, y+x }[1];

                  x + z

restart;
z+x:
{ x+z, y+x }[1];

                  y + x

@Grigoriy Yashin Maple's trig commands work with radians, so you want Pi rather than 180, and in that case it does the simplification automatically.

As I mentioned before, the collect command can be useful for simplifying rearrangements. In this case it helps to first replace the terms m__1+m__2+m__f with a temporary, then collect, and then resubstitute. I uses the frozen form as the replacement, and resubstitute merely by thawing. Alternatively, you could also do the algsubs with any temp names of your choice. Or you could use subs and substitute only for the literal occurences of m__1+m__2+m__f.

The following shows some possibilities, for collect.

restart

PDEtools[declare](`&theta;__l`(t), `&beta;__l`(t), `&theta;__si`(t), `&beta;__si`(t), psi(t), x(t), z(t)); PDEtools[declare](prime = t)

`derivatives with respect to`*t*`of functions of one variable will now be displayed with '`

U__l := simplify(g*(m__2*(z-(1/2)*l__b*sin(psi(t))-l__1*sin(`&theta;__l`(t)+psi(t))-l__2c*sin(Pi-`&beta;__l`(t)-`&theta;__l`(t)-psi(t)))+m__f*(z-(1/2)*l__b*sin(psi(t))-l__1*sin(`&theta;__l`(t)+psi(t))-l__2*sin(Pi-`&beta;__l`(t)-`&theta;__l`(t)-psi(t))-l__fc*sin(Pi-`&beta;__l`(t)-`&theta;__l`(t)-psi(t))^H)+m__1*(z-(1/2)*l__b*sin(psi(t))-l__1c*sin(`&theta;__l`(t)+psi(t))))+(1/2)*k__1*`&Delta;x__kl`^2+(1/2)*k__2*`&Delta;x__fl`^2, trig)

-g*m__f*l__fc*sin(beta__l(t)+theta__l(t)+psi(t))^H-g*(l__2*m__f+l__2c*m__2)*sin(beta__l(t)+theta__l(t)+psi(t))-g*(l__1*m__2+l__1*m__f+l__1c*m__1)*sin(theta__l(t)+psi(t))-(1/2)*g*l__b*(m__1+m__2+m__f)*sin(psi(t))+z*(m__1+m__2+m__f)*g+(1/2)*k__2*`&Delta;x__fl`^2+(1/2)*k__1*`&Delta;x__kl`^2

NULL

thaw(collect(algsubs(m__2+m__f = freeze(m__2+m__f), algsubs(m__1+m__2+m__f = freeze(m__1+m__2+m__f), U__l)), [freeze(m__1+m__2+m__f), freeze(m__2+m__f), m__1, m__2, m__f, g], simplify))

(-sin(theta__l(t)+psi(t))*l__1c-(1/2)*l__b*sin(psi(t))+z)*g*(m__1+m__2+m__f)+(-sin(beta__l(t)+theta__l(t)+psi(t))*l__2c-sin(theta__l(t)+psi(t))*(l__1-l__1c))*g*(m__2+m__f)+(-sin(beta__l(t)+theta__l(t)+psi(t))*(l__2-l__2c)-l__fc*sin(beta__l(t)+theta__l(t)+psi(t))^H)*g*m__f+(1/2)*k__2*`&Delta;x__fl`^2+(1/2)*k__1*`&Delta;x__kl`^2

thaw(collect(algsubs(m__2+m__f = freeze(m__2+m__f), algsubs(m__1+m__2+m__f = freeze(m__1+m__2+m__f), U__l)), [g, freeze(m__1+m__2+m__f), freeze(m__2+m__f), m__1, m__2, m__f], simplify))

((-sin(theta__l(t)+psi(t))*l__1c-(1/2)*l__b*sin(psi(t))+z)*(m__1+m__2+m__f)+(-sin(beta__l(t)+theta__l(t)+psi(t))*l__2c-sin(theta__l(t)+psi(t))*(l__1-l__1c))*(m__2+m__f)+(-sin(beta__l(t)+theta__l(t)+psi(t))*(l__2-l__2c)-l__fc*sin(beta__l(t)+theta__l(t)+psi(t))^H)*m__f)*g+(1/2)*k__2*`&Delta;x__fl`^2+(1/2)*k__1*`&Delta;x__kl`^2

thaw(collect(subs(m__1+m__2+m__f = freeze(m__1+m__2+m__f), U__l), [g, freeze(m__1+m__2+m__f)], simplify))

((-(1/2)*l__b*sin(psi(t))+z)*(m__1+m__2+m__f)-m__f*l__fc*sin(beta__l(t)+theta__l(t)+psi(t))^H+(-l__2*m__f-l__2c*m__2)*sin(beta__l(t)+theta__l(t)+psi(t))-(l__1*m__2+l__1*m__f+l__1c*m__1)*sin(theta__l(t)+psi(t)))*g+(1/2)*k__2*`&Delta;x__fl`^2+(1/2)*k__1*`&Delta;x__kl`^2

``

Download PotenEnergy_accc.mw

That last result is relatively quite compact, though of course it depends on the metric for measuring size of an expression.

Please stop(!) posting duplicates of this query.

You may need to install all of the subpackage -- and perhaps even most or all of the parent package -- to get full functionality of the command in question.

You should start off by sending an inquiry to the authors of this 3rd party package.

First 177 178 179 180 181 182 183 Last Page 179 of 592