• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Problem with NSolve Speed

October 6, 2018   BI News and Info

I have a very complicated function but only of 1 variable. I want to find the first value for which that function is zero. Mathematica can easily plot it:

func = Det[coeffMatrix];
Plot[func, {\[Beta]1, 0, 3}]

FoWGR Problem with NSolve Speed

From that plot, one can easily see that the first value would be ~2.556.

To show that $ \beta_1$ = 2.556 is actually the approximate solution:

func /. \[Beta]1 -> 2.556

-0.00139597

However, when I try to find it numerically:

NSolve[func == 0 && 0 < \[Beta]1 < 10, \[Beta]1]

…it just runs and runs and runs and never gives an answer. Why ? and how can I fix it ?

The complete code

constants = {b1 -> (-(Cosh[
          0.68*\[Beta]1]*(0.6553600000000004*Cos[0.15*\[Beta]1]*
            Cos[0.68*\[Beta]1] - 
           0.6553600000000004*Cos[0.68*\[Beta]1]*
            Cosh[0.15*\[Beta]1] + 
           1.2621440000000002*Sin[0.15*\[Beta]1]*Sin[0.68*\[Beta]1] + 
           0.7378559999999998*Sin[0.68*\[Beta]1]*
            Sinh[0.15*\[Beta]1])) + 
      Cos[0.68*\[Beta]1]*(-0.7378559999999998*Sin[0.15*\[Beta]1] - 
         1.2621440000000002*Sinh[0.15*\[Beta]1])*
       Sinh[0.68*\[Beta]1])/(Cosh[
        0.68*\[Beta]1]*(-0.6553600000000004*Cos[0.68*\[Beta]1]*
          Sin[0.15*\[Beta]1] + 
         1.2621440000000002*Cos[0.15*\[Beta]1]*Sin[0.68*\[Beta]1] + 
         0.7378559999999998*Cosh[0.15*\[Beta]1]*Sin[0.68*\[Beta]1] - 
         0.6553600000000004*Cos[0.68*\[Beta]1]*Sinh[0.15*\[Beta]1]) + 
      Cos[0.68*\[Beta]1]*(0.7378559999999998*Cos[0.15*\[Beta]1] + 
         1.2621440000000002*Cosh[0.15*\[Beta]1])*Sinh[0.68*\[Beta]1]),
   b2 -> (2.5*
      Sec[0.68*\[Beta]1]*(Cosh[
          0.68*\[Beta]1]*(-0.26214400000000015 + 
           0.26214400000000015*Cos[0.15*\[Beta]1]*
            Cosh[0.15*\[Beta]1] - 
           Sin[0.15*\[Beta]1]*Sinh[0.15*\[Beta]1]) + 
        0.8*(Cosh[0.15*\[Beta]1]*Sin[0.15*\[Beta]1] - 
           Cos[0.15*\[Beta]1]*Sinh[0.15*\[Beta]1])*
         Sinh[0.68*\[Beta]1]))/((0.7378559999999998*
          Cos[0.15*\[Beta]1] + 
         1.2621440000000002*Cosh[0.15*\[Beta]1])*Sinh[0.68*\[Beta]1] +
       Cosh[0.68*\[Beta]1]*(-0.6553600000000004*Sin[0.15*\[Beta]1] - 
         0.6553600000000004*Sinh[0.15*\[Beta]1] + 
         1.2621440000000002*Cos[0.15*\[Beta]1]*Tan[0.68*\[Beta]1] + 
         0.7378559999999998*Cosh[0.15*\[Beta]1]*Tan[0.68*\[Beta]1])), 
  d2 -> (2.5*
      Sech[0.68*\[Beta]1]*(-0.26214400000000015*Cos[0.68*\[Beta]1] + 
        0.8*Cosh[
          0.15*\[Beta]1]*(0.3276800000000002*Cos[0.15*\[Beta]1]*
            Cos[0.68*\[Beta]1] + 
           Sin[0.15*\[Beta]1]*
            Sin[0.68*\[Beta]1]) + (Cos[0.68*\[Beta]1]*
            Sin[0.15*\[Beta]1] - 
           0.8*Cos[0.15*\[Beta]1]*Sin[0.68*\[Beta]1])*
         Sinh[0.15*\[Beta]1]))/(-0.6553600000000004*
       Cos[0.68*\[Beta]1]*Sin[0.15*\[Beta]1] + 
      1.2621440000000002*Cos[0.15*\[Beta]1]*Sin[0.68*\[Beta]1] - 
      0.6553600000000004*Cos[0.68*\[Beta]1]*Sinh[0.15*\[Beta]1] + 
      0.7378559999999998*Cos[0.15*\[Beta]1]*Cos[0.68*\[Beta]1]*
       Tanh[0.68*\[Beta]1] + 
      Cosh[0.15*\[Beta]1]*(0.7378559999999998*Sin[0.68*\[Beta]1] + 
         1.2621440000000002*Cos[0.68*\[Beta]1]*Tanh[0.68*\[Beta]1]))}

matrix = {{a1 (Sin[u \[Beta]1] - Sinh[u \[Beta]1]), 
    b1 (Cos[u \[Beta]1] - Cosh[u \[Beta]1]), -b2*
     Cos[y*\[Theta]*\[Beta]1], -d2*
     Cosh[y*\[Theta]*\[Beta]1]}, {a1 (Cos[u \[Beta]1] - 
       Cosh[u \[Beta]1]), b1 (-Sin[u \[Beta]1] - Sinh[u \[Beta]1]), 
    b2*\[Theta]*Sin[y*\[Theta]*\[Beta]1], -d2*\[Theta]*
     Sinh[y*\[Theta]*\[Beta]1]}, {a1 (-Sin[u \[Beta]1] - 
       Sinh[u \[Beta]1]), b1 (-Cos[u \[Beta]1] - Cosh[u \[Beta]1]), 
    b2*\[Alpha]^4*\[Theta]^2*
     Cos[y*\[Theta]*\[Beta]1], -d2*\[Alpha]^4*\[Theta]^2*
     Cosh[y*\[Theta]*\[Beta]1]}, {a1 (-Cos[u \[Beta]1] - 
       Cosh[u \[Beta]1]), 
    b1 (Sin[u \[Beta]1] - 
       Sinh[u \[Beta]1]), -b2*\[Alpha]^4*\[Theta]^3*
     Sin[y*\[Theta]*\[Beta]1], -d2*\[Alpha]^4*\[Theta]^3*
     Sinh[y*\[Theta]*\[Beta]1]}};

testingParam = { \[Theta] -> 0.8, \[Alpha] -> 0.8, u -> 0.15, 
   y -> 1 - 0.15} ;

coeffMatrix = (matrix /. a1 -> 1) /. constants /. testingParam ;

func = Det[coeffMatrix];
NSolve[func == 0 && 0 < \[Beta]1 < 10, \[Beta]1]

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

NSolve, Problem, Speed
  • Recent Posts

    • Dapper Duo
    • AI Weekly: These researchers are improving AI’s ability to understand different accents
    • Why Choose RapidMiner for Your Data Science & Machine Learning Software?
    • How to Use CRM Integration to Your Advantage – Real World Examples
    • WATCH: ‘Coming 2 America’ Movie Review Available On Amazon Prime & Amazon
  • Categories

  • Archives

    • March 2021
    • February 2021
    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited