PatrickT

Dr. Patrick T

2153 Reputation

18 Badges

16 years, 98 days

MaplePrimes Activity


These are questions asked by PatrickT

I wrote a procedure which rounds floats to a specified precision. I would like to apply it to a Matrix/List/Array/Vector that contains non-numeric cells as well as floats. I'm stuck at the type-checking stage.


# Round0 works on floats and lists and Matrices of floats:
restart;
Round0 := proc(x,n::integer:=1)
   parse~(sprintf~(cat("%.",n,"f"),x));
end proc:

Round0(1.23456789);
1.2

Round0([1.23456789,9.87654321],2);
[1.23, 9.88]

I would like to recolor a list of plots using Maple default values. I have produced a list of colors with the plots:-setcolors(default) command. However, the colors are returned as a list of Hex values.  I first converted the Hex values to RGB values and then attempted to adapt a procedure written by Joe Riel, named -recolor- (refer to Joe's answer from which this question is branched).

But I must have done something wrong.

The conversion from Hex to RGB...

Maple has a number of protected names that cannot be redefined without some work.

A common request is to use the letter j or J instead of the default I for the imaginary unit. Also common is to be able to use the letter I as an ordinary variable, rather than as an imaginary unit. For this, there is a very convenient interface command.


restart;

(-1)^(1/2);

I

interface(imaginaryunit=J):
(-1)^(1/2);
 
 J

(There...

In some cases if not always, "fi" can be used to close an "if" clause, instead of "end if" and "od" can be used to close a "do" clause, instead of "end do".

These short forms are intuitive and can save a lot of space; for instance say you have 5 "do" clauses to be closed, it is a lot shorter to type "od:od:od:od:od:" than  "end do:end do:end do:end do:end do:"

Yet for some reason it does not seem to be a recommended short form. The Advaced Programming Guide (dated 2008...

 

I have equations of the form x=max( f(x,u,E) ), where x is the unknown "variable" to solve for, where u is the "control" variable that can be selected to maximize f, and where E is a parameter. These are all real, positive scalars on [0,1].

One of my objectives is to plot x against E, for those values of u that solve the maximization. In my problem, the optimal values of u are expected to be unique for a given value of E.

My approach was to define...

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