smith_alpha

155 Reputation

6 Badges

12 years, 150 days

MaplePrimes Activity


These are questions asked by smith_alpha

Hi,

 

  Suppose I have a probability distribution function f(x). I would like to generate points in a 

(1) given interval, can be up to infinity

(2) number of points

(3) satisfy the known probability distribution function f(x)

(4) possible other specifications

 

 

  Is there any build-in option in maple I could use? Or I have to write something manually?

 

Thank you very much!

 

Hello,

 

  I have a complicated task. Suppose there is a file, its content is

1

A    3
0.8 0.2

0.6 0.3

0.5 0.4
****
2
A   3

0.8 0.2

0.6 0.3

0.5 0.4

****

 

  I want to read the file for each line, and store the content in each variable, e.g. "S" and 3 for two different variables, respectively. 

By using 

Nn:=readline("file");
Nn2:=readline("file");
Nn3:=readline("file");

parse(Nn);

parse(Nn2);

 

For N2, it does not work "Error, incorrect syntax in parse: unexpected number (near 6-th character of parsed string)"

 

How to read such a file properly including varies of content? Thanks a lot!

 

 

Suppose I have a file, test.txt, which the content is

 

2
2 0.0 0.0 0.0
1 0.0 0.0 1.6

 

I would like to save 

Z:=2;

C[1,1]:=2;C[2,1]:=0.0;C[3,1]:=0.0;C[4,1]:=0.0;

C[1,2]:=1;C[2,2]:=0.0;C[3,2]:=0.0;C[4,2]:=1.6;

 

However, if I use readdata("...",4), seems it do not work.

 

Is there any flexible command in maple can readfile with different column? Thank you very much!

Hi,

 

  Suppose I have a file, 1.mw, which includes a subroutine

 

aver:=proc(a,b)

  local res;
  res:=(a+b)/2;

  return res;

end proc:

 

   Now I am writing another file, 2.mw. I would like to load the subroutine, aver, in 1.mw. How shall I write in 2.mw to use that subroutine in 1.mw?

 

Thank you very much

Hi,

 

  Suppose I would like to use writedata for a series of files, e.g. test1.txt, test2.txt, test3.txt.  

I tried

***

a_min:=1;a_max:=3;
b_min:=1;b_max:=3;
A:=array(a_min..a_max,b_min..b_max);


for i from a_min to a_max do
  for j from b_min to b_max do 
     A[i,j]:=i*j;
  end do;
end do;

for i from 1 to 3 do
  file_name:=`test||i`;
  writedata[APPEND](file_name,A);
end do;

****

Seems "||" inside `` does not work, is there any robust solution for this issue? 

 

Thank you very much

 

1 2 3 4 5 6 7 Page 3 of 10