Carl Love

Carl Love

28045 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

Please put any followups to this Question in this thread. Below, I've copied your new Question here, and I'll delete the new Question itself. OP's writing from here on:

I am an ophthalmologist and a novice in programing. I am having a problem obtaining the x-y coordinate equations for each of the fitted Splines in Maple.  Attached is the raw data and the Maple Data2_12_5_2023.xlsx Spline_Fits_12_5_2023.maple worksheet for which I need the individual spline equations and to learn how to obtain them.  I will pay you for the service. Can you please obtain the x-y Cartesian equations , not parametric, for each of the fitted Splines, give me a step-wise method for obtaining them and how to plot the Spline fits on the raw data plot?  

Your assistance is most appreciated.

Ron

Ronald A Schachar, MD, PhD

Cell: (858) 784-1705

Email: ron@2ras.com

@delvin The Jacobi functions require two arguments. Your math-paper transcription shows the 2nd argument as a fancy-script L, which I've duplicated below. Also, the parameter of Xi is phi, not psi or Psi.

restart:

Eq21:=
    12*Psi^3*rho__3^2*D[1,1](w)(phi) +
    (4*omega*rho__3^2 - 3*rho__2^2*Psi)*w(phi) +
    Psi*rho__3^2*(rho__1 + 2*rho__3)*w(phi)^3
;

12*Psi^3*rho__3^2*((D@@2)(w))(phi)+(-3*Psi*rho__2^2+4*omega*rho__3^2)*w(phi)+Psi*rho__3^2*(rho__1+2*rho__3)*w(phi)^3

w:= phi-> kappa__0 + kappa__1*(D(Xi)/Xi)(phi) + h__1*(Xi/D(Xi))(phi);

proc (phi) options operator, arrow; kappa__0+kappa__1*(D(Xi)/Xi)(phi)+h__1*(Xi/D(Xi))(phi) end proc

Xi:= subs(
    L= `ℓ`,  #just an alternate typescript abbreviation for script "L"
    phi->
        (varepsilon__1*JacobiCN(zeta__1*phi, L) + varepsilon__2*JacobiSN(zeta__2*phi, L))
        / (varepsilon__3*JacobiCN(zeta__3*phi, L) + varepsilon__4*JacobiSN(zeta__4*phi, L))
);

proc (phi) options operator, arrow; (varepsilon__1*JacobiCN(zeta__1*phi, `ℓ`)+varepsilon__2*JacobiSN(zeta__2*phi, `ℓ`))/(varepsilon__3*JacobiCN(zeta__3*phi, `ℓ`)+varepsilon__4*JacobiSN(zeta__4*phi, `ℓ`)) end proc

#Use preset values for h__1, kappa__0, varepsilon__2, varepsilon__4, zeta__1, and Psi.
Eq21a:= eval(  
    Eq21,
    [
        (h__1, kappa__0, varepsilon__2, varepsilon__4, zeta__1) =~ 0,
        Psi= kappa__1/12*sqrt(-6*rho__1 - 12*rho__3)
    ]
):

simplify(solve({Eq21a}, {omega}));

{omega = -(1/24)*kappa__1*(-6*rho__1-12*rho__3)^(1/2)*(zeta__3^2*rho__3^2*(rho__1+2*rho__3)*(`ℓ`^2-1/2)*kappa__1^2-(3/2)*rho__2^2)/rho__3^2}

 

NULL

Download J03.mw

This is an open-ended question; I don't have a definite opinion about it: Is something as crude as the empirical rule worth studying to the extent implied by the above Post when one has Maple, which has much more sophisticated functions for assessing whether data come from a Normal distribution?

That being said, I think that everyone should learn and memorize the central probabilities for 1, 2, and 3 standard deviations. That can help in everyday life or help one to understand nearly any research that uses statistics.

@delvin What do you mean by "fixed"? You simply typed a - where you should've typed =. That's all there is to it.

Regarding tanh: You can simply enter tanh(a+b) and tanh(a-b). Maple knows these functions, and you don't need to provide any further definition.

@delvin This is your input for pde2 from your attached worksheet:

pde2:= beta[3]*beta[4]*diff(U(xi), xi, xi) - (beta[4]*diff(U(xi),xi))*(u(xi[n - 1])-2*U(xi)+u(xi[n + 1]));

If you want that to be equivalent to the displayed equation at the top of your worksheet, then change the central (minus sign) to = (equals sign).

Regarding tanh, are you asking because you think that perhaps Maple's definition is different from what you expect? If so, what do you expect?

@aimLow The fact that your error messages are accompanied by your input in a red-dashed rectangle indicates that those two lines have a syntax error specific to 2-D Input. In such cases, Maple cannot translate the input into equivalent 1-D Maple-code input. The error is not related to your use of sum. If you tell me what output you expect from each command, I might be able to help further.

@Kitonum Maple understands indefinite sums, and they can't be adequately replaced with add, for example:

sum(i^2, i);
            1/3*i^3 - 1/2*i^2 + 1/6*i                     

 

@sursumCorda If you tell me for your most-recent case what you expect the quotients to be, I may be able to adjust my program. What does Mathematica return? The package Groebner might have something that helps.

The direct problem is that regardless of the elimination order used, the 2nd remainder has a denominator containing the 3rd variable.

As I said, my knowledge of this area of math is limited. It may be that this problem cannot be solved by using quo and rem as the only algebraic operations. It may require Groebner or something similar.

What does the operator symbol N (in "blackboard bold") in paragraph 1 mean? 

@sursumCorda 

Here is a procedure to reconstruct the original from the output of PolynomialReduce(P,R,V). It only requires one preliminary step to your expand(inner(...)) + ..., and it needs to be passed the elimination order that was used.

PolyRecon:= proc(Q::list(polynom), Rm::polynom, Z::list(polynom), V::list(name))
local k, z:= <Z>, v;
    for k,v in V do z[k+1..]:= rem~(z[k+1..], z[k], v) od;
    expand(<Q>^+.z + Rm)
end proc
:
(P,R,V):= (x^5 - x*y^6 - x*y, [x^2 + y, x^2 - y^3], [y, x]):
PolynomialReduce(P,R,V);
 
[    5    3  4    5  3    7  2    9     / 10    \      7    3]   3
[-x y  + x  y  - x  y  + x  y  - x  y + \x   - 1/ x, -x  + x ], x 

PolyRecon(%, R, V);
                            6    5      
                        -x y  + x  - x y
evalb(%=P);
                              true
V:= [x,y]:
PolynomialReduce(P,R,V);
                  [ 3           3      ]      
                  [x  - x y, x y  - x y], -x y

PolyRecon(%, R, V);
                            6    5      
                        -x y  + x  - x y
evalb(%=P);
                              true

 

@sursumCorda I wouldn't expect your reconstruction process to return the original, just something equivalent to the original under the given reductions. It seems to me that it does that. In other words, for any P, R, V such that PolynomialReduce(P,R,V) returns a result, I think that it'll always be true that

PolynomialReduce(expand(inner(R, PolynomialReduce(P,R,V)[1])), R, V)[2] = 0

Note that for each iteration of my loop, all future divisors are also reduced.

@sursumCorda The elimination order matters a great deal in these problems. For the case shown, 
rem(y^3 - y, x^3 - x, y) = 0, so for the second loop iteration, the divisor is 0. I suppose one could trap for this error and try a different order in that case.

(My knowledge of this area of math (I guess it's Commutative Ring Theory?) is limited.)

Here is a worksheet that summarizes all of the above.

restart:

FamN:= [3,2,2,2,1]:  #reduced family sizes for test problem

nf:= nops(FamN):

PS:= [0, seq[scan= `+`](FamN)];  #their partial sums

[0, 3, 5, 7, 9, 10]

FamS:= (`{}`@`$`@`..`)~(PS[..-2]+~1, PS[2..]);  #partition

[{1, 2, 3}, {4, 5}, {6, 7}, {8, 9}, {10}]

It:= Iterator:-Permute(PS[-1]):

# For efficiency, split the Iterator's output array into aliases for
# the image of each family under a given permutation:
sp:= output(It):
FamA:= [seq](ArrayTools:-Alias(sp, PS[i], [FamN[i]]), i= 1..nf)
:

# Does the given permutation swap families i and j?
Swapped?:= (i,j)-> local x;
    andseq(x in FamS[j], x= FamA[i]) and andseq(x in FamS[i], x= FamA[j])
:

SwapJ:= (2,3):  #indices of families to swap

V:= 0:  #counter of permutations with the desired property

CodeTools:-Usage(in It do if Swapped?(SwapJ) then V++ fi od):

memory used=1.04GiB, alloc change=26.27MiB, cpu time=11.08s, real time=10.04s, gc time=1.83s

V;

2880

V/10!;  #probability

1/1260

# Now, do the same thing with fixed-size set partitions, which are often
# easier to work with because there are far fewer of them than permutations.

CountPartitions:= (S::list(posint))->
    add(S)!/mul([S[], rhs~(Statistics:-Tally(S))[]]!~)
:

# My flawed first-posted attempt was analogous to this:
CountPartitions(FamN[[({$nf} minus {SwapJ})[]]])
/ CountPartitions(FamN);

1/210

# The correction is:
CountPartitions(FamN[[({$nf} minus {SwapJ})[]]])
/ CountPartitions(FamN) / numboccur(FamN, FamN[SwapJ[1]])!

1/1260

# Now apply what we've learned above to the original problem:
FamN:= [3,4,4,4,1]:
CountPartitions(FamN[[({$nops(FamN)} minus {SwapJ})[]]])
/ CountPartitions(FamN) / numboccur(FamN, FamN[SwapJ[1]])!

1/900900

# So, the probability that this happens for any one of the 3 possible pairs
# of equal-size families, and happens for that same pair in the next
# drawing is:
p1:= evalf(3*%^2);

0.3696307393e-11

# To put that into perspective, the probability of a royal flush in a 5-card
# poker hand with no card exchanges is
p2:= evalf(4/binomial(52,5));

0.1539077169e-5

round(p2/p1);

416382

 

Download SecretSanta.mw

@sursumCorda Here is a procedure that might do what you want. Let me know. I've made it so that the elimination order is an optional third argument:

PolynomialReduce:= proc(
    p::polynom, Z::list(polynom), 
    ord::list(name):= [indets(p, And(name, Not(constant)))[]]
)
local r:= p, v:= ord, z:= Z, k, d;
    if nops(v) < nops(z) then 
        v:= [v[], (indets(z, And(name, Not(constant))) minus {v[]})[]]
    fi; 
    [for k to nops(z) do
         z:= rem~(z[2..], (d:= z[1]), v[k]);
         quo(r, d, v[k], 'r')
     od],
     r
end proc
:      
PolynomialReduce(x^2+y^2, [x-y, y+a]);
                                           2
                   [x + y, -2 a + 2 y], 2 a 

I withdrawal the above Reply. Indeed, my probabilities were too large by a factor of 6. Although my procedure CountPartitions is correct, one does need to consider the order of the images when computing the probability. I confirmed this by doing the analogous problem with the sizes changed to [3,2,2,2,1] and enumerating all 10! ~ 3.6 million permutations, which only takes 11 seconds.

First 28 29 30 31 32 33 34 Last Page 30 of 709