1
$\begingroup$

I am trying to solve an equation on Mathematica 12.1 to get angles in radians as part of some analysis:

forceToStrain[in_] := in/(51.76*10^9);
strainFromTheta[in_] := ((in/(2*Sin[in/2])) - 1) // N
(*thickness = 0.28 * 16 ply = 4.48 mm = 4.48*10^(-2 m)*)

Solve[((x/(2*Sin[x/2])) - 1) == forceToStrain[10], x]

But I am getting this error:

Reduce::inex: Reduce was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Reduce require exact input, providing Reduce with an exact version of the system may help.

It doesn't seem complicated as an equation as I can solve it by hand:

strainFromTheta[.00007]
forceToStrain[10]
Output: 2.04167*10^-10 and 1.93199*10^-10

Can anyone tell me whether I could use a different function or rearrange the equation differently to get the angles?

$\endgroup$
1
  • $\begingroup$ It is weird that Solve does not work. You can get solutions using FindRoot, but you will have to specify a "guess" as a starting point. FindRoot[((x/(2*Sin[x/2])) - 1) == forceToStrain[10], {x, .1}](*{x\[Rule]0.00006809393481894709`}*) $\endgroup$
    – Natas
    Aug 25, 2020 at 12:23

1 Answer 1

2
$\begingroup$

The result of Plot[((x/(2*Sin[x/2])) - 1) == forceToStrain[10], {x, -2, 2}, WorkingPrecision -> 35]suggests possible roots are located near the origin. Making use of it, the following commands work well.

forceToStrain[in_] := in/(51.76*10^9);
strainFromTheta[in_] := ((in/(2*Sin[in/2])) - 1) // N

Solve[((x/(2*Sin[x/2])) - 1) == forceToStrain[10] && x >= -0.1 && 
  x <= 0.1, x, WorkingPrecision -> 40]
(*{{x -> -0.000068094}, {x -> 0.000068094}}*)
NSolve[((x/(2*Sin[x/2])) - 1) == forceToStrain[10] && x >= -0.1 && 
  x <= 0.1, x, WorkingPrecision -> 40, Method ->"DifferentialEvolution"]
(*{{x-> -0.00006809395681119561597156442...},{x -> 0.00006809395681119561597156442191...}}*)
FindRoot[((x/(2*Sin[x/2])) - 1) - forceToStrain[10] == 0, {x, 10^-3}, 
 WorkingPrecision -> 30]
(*{x -> 0.0000680939568079706253704515525266}*)
$\endgroup$
4
  • $\begingroup$ That makes sense. Thanks. It seems using absolute timing gives Solve (4.18s), NSolve (3.95s), and FindRoot (0.00836s). $\endgroup$
    – Letshin
    Aug 25, 2020 at 13:35
  • 1
    $\begingroup$ @Zhao: Did you use ClearAll["Global*"]` in order to obtain unbiased timings? $\endgroup$
    – user64494
    Aug 25, 2020 at 13:46
  • $\begingroup$ No - fair point. Thanks. Doing that now returns Solve (3.9651s), NSolve (3.8633s), and FindRoot (0.0018s). I shall be using FindRoot in this case. $\endgroup$
    – Letshin
    Aug 25, 2020 at 13:49
  • $\begingroup$ @Zhao: It is not so simple. The FindRoot command returns only one root and fails with {x,0}. I don't think the execution time is of very importance here. $\endgroup$
    – user64494
    Aug 25, 2020 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.