acer

32385 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

A call to fsolve with multivariate input returns unevaluated if it cannot find a solution. But as a numeric approach it may not be attempting to prove analytically that there is no solution, so the unevaluated return means only that it could not find one. In the general (including the nonpolynomial case) it may be that there is a solution which was not found, and thus it would be wrong for a routine that merely searches to return a result (such as NULL) and convey the impression that there definitely is no solution.

Checking whether the result is of type 'specfunc(anything,fsolve)' is an ok way to ascertain whether a solution was found. But note that if done at the top-level (outside of a procedure) then the assigned result should be wrapped in eval(...,1) as the first argument to type, if you wish to avoid a recomputation. See here for a post about that, and note Joe Riel's comment.

For such a system of polynomials with real, numeric coefficients you might consider using RootFinding:-Isolate if you wish to find all real roots and also to get an empty list in the case that it ascertains that none exist.

acer

If m1 is a Matrix then,

F,C := LinearAlgebra:-Dimensions(m1)

or,

F,C := op(1,m1)

acer

If I've understood you properly,

restart:
with(plots):
animate(plot3d,[sqrt(h),theta=-t..0,h=0..4,coords=cylindrical],t=0..2*Pi,
                orientation=[-63,-24,-51],style=surface,title="");

restart:
with(plots):
display(seq(plot3d(sqrt(h),theta=-t*2*Pi..0,h=0..4,coords=cylindrical),t=0..1,1/25),
        orientation=[-63,-24,-51],style=surface,insequence=true);

acer

Digits set to 4 means that floating-point computations are performed with 4 digits of working precision. It does not mean (either with or without rounding) that results in general will attain 4 correct places.

acer

T := table(["green" = "gruen", "red" = "rot", "blue" = "blau"]):

assigned(T["asdf"]);

                                    false

assigned(T["green"]);

                                    true

acer

If you have assigned your original inert integral of a piecewise to the name K, then you could do,

value(K) assuming continuous:
simplify(%) assuming T2>T1;

acer

Inspired by Rouben's very nice explanation, the result can be demonstrated via computation alone.

(The introduced values assigned to `a` and `bT` are inspired by RR's visual and verbal explanation, yet while not a recipe to solve all similar problems the following does comprise a fully computational result, FWIW.)


restart:

J := Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1);

Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1)

s := solve(op(1,J));

(1/2)*2^(4/5)

# J = J1 + c

J1,c := op(simplify(IntegrationTools:-Split(J,s))):
J = J1 + c;

Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1) = Int(-x+(-x^5+1)^(1/5), x = 0 .. (1/2)*2^(4/5))+Int(x-(-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)

a := Int(s-x,x=0..s):

# J1 = a + b , hence J = a + b + c

b := IntegrationTools:-Combine(J1-a):
J1 = a + b;

Int(-x+(-x^5+1)^(1/5), x = 0 .. (1/2)*2^(4/5)) = Int((1/2)*2^(4/5)-x, x = 0 .. (1/2)*2^(4/5))+(1/2)*(Int(2*(-x^5+1)^(1/5)-2^(4/5), x = 0 .. (1/2)*2^(4/5)))

bT := Int((-x^5+1)^(1/5),x = 1/2*2^(4/5) .. 1);

# Demonstrate that bT = b , hence J = a + bT + c
# This shows that bT = b, though it might also serve
# to obtain bT from b, via a change of variables.

value(combine(bT-student[changevar](x=y^(1/5),

                   (student[changevar](y=(1-x^5),b,y)),x)));

Int((-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)

0

# Transform aT = a , hence J = aT + bT + c

aT := student[changevar](x=y,student[changevar](y=s-x,a,y),x);

Int(x, x = 0 .. (1/2)*2^(4/5))

J = aT + bT + c;
value(combine(%));

Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1) = Int(x, x = 0 .. (1/2)*2^(4/5))+Int((-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)+Int(x-(-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)

int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1) = 1/2

 


Download rr.mw

acer

Using Maple 2015.1 and its Import command, letters can be imported from the STL 3D format.

restart:

#
# One (of many) STL format collections of the English alphabet:
#     http://www.stlfinder.com/model/all-alphabet-letters-a-z
#
basedir:=cat(kernelopts(homedir), "/My Documents/stl/All_Alphabet_Letters_A-Z"):

getletter:=L->Import(cat(basedir, "/Letter_", L, ".stl"),
                     orientation=[-90,0,0],title=""):

letters := [m,a,p,l,e]:

for letter in letters do
  if not assigned(AZ[letter]) then
    AZ[letter]:=getletter(letter);
  end if;
end do:

with(plottools): with(plots):

Rplot:=display(AZ[letters[1]],
               seq(translate(AZ[letters[i]], 40*(i-1)+15, 0, 0),
                   i=2..nops(letters))):

Rplot:=transform((x,y,z)->[z,x,y])(scale(Rplot, 5/6*2*Pi/200, 1/5, 1/20, [0,0,10])):

display(changecoords(Rplot,cylindrical), scaling=constrained, axes=none,
        orientation=[0,90,0], viewpoint=[circleright], frames=50);

acer

The first variant given on your cited link, with the writing on an opaque surface, is demonstrated below.

restart:
with(plots): with(ImageTools):
fn:=cat(kernelopts(homedir),"/mma.bmp"):
p:=display(textplot([0,1,"Mathematica",font=["times","roman",50]]),
           axes=none,scaling=constrained):
plotsetup(bmp,plotoutput=fn);
display(p);
plotsetup(default);
img:=Scale(Read(fn),1..250,1..250):
P3D:=plot3d(1, theta=0..2*Pi, h=0..Pi, image=img, coords=cylindrical,
            view=1.2..1.9, orientation=[0,90,0], axes=none,
            viewpoint=["circleright", frames=30]):
P3D;

Just like a usual animated Maple plot, you can single left-click on the plot, and then from the main menubar you could bump up the frame rate, and toggle loop, and play it.

If a non-rectilinear 3D projection effect is desired then a custom viewpoint formula or (more likely) a sequence of orientations is possible, instead of the simple circleright viewpoint.

acer

If the x and y (ie, the x_i) only appear in that way (as polynomial coefficients, say) then could you not simply evaluate the Matrix at [x_1=1,...x_n=1]?

M:=Matrix([[a*x, -b*y],[c*x^2, -d*y]]);

                                   [a x   -b y]
                                   [          ]
                              M := [   2      ]
                                   [c x   -d y]

eval(M, [x=1,y=1]);

                                   [a  -b]
                                   [     ]
                                   [c  -d]

acer

Use add rather than sum for such finite, definite summation. 

The problem you saw is that V[i] with an unassigned symbolic index i is not allowed for the kind of data structure associated with a DataTable.

For the sum command Maple evaluates the first argument up front, and baulks as V[i]. The add command has special evaluation rules (to delay the evaluation) and so Maple doesn't then evaluate V[i] until i gets a value.

Another way is to use unevaluation single right quotes, to delay the evaluation. Eg,

sum('V[i]', i=1..10);

acer

This works in at least 64bit Linux Maple 2015.0, 18.02, and 17.02,

ee := sin(-(1/6)*Pi+(1/2)*arccos(1/3)):

evala(expand(convert(ee,expln)));      

                                       1/2  1/2
                                      2    3
                                1/2 - ---------
                                          6

acer

Open a new blank Worksheet, and from the main menubar select Format -> Styles...

That should pop up a small window titled "Style Management". In its list box scroll down until you see "Maple Input". Select that. Then press click on the "Modify" button in that popup.

That should raise another popup window titled "Character Style" with an entry box filled in already with "Maple Input", and default "Courier New" grayed out. On the left of this second popup is a button "Color". Press it, and a color choose pops up. Select the bright red square. The press the "OK" button in that second popup, which dismisses it. Then press the "OK" button in the first popup, which dismisses it.

The 1D Maple Notation in execution groups and their prompts should now appear in bright red.

Now you need to make this blank worksheet your new default style. From the menubar select Format -> Manage Style Sets...

In the popup titled "Style Set Management" which appears click on the button "New Style Set". That raises another popup, titled "Choose Styles". In this popup clickon the "Unselect All" button to clear all the check boxes. Scroll down and toggle the check box "Maple Input". Then click on the "OK" button, which should make the file-manager popup appear, to allow you to save the style as a .mw file. Give it a name of your choice, and click on the "Save" button which dismisses the file-manager popup. You should now be back in the "Style Set Management" popup. Ckick the radio-button for "User-defined Style Set", and then click on the button "Browse" and find and choose the file which you previously saved. Then click on the "OK" button to finish.

At this point your new custom style (.mw file) sheet will get used for all new Worksheets, even if you close the whole GUI down and relaunch.

See here.

acer

In Maple 2015 you can programmatically insert a PlotComponent which contains the animation and then also set it playing programmatically.

When it's playing, you can still click on it with the mouse to get the usual menubar controls, so as to stop it, etc.

Here's a command for doing that. It needs at least Maple 2015.0 to execute the procedure.

Note that only one such insertion can be done per execution group.

Both the examples play the animation immediately upon insertion. The second one also loops (ie. replays continuously).

The MapleNet backend for rendering uploaded worksheets seems pretty old, and doesn't show the components. So below I've inserted then by hand into this posting. In the actual worksheet there is a border around each PlotComnent (and the code could be adjusted to repress that, too).

restart:

kernelopts(version);

`Maple 2015.1, X86 64 WINDOWS, May 14 2015, Build ID 1044754`

autoplay := proc( anim, {continuous::truefalse:=false} )
  local P, T;
  uses DocumentTools, DocumentTools:-Layout,
       DocumentTools:-Components;
  P := Plot(':-identity' = "Plot0", anim,
            ':-continuous'=continuous);
  T:=InsertContent(Worksheet(Group(Input(Textfield(P)))),
                   ':-output'=':-table');
  DocumentTools:-SetProperty(T["Plot0"],':-play',true);
  NULL:
end proc:

A := plots:-animate(plot,
                    [sin(a*x)/x^2,x=-Pi/2..Pi/2,
                     view=-30..30,gridlines=false],
                    a=1.0..50.0):

autoplay(A);

autoplay(A, continuous);

 

Download autoplay.mw

I have another, unfinished, fancier version which also has all the buttons to play/pause/etc right beside the PlotComponent. Not sure how much demand there'd be for that...

acer

I don't know whether I accurately transcribed your "solution" given in terms of abbreviated Chebyshev polynomials (which I assign to `OP` below). But here is how it can be converted to rational form, both for your "solution" OP as well as for a better approximation.

I also show the continued fraction form (though I use only the explicit rational polynomial form for the plotting).

restart:

f := cos(x):

fa := numapprox:-chebpade(f, x=0..2, [2,2]);

(HFloat(0.36861925958183306)*T(0, x-1)-HFloat(0.7273082240925188)*T(1, x-1)-HFloat(0.13338631081833283)*T(2, x-1))/(T(0, x-1)+HFloat(0.10915303237358412)*T(1, x-1)+HFloat(0.07088232684241387)*T(2, x-1))

sol := evalf( eval(fa, T='orthopoly[T]') );

(HFloat(1.2293137944926846)-HFloat(0.7273082240925188)*x-HFloat(0.26677262163666565)*(x-1.)^2)/(HFloat(0.819964640784002)+HFloat(0.10915303237358412)*x+HFloat(0.14176465368482774)*(x-1.)^2)

numapprox:-confracform(sol);

-HFloat(1.8817992687356087)-HFloat(3.681482753465016)/(x+HFloat(4.081897985226272)+HFloat(28.466776346835747)/(x-HFloat(5.311938552205301)))

# This OP appears to be what you posted.
OP := (-.221091073962959*T(1, x-1)+.7710737338*T(0, x-1)
       -0.4212446689e-1*T(2, x-1))/
      (0.836360586596837e-1*T(1, x-1)+T(0, x-1)+0.3360079945e-1*T(2, x-1)):

solOP := eval(OP, T='orthopoly[T]' );

(-.221091073962959*x+1.034289275-0.8424893378e-1*(x-1)^2)/(0.836360586596837e-1*x+.8827631418+0.6720159890e-1*(x-1)^2)

numapprox:-confracform(solOP);

-1.253674543-1.729701053/(x+17.66344080+339.4769497/(x-18.41888620))

plot( [cos(x), solOP, sol], x=0..2,
      style=[line,point,point], symbolsize=15,
      symbol=[default, soliddiamond, solidbox],
      adaptive=false, numpoints=20, gridlines=false,
      legend=["cos(x)", "solOP", "sol"] );

 


Download chebpade.mw

acer

First 225 226 227 228 229 230 231 Last Page 227 of 336