Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello,

I have a problem using the NonlinearFit function from the Statistics package in Maple 2018.

I want to fit an exponential function which is non-linear in the parameters. The function in itself is working fine but i want to implement an extra condition on the parameters that are fitted. I already implemented the range of each parameter which is from 0 to 1, but I also want to implement the following condition:

a + b + c = 1.0
 

This is the code that i am using:

with(Statistics);
X := Vector([0, 100, 200, 300, 400, 500], datatype = float);
Y := Vector([0.2e-2, 0.5e-2, 0.7e-2, 0.75e-2, 0.77e-2, 0.8e-2], datatype = float);
nlfit := NonlinearFit(epsfunc, X, Y, t, parameterranges = [a = 0 .. 1, b = 0 .. 1, c = 0 .. 1], initialvalues = [a = .2, b = .2, c = .2], output = [parametervalues, leastsquaresfunction]);

 

It there a way to implement the additional condition that a+b+c=1.0?

 

Thanks!

Joa

 

 

Edit:

Epsfunc is the result of solving an ODE using dsolve:

the following code is used:

restart;

eq1 := x(t)+(t1+t2)*(diff(x(t), t))+t1*t2*(diff(x(t), t, t)) = (n1+n2)*(diff(eps(t), t))+(n1*t2+n2*t1)*(diff(eps(t), t, t));
tr := n1*n2*(E1+E2)/((n1+n2)*E1*E2);
x := proc (t) options operator, arrow, function_assign; x0 end proc;
solution := dsolve({eq1, eps(0) = x0/(E1+E2), (D(eps))(0) = x0*((n1/E1+n2/E2)/(n1+n2)-1/(E1+E2))/tr}, eps(t)); assign(solution);


E := 500;
E1 := a*E; E2 := b*E; t1 := 100; t2 := c*t1; n1 := E1*t1; n2 := E2*t2; x0 := 2;
epsfunc := eval(eps(t));
 

How to solve this DE with IC by using DTM.
D^m u(x,t)=u''(x,t)-u^2 (x,t), where n-1< m < n 

IC: u(x,0)=1+sin(x), and u'(x,0)=0

I have a problem for school that I need help with. 

Solve: by variation of parameters.

x3y’’’ – x2y’’ − 2xy’ + 6y = x2

Use any software, e.g. Maple, as an aid in computing roots of the auxiliary equation and the Wronskian-based determinants W, W1, W2, W3

I was able to hand calculate the roots as [m1 = 3, m2 = 2, m3 = -1]
 

NULL

with(VectorCalculus); Wronskian([x^3, x^2, 1/x], x, 'determinant')

Matrix(%id = 18446744078324919462), -12*x

(1)

with(VectorCalculus); Wronskian([0, x^2, 1/x], x, 'determinant')

Matrix(%id = 18446744078349556782), 0

(2)

with(VectorCalculus); Wronskian([x^3, 0, 1/x], x, 'determinant')

Matrix(%id = 18446744078266878782), 0

(3)

with(VectorCalculus); Wronskian([x^3, x^2, 0], x, 'determinant')

Matrix(%id = 18446744078331625094), 0

(4)

m3 := Matrix(3, 3, [0, x^2, 1/x, 0, 2*x, 1/x^2, x^2, 2, 2/x^3])

Matrix(%id = 18446744078385724822)

(5)

Determinant(m3, method = multivar)

Determinant(Matrix(%id = 18446744078385724822), method = multivar)``

(6)

roots(x^3-x^2-2*x+6, alpha, beta)

[]

(7)

``

solve(x^3-x^2-2*x+6 = 0, x)

-(1/3)*(71+9*58^(1/2))^(1/3)-(7/3)/(71+9*58^(1/2))^(1/3)+1/3, (1/6)*(71+9*58^(1/2))^(1/3)+(7/6)/(71+9*58^(1/2))^(1/3)+1/3+((1/2)*I)*3^(1/2)*(-(1/3)*(71+9*58^(1/2))^(1/3)+(7/3)/(71+9*58^(1/2))^(1/3)), (1/6)*(71+9*58^(1/2))^(1/3)+(7/6)/(71+9*58^(1/2))^(1/3)+1/3-((1/2)*I)*3^(1/2)*(-(1/3)*(71+9*58^(1/2))^(1/3)+(7/3)/(71+9*58^(1/2))^(1/3))

(8)

m3 := Matrix(3, 3, [0, x^2, 1/x, 0, 2*x, 1/x^2, 1/x, 2, 2/x^3])

Matrix(%id = 18446744078348970214)

(9)

Determinant(m3, method = multivar)

Determinant(Matrix(%id = 18446744078348970214), method = multivar)

(10)

``

m3 := Matrix(3, 3, [0, x^2, 1/x, 0, 2*x, 1/x^2, 1/x, 2, 2/x^3])

``

``


 

Download project_27.mw

 

 

 

Lets say I have a circle with the eqn 

x^2 + y^2 - 10*x - 75 = 0

Is there a command which would allow me to convert the above to (x-5)^2+y^2=100 ? 

I have tried to both collect, factor but neither of these work for obvious reason. 

So any idea/surgestion on which command one could use? 

Many thanks in advance.  

i have try to solve these eq by maple 

and i got these errors 

 

new2fornet.maple

 

simplify(series(sin(g(x)),x=0,4));

 

sin(g(0)) + cos(g(0))*D(g)(0)*x + (-1/2*sin(g(0))*D(g)(0)^2 + 1/2*cos(g(0))*(D@@2)(g)(0))*x^2 + (1/6*(-D(g)(0)^3 + (D@@3)(g)(0))*cos(g(0)) - 1/2*sin(g(0))*(D@@2)(g)(0)*D(g)(0))*x^3 + :-O(1)*x^4

 

and I'd like to give the various values for g to evaluate the series. That is, I know g and it's derivatives at 0.

Maple 2019.2.

These two expressions are mathematically equivalent:

But simplify(expr1-expr2) does not give zero where simplify(convert(expr1,trig)-expr2) does.

Is this normal behavior or can be expected sometimes? As a user I would have expected Maple internally to figure all of this itself. Compare to Mathematica:

Is there a different command in Maple that will show mathematical equivalence of two expressions to try other than simplify?

Thanks
 

restart;

expr1:=(-exp(n*Pi*(2*b - y)/a) + exp(n*Pi*y/a))/((exp(2*n*Pi*b/a) - 1)):
expr2:= sinh(n*Pi/a*y)/tanh(n*Pi/a*b)-cosh(n*Pi/a*y):
simplify(expr1-expr2);

(-sinh(n*Pi*b/a)*exp(n*Pi*(2*b-y)/a)+(-sinh(n*Pi*y/a)*cosh(n*Pi*b/a)+cosh(n*Pi*y/a)*sinh(n*Pi*b/a))*exp(2*n*Pi*b/a)+(exp(n*Pi*y/a)-cosh(n*Pi*y/a))*sinh(n*Pi*b/a)+sinh(n*Pi*y/a)*cosh(n*Pi*b/a))/((exp(2*n*Pi*b/a)-1)*sinh(n*Pi*b/a))

simplify(convert(expr1,trig)-expr2);

0

 


 

Download q.mw

 

How to change default directory for Maple 2019?

Solving_ODE.mw

 

Here is an example.  How would I solve this non-homogeneous system of ODEs

Is there a guide for programming in maple?  I mean like using it like a normal programming language using the code editor (external one not the whole worksheet thing maple has by default) debugging writing functions and the lot.

Source of interest in this topic.  There is a problem with drawing a cylinder. I draw a cylinder using the arrow function as follows:

cylinder := seq(arrow(`<,>`((L[1][i]+L[4][i])*(1/2), (L[2][i]+L[5][i])*(1/2), (L[3][i]+L[6][i])*(1/2)), `<,>`(-(L[1][i]+L[4][i])*(1/2)+(L[7][i]+L[10][i])*(1/2), -(L[2][i]+L[5][i])*(1/2)+(L[8][i]+L[11][i])*(1/2), -(L[3][i]+L[6][i])*(1/2)+(L[9][i]+L[12][i])*(1/2)), width = 1, color = green, head_length = 0, head_width = 0, length = VectorNorm(`<,>`((L[1][i]+L[4][i])*(1/2)-(L[7][i]+L[10][i])*(1/2), (L[2][i]+L[5][i])*(1/2)-(L[8][i]+L[11][i])*(1/2), (L[3][i]+L[6][i])*(1/2)-(L[9][i]+L[12][i])*(1/2)), 2), transparency = 0.), i = 1 .. N+1):

(L [j], j = 1..12 - the coordinates of the red points on the cylinder).


But, as you can see, because of the faces, everything does not turn out very smoothly. Is there a way to display the cylinder smoothly, but so that without too much computing resources, ie no more resource than a "arrow"?

Hai

Help required to plot the graphs for system  difference schemes .

 I am attaching the codes and sample graphs and  maple query but still getting  error.

here is the codes 

restart;
restart; Digits := 1;
Pr:=0.01:E:=1:a:=0:N:=10:

`&Delta;t`:=0.01:`&Delta;y`:=0.01:

#Discritization scheme

for i from 1 by 1 while i<=N do;  
end:
for j from 0 by 1 while j<=N do;
end:

eq1[i, j] := (U[i, j+1]-U[i, j])/`&Delta;t` = (1/2)*Gr*(theta[i, j+1]+theta[i, j])+(1/2)*Gc*(C[i, j+1]+C[i, j])+(U[i-1, j+1]-2.*U[i, j+1]-2.*U[i, j]+U[i+1, j])/(2.*`&Delta;y`)^2-(1/2)*M*(U[i, j+1]+U[i, j]):

eq2[i, j] := (theta[i, j+1]-theta[i, j])/`&Delta;t` = (1/Pr)*(theta[i-1, j+1]-2*theta[i, j+1]+theta[i+1, j+1]+theta[i-1, j]-2*theta[i,j]+theta[i+1,j])/(2.*`&Delta;y`)^2-E*((1/`&Delta;y`)^2*(U[i+1, j]-U[i, j])^2):

eq3[i, j] := (C[i, j+1]-C[i, j])/`&Delta;t` = (1/Sc)*(C[i-1, j+1]-2*C[i, j+1]+C[i+1, j+1]+C[i-1, j]-2*C[i,j]+C[i+1,j])/(2*`&Delta;y`)^2-(K/2)*(C[i, j+1]-C[i, j]):
end do;  
Error, reserved word `end` unexpected
end do:
Error, reserved word `end` unexpected

# initial conditions
U[i, 0] := 0:
theta[i, 0]:= 0:
C[i, 0] := 0:
 

NULL;
U[0,j]:=exp(a*j*`&Delta;t`):
theta[0,j]:=(j*`&Delta;t`):
C[0,j]:=j*`&Delta;t`:

U[N,j]:=0:
theta[N,j]:=0:
C[N,j]:=0:

sys := ([seq])(seq(eq[i, j], j = 0 .. N), i = 1 .. N):
nops(sys);
vars:=indets(sys):
nn := Matrix(N+1, N+1,(i, j)-> U[i-1, j-1]):
##
p:=proc(kk) local U_res,A;
  U_res:=solve(eval(sys,k=kk),vars);
  A:=eval(nn,U_res);
  plots:-matrixplot(A)
end proc;

plots:-(U,[M],Y=0..4);

 

https://www.mapleprimes.com/questions/225117-How-To-Solve-This-Error-In-Maple

 

I have just upgraded my laptop from Windows 7 to Windows 10.  On starting up Maple 2018,  I receive the attached message on screen.  This is after previously loading the worksheet successfully.   Today,  I am not able to do so.  I need to permanently register my firewall to allow Maple to run; can anyone help?

Melvin

 

The routines for finding nonclassical symmetries of PDE, mentioned in the research articles are not currently available. The routines like GENDEFNC may have been changed to other one. Please tell how to find nonclassical symmetries of a PDE or a system of PDE. I am using Maple 2016.

I've found the Taylor series expansions for two functions.  The two expansions are identical until the third term.  When I subtract one expansion from the other, I expected that the identical terms would cancel and disappear.  But I can't get Maple to do this.  If I copy and paste the output into a Maple command, the "big Oh" terms are not treated correctly.  The correct answer would be (x^3)/6 + O(x^4).  Here's my work:
 

taylor(ln(1+x), x = 0, 4)

series(x-(1/2)*x^2+(1/3)*x^3+O(x^4),x,4)

(1)

taylor(ln(1+sin(x)),x=0,4)

series(x-(1/2)*x^2+(1/6)*x^3+O(x^4),x,4)

(2)

 

(series(x-(1/2)*x^2+(1/3)*x^3+O(x^4),x,4))-(series(x-(1/2)*x^2+(1/6)*x^3+O(x^4),x,4))

(series(x-(1/2)*x^2+(1/3)*x^3+O(x^4),x,4))-(series(x-(1/2)*x^2+(1/6)*x^3+O(x^4),x,4))

(3)

collect((3),x)

(series(x-(1/2)*x^2+(1/3)*x^3+O(x^4),x,4))-(series(x-(1/2)*x^2+(1/6)*x^3+O(x^4),x,4))

(4)

x-(1/2)*x^2+(1/3)*x^3+O(x^4)-x+(1/2)*x^2-(1/6)*x^3-O(x^4)

(1/6)*x^3

(5)

x-(1/2)*x^2+(1/3)*x^3+O(x^4)-x+(1/2)*x^2-(1/6)*x^3-O(x^4)

(1/6)*x^3

(6)

``

How can I get Maple to give me the right answer?  I tried various commands (collect, combine, simplify, etc.) but nothing worked.  Also, why do the font and color of my first two commands differ?  Thanks
 

Download Taylor_question.mw

First 490 491 492 493 494 495 496 Last Page 492 of 2097