Kitonum

15082 Reputation

24 Badges

12 years, 25 days

MaplePrimes Activity


These are replies submitted by Kitonum

In your code two errors:

1) You have eight unknowns, but only six equations.

2) In the last line after the T[gi] is ', and should be a comma.

I have solved your example as follows:

restart: with(plots): with(Statistics):

X:=<0, 7.17, 18.11, 34.34, 57.95, 91.84, 139.98, 207.94, 303.48, 437.57, 625.87, 890.96, 1265.91, 1800>:

Y:=<.44, .43, .42, .41, .40, .39, .38, .37, .36, .35, .34, .33, .32, .31>: 

fit:=NonlinearFit(a+b1*exp(-t/c1)+b2*exp(-t/c2),X, Y, t); 

fit1 := plot(fit, t=0..1800, thickness=2):

graph1 := pointplot(X, Y, symbol = BOX, symbolsize=15, axes = BOXED):

display(graph1, fit1);

I have solved your example as follows:

restart: with(plots): with(Statistics):

X:=<0, 7.17, 18.11, 34.34, 57.95, 91.84, 139.98, 207.94, 303.48, 437.57, 625.87, 890.96, 1265.91, 1800>:

Y:=<.44, .43, .42, .41, .40, .39, .38, .37, .36, .35, .34, .33, .32, .31>: 

fit:=NonlinearFit(a+b1*exp(-t/c1)+b2*exp(-t/c2),X, Y, t); 

fit1 := plot(fit, t=0..1800, thickness=2):

graph1 := pointplot(X, Y, symbol = BOX, symbolsize=15, axes = BOXED):

display(graph1, fit1);

@Markiyan Hirnyk Of course, i read about Alec's approach using `if`-construction. This approach does not work for the continuous case, what i also wrote! Another example :

f:=(k1,k2,n1,n2)->int( int( `if` (x*k1/n1 +y*k2/n2+k2/n2 > 1/2 and

x*k1/n1 +y*k2/n2 >1/2, 1, 0), x=0..n1), y=0..n2): 

f(1,2,3,4);

 

But if we replace `if` by piecewise it all works:

f:=(k1,k2,n1,n2)->int( int( piecewise(x*k1/n1 +y*k2/n2+k2/n2 > 1/2 and

x*k1/n1 +y*k2/n2 >1/2, 1, 0), x=0..n1), y=0..n2): 

f(1,2,3,4);

Thus, piecewise-construction has a wider application.

@Markiyan Hirnyk Of course, i read about Alec's approach using `if`-construction. This approach does not work for the continuous case, what i also wrote! Another example :

f:=(k1,k2,n1,n2)->int( int( `if` (x*k1/n1 +y*k2/n2+k2/n2 > 1/2 and

x*k1/n1 +y*k2/n2 >1/2, 1, 0), x=0..n1), y=0..n2): 

f(1,2,3,4);

 

But if we replace `if` by piecewise it all works:

f:=(k1,k2,n1,n2)->int( int( piecewise(x*k1/n1 +y*k2/n2+k2/n2 > 1/2 and

x*k1/n1 +y*k2/n2 >1/2, 1, 0), x=0..n1), y=0..n2): 

f(1,2,3,4);

Thus, piecewise-construction has a wider application.

int(int(`if`(i+j<=8, i*j, 0), i=1..6), j=1..6);

int(int(`if`(i+j<=8, i*j, 0), i=1..6), j=1..6);

Quote: "

With m = 1, we have f(x) = 3*x^2+2*x-7.

minimize(h(x),x>=1);

we get minimum is -2"

A strange argument!  The global minimum of the function of two variables f(x,m)=3*x^2+2*m*x+2*m^2-3*m-6  in the region 1<= x, m=-infinity..infinity,  equals  -25/8  and it is reached at  x=1, m=1/4 .

Quote: "

With m = 1, we have f(x) = 3*x^2+2*x-7.

minimize(h(x),x>=1);

we get minimum is -2"

A strange argument!  The global minimum of the function of two variables f(x,m)=3*x^2+2*m*x+2*m^2-3*m-6  in the region 1<= x, m=-infinity..infinity,  equals  -25/8  and it is reached at  x=1, m=1/4 .

The program of Joe Riel solves another problem: it shows that 1st, 2nd, 3rd members of the sequence are identical with 25th, 26th and 27th members. Thus, this sequence is periodic with period 24.

The program of Joe Riel solves another problem: it shows that 1st, 2nd, 3rd members of the sequence are identical with 25th, 26th and 27th members. Thus, this sequence is periodic with period 24.

convert(M,list);  geom3d[point]('M',op(%));

[1, -1, 3]

  M

convert(M,list);  geom3d[point]('M',op(%));

[1, -1, 3]

  M

@toandhsp It seems all right!

OK! Thanks for your explanations!

First 106 107 108 109 110 111 112 Page 108 of 112