radaar

202 Reputation

8 Badges

7 years, 159 days

MaplePrimes Activity


These are replies submitted by radaar

@tomleslie I think it is better to put the output of diff(f(x),x) instead of just diff(f(x),x). Is it?

@9009134 I think maple global optimization package or stochastic optimization techniques (if the problem is written as an optimization problem) can solve this issue.

Please see this research article

http://sciencedirect.com/science/article/abs/pii/S036054421400560X

 

@Carl Love What about using map function here

@Gillee great great

@acer Thanks a lot. Sorry for not providing the information that nn is an integer.

@Mac Dude Thanks for your reply. I am trying to optimize a function where the variables are nn and xx[ii]s. The second and third argument inside Minimize function ie nn=1..5 and seq(xx[ii]=1..10,ii=1..nn) are the bounds for those variables. Here nn itself is a variable rather than a constant. That is why it is showing error. How to solve this problem?

Suppose nn is a constant i.e., let us say nn=5

restart;

W := proc ()

      global rf;

     rf := add(xx[ii]^2-5, ii = 1 .. 5);

     return rf ;

    end proc;

Optimization:-Minimize(W(), xx[1] = 1 .. 10, xx[2] = 1 .. 10, xx[3] = 1 .. 10, xx[4] = 1 .. 10, xx[5] = 1 .. 10);


[-20.,  [xx[1] = 1., xx[2] = 1., xx[3] = 1., xx[4] = 1., xx[5] = 1.]]

But the issue i am facing in my original question is nn is a variable


 

@Carl Love Thanks a lot for your comments. I will try to make the following changes. In future, I will be posting different optimization algorithms including both deterministic as well as non-deterministic. Hope your help and cooperation.

@acer In the new example, I am not using a random array. Instead, I am using a different array i.e

 

dat := CodeTools:-Usage([seq([Array(1 .. 100, fill = 0), Array(1 .. 100, fill = 100), Array(1 .. 100, fill = 50)], ii = 1 .. 200)])

 

With this why I am getting the above error. Can you please modify the code such that i can use it for the new array.

 

 

@ If that is the case better would be genetic algorithm, artificial bee colony algorithm etc.

@acer I removed float[8] still getting error. so how can i use it for new example where I am inserting arrays

@Carl Love Will this algorithm works for multivariable functions. Thank you

@acer  Iam getting following error. thread.mw
 

FFG := proc (xx::(Array(datatype = float[8])), yy::(Array(datatype = float[8])), zz::(Array(datatype = float[8])), maxx::integer) local T::float, ii::integer; option threadsafe; T := 0.; for ii to maxx do T := T+xx[ii]^2+yy[ii]^2+zz[ii]^2 end do; T end proc; cFFG := Compiler:-Compile(FFG)

dat := CodeTools:-Usage([seq([Array(1 .. 100, fill = 0), Array(1 .. 100, fill = 100), Array(1 .. 100, fill = 50)], ii = 1 .. 200)])

memory used=0.56MiB, alloc change=0 bytes, cpu time=1000.00us, real time=0ns, gc time=0ns

 

CodeTools:-Usage(Threads:-Map(proc (L) options operator, arrow; cFFG(op(L), 100) end proc, dat), iterations = 20)

Error, (in cFFG) invalid input: expecting a hardware float[8] rtable, but received 1

 

``


 

Download thread.mw

 

restart;

tt := -0.689609e-3; T_c := .242731; mu := .365908; k := 1; N := 1; II := 2; q := 5; m := 3:

R1 := a*tanh((a^2-mu)/(2*T_c))*ln((-2*II*N*Pi+2*a^2+2*a*q+q^2-2*mu)/(-2*II*N*Pi+2*a^2-2*a*q+q^2-2*mu))/q-2;

R2 := evalf(Int(R1, a = 0 .. 10000));

R3 := evalf(q*ln((-q^2-k^2+mu+II*(2*N*Pi*T_c-(2*m+1)*Pi*T_c)+k*q)/(-q^2-k^2+mu+II*(2*N*Pi*T_c-(2*m+1)*Pi*T_c)-k*q))/(k*(tt+R2)))

Result:               R2 := -0.08174801869 + 1.984664086 I
                           R3 := 0.03164888870 + 0.7619386260 I

 

@acer Can I use add function inside FFG procedure?

@ I agree with your comments on optimization tools. Hope much better features will be incorporated in the new version.

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