acer

32617 Reputation

29 Badges

20 years, 42 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The extra red chevrons (extra prompts), within a single execution-group, do not affect the parsed meaning, AFAIK.

 

 

Do mean you want something like this?

restart:
f := x->sqrt(2*x-1):                                           

ee := (f(x+h)-f(x))/h:                                         

radnormal(1/rationalize(1/ee));

                           2
           ---------------------------------
                    1/2                  1/2
            (2 x - 1)    + (2 x + 2 h - 1)

For this example the outermost operation in the last line above might also be normal instead of radnormal.

add( `if`(`mod`(10,n)=0,a(n),0), n=1..10 );

            a(1) + a(2) + a(5) + a(10)

If you know the identity of the Code-Edit-Region then you should be able to use the SetProperty command from the DocumentTools package.  Eg,

DocumentTools:-SetProperty("CodeEditRegion0",visible,true);

If you don't know its identity then you could example the .mw file as plaintext, or get back to us and a procedure to return candidate strings could be constructed (it'd take me a bit to write it...).

For your example,

restart;

kernelopts(version);

    Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750

Student:-Calculus1:-Roots( 4^x+1 = x^4, x = -10 .. 10, numeric );

            [-1.053567011, 2.094012853, 3.989728952]

remove(type,[solve( 4^x+1 = x^4.0, x )],nonreal);
Warning, solutions may have been lost

            [-1.053567011, 2.094012853, 3.989728952]

sol := solve(4^x+1 = x^4, x):
remove(is,evalf([allvalues(sol)]),nonreal);
Warning, solutions may have been lost

            [-1.053567011, 2.094012853, 3.989728952]

[RealDomain:-solve( 4^x+1 = x^4.0, x )];

            [-1.053567011, 2.094012853, 3.989728952]

Try using the ImageTools:-Scale command to scale down the number of columns.

Make the Matrix datatype=float[8]. Much better for memory performance would be to make the 50x500000 Matrix with the float[8] datatype when first created. Less great, if numeric Matrix M is datatype=anything, would be to create the copy Matrix(M,datatype=float[8]) .

Eg,

restart;

n:=50000:

M:=Matrix(50,n,(i,j)->evalhf(sin(j*5*Pi/n)),datatype=float[8]):

ImageTools:-Scale(M, 1..500, 1..500);

ImageTools:-Scale(M, 1, 1..500);

In the top right of your web browser window your handle/name should appear. It's a link to your profile page.

Your profile contains a section containing all your posted Question/Answers/Replies.

Here is a link to all the Questions you've asked on this site.

I was only able to reproduce your 2D Input problem if I entered the Unit(s) appearing in that denominator by using the Units palette.

But if I used 2D command-completion then it worked ok. When you have the input cursor in that denominator then instead of using the s from the Units palette then instead type it in as follows. First type in Unit and then hit the Escape key, and then a popup menu of choices should appear. Select the top menu item, to enter a unit. That should enter the typeset template for the unit, with a dummy name like u highlighted. Simply type s to replace the dummy name. Then use the right-arrow to move the cursor to the next entry point.

But why not combine all the units in your expression first, to just J? You can do that programmatically, or in this case mentally.

restart

E__n := proc (n) options operator, arrow; (-1)*6.63*Unit('J')*Unit('s')*3*10^8*Unit('m'/'s')*1.097*10^7*Unit(1/'m')/(10^34*n^2) end proc

combine(E__n(4), units)

-0.1363708125e-18*Units:-Unit(J)

(1)

E__n := unapply(combine(-1.097*(6.63*10^(-34)*Unit('J')*Unit('s')*3)*10^8*Unit('m'/'s')*10^7*Unit(1/'m')/n^2, units), n)

proc (n) options operator, arrow; -0.2181933000e-17*Units:-Unit(J)/n^2 end proc

(2)

E__n(4)

-0.1363708125e-18*Units:-Unit(J)

(3)

kernelopts(version)

`Maple 2018.1, X86 64 LINUX, Jun 8 2018, Build ID 1321769`

(4)

``

Download Maple_prob1_ac.mw

How about just the following, if the file name is test.txt.

M := parse~(ImportMatrix("test.txt",delimiter=" "));

You would replace test.txt with the fully qualified file name, according to its actual location on your machine, or first call currentdir( ) appropriately.

restart:

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

with(Statistics):
N := 3:
X := RandomVariable(Binomial(N, 1/2)):

F := value(CDF(X, s, inert));

F := sum(piecewise(_t < 0, 0, binomial(3, _t)*(1/2)^_t*(1/2)^(3-_t)), _t = 0 .. s)

plot(F, s=-1..N+1,
     gridlines=true, axis[1]=[gridlines=N+1],
     thickness=3);

Download binomialcdf.mw

It wasn't clear to me whether you also needed the terms to be sorted. So I do it with and without, below.

restart;

 

P:=proc(expr, nm)
  local f, i, j, k, L, s;
  s:=`tools/gensym`(nm);
  f:=proc() `tools/genglobal`(s); end proc:
  f(),f();
  L:=PolynomialTools:-CoefficientList(expr,nm):
  add(add(`*`(seq(f(),j=1..i-1)),k=1..L[i]),i=1..nops(L));
end proc:

 

foo := 2*x + 3*x^3;

3*x^3+2*x

ans1 := P(foo, x);

x10*x11*x9+x3*x4*x5+x6*x7*x8+x1+x2

ans2 := P(foo, x);

x10*x11*x9+x3*x4*x5+x6*x7*x8+x1+x2

ans1-ans2;

0

sort( ans1, order=plex(seq(cat(x,i),i=1..nops(indets(ans1,name)))) );

x1+x2+x3*x4*x5+x6*x7*x8+x9*x10*x11

bar := expand(t*randpoly(t, degree=3, coeffs=rand(1..3), dense));

t^4+3*t^3+3*t^2+2*t

new := P(bar, t);

t18*t19*t20*t21+t10*t11*t9+t12*t13*t14+t15*t16*t17+t3*t4+t5*t6+t7*t8+t1+t2

sort( new, order=plex(seq(cat(t,i),i=1..nops(indets(new,name)))) );

t1+t2+t3*t4+t5*t6+t7*t8+t9*t10*t11+t12*t13*t14+t15*t16*t17+t18*t19*t20*t21

 

Download polygen.mw

Was the restriction on a subsequently added to the Question?

restart;

f := sin(x) / ( ( sin(a*x) )^a * ( sin((1-a)*x) )^(1-a) ):

MultiSeries:-limit(f, x=0, left) assuming a>0, a<1;

-1/((-1+a)^(1-a)*(-a)^a)

MultiSeries:-limit(f, x=0, right) assuming a>0, a<1;

1/((1-a)^(1-a)*a^a)

simplify(evala(%-%%)) assuming a>0, a<1;

0

 

Download limitparam.mw

 

You could have a look at this old discussion thread (and the links to yet older discussions, in my Answer there).

The reason that you see "so many" solutions is that by default for your example solve computes both real and complex solutions.

If you only want purely real solutions of your system of polynomial equations then pass the additional option real to the solve command.

restart;

f1:=x^2+y^2=1:

f2:=y=x^3:

solve({f1,f2},{x,y},real,explicit);

{x = -(1/6)*(6*(108+12*93^(1/2))^(1/3)-72/(108+12*93^(1/2))^(1/3))^(1/2), y = -(1/216)*(6*(108+12*93^(1/2))^(1/3)-72/(108+12*93^(1/2))^(1/3))^(3/2)}, {x = (1/6)*(6*(108+12*93^(1/2))^(1/3)-72/(108+12*93^(1/2))^(1/3))^(1/2), y = (1/216)*(6*(108+12*93^(1/2))^(1/3)-72/(108+12*93^(1/2))^(1/3))^(3/2)}

 

Download solvepolysysreal.mw

 

It is simply -> which are the keystrokes minus - , and greater-than > .

You can have a blank space before or after them, but no space between them.

As for the manual, see this section of the Programming Guide.

The following was all done in a terminal session (Command Line Interface, or CLI).

( x->sin(x)+x )( 5 );                                                                        

                     sin(5) + 5

( x -> sin(x)+x )( 5 );                                                                      

                     sin(5) + 5


map( x->sin(x)+x, [2,3,7] );                                                                 

          [sin(2) + 2, sin(3) + 3, sin(7) + 7]

f := x->sin(x)+x;                                                                            

                 f := x -> sin(x) + x

f(t);                                                                                        

                     sin(t) + t

expr := cos(x)^2;                                                                            

                                  2
                    expr := cos(x)

g := unapply( expr, x );                                                                     

                                  2
                  g := x -> cos(x)

g(t);                                                                                        

                         2
                   cos(t)

x -> tan(x)^2;                                                                               

                          2
               x -> tan(x)

proc(x) option operator, arrow; tan(x)^2; end proc;

                          2
               x -> tan(x)
First 175 176 177 178 179 180 181 Last Page 177 of 339