Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Un gros MERCI Emmanuel! I got the solution I needed for the 3rd part of this piecewise funtion (it agrees with mathematica) I need the k and the x values that are real values: 50.4900997166127 0.881173769148990

Here is the code. It took a little bit of digging to get the substitutions. It would also be nice to know if there is an option in solve to just return the real values :)

fp2 = sqrt(r^2-(x-c)^2) dfp2 = derivative(fp2, x) fp3 = -k*(x-1)^3 dfp3 = derivative(fp3, x) sys = [fp2 == fp3,dfp2 == dfp3] SS = solve(sys, (x, k), algorithm="sympy") print(SS[0][k].subs(c=0.7,r=0.2)) print(SS[0][x].subs(c=0.7,r=0.2)) print(SS[1][k].subs(c=0.7,r=0.2)) print(SS[1][x].subs(c=0.7,r=0.2))

50.4900997166127 0.881173769148990 1.04977199683675*I 0.368826230851010

​Bien à vous! Pat Browne Rimouski Québec

click to hide/show revision 2
No.2 Revision

Un gros MERCI Emmanuel! I got the solution I needed for the 3rd part of this piecewise funtion (it agrees with mathematica) I need the k and the x values that are real values:

 50.4900997166127
*****50.4900997166127
 0.881173769148990

0.881173769148990*****

Here is the code. It took a little bit of digging to get the substitutions. It would also be nice to know if there is an option in solve to just return the real values :)

 fp2 = sqrt(r^2-(x-c)^2)
    dfp2 = derivative(fp2, x)
    fp3 = -k*(x-1)^3
    dfp3 = derivative(fp3, x)
    sys = [fp2 == fp3,dfp2 == dfp3]
    SS = solve(sys, (x, k), algorithm="sympy")
    print(SS[0][k].subs(c=0.7,r=0.2))
    print(SS[0][x].subs(c=0.7,r=0.2))
    print(SS[1][k].subs(c=0.7,r=0.2))
    print(SS[1][x].subs(c=0.7,r=0.2))

print(SS[1][x].subs(c=0.7,r=0.2))

50.4900997166127 *****50.4900997166127 0.881173769148990 0.881173769148990***** 1.04977199683675*I 0.368826230851010

0.368826230851010

​Bien à vous! Pat Browne Rimouski Québec

click to hide/show revision 3
No.3 Revision

Un gros MERCI Emmanuel! I got the solution I needed for the 3rd part of this piecewise funtion (it agrees with mathematica) I need the k and the x values that are real values:

 *****50.4900997166127
        0.881173769148990*****

Here is the code. It took a little bit of digging to get the substitutions. It would also be nice to know if there is an option in solve to just return the real values :)

  fp2 = sqrt(r^2-(x-c)^2)
   dfp2 = derivative(fp2, x)
   fp3 = -k*(x-1)^3
   dfp3 = derivative(fp3, x)
   sys = [fp2 == fp3,dfp2 == dfp3]
   SS = solve(sys, (x, k), algorithm="sympy")
   print(SS[0][k].subs(c=0.7,r=0.2))
   print(SS[0][x].subs(c=0.7,r=0.2))
   print(SS[1][k].subs(c=0.7,r=0.2))
   print(SS[1][x].subs(c=0.7,r=0.2))

 *****50.4900997166127
*****
50.4900997166127
  0.881173769148990*****
0.881173769148990
*****
1.04977199683675*I
0.368826230851010

​Bien à vous! Pat Browne Rimouski Québec