transcendental-equation

Floating point accuracy with different languages

送分小仙女□ 提交于 2021-01-26 19:15:35
问题 I'm currently doing distance calculations between coordinates and have been getting slightly different results depending on the language used. Part of the calculation is taking calculating the cosine of a given radian . I get the following results // cos(0.8941658257446736) // 0.6261694290123146 node // 0.6261694290123146 rust // 0.6261694290123148 go // 0.6261694290123148 python // 0.6261694290123148 swift // 0.6261694290123146 c++ // 0.6261694290123146 java // 0.6261694290123147 c I would

Find root of a transcendental equation with python

妖精的绣舞 提交于 2019-12-12 11:35:13
问题 I have to solve the following transcendental equation cos(x)/x=c for given constant c. For example I did a short code in Mathematica, where I generated a list of random values for constant c const = Table[RandomReal[{0, 5}], {i, 1, 10}] (*{1.67826, 0.616656, 0.290878, 1.10592, 0.0645222, 0.333932, 3.59584, \ 2.70337, 3.91535, 2.78268}*) Than I defined the function f[x_, i_] := Cos[x]/x - const[[i]] and started looking for the roots: Table[FindRoot[f[x, i] == 0, {x, 0.1}][[1, 2]], {i, 1,

Solving a system of transcendental equations with python

情到浓时终转凉″ 提交于 2019-12-06 07:01:42
问题 Assuming I have the following four equations: cos(x)/x = a cos(y)/y = b a + b = 1 c sinc(x) = d sinc(y) for unknown variables x, y, a and b . Note that cos(x)/x=a has multiple solutions. Similar goes for variable y . I am only interested in x and y values, which are first positive roots (if that matters). You can safely assume a, b, c and d are known real constants, all positive. In Mathematica the code to solve this would look something like: FindRoot[{Cos[x]/x == 0.2 a + 0.1, Cos[y]/y == 0

Solving a system of transcendental equations with python

久未见 提交于 2019-12-04 12:03:15
Assuming I have the following four equations: cos(x)/x = a cos(y)/y = b a + b = 1 c sinc(x) = d sinc(y) for unknown variables x, y, a and b . Note that cos(x)/x=a has multiple solutions. Similar goes for variable y . I am only interested in x and y values, which are first positive roots (if that matters). You can safely assume a, b, c and d are known real constants, all positive. In Mathematica the code to solve this would look something like: FindRoot[{Cos[x]/x == 0.2 a + 0.1, Cos[y]/y == 0.2 b + 0.1, a + b == 1.0, 1.03*Sinc[x] == Sinc[y]*1.02}, {{x, .1}, {y, .1}, {a, .3}, {b, .1}}] which as

Increasing accuracy of solution of transcendental equation

℡╲_俬逩灬. 提交于 2019-11-26 11:24:51
I have a specific kinematics as a part of a more complex machine and need to compute some physical parameters that are very hard (more like impossible) to measure with proper accuracy with instruments I have at my disposal [kinematics] At first look it is a simple 1 degree of freedom arm (black) which can rotate around x axis. It has a weight to force it to go always up until it hit the mechanic endpoint (angle a0 ) or some tube (blue) with radius r0 . Arm rotation center is at y0 . The tube can be moved to any y(t) height. [usage] This is used to measure the radius of a tube for further

Increasing accuracy of solution of transcendental equation

不问归期 提交于 2019-11-26 02:25:22
问题 I have a specific kinematics as a part of a more complex machine and need to compute some physical parameters that are very hard (more like impossible) to measure with proper accuracy with instruments I have at my disposal [kinematics] At first look it is a simple 1 degree of freedom arm (black) which can rotate around x axis. It has a weight to force it to go always up until it hit the mechanic endpoint (angle a0 ) or some tube (blue) with radius r0 . Arm rotation center is at y0 . The tube