Items tagged with programming programming Tagged Items Feed

I have an expression of derrivative, lets say (D[2, 2](G))(x, y).

How to get this numbers - [2,2] programmicaly from it?

i was to design a GUI using embedded components, i started as shown in the screenshot i uploaded but i had alittle problem trying to code the `evaluate at params` bottton i wanted the botton to return the evaluation of the mathematical expression at the value of the various parameters [delta,gamma,alpha,G,C] into the mathcontainer infront of it i.e evaluating at these points which can be change as new vualues are type in the textfeilds. such as

this is the code i used and it poping out an error message

use DocumentTools in

module()
local f,q,delta,gamma,alpha,G,C;

Do(f=%MathContainer0);
Do(delta=value(%MathContainer1));
Do(gamma=value(%MathContainer2));
Do(alpha=value(%MathContainer3));
Do(G=value(%MathContainer4));
Do(C=value(%MathContainer5));



q:=eval(f,value,delta,gamma,alpha,G,C);
Do(%MathContainer6=q);




end module;
pls i need some one to correct me

hi, I want calculate lambda(lagrange multiplier) for lane emden type equation, I have made a programme for it but here is error at the end of programme,plz help

lambda.3rd.mw

Hi dear friends

How do I improve my ability to manipulate code?

Thanks

_________________________________________________________________________________________

 

restart:

Digits := 30: m := 20: p0 := 8.: g := -0.3: nu := 0.3: a := 1:


w := sum(b[n]*r^(1.02*n), n = 1 .. m):


ODE := r^3*(g*r+a)^3*(diff(w, r, r, r, r))+2*(diff(w, r, r, r))*r^2*(4*g*r+a)*(g*r+a)^2+(diff(w, r, r))*r*(3*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2+11*g^3*r^3+3*a^2*g*nu*r+15*a*g^2*r^2+3*a^2*g*r-a^3)+(diff(w, r))*(6*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2-2*g^3*r^3-3*a*g^2*r^2+a^3):


for P from p0 by 0.1e-1 to p0+1 do
W := simplify(subs(solve({seq(evalf(subs(r = j/(m+2), ODE)), j = 2 .. m-1), subs(r = 1, diff(w, r))}, {seq(b[j], j = 1 .. m)}), w/b[m])):
F := (int(((diff(W, `$`(r, 2))+(diff(W, r))/r)^2-(2*(1-nu))*(diff(W, `$`(r, 2)))*(diff(W, r))/r)*r*(1+g*r/a)^3, r = 0 .. a))/(int((diff(W, r))^2*r, r = 0 .. a)):
delta[trunc(100*(P-p0))] := abs(F-P) end do:


plot(W, r = 0 .. a);


Min := min(seq(delta[j], j = 0 .. 100)):


for j from 0 to 100 do if delta[j] = Min then print(p0+j/(100.)) else  end if end do;

To begin with my code is:

with(Statistics);

N:=RandomVariable(Normal(5,2))

 

for i from 1 by 1 to 100 do

OS[i]:=Sample(N,50)

end do

 

for i from 1 by 1 to 100 do

 print(i)

  from j from 1 by 1 to 1000 do

    BS[i,j]:=Bootstrap('Mean',OS[i],replications=1)

  end do

end do

 

My goal is to produce as an output in the software's screen the values of 1000 bootstrap means for each of 100 original samples in order to export the results to Excel. Based on my basic knowledge of programming I thought that I can do that through the use of the vectors. Unfortunately though when I trigger the operation the software seems to be evaluating (with the homonymous indication in the bottom left corner of the screen) it for an indefinite period of time, obliging me to stop it at some point. However, let me point out that when I do the same process for i and j 4 and 10 for example then I have results, therefore presumably my code is correct. I know that I can do the same operation in Excel and I have already created a respective macro, however I wanted to use Maple in order to take advantage of its fast operation of calculations, which is pointless in case that I have to wait more time for the results than I have already waited to be eventually produced.

Any thought and idea would be appreciated, thank you very much in advance!

Hi everybody:

I'm going to learn programming with maple 18, are there any good and new pdf files for learn it?

with regards...

 

Hello Forum:

In the Programming Guide, section 14.3 (Programming Guide: Advanced Connectivity), the subsection `Runtime Environment Prerequisites' a sample script is given in order to set up the environment varibales MAPLE and LD_LIBRARY_PATH:

--8><--------------------------------------------------------------------------

#!/bin/sh
export MAPLE="/usr/local/maple"
. $MAPLE/bin/maple -norun
myapp $*


-----------------------------------------------------------------><8-----------

For testing, `my app $*' can be replaced by `printenv': it seems not to work with Maple 2015.

Any hint ?

Thanks in advance,

Jerome

 

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

Hello. I have a question. If you can help me, i am pleasure.

Have nice day. :)

 

restart;
soru := proc(n,x)
local top::0;
for x from 2 to n do
top =top+(((x^(2+i))*top)^(1/(n+2-i)));
print(top);
od;
end proc;

 

soru(5,1);

Error, (in soru) illegal use of a formal parameter

Hi all,
can you help in that please?
How can I use this small procedure (root_of_cheb) as a sub-procedure in  the next procedure (EvalInt) ?
is it possible?

restart:
root_of_cheb:=proc(n)
   local xk,b,k:
   xk:=(k,n)->cos((2*k-1)*Pi/(2*n));
   sort([seq(evalf(xk(k,n)),k=1..n)]):
end:
EvalInt:=proc(f,n)
   local xk:
   xk:=(k,n)->cos((2*k-1)*Pi/(2*n));
   evalf((Pi/n)*add(f(xk(i,n)),i=1..n)):
end:

Thank you

Dear all,

I have a question regarding the computation speed of Maple. I'm doing some numerical work with Maple and when I'm not using the build in Maple routines, but write my one routines to solve e.g. a system of partial differential equations using a finite differencing method, it takes Maple sometimes up to two hours to finish the computation. I also noticed that Maple is only using around 30% of my CPU. I know it's more efficient to do numerical work with C++ or other programming languages (at least that's what most people I know are using) but do any of you know some ways to improve the computation speed of Maple or to make it use more of my CPU to do the calculations faster?

1.  a procedure quadsumstats whose input is an integer n. This procedure should return a list of length 

n whose kth  entry is the number of solutions to
x^2 + y^2 = k 
for
1 <= k and k <= n

I am sort of confused as to how to construct that list of length n and how to obtain integer solutions to the equation in maple.

2.

a procedure firstCount(k) that finds the first integer
n
with
k
representations as
"x^2+y^2= n." What does it mean for an integer to have k representations?

 

 

 

 

I need to write a procedure that does the following :

Write a procedure quadsum whose input is an integer n and whose output is a list of pairs of solutions [x,y] to the above formula.

Your procedure should implement the following algorithm.

1 Initialization
Set
"mylist = []."

Start at
x = 0
and
y = 0.

2 Phase A
Increment both
x
and
y
until
"x^2+y^2 >=n."

Phase B
Repeat the following until
x^2>n

If you are above the circle
x^2 + y^2 = n
then go down in unit steps until you are on or below the circle.

If you are on the circle, add the point to the list
"mylist. "

If you are on or below the circle
x^2 + y^2 = n
then go one step to the right. My procedure is as follows: but it runs into an infinite loop(most probably because of the while loop defined inside the while loop). What am I doing incorrectly?

I have atta

 

hello,

i am quite new into programming and i need help with writing a code that determines the largest integer in the list...

Please help..

Thank you 

The algorithm that I need to replicate is as follows:

real function f(x,y)

integer n; real a,b,c,x,y

f<-max(|x|,|y|)

a<-min(|x|,|y|)

for n=1 to 3 do

b<-(a/f)^2

c<-b/(4+b)

f<-f+2*c*f

a<-ca

end for

end function f

How can I define f,a as  functions that I am later using as variables(in f=f+2cf,b=(a/f)^2)? also, is n just a variable for iteration? 

 

1 2 3 4 5 6 7 Page 1 of 7