9 years, 57 days

These are answers submitted by acer

kernel builtins

Yesterday at 8:10 PM acer 10551

What all these do... is another question.

started := false:
T := 'T':
for i from 1 to 1000 do
  f := eval(parse(cat("proc() option builtin=",i,"; end proc")));
  p := (s->StringTools:-Take(s,StringTools:-Search(";",s)-1))(convert(eval(f),string)[26..]);
  if not type(parse(p),posint) then
    T[i] := p;
    started := true;
    if started then i:=1000; next; end if;
  end if;
end do:
[ entries(T,nolist) ];



November 25 2014 acer 10551

Try setting infolevel[`pdsolve/numeric`] before calling the solver.

For example,


At value 2 I am seeing a brief description, such as, "Deriving 3-point (space) theta scheme for input PDE". At value 3 I am seeing printout of what appear to be differencing procedure(s).



November 24 2014 acer 10551

One way to get that smoother is to use the `gridrefine` option of implicitplot. Eg,

plots:-implicitplot(-x^3+3*x+a = 0, a = -3 .. 3, x = -4.0 .. 4.0,
                         view = [-3 .. 3, -4 .. 4], gridrefine = 2);



November 24 2014 acer 10551

Try that as `Or`, rather than `OR`.



November 22 2014 acer 10551

Look at the help page with topic examples,Explore for the cobweb plot of the logistic map.

For the bifurcation diagram see this message threa on this site.



November 21 2014 acer 10551

How you go about it may depend on whether you want to be able to programmatically access any displayed values after manually updating them in the tabulated representation.

If you insert a DataTable Embedded Component from the palettes then you can associate that with a Matrix or Array. This includes the functionality that if you update the Matrix then the DataTable entry reflects that. And vice versa. Also, you can put customized row and column headers on the Component. There is no command at present to insert such a DataTable via a command. (I suspect that it might be done with some very low level XML manipulation, but it is not straightforward and the insertion may be buggy.)

If you only need to display the data and not to interact with it (as you've stated is the case) then there are some undocumented routines that can accomplish this. (These are evident by inspectng the Explore:-ModuleApply and ImageTools:-Embed library procedures.) Of course your success might be limited, with undocumented routines. For example, using Maple 18.01, with the purely numeric entries of data being represented as strings,


makegrid := proc(M::Matrix)
  uses DocumentTools:-Layout;
  local i,j,m,n,wks;
  m,n := op(1,M);
  wks := Worksheet(Table(alignment=center,width=20,
end proc:



In Maple 17 the following seems possible. This makes a little effort at weighting the width of the columns according to string length. (That weighting will break down if the entries are long enough to line-wrap, I think.)


grid := proc(M::Matrix)
  uses DocumentTools:-Layout;
  local i,j,Ms,m,n,wks;
end proc:



The mechanism used above is not in Maple 16 or earlier, so this won't work there.


You wrote that f(t) is a "function". It's not clear whether you mean an expression such as t*sin(t) or an operator (or procedure) such as t->t*sin(t).

Several others have show you different ways of mapping an operator/procedure `f` across a list of values. If your `f` is already a procedure or operator then Carls' and Kitonum's Answers should work fine.

However you also used the word `subs`. So it seems to me that you might possibly have an expression rather than a procedure. If that is in fact your situation then you could do one of the following:

1) Use `unapply` to obtain an operator from the expression, then follow the other suitable Answers.


2) produce a sequence involving `f` with `t` taken from the list. Eg,

T := [0,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]:
f := t^2: 

[ seq( f, t=T ) ];

              [0, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1]


3) (awkwardly, IMO) map 2-argument eval across the list via a custom operator, Eg,

map( x->eval(f,t=x), T );

              [0, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1]

If you already have an operator like f=t->t^2 then going the route of turning that into an expression by invoking f(t) say, and then doing 2) above, requires having a free dummy variable. (I never understand why people create operators simply to invoke then one single time. Yet it's quite common to see people start with an expression, unapply it, then apply it as the argument to `plot`, etc.)



November 18 2014 acer 10551

You have not indicated very clearly in your question whether you will accept F or G appearing in the representation of B/A and C/A, or not. I am supposing that it is ok for them to appear. You give only a somewhat inarticulate hint that F,G are to be treated differently than `kappa`, `k`,  and `a`, in my opinion.

You can eliminate A,B and C from the four equations. The eliminate command can so that, for this example, as well as provide an additional result (which will still hold for the remaining F and G).


eq1 := A+B=F+G:
eq2 := k*(A-B)=kappa*(F-G):
eq3 := F*exp(I*kappa*a)+G*exp(-I*kappa*a)=C*exp(I*k*a):
eq4 := kappa*F*exp(I*kappa*a)-kappa*G*exp(-I*kappa*a)=k*C*exp(I*k*a):

S := {eq1,eq2,eq3,eq4}:

Q := eliminate( S, {A,B,C} ):

B/A = eval(B/A,Q[1]);

                      B   F k - F kappa + G k + G kappa
                      - = -----------------------------
                      A   F k + F kappa + G k - G kappa

C/A = eval(C/A,Q[1]);

               C   2 (F exp(I kappa a) + G exp(-I kappa a)) k
               - = ------------------------------------------
               A   exp(I k a) (F k + F kappa + G k - G kappa)

# The second part of the result Q from `eliminate` indicates a remaining
# restriction on the remaining names F,G,a,k, and kappa. If you wish, you can solve this
# for F (or G) for this example. But you don't have to. The elements of the set
# Q[2] are implicitly equal to zero (though below I explicitly make an equation
# of it, just to make the point).


     {F exp(I kappa a) k - kappa F exp(I kappa a) + G exp(-I kappa a) k

        + kappa G exp(-I kappa a) = 0}

That remaining restriction on F,G,a,k, and kappa can be used to remove F and G from the representation above for B/A and C/A.

R := solve(Q[2],F);
normal( eval( eval(B/A,Q[1]), R ) );
normal( eval( eval(C/A,Q[1]), R ) );

As Carl's showed, if you don't want F and G to appear then you might as well just do a single `solve` for {A,B,C,F}. Or you could use eliminate with 4 names,

T := eliminate( S, {A,B,C,F} ):
B/A = eval(B/A,T[1]);
C/A = eval(C/A,T[1]);

In some other example it may happen than you can eliminate A,B, and C but not all other instances of some specific subset of the remaining names.



November 18 2014 acer 10551

It may not always help. but it quite often comes up that there is some benefit to preventing `evalf/int` from poking too hard at the integrand as an expression. One way to get that is to make the integrand an operator rather than an expression.

I suppose you realize that this is a nasty looking integral. It is very small for most of x=0..1, and then up around the range 0.93..1 it becomes very large. Well, it becomes larger than fits within the range of double-precision. Hence it may be beneficial to prevent `evalf/int` from using `evalhf` and concluding that the answer is Float(infinity).

As mentioned, this kind of approach is not going to always work. Nothing will always work. However, for this particular example,


y := 1: z := 2 + x + y: s := 1/2:
m2 := 5325: m1 := 5279: mz := 106055/10:

igrand := 1/z^3 *(x + y + 2* x*y)* (1 + s^2/(2 *m2^2* z))
          *exp(-(m2^2*x + m1^2*y)/s^2 + (mz^2 *(x + y + 2 *x*y))/(2* s^2* z)):

evalf(Int(unapply(igrand,x), 0..1.0, digits=136, epsilon=1e-10)):
                             8.629559550 10     

With regard to your broader question, you could try saving your partial results before problematic calls, if you know what they are.



November 17 2014 acer 10551

Your guess is right, the procedure normally sees only the evaluated argument and not the name (to which it was assigned) that is used in the call.

However, there are some other ways to go about it.

One way is to call the procedure with an invocation using unevaluation quotes on the arguments. This works easily without having the procedure's parameters be specified (by type, or in number). This has the benefit (if I understand your wish rightly) of not requiring knowledge of the number of arguments at the time the procedure is defined.


  local x;
  for x in [_passed] do
  end do;
end proc:


p( 'A', 'B[1]' );
                                   A, [4]
                                  B[1], [7]

Another couple of ways involve using the uneval or evaln modifiers of parameters of a procedure. Unfortunately those cannot be used directly with the seq modifier, so it's not simple to be able to pass a sequence of such (whose number is not known in advance of defining the procedure).

Using A and B[1] from above,

p2 := proc( y::uneval, w::uneval)
  local x;
  for x in [y,w] do
    print( eval(x,1), eval(x,2) );
  end do;
end proc:

p2( A, B[1] );
                                   A, [4]
                                  B[1], [7]

p3 := proc( y::evaln, w::evaln )
  local x;
  for x in [y,w] do
    print( eval(x,1), eval(x,2) );
  end do;
end proc:

p3( A, B[1] );
                                   A, [4]
                                  B[1], [7]



November 14 2014 acer 10551

Firstly, it is spelled with a capital J. It is Jacobian, not jacobian.

Secondly, make sure that you are not entering rsin(t) when you meant r*sin(t). otherwise you'll just get the single name rsin. The same goes for rcos.

Thirdly, it appears that you already have the name r assigned to something else (a failed call to RandomMatrix, without loading the LinearAlgebra package?). You can undo that using the unassign command, or by issuing the command r:='r'. Or don't make that assignment before your current example.

Fourthly, make sure that you have either loaded the package using the command with(VectorCalculus) or you are calling it by its long-form name. Eg,

VectorCalculus:-Jacobian([r*cos(t), r*sin(t), r^2*t], [r, t]);

                             [cos(t)    -r sin(t)]
                             [                   ]
                             [sin(t)    r cos(t) ]
                             [                   ]
                             [              2    ]
                             [2 r t        r     ]


jre 1.6?

November 10 2014 acer 10551

Which java runtime do you have? It's possible to have multiple java runtimes even on OSX, I believe. If it is java 7 then could you try adding the JRE 1.6 (required for Maple 18) runtime obtained from Apple (legacy Java SE 6?)?

If you already have that java version then sorry, I don't have another suggestion.



November 09 2014 acer 10551

Your preamble loads the Physics package, etc, which rebinds `.`.

Those invocations of `.` result in z1 being a Physics:-`*` function call (in stock Maple 18.01).


Physics:-Setup(mathematicalnotation = true): 
Physics:-Setup(anticommutativeprefix = psi):
ap1 := Physics:-Creation(psi, 1, notation = explicit):
am1 := Physics:-Annihilation(psi, 1, notation = explicit): 
ap2 := Physics:-Creation(psi, 2, notation = explicit):
am2 := Physics:-Annihilation(psi, 2, notation = explicit):

z1 := ap1 . am1 . ap2:

type(z1, specfunc(anything, Physics:-`*`));



before writing?

November 05 2014 acer 10551

Why not substitute before writing to the file?

f := x-> arcsin(x):

str := StringTools:-Substitute(sprintf("%a",f(1)),"Pi","pi"):


file := cat(kernelopts(homedir),"/Documents/foo.txt"):





it ought to..

November 05 2014 acer 10551

It ought to be able to do that. See the Student[NumericalAnalysis][LinearSolve] command.


1 2 3 4 5 6 7 Last Page 1 of 102