acer

29759 Reputation

29 Badges

19 years, 317 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The following approach is not fancy, but hopefully you'll find it understandable.

The basic idea here is to form a list of all the indices of the table, and then pare that down according to whether the corresponding values are NULL.

T := table([1 = NULL, 2 = NULL, 3 = NULL, 4 = NULL, 5 = NULL, 6 = NULL, 7 = 5, 9 = NULL, 8 = NULL, 11 = 4, 10 = NULL, 13 = NULL, 12 = NULL, 15 = 9, 14 = NULL, 18 = NULL, 19 = 8, 16 = 9, 17 = NULL, 22 = 9, 23 = NULL, 20 = NULL, 21 = 8, 27 = NULL, 26 = 8, 25 = 4, 24 = NULL, 31 = NULL, 30 = 9, 29 = NULL, 28 = 9, 36 = NULL, 37 = 9, 38 = 9, 39 = NULL, 32 = 5, 33 = NULL, 34 = NULL, 35 = NULL, 45 = NULL, 44 = NULL, 47 = NULL, 46 = NULL, 41 = 8, 40 = NULL, 43 = NULL, 42 = NULL, 54 = NULL, 55 = NULL, 52 = NULL, 53 = NULL, 50 = NULL, 51 = NULL, 48 = 5, 49 = 9, 60 = 8, 59 = NULL, 58 = 7, 57 = 7, 56 = NULL]):
 

select(i->T[i]<>NULL, [indices(T,nolist)]);

[7, 11, 15, 19, 16, 22, 21, 26, 25, 30, 28, 37, 38, 32, 41, 48, 49, 60, 58, 57]

Download table_lk.mw

ps. There are even fancier ways, including some using newly introduced syntax. But the above should work in most/many old versions.

Please see the attached, which I believe is as much as can be recovered from your original attachment. (This is much more than the GUI itself recovers.)

Assignment2_ac.mw

There may now be four or five removed (invalid) 2D inputs:
1) just after, "We only need to consider the eigenvalues of the matrix A of the modelled system"
2) just before "From A__1 we have the first eigenvalue"
3) Just before, "The roots of the polynomium"
4) Just before, "To find the two eigenvalues we solve"
5) Just before, "The roots of the polynomium"

note: I think you might also have some misspellings, eg. "polynomium" for "polynomial", and "Luaponov" for "Lyaponov".

note: Of course, I will add this example to my previous bug reports of similar, reported problems.

note: There is some evidence that use of the Matrix palette in non-executable 2D Math might be related to the underlying GUI problem.

It looks as if there is no multiplication sign (or space, for implicit multiplication with 2D Input) before the brackets in the terms that look like,

   a(x+I*y)  ,  b(x-I*y) 

In that case those terms would be function calls (of a and b), rather than products.

Similarly the terms that look like bz , az would be just two-letter names, rather than products.

It's difficult to tell for sure because you haven't upload and attached your actual worksheet (green up-arrow in the Mapleprimes editor).

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.

First 24 25 26 27 28 29 30 Last Page 26 of 309