Thomas Dean

322 Reputation

10 Badges

19 years, 113 days

MaplePrimes Activity


These are questions asked by Thomas Dean

I tried the example in BodePlot help.

restart;
with(DynamicSystems):
sys := TransferFunction( 1/(s-10) ):
BodePlot(sys);


That works OK. But, if I invoke Syrup, the example no longer works.

restart;
with(Syrup);
with(DynamicSystems):
ckt := [V, Rsrc(50), C1(15e-9), L1(15e-6), C2(22e-9), L2(15e-6), C3(22e-9), L3(15e-6), C4(15e-9), 1, Rload(50)];

TF := subs(other, V=1, v[Rload]);
sys := TransferFunction(TF);

BodePlot(sys);
I get a message "not a valid plot structure".  OK, try the example, again.

sys := TransferFunction( 1/(s-10) ):
BodePlot(sys);
I also get the "not a valid plot structure" message.

What am I doing wrong?

This started as calculating the location of a machine tool bit that is tangent to a line and a circle.  I watched the part being made.  The machinist moved the tool bit manually until it touched straight and circular markings on a aluminum blank.  Repeating this two times, recording the x-y values, the g-code was altered and the CNC machine started to make the part.  Should be a simple calculation, right?

Well, not for me:

restart; with(geometry):
## Find the (x, y) location of a machine mill path such that the tool is
## tangent to a line and a circle.
##
## Given a line, L1, and a circle, C1, find a circle, C4 tangent to
## both L1 and C1.  Choose the X value of C4 to be such that the
## center of C4 is between the intersection of L1 with the X axis and
## origin.
x0 := (3+1/2)/2;
x1 := x0; y1 := x0 + (1+1/4);
point('P1', x1, y1); ## center of the circle

circle('C2', [P1, x0]);

## X value for line L1
x3 := (3+1/2)/2-(3/4+20/1000)/2-1/2; y3 := 1+1/4; evalf([x3, y3]);
## points P2 and P3 lie on the line
point('P2', x3, 0); point('P3', x3, y3);
line('L1', [P2, P3]);

intersection('I1', L1, C2);
for s in I1 do print(evalf(coordinates(s))) end do;

tr := 1/8;  ## tool radius, radius of C4
## find P4 such that C4 is tangent to L1
x4 := x3 - tr;
## P4 moves parallel to L1
point('P4', x4, 'y4');
circle('C4', [P4, tr]);
Equation(C4); Equation(C2);
intersection('I2', C2, C4);
## fails

## The centerline of the part is at x = (3+1/2)/2 Another dimension of
## the part, is (3/4+20/1000), centered on the centerline.  A second
## dimension of the part is 1/2.  From the physical layout of the
## part, observe that
x_value := (3+1/2)/2 - (3/4+20/1000)/2 - 1/2 - tr: evalf(%);
eq1 := subs(x = x_value, Equation(C4)); eq2 := subs(x = x_value, Equation(C2));
sol := solve([eq1, eq2]); evalf(%);
evalf(sol);

## want the solution with the least y value for point P4
res1 := subs(sol[1], coordinates(P4));
res2 := subs(sol[2], coordinates(P4));

if evalf(res1[2]) < evalf(res2[2]) then
    soln := res1;
else
    soln := res2;
end if;
evalf(soln);

point('P8', soln); evalf(coordinates(P8));
circle('C8', [P8, 1/8]); evalf(Equation(C8)); evalf(Equation(C2));
## the intersect fails  Why?

intersection('I8', C2, C8);

evalf(coordinates(I8[1])); evalf(coordinates(I8[2]));

solve([Equation(C2), Equation(C8)]); evalf(%);
print("The location is", evalf(soln));

 

I was working through some example problems and came across this statement.  Actually comparing Sympy results to Maple. (I prefer Maple).

"Calculate the volume integral of f(...) over the sphere of radius r"

I can solve the problem, but, got hung up on the exact meaning of the problem statement.

Tom Dean

restart
with(VectorCalculus):
with(LinearAlgebra):

## http://www.acme.byu.edu/wp-content/uploads/2017/08/Sympy.pdf
## Problem 7

f := proc(x, y, z)
    (x^2 + y^2 + z^2)^2
end proc;

(M, d) := Jacobian([rho*sin(phi)*cos(theta),
                    rho*sin(phi)*sin(theta),
                    rho*cos(phi)],
                   [rho, phi, theta],
                   'determinant' );
abs(d);
simplify(%);

eqn := f(rho*sin(phi)*cos(theta), rho*sin(phi)*sin(theta), rho*cos(phi));
eqn := eqn * abs(simplify(d));

soln := int(eqn,[rho=0..r,theta=0..2*Pi,phi=0..Pi]);
subs(r=3, soln);

 

I am attempting to reproduce the results claimed by analog.com for a band pass filter.

I have checked the circuit specification and found no errors.

Am I expecting too much or am I doing something wrong?

## www.analog.com/designtools/en/filterwizard/
## Filter Requirements for Band-Pass, 4th order Butterworth
## Specifications: Optimize for Power, +Vs= 5, -Vs= -5
## Gain: 10 dB
## Passband: -3dB at 2kHz
## Stopband: -40dB at 40kHz
## Component Tolerances: Capacitor = 5%; Resistor = 1%; Inductor = 5%; Op Amp GBW = 20%

restart;
with(Syrup); Version;
with(DynamicSystems):

ckt := "*60 kHz Band Pass Filter  \n\
vin 1   0 \n\
R1A 1   2 165k \n\
R1B 5   7 169k \n\
R2A 2   0 976 \n\
R2B 7   0 1k \n\
R3A 6   0 221 \n\
R3B 11  0 226 \n\
R4A 5   6 12.7k \n\
R4B 10 11 12.7k \n\
R5A 4   3 97.6k \n\
R5B 9   8 100k \n\
R98 3   0 1e9 \n\
R99 8   0 1e9 \n\
C1A 2   4 270pF \n\
C1B 7   9 270pF \n\
C2A 2   3 270pF \n\
C2B 7   8 270pF \n\
* \n\
X1A 6  3 5  NonIdealOpAmp \n\
X1B 11 8 10 NonIdealOpAmp \n\
.include Library:-NonIdealOpAmp \n\
.end";

volts, others := Solve(ckt, 'ac', 'returnall');
gain := eval(v[10]/vin, volts);
H := subs({A=80000, f0=15*10^6, Ro=100}, gain);
evalf(H);
tf := evalf(H);
sys := TransferFunction(tf);
PrintSystem(sys);
plotsetup(maplet);
MagnitudePlot(sys);

 

I use Ubuntu 14.04 and X, not the desktop.  I use emacs/maple 2016.

GNU Emacs 25.1.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2017-03-1

;;; maplev.el --- Maple mode for GNU Emacs

;; Authors:    Joseph S. Riel <joer@k-online.com>
;;             and Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
;; Time-stamp: "2003-10-09 22:49:16 joe"
;; Created:    June 1999
;; Version:    2.155
;; Keywords:   Maple, languages
;; X-URL:      http://www.k-online.com/~joer/maplev/maplev.html
;; X-RCS:      $Id: maplev.el,v 1.14 2006-06-02 14:02:38 joe Exp $

I use emacs/maple mode with maple 2016.  Quite often, emacs looses connection with the maple server.  I do  not remember this happening or maybe not as often, with earlier versions of maple.

After using maple/emacs, I started xmaple.  After a few expression evaluations, the maple server stopped.  Restarting xmaple and repeating the expression evaluations many times, I do not get the crash.  So, this appears to be a difficulty with external connections to the maple server.

Does a later version of maple mode exist?

 

First 8 9 10 11 12 13 14 Page 10 of 15