radaar

202 Reputation

8 Badges

7 years, 223 days

MaplePrimes Activity


These are answers submitted by radaar

@ KGaurav

 

restart;

FF := proc (x)

         return exp(x^2)-exp(x^2+1):
         end proc;

Optimization:-Minimize(FF(x), x = 0 .. 10);

 


 Answer:  [HFloat(-4.618942837551931e43), [x = HFloat(10.0)]]

 

restart;
with(Student[MultivariateCalculus]):

 

Gradient(exp(x*y^3*z^2),[x,y,z]=[1,-1,2])

Most probably it uses root-finding iterative methods such as newton-raphson method. 

X_n+1=X_n-f(X_n)/f'(X_n)

op_f := Optimization[Minimize](5+x/sqrt(2)*(x^2), x = 0 .. 1)

answer------  op_f := [5., [x = 6.69342029027229*10^(-6)]]

 

I think this what you need. Thank you

we can reduce time of function evaluation
 

restart; JJ := Int(exp(-sqrt(4*x^2+4*y^2+4*z^2)^3)*piecewise(x^2+y^2+z^2 < 4, 1, 0), x = -2 .. 2, y = -2 .. 2, z = -2 .. 2); CodeTools:-Usage(evalf(JJ))

memory used=1.37MiB, alloc change=1.00MiB, cpu time=657.00ms, real time=649.00ms, gc time=0ns

 

.5235987756

(1)

restart; JJ := Int(exp(-sqrt(4*x^2+4*y^2+4*z^2)^3)*piecewise(x^2+y^2+z^2 < 4, 1, 0), x = -2 .. 2, y = -2 .. 2, z = -2 .. 2, epsilon = 0.1e-3, method = _cuhre); CodeTools:-Usage(evalf(JJ))

memory used=241.60KiB, alloc change=0 bytes, cpu time=47.00ms, real time=43.00ms, gc time=0ns

 

.5235983900

(2)

``


 

Download int_time.mw

with(Matlab):
FromMatlab("Insert code matlab here"):

Page 1 of 1