acer

32405 Reputation

29 Badges

19 years, 350 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

In your input of the system enter exp(t) instead of the literal keystrokes e^t .

Since you are using 2D Input mode you could also be able type the letters exp and then press the Esc key, to get command completion. The first item in the popup should allow you to get the typeset math instance of exp(t).

See also this page (though I'm not sure you'd get the warning about wrong usage in such an old version).

ps. You don't have to assign to the letter e, and the fewer assignments to short names the cleaner your global namespace will be...

You haven't told u which version of Maple you're using, which can make it tricky.

Is this something like what you're after, getting back a usual (non-DG) representation of the things assigned to w?

restart;

with(DifferentialGeometry):

DGsetup([x1, x2, x3, x4], M):

w := evalDG(dx1*x1+dx2*x3);

_DG([["form", M, 1], [[[1], x1], [[2], x3]]])

M > 

hoo := op(2,Typesetting:-Parse(subsindets(`print/_DG`(op(w)),
                                          specfunc(anything,Typesetting:-mcomplete),
                                          u->op(1,u))));

dx1*x1+dx2*x3

M > 

lprint(eval(hoo,1));

dx1*x1+dx2*x3

M > 

latex(eval(hoo,1));

{\it x1}\,{\it dx1}+{\it x3}\,{\it dx2}

M > 

restart;

with(DifferentialGeometry):

with(JetCalculus):

DGsetup([x1, x2, x3], M);

`frame name: M`

w:=evalDG(x2/x4*dx1-dx2);

_DG([["form", M, 1], [[[1], x2/x4], [[2], -1]]])

M > 

hoo := op(2,Typesetting:-Parse(subsindets(`print/_DG`(op(w)),
                                          specfunc(anything,Typesetting:-mcomplete),
                                          u->op(1,u))));

x2*dx1/x4-dx2

M > 

lprint(eval(hoo,1));

x2*dx1/x4-dx2

M > 

latex(eval(hoo,1));

{\frac {{\it x2}\,{\it dx1}}{{\it x4}}}-{\it dx2}

Download DG_ex.mw

Many of the options of the plot3d command can also be used with other 3D plotting commands such as pointplot3d.

Notice that Help page is also cross-referenced by a link from the See Also sidebar of the Help page for topic pointplot3d. Such See Also links are often useful.

More directly, that Help page for topic pointplot3d explicitly mentions that plot3d,options page being relevant, in its Parameters section.

The lightmodel option provides the programmatic means to specify the choices 1-4 or none that you'd see in the right-click popup menu.

The light option provides the programmatic means to specify a custom lighting (ie. with a similar effect to what the popup shows if you interactively select "User").

You could try,

   YFtpt5 := TtT -> eval(solution(TtT, 0.5), Y);
   plot(YFtpt5, 0.01..10);

But it would be easier to check if you uploaded and attached a worksheet showing your equations. You could use the green up-arrow in the Mapleprimes response editor. (It's not immediately clear how the TtT affects the equations.)

If I understand correctly what you're trying to accomplish, then try adding the Document Property with attribute name Active and attribute value true

Then save the .mw file, then save it to your Help database, etc, as usual.

Then try opening it via that link from another Help page, in the Help window. Hopefully it will open as a Worksheet/Document, rather than as yet another Help page.

For your first query: The exact roots of some cubics may not all be representable in terms of radicals without the imaginary unit being present. That's a math thing, not merely a Maple thing.

For such a representation, floating-point approximation of such roots often results in small imaginary artefacts (eg, 7.6e-10, etc) due to quite usual roundoff error in the float computation.

Representation of such exact real roots in a trig form can avoid the presence of the imaginary unit. Floating-point approximation of those can avoid the small imaginary float artefacts.

restart;

eq1 := x^2 + 2*x - 3;
eq2 := x^3 + 3*x^2 - 4*x - 8;

x^2+2*x-3

x^3+3*x^2-4*x-8

S1 := solve({eq1 = eq2}, explicit);

{x = (1/6)*(44+(132*I)*39^(1/2))^(1/3)+(44/3)/(44+(132*I)*39^(1/2))^(1/3)-2/3}, {x = -(1/12)*(44+(132*I)*39^(1/2))^(1/3)-(22/3)/(44+(132*I)*39^(1/2))^(1/3)-2/3+((1/2)*I)*3^(1/2)*((1/6)*(44+(132*I)*39^(1/2))^(1/3)-(44/3)/(44+(132*I)*39^(1/2))^(1/3))}, {x = -(1/12)*(44+(132*I)*39^(1/2))^(1/3)-(22/3)/(44+(132*I)*39^(1/2))^(1/3)-2/3-((1/2)*I)*3^(1/2)*((1/6)*(44+(132*I)*39^(1/2))^(1/3)-(44/3)/(44+(132*I)*39^(1/2))^(1/3))}

evalf(S1);

{x = 2.068707824-0.4e-9*I}, {x = -3.346462190-0.7660254040e-9*I}, {x = -.722245634+0.9660254040e-9*I}

S2 := evalc([S1]);

[{x = (2/3)*22^(1/2)*cos((1/3)*arctan(3*39^(1/2)))-2/3}, {x = -(1/3)*22^(1/2)*cos((1/3)*arctan(3*39^(1/2)))-2/3-(1/3)*3^(1/2)*22^(1/2)*sin((1/3)*arctan(3*39^(1/2)))}, {x = -(1/3)*22^(1/2)*cos((1/3)*arctan(3*39^(1/2)))-2/3+(1/3)*3^(1/2)*22^(1/2)*sin((1/3)*arctan(3*39^(1/2)))}]

evalf(S2);

[{x = 2.068707823}, {x = -3.346462191}, {x = -.722245633}]

Download cubic_sol.mw

For your second query, for systems (more than one variable) fsolve returns just a single root. Here you can utilize fsolve's avoid option to get additional approximate roots.

There is no Maple language command that would export either a Maple .mw worksheet file or its full XML representation to SVG format.

By the way, your code doesn't actually assign to tb, since you used = the syntax for an equation rather than := a syntax for assignment. But it would not matter, regardless. The return value from Tabulate can only be a brief lookup rtable (of the names of GUI components or Tables), or an XML-like representation of a whole worksheet containing the Table. I know of no programmatic way to export that to SVG.

There is already a command for doing this kind of thing with strings. So all that's needed is simple conversion.

restart;
x := evalf[10^3](Pi):
N := 31^116:

 

NC:=proc(d::nonnegint,x::numeric)
   StringTools:-CountCharacterOccurrences(String(x),String(d));
end proc:

 

NC(3, N);

18

NC(3, x);

103

Download num_dig.mw


note. I you want to compute the number of occurences of all the possible digits then it might be more efficient to use a single call to StringTools:-CharacterFrequencies instead of multiple calls to CountCharacterOccurrences.

[edit: I've replaced my Answer. I mistakenly thought that I'd tried this approach unsuccessfully.]

You can utilize the UseUnit command to inform Maple how you want units of particular dimension (here, electric_potential^2) to be simplified/combined.

restart;

Units:-UseUnit(V^2):

x := 19.073*Unit('m'^4*'kg'^2/('s'^6*'A'^2));

19.073*Units:-Unit(m^4*kg^2/(s^6*A^2))

simplify(x)

19.073*Units:-Unit(V^2)

Download units_elec_pot_sq2.mw

Derived units (eg. N, W, V) are named units formed as a compound multiplication/division of so-called base units. Simplification to powers of non-base units doesn't necessarily happen by default. You can specify such using the UseUnit command.

Here's one way.

restart;

b := exp(-I*varphi)*sin(theta/2)*cos(theta/2) + cos(theta/2)*exp(I*varphi)*sin(theta/2);

exp(-I*varphi)*sin((1/2)*theta)*cos((1/2)*theta)+cos((1/2)*theta)*exp(I*varphi)*sin((1/2)*theta)

simplify(combine(b));

sin(theta)*cos(varphi)

Download trig_simp_ex.mw

Notes:
 - You used lowercase `i` which means nothing special to Maple by default. In Maple the imaginary unit is capital I by default.
 - You mentioned capitalized Cos in the target expression, but in Maple the trig command is lowercase cos.
 - You mentioned Phi in the target expression, but in the original you used varphi.

You mentioned trying unsuccessfully with.
    combine(b,exp) and simplify(b,trig)
But in fact what is adequate (in the right order) are the other way around, ie.,
    combine(...,trig) and simplify(...,exp)
In other words, the following version is also sufficient,

   simplify(combine(b, trig), exp)

There is no command that can directly cause the GUI to alter the column widths of a GUI Table (whether originally embedded by mouse or by command).

During the same execution run -- while control is still in the same Execution Group -- you can issue a second (or more) Tabulate calls and it will replace the earlier instance. (This can sometimes be useful in loops that take a long time, say.) I suspect that is not your situation.

I suspect that you want to finish execution. Then at some arbitrary later time be able to modify the embedded Table programmatically. There is no direct way, because a GUI Table is not itself an Embedded Component with properties manageable by SetProperty, etc.

A rather complicated way to simulate such an effect might be to:
1) Have Tabulate return just the XML.
2) InsertContent of that XML (and retain a copy of it).
2) Programmatically scan that copy and substitute new column
    widths into its code, and retain this running version.
3) Embed the edited copy using the replaceid option to overwrite
    the earlier instance.

This also handles your example,

restart;

with(StringTools):

 

L:="[ (0, 1, 3), (1, 2), (1, 10), (2), (3, 4), (4, 5), (4, 9), (5, 6), (6,9, 7), (7, 8),(8, 9),
(10, 11), (11, 12), (11, 16), (12), (13,9,10, 14), (14, 15), (15, 16)]":

 

CharacterMap("()[]","{}{}",L);

"{ {0, 1, 3}, {1, 2}, {1, 10}, {2}, {3, 4}, {4, 5}, {4, 9}, {5, 6}, {6,9, 7}, {7, 8},{8, 9},
{10, 11}, {11, 12}, {11, 16}, {12}, {13,9,10, 14}, {14, 15}, {15, 16}}"

Download cmap.mw

Another workaround that I see for this problem with the maplet plotdevice is to add the style=line option to the plot command.

That can be done for all 2D plots via the command,
   plots:-setoptions(style=line):
which can be added to the start of a worksheet or an initialization file.

(That does not interfere with the default behavior of plots:-pointplot.)

You might find this less intrusive on your other computations than a workaround such as increasing Digits above 15, or setting UseHardwareFloats to false, etc, which may have broad reaching effects on calculations.

Your first attempt using solve fails because the remaining variables are not free of conditions.

You could think of it like so; solve baulks at returning a solution for T & a if there are remaining conditions on some of the other names involved.

Here are some alternatives to Rouben's natural suggestion to specify {T,a,I__cm} as the second argument to solve.

The first uses eliminate instead of solve, and it reveals a relationship amonsgt the remaining variables. (That happens to be the third equation, which here seems obvious but for other examples might not be so apparent.)

The second uses the parametric option to the solve command. Notice that if m=0 then T=0 and I__cm=0 also. In that case a can be anything, and not just g/2.

You could also specify a subset of the remaining variables as the parameters.

restart;

sys := {I__cm = m*r^2, r*T = I__cm*a/r, g*m - T = m*a};

{I__cm = m*r^2, r*T = I__cm*a/r, g*m-T = m*a}

R := eliminate(sys, {T, a});

[{T = g*m*I__cm/(m*r^2+I__cm), a = g*m*r^2/(m*r^2+I__cm)}, {-m*r^2+I__cm}]

S := solve(R[2], I__cm);

{I__cm = m*r^2}

eval(R[1], S);

{T = (1/2)*g*m, a = (1/2)*g}

solve(sys, {T, a}, parametric = full);

piecewise(r = 0, [], -m*r^2+`#msub(mi("I"),mi("cm"))` = 0, piecewise(m = 0, [{T = 0, a = a}], r = 0, [{T = -a*m+g*m, a = a}], m <> 0 and r <> 0, [{T = (1/2)*g*m, a = (1/2)*g}]), `and`(r <> 0, -m*r^2+`#msub(mi("I"),mi("cm"))` <> 0), [])

solve(sys, {T, a}, parameters = {I__cm}, parametric = full);

piecewise(-m*r^2+`#msub(mi("I"),mi("cm"))` = 0, [{T = (1/2)*g*m, a = (1/2)*g}], -m*r^2+`#msub(mi("I"),mi("cm"))` <> 0, [])

solve(sys, {T, a}, parameters = {m}, parametric = full);

piecewise(-m*r^2+`#msub(mi("I"),mi("cm"))` = 0, piecewise(m = 0, [{T = 0, a = a}], m <> 0, [{T = (1/2)*g*m, a = (1/2)*g}]), -m*r^2+`#msub(mi("I"),mi("cm"))` <> 0, [])

solve(sys, {T, a}, parameters = {r}, parametric = full);

piecewise(r = 0, [], -m*r^2+`#msub(mi("I"),mi("cm"))` = 0, piecewise(r = 0, [{T = -a*m+g*m, a = a}], r <> 0, [{T = (1/2)*g*m, a = (1/2)*g}]), `and`(r <> 0, -m*r^2+`#msub(mi("I"),mi("cm"))` <> 0), [])

Download solveSysac.mw

You were already using k for the index of summation (sum call) that gets computed by f. That k was not being declared local to f. And the index name is not local to the sum call.

Then you try to use k in a wrapping seq call, as the index name. So, when seq invoked f, k takes a numeric value -- and is not free for use as an index name by sum.

You could use a different name (eg. kk) as the index name in that seq call.

Or you could change f from an operator into a procedure with local k.

Or you could change f to use add instead of sum, since in this situation add can safely use its own local instance of the index name.

For example, implementing both the second and third approaches (my preference),

Least-Squares_Fitting_in_Maple_video_ac.mw

I did the above in Maple 2019, since that was the version in which your attachment was last saved.

First 52 53 54 55 56 57 58 Last Page 54 of 336