Joe Riel

9660 Reputation

23 Badges

20 years, 8 days

MaplePrimes Activity


These are replies submitted by Joe Riel

@Markiyan Hirnyk It isn't clear to me that that original poster wants a name as the result.  For example, the original expression could be the list [1,2,3] and desired result is the number 123.  My guess is that this is purely for display, in which case some flavor of print may be a better choice.

Could you give a simple example of the type of expression you are dealing with?

What do you hope to accomplish with this?

@aryan_ams There is no solution.  Note that the determinant of the matrix is 0.  That doesn't necessarily mean that there cannot be a solution, but if there was one Maple should have found it.  You could use ?Optimization[Minimize] to find a close solution:

a := 18*x-45*y+36*w-9*z+0.7500000000e-2 = 0:
b := 9*x-18*y+9*w-0.8333333330e-2 = 0:
c := 9*y-18*w+9*z-0.3083333333e-1 = 0:
d := -9*x+36*y-45*w+18*z-0.6000000000e-1 = 0:

f := add(lhs(eq)^2, eq = [a,b,c,d]):
result := Optimization:-Minimize(f);
Warning, problem appears to be unbounded
result := [0.00004444444448889,
    [w = -0.00296296296277778, x = 0., y = -0.00212962962944444, z = 0.]]

eval([a,b,c,d],result[2]);
[-0.00333333333500000 = 0, 0.00333333333500000 = 0, 0.00333333333500000 = 0,
-0.00333333333499998 = 0]

@aryan_ams There is no solution.  Note that the determinant of the matrix is 0.  That doesn't necessarily mean that there cannot be a solution, but if there was one Maple should have found it.  You could use ?Optimization[Minimize] to find a close solution:

a := 18*x-45*y+36*w-9*z+0.7500000000e-2 = 0:
b := 9*x-18*y+9*w-0.8333333330e-2 = 0:
c := 9*y-18*w+9*z-0.3083333333e-1 = 0:
d := -9*x+36*y-45*w+18*z-0.6000000000e-1 = 0:

f := add(lhs(eq)^2, eq = [a,b,c,d]):
result := Optimization:-Minimize(f);
Warning, problem appears to be unbounded
result := [0.00004444444448889,
    [w = -0.00296296296277778, x = 0., y = -0.00212962962944444, z = 0.]]

eval([a,b,c,d],result[2]);
[-0.00333333333500000 = 0, 0.00333333333500000 = 0, 0.00333333333500000 = 0,
-0.00333333333499998 = 0]

Good news. I always enjoy studying your posts---invariably I learn something, either about using Maple or math.

Posting the problem, either as text or by uploading a worksheet (use the green arrow on the toolbar), would be helpful.

 

Syrup doesn't just plot circuits; it also solves them. That how I got the the transfer function. Maple has a product, ?MapleSim, that simulates circuits, more generally, multi-domain physical models. 

SCR = software change request.  Frequently a euphemism for a bug report, but here it really is a feature enhancement request.

Syrup doesn't just plot circuits; it also solves them. That how I got the the transfer function. Maple has a product, ?MapleSim, that simulates circuits, more generally, multi-domain physical models. 

SCR = software change request.  Frequently a euphemism for a bug report, but here it really is a feature enhancement request.

The usual way, in Maple, to combine plots is to use the ?plots[display] command. Alas, that currently does not work when the plots are array plots, which is what is generated by the ?BodePlot command so that both magnitude and phase appear in one plot structure. As a workaround, you can generate the magnitude and phase plots separately, using the ?MagnitudePlot and ?PhasePlot commands from ?DynamicSystems, then combine them with plots[display].

Here is an example of how to do that. To generate the transfer functions for an electric circuit, I used the Syrup package, which is available here; you can enter them however you'd like.

with(Syrup):
with(DynamicSystems):
ckt := [V(1), L &+ Rl, C &+ Rc, 1, R]:
Draw(ckt);

(sol,rest) := Solve(ckt,returnall):
tf := TransferFunction(eval(v[R], rest));
                     tf := Transfer Function (continuous)

params := { L = 1e-6, Rl=0.01, Rc=1e-3, R=1 }:
p1 := MagnitudePlot(tf, parameters=params union {C=100e-6}):
p2 := MagnitudePlot(tf, parameters=params union {C=10e-6},color=green):
plots:-display(p1,p2);

It would be useful if the DynamicSystems plot procedures had an option for specifying multiple parameter sets (rather than just one).  I'll submit that as an SCR.

The usual way, in Maple, to combine plots is to use the ?plots[display] command. Alas, that currently does not work when the plots are array plots, which is what is generated by the ?BodePlot command so that both magnitude and phase appear in one plot structure. As a workaround, you can generate the magnitude and phase plots separately, using the ?MagnitudePlot and ?PhasePlot commands from ?DynamicSystems, then combine them with plots[display].

Here is an example of how to do that. To generate the transfer functions for an electric circuit, I used the Syrup package, which is available here; you can enter them however you'd like.

with(Syrup):
with(DynamicSystems):
ckt := [V(1), L &+ Rl, C &+ Rc, 1, R]:
Draw(ckt);

(sol,rest) := Solve(ckt,returnall):
tf := TransferFunction(eval(v[R], rest));
                     tf := Transfer Function (continuous)

params := { L = 1e-6, Rl=0.01, Rc=1e-3, R=1 }:
p1 := MagnitudePlot(tf, parameters=params union {C=100e-6}):
p2 := MagnitudePlot(tf, parameters=params union {C=10e-6},color=green):
plots:-display(p1,p2);

It would be useful if the DynamicSystems plot procedures had an option for specifying multiple parameter sets (rather than just one).  I'll submit that as an SCR.

@PatrickT It's a ?MapleSim file. 

Please use the MaplePrimes upload facility (green arrow on toolbar) rather than appears to be a dodgy external site.  I couldn't get it to download in a reasonable amount of time and the ads and misdirection at that site are annoying.

@Reinhard Willinski Alas, yes.  Will distribute a fix shortly

Addendum: The 0.1.8 version (above) has the fix.

@Christopher2222 That works for me; I copied and pasted it directly into Maple and it returned the modified procedure as expected.

First 71 72 73 74 75 76 77 Last Page 73 of 195