Carl Love

Carl Love

26488 Reputation

25 Badges

12 years, 266 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

The output of plottools:-transform, which you've assigned to t1, is a procedure, so you need to use procedure-calling syntax to use it. Change t1{p1, p2, p3} to

t1~([p1, p2, p3])

Or, you can use t1 to operate on the combined plot like this:

t1(plots:-display(p1, p2, p3))

If you're performing a chain of substitutions, it doesn't make sense to me to introduce intermediate variables that are both

  1. not wanted in the final result,
  2. not eliminated by some part of the chain.

That's the case with your f0, and it's what causes your troubles. Just remove f0 from equ5.

You've also made a logical error in equ4`w__k,norm` should be w__k because `w__k,norm` is already eliminated by equ1.

The command subs is inappropriate for doing sophisticated algebra; a better choice is simplify with side relations (see ?simplify,siderels).

After making those corrections, this will do the conversion that you want:

expand(
    simplify(
        errfunc, combinedSet,
        #Since combinedSet has 7 equations, it's best to choose 7 variables to eliminate, but
        #there's some flexibility allowed in which you choose and in which order you put them. 
        [Z__k, Z0, R__x, C__x, L__x, w__k, z__k]
    )
);

 

Let's say that your original sequence of solutions is named sols. Then do

solsnn:= select(type, {sols}, set(name=nonnegative))[];

The Answer by @mmcdara is very educational. You can learn a lot about systems of equations and about solving them with Maple from it, and you should study it. Nonetheless, there is an easier way which isn't so educational.

restart:
(ia, va, ib, vb):= Vector~(4, symbol=~ [Ia, Va, Ib, Vb])[]: 
(ya, yb):= Matrix~((4,4), symbol=~ [Ya, Yb])[]:
ConnectCondition:= 
    (Ia[3], Ia[4], Va[3], Va[4])=~ (-Ib[1], -Ib[2], Vb[1], Vb[2]) 
:
Y11Condition:= (Va[2], Vb[3], Vb[4])=~ 0:
Eqs:= eval(
    {seq(ya.va - ia), seq(yb.vb - ib)}, 
    {ConnectCondition, Y11Condition}
):
Svars:= seq~({ia, ib, va, vb}) intersect indets(Eqs) minus {Va[1]}: 
S:= subsindets(
    simplify(solve(Eqs, Svars)),
    patindex(anything),
    n-> cat(op(0,n), op(n))
):
lprint(Ia1 = eval(Ia1, S));
Ia1 = (((Ya44+Yb22)*Ya33+(-Yb21-Ya43)*Ya34+Ya44*Yb11+Yb11*Yb22-Yb12*Yb21-Ya43*
Yb12)*Ya11-Ya14*Ya33*Ya41+Ya13*Ya34*Ya41+Ya14*Ya31*Ya43-Ya13*Ya31*Ya44-Ya14*
Ya41*Yb11+Ya13*Ya41*Yb12+Ya31*(-Ya13*Yb22+Ya14*Yb21))*Va1/((Ya44+Yb22)*Ya33+(-
Yb21-Ya43)*Ya34+Ya44*Yb11+Yb11*Yb22-Yb12*Yb21-Ya43*Yb12)

The is the beginning of an HTML code for a special character; `>` is the "greater than" symbol >; `"` is the double-quotation symbol ". These are not part of ordinary Maple code (unless entered as a part of a quoted string). You must be copying from an HTML source. In actual Maple code, those 4 lines are

for m from n by -2 while n > 2 do
if errr > perrr or errrs > perrrs then
if derrr > 10^10 then
printf(" \134n");

I don't know what \134n in the last command means. Perhaps it's supposed to be just \n, which is the newline character.

All of that (isotherms, 3d plots of Nusselt number, skin friction, etc.) is covered in this Post: https://www.mapleprimes.com/posts/209715-Numerically-Solving-BVPs-That-Have-Many

Like this:

PlotEllipseFromMatrix:= proc(H::Matrix(2, realcons), C::Vector(2, realcons))    
local x, y, X:= <x,y>-C;
    if LinearAlgebra:-IsDefinite(H) = true then 
        algcurves:-plot_real_curve(X^+.H.X - 1, x, y)
    else
        error "not an ellipse, or it can't be determined"
    fi
end proc
:

 PlotEllipseFromMatrix(<3,1;1,1>, <1,2>);

One may wonder What is the difference between an explicit logarithmic plotting command and a simple plot with option axis= [mode=log]? The answer is that the explicit command chooses the points to plot so that the independent variable values will become roughly evenly spaced after the logarithm is applied; whereas the axis= [mode= log] option chooses exactly the same points as would've been chosen if the option weren't there and then applies the logarithm. Thus, your plot command sees the subrange 10^6..10^7 as an insignificant part (less than 1/1000th) of the overall range 10^6..10^10.

Here's the same thing using plots:-loglogplot:

restart:
Z__target:= 50e-3*Unit(ohm):
f__roll_off:= 35e6*Unit(Hz):
f__range:= 1e6..1e10:
Z__target_ac:= f-> Z__target*sqrt(1+(f/f__roll_off)^2):
plots:-loglogplot(
    Z__target_ac(f*Unit(Hz)), f= f__range, color= red,
    gridlines, axes= boxed, title= "    Target Impedance\n",
    labels= ["Frequency (Hz)", "Impedance (&Omega;)"],
    axis[2]= [tickmarks= [3, subticks= 4]],
    labeldirections= [horizontal, vertical]
);

Also, regardless of your plot command, there's no need for the log[10]10^20, or evalf in Z__target_ac.

Note how I controlled the tickmarks on the vertical axis with
axis[2]= [tickmarks= [3, subticks= 4]]

You say that expr is always a sum of terms. Then this should do what you want:

for item in [op](expr) do ... od

It may come as a suprise that the complex-valued function (-2)^x is a very smooth, continuous function of its real argument x, but here it is:

plot([(Re,Im)((-2.)^x), x= -2..2], scaling= constrained);

The fact that the integral signs are gray rather than blue suggests that there's a possibility of evaluating them with the value command. Try value(%) after pdsolve.

It's possible to automate this process so that starting with any univariate procedure f we can obtain a parameter-shifted g without needing to explicitly compute the inverse of the shift (that inverse is found automatically, and only once). Like this:

f:= (n::algebraic)-> `if`(n::complexcons, `if`(n=0,1,0), 'procname'(n))
:
shift:= proc(F::uneval, N::name)
local
    f:= eval(F,1), e:= eval(op(f)), 
    n:= `if`(nargs=2, N, indets(e, And(name, Not(constant)))[])
;
    subs(_f= op(0,f), _s= {solve}(e= _n, n), _n= n, _n-> _f~(_s)[])
end proc
: 
g:= shift(f(n+1/3)):
g(1/3), g(1), g(x);
                         1, 0, f(x - 1/3)

 

Change the first argument of the eval to

:-`.`(I__b, diff(`&omega;_`(t), t))

This restores (temporarily, for this statement only) the default matrix multiplication operator, which has been overloaded by Physics

An alternative is

use `.`= :-`.` in
    eval(
...
exactly what you had ...)
end use;

My personal choice for this very common situation is return with no argument, as in

set_r:= proc(r::integer) thismodule:-r:= r; return end proc;

I usually do this even if the result of the previous command is always NULL.

I was about to give you the patfunc answer, but you beat me to it. So, here's a shortcut syntax:

evalindets[2](expr, 'patfunc(identical(R0), anything)', 1= r0, subsop);

Yes, that help page is on my "speed dial", so to speak. Surely I've read it a few hundred times. So let me know if you have any questions about it.

Did you see the Reply that I made to your previous Question earlier today? 
https://www.mapleprimes.com/questions/234951-How-To-Obtain-This-Simplification-In-Maple
I wonder if you had any comment about that.

First 23 24 25 26 27 28 29 Last Page 25 of 382