18245 Reputation

29 Badges

14 years, 243 days

Social Networks and Content at

MaplePrimes Activity

These are replies submitted by acer

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?


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



  [&<, &<=, &=, &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]


  Convex version 1.2.0, Copyright (C) 1999-2016 Matthias Franz
  This package is distributed under the GNU General Public License
  See 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.


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


[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


[469, 93, 203]



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

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

                  x + z

{ 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.


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)



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


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


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




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.

@HuanLuong A brief description of a data collection with "blank cell data" is not an example of a data collection with "blank cell data".

@HuanLuong If you replace each "blank cell data" value with either undefined or Float(undefined) then the plotting command should exclude it from the rendered surface.

I cannot state precisely how to do the replacement programmatically, since you haven't given an example of such a data collection with "blank cell data".

@Grigoriy Yashin Your second example demonstrates how one can get into a muddle by using several unnecessary layers of operators. It makes it less easy to tell how it has gone wrong, with diff being called on names rather than function calls in t. For example, you need to apply wrt t and get x(t) before calling diff and not afterwards.

Also, the intial, short operators like x:=t->x are wrong (and near meaningless).

But your whole second example can be handled simply with no operators at all (at least, not for this task -- and you could always unapply the final result, say with respect to t).

I suggest that you stop using operators in the original way, as it obscures what is going on, and is overly confusing.

By the way, your input contains two names which can appear like `l__2c` but which are not the same. In one of them the "c" seems to be a UTF-8 encoding, perhaps `\321\201`. Anyway, they are not the same name, and I suspect that is an oversight or typo. I have made them the same, below. Of course, if you really intended them to be different then you can change it. The important thing is that all you really need here is expressions.


V__2six := diff(x(t), t)-(l__1*sin(`&theta;__si`(t))-l__2c*sin(`&beta;__si`(t)+`&theta;__si`(t)))*cos(psi(t))*(diff(psi(t), t))-sin(psi(t))*(l__1*cos(`&theta;__si`(t))*(diff(`&theta;__si`(t), t))-l__2c*cos(`&beta;__si`(t)+`&theta;__si`(t))*(diff(`&theta;__si`(t), t)+diff(`&beta;__si`(t), t)))

diff(x(t), t)-(l__1*sin(theta__si(t))-l__2c*sin(beta__si(t)+theta__si(t)))*cos(psi(t))*(diff(psi(t), t))-sin(psi(t))*(l__1*cos(theta__si(t))*(diff(theta__si(t), t))-l__2c*cos(beta__si(t)+theta__si(t))*(diff(theta__si(t), t)+diff(beta__si(t), t)))

V__2siy := -l__1*sin(`&theta;__si`(t))*(diff(`&theta;__si`(t), t))-l__2c*sin(`&beta;__si`(t)+`&theta;__si`(t))*(diff(`&theta;__si`(t), t)+diff(`&beta;__si`(t), t))

-l__1*sin(theta__si(t))*(diff(theta__si(t), t))-l__2c*sin(beta__si(t)+theta__si(t))*(diff(theta__si(t), t)+diff(beta__si(t), t))

V__2siz := diff(z(t), t)+(l__1*sin(`&theta;__si`(t))+l__2c*sin(`&beta;__si`(t)+`&theta;__si`(t)))*sin(psi(t))*(diff(psi(t), t))-cos(psi(t))*(l__1*cos(`&theta;__si`(t))*(diff(`&theta;__si`(t), t))+l__2c*cos(`&beta;__si`(t)+`&theta;__si`(t))*(diff(`&theta;__si`(t), t)+diff(`&beta;__si`(t), t)))

diff(z(t), t)+(l__1*sin(theta__si(t))+l__2c*sin(beta__si(t)+theta__si(t)))*sin(psi(t))*(diff(psi(t), t))-cos(psi(t))*(l__1*cos(theta__si(t))*(diff(theta__si(t), t))+l__2c*cos(beta__si(t)+theta__si(t))*(diff(theta__si(t), t)+diff(beta__si(t), t)))

V__2si := simplify(V__2six^2+V__2siy^2+V__2siz^2, size)

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

indets(%, name)

{l__1, l__2c, t}



If you are interested in rearranging your result with some particular form in mind then I suggest that you also look at the collect command. That command accepts a third parameter which specifies how to treat the resulting coefficient term. For example,
   collect(V__2si, [l__1, l__2c], u -> simplify(u, size));
   collect(V__2si, [diff], u -> simplify(u, size));
   collect(V__2si, [diff(theta__si(t), t), diff(beta__si(t), t)], u -> simplify(u, size));
   collect(V__2si, [diff(x(t), t), diff(z(t), t)], u -> simplify(u, size))

and so on. There are many variations. It wasn't clear to me what form you prefer.

Also, you might prefer to have the output of certain function calls (with respect to t) appear in suppressed form. And you might prefer a prime notation for derivatives. This is only a suggestion. You might find it easier to see the structure of the terms in the output if your document starts with one or both of these commands:
   PDEtools[declare](theta__si(t), beta__si(t), psi(t),x(t),z(t));
   PDEtools[declare](prime = t);


@dharr You can speed that up quite a bit by adding the options method=_d01ajc,epsilon=1e-5 to the Int call assigned to intt.

This is also reasonably quick (turning off adaptive plotting could make it even faster...).

It also includes a dotted asymptote for m=1.4, and you could add such for the other m values, if you please.

ig := 2*sqrt((a^2 + 1)/(x^2 + 1))
         /sqrt((x^2 + 1)*exp(4*m*(arctan(a) - arctan(x))) + (-a^2 - 1)):
Mvals:=[0.8, 1.0, 1.2, 1.3, 1.35, 1.4]:

What is this!? The dummy variable of integration is x, and the range is set by you with the value given for a and infinity.

As given the integral doesn't contain any free variable with respect to which to plot, once evaluated at the given numeric values of the two parameters a and m. As you gave it, the integral has a constant value.

Did you intend for the upper limit of integration to be some free name, instead of infinity as you wrote it? In such a case you could plot for the value of the integral versus that name.

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