jaytreiman

273 Reputation

12 Badges

19 years, 163 days

MaplePrimes Activity


These are answers submitted by jaytreiman

If the values of f(v_i) are known for enough vectors v_i and the forms of q and p are known, eg all terms are of degree <= 4 in the components of the v's, one can try solving the system equations q(v_i)*f(v_i)=p(v_i).  Since this system is linear in the coefficients for p and q, there are a number of techniques available.

As an example, if the dimension of v is 2 and the degree of the polynomials is at most 2, letting v_i=(x_i,y_i) one has equations of the form

A1*x_i^2+B1*y_i^2+C1*y_i*x_i+D1*x_1+E1*y_1+F1=f(v_i)*(A2*x_i^2+B2*y_i^2+C2*y_i*x_i+D2*x_1+E2*y_1+F2)

with

p=A1*x_i^2+B1*y_i^2+C1*y_i*x_i+D1*x_1+E1*y_1+F1 and q=A2*x_i^2+B2*y_i^2+C2*y_i*x_i+D2*x_1+E2*y_1+F2.  Here one only requires the independence of 12 equations for a solution to exist.

 If you change the commands slightly, to match the examples in the help on Maximize, the routine gives a good answer.  I have attached a demonstration of how I got this to work.

Download example_to_post_repl.mw

Maple always starts with the same seed for its pseudo-random number generator.  What you need to do is to get new seed.  For example, you could use, in MapleTA,

$seed=rand(1000,10000000);

to get a seed and then use

RandomTools[SetState](state=$seed);

within your maple code to get different permutations.

 

For example:

    \code{
      $n=3;
$seed=rand(1000,10000000);
      $pa=maple("randomize();with(combinat);RandomTools[SetState](state=$seed);[randperm($n),randperm($n)]");

First I checked that the decimal representation of the mathml entity and the mathml entity name match.  They do.

Next I went into MapleTA 8 and added the two entity names in mathml into a MapleTA question.  Once I got the correct matching fractur P's.  After that I got different giffs for the two entities.  To me this looks like a bug in the routine MapleTA uses to generate its graphics.  Please report this as a possible bug.

Here is the code MapleTA gave me:

mode=Inline@
name=Test1@
comment=@
editing=useHTML@
solution=@
algorithm=@
uid=b2de4b19-6ec6-4e75-9a49-1288a4769370@
weighting=1@
numbering=alpha@
part.1.name=sro_id_1@
part.1.editing=useHTML@
part.1.fixed=@
part.1.question=null@
part.1.choice.2=False@
part.1.choice.1=True@
part.1.mode=Non Permuting Multiple Choice@
part.1.display=vertical@
part.1.answer=2@question=<p>These are the same.&nbsp; <math><mi>&#120083;</mi></math> and <math><mi>&Pfr;</mi></math></p><p><span>&nbsp;</span><1><span>&nbsp;</span></p>@

Here is a png of the rendering.

The read command will read a "maple input file."  For example, the command read "input.txt"; will read and execute your file.  (I got a number of errors, but that can be fixed.)

 

This is in Section 10.4 of Chapter 10 of the Programming Guide.  Look under "Files Used by Maple".

Resetting a single variable is easy.  To clear the variable a one can use the command

a := 'a';

You can clear all of the variables using the restart command.  (I had this wrong.  Typing too late at night.)

 

Please post a worksheet demonstrating your other problem.  One important point is that you only have the same variable values in two worksheets if the worksheets are using the same kernel.  Frequently people have one kernel for each worksheet.

It is not clear to me what you want to do.  Perhaps the following is what you want.  It applies a function of a list to each element of your listlist.

restart;

A := LinearAlgebra:-RandomMatrix(2, 3);
A := convert(A, listlist);

A := Matrix(2, 3, {(1, 1) = 99, (1, 2) = 44, (1, 3) = -31, (2, 1) = 29, (2, 2) = 92, (2, 3) = 67})

 

[[99, 44, -31], [29, 92, 67]]

(1)

B :=  y-> piecewise(y[1]+y[2] < y[3], y[1]*y[3]+y[2]^2, y[1]+y[2] < y[3] and y[3] < y[1]^2+y[2], y[3]^2*y[2]+y[1]*y[3]);

proc (y) options operator, arrow; piecewise(y[1]+y[2] < y[3], y[1]*y[3]+y[2]^2, y[1]+y[2] < y[3] and y[3] < y[1]^2+y[2], y[3]^2*y[2]+y[1]*y[3]) end proc

(2)

map(B,A);

[0, 0]

(3)

 

 

Download QuesAns37.mw

I tried it on SUSE 12.1 (64 bit)  with both Maple 15 and Maple 16.  I also tried it on Maple 16 with Windows 7 (64 bit).  It works for me in all three casses.

As requested above, please post a message with  your initialization file and any other setup information that may be useful.

Do you have the update to 16.01?

Is using multi-part questions not adequate?

If you want the

nterface(prettyprint = 1):

in the procedure, why not put it in the procedure?

 

 

p1 := proc () interface(prettyprint = 1): print(eval(thisproc)) end proc;

proc () interface(prettyprint = 1); print(eval(thisproc)) end proc

(1)

p1();

proc() interface(prettyprint = 1); print(eval(thisproc)); end proc;

 

 

 

Download ProcPrintProc.mw

Is this what you want?  (It works the same way in 14 and 16.)

In LaTeX I use y^{\prime\prime}(x) to get the desired result.

A simple illustration may help you see what is happening.  The attached code and results show that when you take a 10 decimal digit floating point approximation to e, evalf(exp(1)), and multiply it by 10^9 you get 2718281828. This has no fractional part since all 10 digits are to the left of the decimal point.  The fractional part must be 0.

 

 

Find the 10 decimal digit approximation to e.

evalf(exp(1));

2.718281828

(1)

Multiply the result by 10^9.

10^9*%;

2718281828.

(2)

The correct answer is 0.

frac(%);

0.

(3)

 

 

Download FracPartExample.mw

I tried your code with Maple 14, 15, and 16 on a machine running SuSe 12.  There are no extra lines in my output.  Perhaps someone who is an expert on your Linux distribution can help.

I think you want to use the save  and anames commands.  The "save" command saves values to a file and the "anames" command will retrieve all of your variable names to use in the "save" command.  The help on these should give enough for saving your results.

 

The "read" command will get the values back from the file.

The problem is that Aplus does not have an initial value.  This means that Aplus is defined recursively.  Try the code

Aplus := 0:
for m from 1 to 5 do
  Aplus:=Aplus+(m+(m*2)):
  end do:
Aplus;

to get rid of the error.  Unfortunately, I believe the code you gave will not compute what you want it to compute.

 

A better approach may be to use the add command.

1 2 3 4 5 Page 2 of 5