gkokovidis

2355 Reputation

13 Badges

20 years, 132 days
Draeger Medical Systems, Inc.

 

 

Regards,
Georgios Kokovidis
Dräger Medical

MaplePrimes Activity


These are answers submitted by gkokovidis

Take a look at this line below.  i=1..n.  How many data points do you have?  There are 15 X values and 15 Y values.

dist:=add( (- m*x[i] - q + y[i])^2, i=1..n);

Therefore, n has to be 15.  See attached.

 

restart:

X:= <2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014>:

Y:= <1234.822,1295.155,1340.097,1384.18,1446.114,1492.063,1554.51,1611.05,1617.651,1571.979,1601.576,1633.443,1611.285,1602.746,1613.41>:

L:= Statistics:-LinearFit([1,x], <X|Y>, x);

plot([<X|Y>, L], x= min(X)..max(X), style= [point, line]);

-HFloat(52524.06159166722)+HFloat(26.921475000000267)*x

 

 

``

``

n:=15;

dist:=add( (- m*X[i] - q + Y[i])^2, i=1..n);

eq1:=diff(dist,m)=0;eq2:=diff(dist,q)=0;

 

15

 

(-2000*m-q+1234.822)^2+(-2001*m-q+1295.155)^2+(-2002*m-q+1340.097)^2+(-2003*m-q+1384.18)^2+(-2004*m-q+1446.114)^2+(-2005*m-q+1492.063)^2+(-2006*m-q+1554.51)^2+(-2007*m-q+1611.05)^2+(-2008*m-q+1617.651)^2+(-2009*m-q+1571.979)^2+(-2010*m-q+1601.576)^2+(-2011*m-q+1633.443)^2+(-2012*m-q+1611.285)^2+(-2013*m-q+1602.746)^2+(-2014*m-q+1613.41)^2

 

120842030*m+60210*q-90771941.17 = 0

 

60210*m+30*q-45220.162 = 0

(1)

solve({eq1,eq2},{m,q});

{m = 26.92149286, q = -52524.09743}

(2)
 

 

Download EquationOfLine.mw

Regards,

Georgios

If you define epsilon before using "solve", you will see that one of the solutions returned is the same as "fsolve", where you supplied epsilon ahead of time.

The system has more than one solution for d[0], and "fsolve" returns just that, one of the solutions.  "solve", after your substitution, happens to return another one, but if you look at all of the solutions, you will see that both "solve" and "fsolve" find what you call the "correct" one.

In order to see what solve is returning, remove your colon at the end of the command, and replace it with a semicolon, so you can see the complete output.  

 

restart

eq3 := 2*d[2]+(1/3)*(6*d[3]*11) = (d[1]+(1/3)*(2*d[2]*11)+3*d[3]*(11/3)^2)^2/(d[0]+11*d[1]*(1/3)+d[2]*(11/3)^2+d[3]*(11/3)^3)-`&epsilon;`*(d[0]+11*d[1]*(1/3)+d[2]*(11/3)^2+d[3]*(11/3)^3)/(11/3)^2

eq4 := 2*d[2]+(1/3)*(6*d[3]*19) = (d[1]+(1/3)*(2*d[2]*19)+3*d[3]*(19/3)^2)^2/(d[0]+19*d[1]*(1/3)+d[2]*(19/3)^2+d[3]*(19/3)^3)-`&epsilon;`*(d[0]+19*d[1]*(1/3)+d[2]*(19/3)^2+d[3]*(19/3)^3)/(19/3)^2

eq5 := d[0]+d[1]+d[2]+d[3] = 8

eq6 := d[0]+9*d[1]+d[2]*9^2+d[3]*9^3 = 2

epsilon := -.1;

-.1

(1)

solve({eq3, eq4, eq5, eq6}, {d[0], d[1], d[2], d[3]})

{d[0] = 12.42847752-4.451192195*I, d[1] = -4.866517349+5.658026338*I, d[2] = .4412976144-1.285973836*I, d[3] = -0.3257788957e-2+0.7913969260e-1*I}, {d[0] = 9.660121267, d[1] = -1.819054253, d[2] = .1653561424, d[3] = -0.6423155722e-2}, {d[0] = 13.10563730, d[1] = -5.960152219, d[2] = .8956877261, d[3] = -0.4117280266e-1}, {d[0] = 12.42847752+4.451192195*I, d[1] = -4.866517349-5.658026338*I, d[2] = .4412976144+1.285973836*I, d[3] = -0.3257788957e-2-0.7913969260e-1*I}

(2)

restart

eq3 := 2*d[2]+(1/3)*(6*d[3]*11) = (d[1]+(1/3)*(2*d[2]*11)+3*d[3]*(11/3)^2)^2/(d[0]+11*d[1]*(1/3)+d[2]*(11/3)^2+d[3]*(11/3)^3)-epsilon*(d[0]+11*d[1]*(1/3)+d[2]*(11/3)^2+d[3]*(11/3)^3)/(11/3)^2:

eq4 := 2*d[2]+(1/3)*(6*d[3]*19) = (d[1]+(1/3)*(2*d[2]*19)+3*d[3]*(19/3)^2)^2/(d[0]+19*d[1]*(1/3)+d[2]*(19/3)^2+d[3]*(19/3)^3)-epsilon*(d[0]+19*d[1]*(1/3)+d[2]*(19/3)^2+d[3]*(19/3)^3)/(19/3)^2:

eq5 := d[0]+d[1]+d[2]+d[3] = 8:

eq6 := d[0]+9*d[1]+d[2]*9^2+d[3]*9^3 = 2:

epsilon := -.1

-.1

(3)

fsolve({eq3, eq4, eq5, eq6}, {d[0], d[1], d[2], d[3]})

{d[0] = 9.660121266, d[1] = -1.819054253, d[2] = .1653561425, d[3] = -0.6423155731e-2}

(4)

assign(%)

simplify(d[0])

9.660121266

(5)
>

 

Download Maple_Question_Solve_Fsolve.mw

Regards,

Georgios

Don not copy the "Then solve for m,q " part.  @ vv is trying to explain to you what to do.

Part 1:  Define n and dist, as below.

n:=4;
dist:=add( (- m*x[i] - q + y[i])^2, i=1..n);

Part 2:  Sovle for m and q, with the command below:

diff(dist,m)=0, diff(dist,q)=0;

So, this is what you would copy and paste into your worksheet:

n:=4;
dist:=add( (- m*x[i] - q + y[i])^2, i=1..n);

diff(dist,m)=0, diff(dist,q)=0;

Regards,

Georgios

Increase Digits after restart, and rerun your worksheet.

restart:Digits:=20:

I ran it on Windows 7 64-bit, Maple 18.02, before and after.  Holes disappeared.  Do not have an explanation.

Regards,

Georgios

Could be a version issues.  The contents below were created in Maple 18, GUI and command line.  No difference.

 

restart:

 

aa:=expand((((o * (((h * h - h * v) * (a * h - a * v) * h * h * h * h * a * a * h - h * h * h * a * a * h * o * (h * h - h * v) * (a * h - a * v)) * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * (a * h - a * o) * (h * h - h * v) * (h - v)) * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * ((v * (a * h - a * v) * h * h * h * a * a * h - h * a * a * h * (h * h - h * v) * v * (a * h - a * v)) * a * a * h * h * h * h * h - h * a * a * h * h * h * h * a * a * h * (a * h - a * o) * (v * h * h * h - h * (h * h - h * v) * v))) * h * a * a * h * h * a * a * h * a * a * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h * o * (((a * h - a * v) * h * a * a * h - a * a * h * o * (a * h - a * v)) * a * a * h * h - a * a * h * h * a * a * h * (a * h - a * o) * (h - v))) * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h - h * h * h * a * a * h * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * h * h * a * a * h * a * a * h * h * h * h * h * h * a * a * h * h * a * a * h * a * a * h * h * (o * (v * (a * h - a * v) * h * h * h * a * a * h - h * a * a * h * (h * h - h * v) * v * (a * h - a * v)) * a * a * h * h * h * h * h - h * a * a * h * h * h * h * a * a * h * (a * h - a * o) * (v * v * h * h * h - h * (h * h - h * v) * v * v))) );

-a^77*h^97*o*v^2+a^77*h^97*v^3-a^23*h^40*o*v^2+a^23*h^40*v^3

(1)

bb:=-a^77*h^97*o*v^2+a^77*h^97*v^3-a^23*h^40*o*v^2+a^23*h^40*v^3;

-a^77*h^97*o*v^2+a^77*h^97*v^3-a^23*h^40*o*v^2+a^23*h^40*v^3

(2)

aa-bb;

0

(3)

Download cline.mw

Regards,

Georgios

You can break it up into 3 seperate plot structures, and then combine them.

aa:=plot(cc1, P[B] = .096 .. .2,color=blue): bb:=plot(cc2, P[B] = .408 .. .5,color=green): cc:=plot(P[B], P[B] = 0 .. .5):

with(plots):display(aa,bb,cc);

Regards,

Georgios

The above commands give me the same error, Error, `DETools` does not evaluate to a module.

If I remove the short form version of the command, after loading DEtools, then it works fine.

with(DEtools):
DEplot(diff(x(t), t)-x(t), x(t), t = -1 .. 1, {x(0) = 1});

Maple version 18.02 on Windows 7 64-bit.
 

Regards,

Georgios

One option is to start with a known test template document, that you created, in the default startup directory, that the students have to open, in order to complete their assignment.  Then enable autosave, as seen in the picture below, with a small time period.  Apply Globally.

Regards,

Georgios

 

As was mentioned, your current file does not contain Maple code. 

Look to see if you have a backup version, in one of your directories.  Maple

saves files with  a .bak extension, as well as with a .sav extension. 

Regards,

Georgios

Here is one way.

restart:

with(plots):

a:=plot([[1,1],[10,20]]):

b:=plot([[10,20],[30,23]]):

c:=plot([[30,23],[12,30]],color=["Blue"]):

display({a,b,c});

 
 

 

Download plotcolor.mw

Regards,

Georgios

The worksheet below uses the Syrup package, written by Joe Riel.  It can be found here.

restart:interface(warnlevel=0):with(plots):with(Syrup):

 

rc_two_pole:=`

V1 1 0 10

R1 1 2 1e3

R2 2 3 1e3

C1 2 0 1e-9

C2 3 0 1e-9
.end`:

ans:=syrup(rc_two_pole,ac);

ans := {v[1] = 10, v[2] = 10000000*(s+1000000)/(s^2+3000000*s+1000000000000), v[3] = 10000000000000/(s^2+3000000*s+1000000000000)}

(1)

s:=I*2*Pi*f: H := eval(subs(ans, v[3]/v[1]));

H := 1000000000000/(-4*Pi^2*f^2+(6000000*I)*Pi*f+1000000000000)

(2)

T:=unapply(H,f);

T := proc (f) options operator, arrow; 1000000000000/(-4*Pi^2*f^2+(6000000*I)*Pi*f+1000000000000) end proc

(3)

G:=f->20*log10(abs(T(f)));

G := proc (f) options operator, arrow; 20*log10(abs(T(f))) end proc

(4)

semilogplot(G(f),f=0.1..100e3,numpoints=2000,axes=boxed);

 

Download transferfunction.mws

Regards,

Georgios

 

I was able to cut and paste the output from a worksheet into the editor.  It did not work directly, as there was a pop-up message (below) about my browser security settings.  I am using Firefox 50.0 on Win7 64-bit.  The message is

Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.
Please paste inside the following box using the keyboard (Ctrl/Cmd+V) and hit OK

 

 

Regards,

Georgios Kokovidis

Dräger Medical

By using a float inside of the integration, Maple 18.02 computes the approximate answer instantaneously.

restart:

int((abs(sin(2.0*x))-abs(sin(x)))/x, x = 0 .. infinity);

.4412712003

(1)

identify(%);

2*ln(2)/Pi

(2)

 

Download Frun.mw

Regards,

Georgios

Another option for finding arclength is to use the Arc Lengths tutor.

This can be found under the Tools-Tutors-Calculus Single Variable - Arc Lengths tab.

Regards,

Georgios Kokovidis

Dräger Medical

I do not see an error when I execute your script, using x(0) = f1(3), Maple 2015.2.  But, one way to avoid an error, is to pass your function a float.  This way, it will use the evaluated verison of f1, instead of sin(3).  See worksheet below.

restart:

f1 := t -> sin(t);

f2 := t -> cos(t);

dsys := {diff(x(t), t) = x(t)*f1(t)+f2(t), x(0) = f1(3.0)};

solution_procedure := dsolve(dsys, type = numeric, output = listprocedure);

 

proc (t) options operator, arrow; sin(t) end proc

 

proc (t) options operator, arrow; cos(t) end proc

 

{diff(x(t), t) = x(t)*sin(t)+cos(t), x(0) = sin(3)}