## 22 Badges

17 years, 99 days

## setoptions3d stopped working in Maple 20...

Maple 2023

This code fails in Maple 2023.  It used to work in earlier versions.  Did I miss something in the release notes?

 > restart;
 > kernelopts(version);

 > with(plots):
 > setoptions3d(font=[Times,roman,12]);
 > arrow(<1,1,1>);

Error, (in plottools:-rotate) invalid arguments for 3-D transformation

## How to find a symbolic solution for this...

Maple 2022

I can derive a symbolic solution by hand for the following ODE, but cannot get Maple to do it for me.  Any tricks?

 > restart;

Velocity field, ,  .

 > v := (x,t) -> piecewise(x <= -t, 0, x < t, 1 - 1/2*(1 - x/t));

Position :

 > de := diff(x(t),t) = v(x(t),t);

Initial condition, assuming

 > ic := x(0) = -a;

Symbolic solution, calculated by hand:

 > x__exact := t -> piecewise(t < a, -a, t - 2*sqrt(t)*sqrt(a));

Verify exact solution by comparing it against the numeric solution for some :

 > a := 3;  # any a>0 should do dsol := dsolve({de,ic}, numeric): plots:-odeplot(dsol, t=0..5);   # dsolve solution plot(x__exact(t), t=0..5);      # symbolic solution (calculated by hand) a := 'a';

Can Maple's dsolve find the exact solution?  This one returns empty in Maple 2022:

 > dsolve({de, ic}) assuming a > 0, t > 0;

Download ode-piecewise.mw

## How to generate these combinations?...

Maple

I expect that there must exist a Maple proc that does the equivalent of the following but I couldn't find it.  Can it be in the combinat package?

And if there isn't one, can the following be improved?  It seems to be horribly inefficient to me, although efficiency is not a major concern for me right now since I need it only for small values of n.

 > restart;

Proc produces all lists of length  consisting of the

two distinct symbols  and .

 > doit := proc(a, b, n::posint)         local p := 1, L := [ [a], [b] ];         for p from 1 to n-1 do                  L := [ map( x -> [a,op(x)], L)[], map( x -> [b,op(x)], L)[] ];         end do:         return L; end proc:
 > doit(a,b,1);

 > doit(p,q,3);

 > doit(5,7,3);

Download mw.mw

## How to define custom lighting?...

Maple 2022

I have been unable to add a directed light source to my plot3d drawings.  Perhaps I am misreading the documentation.  In the following experiment, I attempt to shine a red light from the direction (phi,theta) but changing the values of phi and theta don't seem to change the scene's lighting.  Can you change the lighting in your Maple?

```restart;
with(plottools):
with(plots):
Explore(display(sphere(), style=surface, color=yellow, light=[phi,theta,1,0,0]),
phi=0..Pi, theta=0..Pi);
```

## How many arguments does a proc take?...

Maple 2022

 > restart;
 > q := (u,v) -> u^2 + v^2;

 > D[3](q);

Error, (in D/procedure) index out of range: function takes only 2 arguments

Question: How does D know that  takes two arguments?

In general, if I pass  to another proc, how can I find out, within
that proc, that  takes only two arguments?

download number-of-arguments.mw

 1 2 3 4 5 6 7 Last Page 1 of 15
﻿