sand15

812 Reputation

13 Badges

10 years, 242 days

MaplePrimes Activity


These are questions asked by sand15

Hi everybody, 
 
 My goal is to generate the Matlab code of some Maple function f(x, a, b, …).

The command
  CodeGeneration[Matlab](f, output=string) 
first produces the warning

Warning, the following variable name replacements  were made : a -> cg, b -> cg1, …

plus the desired code

freturn :=f(x, cg, cg1, …)
….
end

As you see here the names a, b, … are no longer arguments of f.

I  have searched in the help pages for CodeGeneration (but with no success at all),  a way to force the translation to conserve the original variable names (a, b, …).

First question : Did I missed the information ?
                            (in which case sorry for the inconvenience)
 
Second question
: If not, does it exist a way to “catch” the warning and thus keep the replacement rules CodeGeneration does ?

Thanks in advance



 
No need to hurry, esthetics is not a vital issue ... but thanks in advance.

PS : sorry for the syntax errors "waves" generated in the original Word document

This question has been deleted by the author

 

Good morning everybody.

I have tried Explore to draw plots in an interactive way.

The function I want to draw (plot3d) is automatically constructed by a specific code, as well as the names of the parameters it depends on. These are of the form P||1, P||2, ...P||N (N is an integer determined during the construction)

... but I did not succeed !

After some investigations I was able to reduced the problem to the following one

N  := 2:
F  := add(P||k * x^k, k=0..N):
G := [seq(P||k=-1.0 .. 1.0, k=0..N)]:
Explore(plot(F, x=0..1), parameters=G)

The result is the classical imbedded window with a plot of -1-x_x^2 and three sliders below.
But as soon as I push anu of them the plot disappears and connot be recoverd.


But the following sequence seems to work as expected

N  := 2:
F  := add(P__k * x^k, k=0..N):
G := [seq(P__k=-1.0 .. 1.0, k=0..N)]:
Explore(plot(F, x=0..1), parameters=G)



Before changing my code, could you please confirm me that parameter names such that P||k are not correctly accounted for by Explore ?


Auxiliary question : more generally, are there points which I have to count carefully when I use the P||k construction ?

Thanks in advance


Good morning everybody


I know this question has already been widely discussed, for example in
http://www.mapleprimes.com/questions/149585-How-To-Order-Legend-Of-Multiple-Plots

I used the answer Kitonum then gave because I have basically the same kind of problem.
As an illustration, here is a sketch of my coding :

N := 3:
for k from 1 to N do
   ...
   MyPlot||k := PLOT(CURVES(....)):
   ...
end do:
plots:-display(seq(MyPlot||k, k=1..N));

The only difference is that I use PLOT instead of plot ... so I have thought that using LEGEND instead of legend would give me the desired result.
But I don't understand how to use LEGEND and how to place the legend in the correct location.

I will appreciate any answer,
Thanks in advance

First 18 19 20 21 22 Page 20 of 22