gkokovidis

2370 Reputation

13 Badges

20 years, 291 days
Draeger Medical Systems, Inc.

 

 

Regards,
Georgios Kokovidis
Dräger Medical

MaplePrimes Activity


These are answers submitted by gkokovidis

This might be a bug.  Maple does not like improper transfer-functions, where degree(num) > degree(den), or the numerator in "s" being an order higher than the denominator, regardless of denominator value.  For example,

restart:
with(DynamicSystems):
sys1 := TransferFunction(s):PrintSystem(sys1);

gives, Warning, improper transfer-function, degree(num) > degree(den)

Even if you were to convert (k*s^2/(s+20))  to  (k*s-20*k+400*k/(s+20)), you would get the same error in your example. 

Try using block diagram reduction equations in Maple directly and then plugging the output into your system.

 

restart:

a:=(10/(s*(s+10)));

(1)

b:=(k*s^2/(s+20));

(2)

tfsyspos:=a/(1+a*b);

(3)

simplify(%);

(4)

tfsysneg:=a/(1-a*b);

(5)

simplify(%);

(6)

 

Download tfsys.mw

 

 

Regards,

Georgios Kokovidis

Dräger Medical

Another way to test equivalence using evalb.

restart:

a:=(x+3)^2*(x-4);

           (1)

b:=x^3+2*x^2-15*x-36;

 (2)

expand(a)-b;

                                                         (3)

evalb(expand(a)-b=0);

                                                   (4)

 

 

Download evalbpoly.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

Look at the help page for the ?isolate command.

 

Using one of your equations from above:

isolate(v=L*(iM-im)/Ton,im);

          im = -v*Ton/L+iM

 

Regards,

Georgios Kokovidis

Dräger Medical

The minimize and maximize commands do not work over the whole range for your piecewise defined function (0..1).  Try the Minimize and Maximize commands, which are part of the Optimization package.  Unlike the minimize and maximize commands, the computation is performed in floating-point for Minimize and Maximize.

 

restart:

g:=x->(piecewise(0 <= x, 7.5, 0))-(piecewise(0.5 < x,9, 0))-(piecewise(0.4 < x and x <= 0.6, 30*x-12, 0.6 < x,6, 0));

(1)

plot(g,0..1);

 

maximize(g(x),x=0.45..0.55,location);

(2)

maximize(g(x),x=0..0.55,location);

(3)

with(Optimization):Digits:=20:

Minimize(g(x),x=0..1);

(4)

Maximize(g(x),x=0..1);

(5)

Maximize(g(x),x=0.45..0.55);

(6)

Maximize(g(x),x=0..0.55);

(7)

 

 

Download minmaxpiecewise.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

See examples at the end of the help file for ?odeplot command.

 

Regards,

Georgios Kokovidis

Dräger Medical

Hard to say without looking @ your code:



 

restart:

with(DEtools):

eq:=diff(y(t),t)=.2*t*y(t);

(1)

DEplot(eq,y(t),t=-1..1,y=-1..1);

 

eq2:=diff(y(x),x) =.2*x*y(x);

(2)

DEplot(eq2,y(x),x=-1..1,y=-1..1);

 

 

 



Download dirfield.mw

 

 

 

Regards,

Georgios Kokovidis

Dräger Medical

dualaxisplot should work for this.  See example below.

with(plots):
listplot([seq([i,i],i=1..10)]);
listplot([seq([i,1/i],i=1..10)]);

a1:=listplot([seq([i,i],i=1..10)],color=red):
a2:=listplot([seq([i,1/i],i=1..10)],color=blue):
dualaxisplot(a1,a2);

Regards,

Georgios Kokovidis

Dräger Medical

One way to preclude your code from executing would be to make it a comment.  Put a number sign '#' in front of each line that you wish to remain inactive.

Regards,

Georgios Kokovidis

Dräger Medical

One way to do this is with functional notation.

 

g := x -> x^2;

(1)

L:=[1,2,3,4,5];

(2)

g~(L);

(3)

 

 

Without functional notation, you could do it like this, using L from above.

seq(x^2 , x = L);

Using eval.

f:=x^2;

seq(eval(f,x=L[i]),i=1..nops(L));

Download func_notation.mw

 

 

Regards,

Georgios Kokovidis

Dräger Medical

If you plot your function, and then zoom in using range values for x and y, you will see that it has 2 roots.  fsolve will find both of them, depending on where your guess value for x happens to be.  You can then use fsolve with the avoid option.  Another way is to use the Roots command from the Student[Calculus1]) package.  This will find both roots over the given range.  Either way, starting with a plot is a good idea to get an overview of what your function looks like.



 

restart:

equ1:=(500*.87)*(1-(1/x)^.2385)-(288*(x^.3174-1))/(.85);

(1)

plot(equ1, x=0..2,y=-0.5..0.5);

 

with(Student[Calculus1]):

Roots(equ1, 0.5 .. 1.5);

(2)

fsolve(equ1,x=1.2);

(3)

fsolve(equ1,x,avoid={x=1});

(4)

 

 



Download solve_eq.mw

 

Regards,

Georgios Kokovidis

Dräger Medical

remove is the command you are looking for.

?remove will take you to the help page with examples.

 

Regards,

Georgios Kokovidis

Dräger Medical

Without making changes to your code, you can add the following line right after fsolve...

assign(%);

Then, if you enter a[5], you will get 7.837455611.

 

Regards,

Georgios Kokovidis

Dräger Medical

Here is one way.  There might be a command, but it is not obvious to me right now.



restart:

R[1]:=-20;

(1)

R[7]:=4;

(2)

R[2]:=-10;

(3)

R[3]:=0;

(4)

R[4]:=3.1;

(5)

R[5]:=7;

(6)

R[6]:=24;

(7)

a1:=seq(R[i],i=1..7);

(8)

a2:=sort([a1],`<`);

(9)

for i from 1 by 1  while type(a2[i],posint) = false do od; print(a2[i]);

(10)

 



Download smallest_int_find.mw

Regards,

Georgios Kokovidis

Dräger Medical

The command for plotting points in 3d is ?pointplot3d.  You can create your own points in the worksheet, or import them from a file.  An example below, taken from the help pages, with a few tweaks.

 



 

?pointplot3d

 

 

 



Download pplot3d.mw

 

 

Regards,

Georgios Kokovidis

Dräger Medical

Look at the code below, and compare it to what you did to see where the problems occur.  First is the use of * as a multiplication between x and y.  Second, you have y as a function of x, so you must use it this way when you describe the differential equation.  The help file for the dfieldplot command shows this as well.  Start there, and use the examples provided as a "template" for the rest of your problems.



 

restart:

with(DEtools):

dfieldplot(diff(y(x), x) = sin(x*y(x))+3*x^2+x^(1/3)+4*y(x)^2+5*y(x), y(x), x = -5 .. 5, y = -5 .. 5, title = `tangent field`, color = black);

 

 

 



Download dfieldplot_exampl.mw

 

 

Regards,

Georgios Kokovidis

Dräger Medical

First 20 21 22 23 24 25 26 Last Page 22 of 75