nvx

40 Reputation

4 Badges

12 years, 264 days

MaplePrimes Activity


These are questions asked by nvx

Hello,

how do I suppress printing of output in case the colon does not do what it should? Example:

if condition then
  printlevel:=0:
  printf("Some info...");
  gArr:=Array(1..2,1..1):
  gArr[1,1]:=plot(sin,-1..1,axes=boxed,color=blue,title=`Title 1`):
  gArr[2,1]:=plot(cos,-1..1,axes=boxed,color=blue,title=`Title 2`):
  printlevel:=1:
  display(gArr);
else
  ERROR("Error message...");
end if;

Hello,

how does one create a piecewise linear function from a given set of points? Having np points [x[i],y[i]], I tried

Lf(q):=q->piecewise(seq('(q>=x[j]) and (q<=x[j+1]),evalf(y[j]+(q-x[j])*(y[j+1]-y[j])/(x[j+1]-x[j]))',j=0..np-1),ERROR("argument out of range!"));

but it did not work (invoking Lf(3); resulted in "Lf(3)," not in an actual number). Then I tried

Page 1 of 1