acer

32303 Reputation

29 Badges

19 years, 309 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

If your worksheets use only 1D Maple notation then most text-based utilities will be able to find the text fragment, as that is stored in the .mw file as plaintext.

If you use some 2D Input mode then it's more effort, as that needs to be converted to 1D input as a preliminary step to searching. It could still be done programmatically, by first running such .mw files through the command,
   Worksheet:-WorksheetToMapleText

You could call DocumentTools:-Tabulate one or several times to show the intermediate results, and and optionally call it again with a empty list (and options) to make it look blank.

That all happens (and overwrites) the same & single Task region that gets thusly embedded just below the Group or Block's output region.

You could also do the same thing with the lower level DocumentTools commands that Tabulate calls. It's a convenience to be able to use the single command.

For example,

restart;
proc() local i, opts;
  uses TB=DocumentTools:-Tabulate;
  opts:=':-exterior'=':-none':
  for i from 1 to 10 do
    Threads:-Sleep(0.5); # to mimic long computation
    TB([ sprintf("%ld",i) ], opts);
  end do;
  TB(["Yay, we counted to 10"], opts);
  NULL;
end proc();

A variant:

p := proc() local i, opts;
  uses TB=DocumentTools:-Tabulate;
  opts:=':-exterior'=':-none':
  for i from 1 to 10 do
    Threads:-Sleep(0.5); # to mimic long computation
    TB([ sprintf("%ld",i) ], opts);
  end do;
  TB([[]], opts);
  i-1;
end proc:
res := p();

The following attachment is as much as I can recover. It might be close to complete. There were two invalid "Equation" XML elements in the .mw file:
  1) just before the text "(bliver til et vejet gennemsnit) in subsection,
        "Gradienter forsat, Stigningsgrad i andre retninger en y og x"
   2) just before "Sætning 2 om gradienter:" in that same subsection

C_Users_rosho_Desktop_Uni_2._semestre_Matematik_Maple_Noter_mat_1_MAS_ac.mw

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

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