Home > Archive > Mathematica > April 2005 > Integrate is driving me crazy, please help!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Integrate is driving me crazy, please help!
|
|
| Jim Martin 2005-04-18, 8:59 am |
| Hello Mathematica Experts:
I am a biomechanist and work mostly in the area of muscle contraction. I
do a lot of numerical computations using excel, but right now I need an
analytical solution that represents force as a function of position
integrated over a shortening amplitude. I downloaded a trial version of
Mathematica and have tried to obtain a solution for this:
Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
hilla, {x, -a, a}]
Mathematica returns this:
(-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
Cos f pi)
I know the line wrap makes this hard to read so please feel free to
email me and I can send you the output as a picture.
In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
I can numerically integrate this function and obtain a value for that
sample data set of 14.04. When I put those sample values into the
solution that Mathematica produces, I get 10.01.
Can any of you please give a hand here? I must be making some simple
Mathematica-beginner error but I just can't see it.
In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
variables that have intrinsic functions in Mathematica? Maybe I am
misunderstanding the output with regard to implicit parentheses etc.
Any help appreciated!
Thanks,
Jim
| |
|
| Hi Jim,
In Mathematica function are written by:
Head[ arguments ]
note the square brackets not braces. These are used for grouping.
I am wondering how you get an numerical result at all.
Sincerely, Daniel
Jim Martin wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
>
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
>
> I know the line wrap makes this hard to read so please feel free to
> email me and I can send you the output as a picture.
>
> In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
>
> I can numerically integrate this function and obtain a value for that
> sample data set of 14.04. When I put those sample values into the
> solution that Mathematica produces, I get 10.01.
>
> Can any of you please give a hand here? I must be making some simple
> Mathematica-beginner error but I just can't see it.
>
> In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
> variables that have intrinsic functions in Mathematica? Maybe I am
> misunderstanding the output with regard to implicit parentheses etc.
> Any help appreciated!
>
> Thanks,
>
> Jim
>
>
| |
| Jens-Peer Kuska 2005-04-19, 8:59 am |
| Hi,
first of all you should fix you input, Mathematica
uses []
for *all* function brakets and pi is Pi
res=Integrate[
(hillb*((f0 + hilla)/
(2*Pi*f*a*Cos[ArcSin[x/a]] + hillb))) - hilla,
{x, -a, a}]
than you should do
tmp = FullSimplify[res, Element[{a, f, hillb,
hilla}, Reals]];
and help Mathematica with your Log[] arguments
tmp //. a_*Log[b_] :> Log[b^a] //. Log[a_] +
Log[b_] :> Log[a*b]
than you have the solution, you expect.
Regards
Jens
"Jim Martin" <jim.martin@utah.edu> schrieb im
Newsbeitrag news:d3vn1h$jm9$1@smc.vnet.net...
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area
> of muscle contraction. I
> do a lot of numerical computations using excel,
> but right now I need an
> analytical solution that represents force as a
> function of position
> integrated over a shortening amplitude. I
> downloaded a trial version of
> Mathematica and have tried to obtain a solution
> for this:
>
> Integrate[(hillb*((f0 +
> hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
>
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb
> (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin
> Cos f pi]))/(4 a ArcSin
> Cos f pi)
>
> I know the line wrap makes this hard to read so
> please feel free to
> email me and I can send you the output as a
> picture.
>
> In a sample data set, hilla=3, hillb=50, f0=8,
> a=1, f=1
>
> I can numerically integrate this function and
> obtain a value for that
> sample data set of 14.04. When I put those
> sample values into the
> solution that Mathematica produces, I get 10.01.
>
> Can any of you please give a hand here? I must
> be making some simple
> Mathematica-beginner error but I just can't see
> it.
>
> In Mathematica, Log is Log to base e, right (LN
> in excel)? Did I use
> variables that have intrinsic functions in
> Mathematica? Maybe I am
> misunderstanding the output with regard to
> implicit parentheses etc.
> Any help appreciated!
>
> Thanks,
>
> Jim
>
>
| |
| David Annetts 2005-04-19, 8:59 am |
| Hi Jim,
<snippage>
> In Mathematica, Log is Log to base e, right (LN in excel)?
> Did I use variables that have intrinsic functions in
> Mathematica? Maybe I am misunderstanding the output with
> regard to implicit parentheses etc.
> Any help appreciated!
Your syntax is wrong ....
Start with your kernel & give your variables numerical values:-
(hillb*((f0 + hilla)/(2*Pi*f*a*Cos[ArcSin[x/a]] + hillb))) - hilla /.
{hilla->3, hillb->50, f0->8, a->1, f->1}
Note differences between your pi & the way that functions are defined --
square brackets vs. round ones.
This kernel can be integrated using:-
Integrate[%, {x, -1, 1}]
which has a numerical value of:-
N[%]
Regards,
Dave.
| |
| Bob Hanlon 2005-04-19, 8:59 am |
| Use square brackets for all functions
asmp={Element[{a,f,f0,hilla,hillb}, Reals],
a>0,hillb>0};
soln = Simplify[Integrate[
(hillb*((f0+hilla)/
(2*Pi*f*a*Cos[ArcSin[x/a]]+hillb)))-
hilla,{x,-a,a}],asmp]
(1/(2*f*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]))*
(2*(f0 + hilla)*ArcTan[(2*a*f*Pi)/Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]]*hillb^2 -
I*(f0 + hilla)*Log[-(I/(2*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]))]*hillb^2 +
I*f0*Log[I/(2*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])]*hillb^2 +
I*hilla*Log[I/(2*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])]*hillb^2 +
f0*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]*hillb + hilla*Pi*Sqrt[hillb^2 -
4*a^2*f^2*Pi^2]*
hillb - 4*a*f*hilla*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])
Simplify[soln/.{hilla->3,hillb->50,f0->8,a->1,f->1}]
269 - 6875/Sqrt[625 - Pi^2] + (13750*ArcTan[Pi/Sqrt[625 - Pi^2]])/
(Pi*Sqrt[625 - Pi^2])
%//N
14.0372
Bob Hanlon
>
> From: Jim Martin <jim.martin@utah.edu>
> Date: 2005/04/18 Mon AM 03:08:44 EDT
> To: mathgroup@smc.vnet.net
> Subject: Integrate is driving me crazy, please help!
>
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
>
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
>
> I know the line wrap makes this hard to read so please feel free to
> email me and I can send you the output as a picture.
>
> In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
>
> I can numerically integrate this function and obtain a value for that
> sample data set of 14.04. When I put those sample values into the
> solution that Mathematica produces, I get 10.01.
>
> Can any of you please give a hand here? I must be making some simple
> Mathematica-beginner error but I just can't see it.
>
> In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
> variables that have intrinsic functions in Mathematica? Maybe I am
> misunderstanding the output with regard to implicit parentheses etc.
> Any help appreciated!
>
> Thanks,
>
> Jim
>
>
>
| |
| Bob Hanlon 2005-04-19, 8:59 am |
| The symbolic solution can be further simplified for hillb^2>4a^2*f^2*Pi^2
soln2=Simplify[soln,hillb^2>4a^2*f^2*Pi^2]
(1/(2*f*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]))*
(2*(f0 + hilla)*ArcTan[(2*a*f*Pi)/Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]]*hillb^2 +
Pi*(f0*hillb*(Sqrt[hillb^2 - 4*a^2*f^2*Pi^2] - hillb) +
hilla*(-hillb^2 + Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]*hillb -
4*a*f*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])))
Bob Hanlon
>
> From: Bob Hanlon <hanlonr@cox.net>
> Date: 2005/04/18 Mon AM 06:34:33 EDT
> To: Jim Martin <jim.martin@utah.edu>, <mathgroup@smc.vnet.net>
> Subject: Re: Integrate is driving me crazy, please help!
>
> Use square brackets for all functions
>
> asmp={Element[{a,f,f0,hilla,hillb}, Reals],
> a>0,hillb>0};
>
> soln = Simplify[Integrate[
> (hillb*((f0+hilla)/
> (2*Pi*f*a*Cos[ArcSin[x/a]]+hillb)))-
> hilla,{x,-a,a}],asmp]
>
> (1/(2*f*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]))*
> (2*(f0 + hilla)*ArcTan[(2*a*f*Pi)/Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]]*hillb^2 -
> I*(f0 + hilla)*Log[-(I/(2*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]))]*hillb^2 +
> I*f0*Log[I/(2*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])]*hillb^2 +
> I*hilla*Log[I/(2*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])]*hillb^2 +
> f0*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]*hillb + hilla*Pi*Sqrt[hillb^2 -
> 4*a^2*f^2*Pi^2]*
> hillb - 4*a*f*hilla*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])
>
> Simplify[soln/.{hilla->3,hillb->50,f0->8,a->1,f->1}]
>
> 269 - 6875/Sqrt[625 - Pi^2] + (13750*ArcTan[Pi/Sqrt[625 - Pi^2]])/
> (Pi*Sqrt[625 - Pi^2])
>
> %//N
>
> 14.0372
>
>
> Bob Hanlon
>
>
| |
|
| Integrate[hillb*((f0 + hilla)/
(2*Pi*f*a*Cos[ArcSin[x/a]] + hillb)) -
hilla, {x, -a, a}]
(-4*a^2*f*hilla*Pi*
Sqrt[hillb^2 - 4*a^2*f^2*
Pi^2] + a*f0*hillb*Pi*
Sqrt[hillb^2 - 4*a^2*f^2*
Pi^2] + a*hilla*hillb*Pi*
Sqrt[hillb^2 - 4*a^2*f^2*
Pi^2] + 2*a*(f0 + hilla)*
hillb^2*ArcTan[(2*a*f*Pi)/
Sqrt[hillb^2 - 4*a^2*f^2*
Pi^2]] - I*Sqrt[a^2]*
(f0 + hilla)*hillb^2*
Log[-((I*Sqrt[a^2]*hillb)/
(2*a*Sqrt[hillb^2 -
4*a^2*f^2*Pi^2]))] +
I*Sqrt[a^2]*f0*hillb^2*
Log[(I*Sqrt[a^2]*hillb)/
(2*a*Sqrt[hillb^2 -
4*a^2*f^2*Pi^2])] +
I*Sqrt[a^2]*hilla*hillb^2*
Log[(I*Sqrt[a^2]*hillb)/
(2*a*Sqrt[hillb^2 -
4*a^2*f^2*Pi^2])])/
(2*a*f*Pi*Sqrt[hillb^2 -
4*a^2*f^2*Pi^2])
% /. {hilla -> 3, hillb -> 50,
f0 -> 8, a -> 1, f -> 1}
(1/(2*Pi*Sqrt[2500 - 4*Pi^2]))*
(538*Pi*Sqrt[2500 - 4*Pi^2] +
55000*ArcTan[(2*Pi)/
Sqrt[2500 - 4*Pi^2]] -
27500*I*Log[-((25*I)/
Sqrt[2500 - 4*Pi^2])] +
27500*I*Log[(25*I)/
Sqrt[2500 - 4*Pi^2]])
N[%]
14.037200672826035 + 0.*I
Bobby
On Mon, 18 Apr 2005 03:08:44 -0400 (EDT), Jim Martin <jim.martin@utah.edu> wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
>
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
>
> I know the line wrap makes this hard to read so please feel free to
> email me and I can send you the output as a picture.
>
> In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
>
> I can numerically integrate this function and obtain a value for that
> sample data set of 14.04. When I put those sample values into the
> solution that Mathematica produces, I get 10.01.
>
> Can any of you please give a hand here? I must be making some simple
> Mathematica-beginner error but I just can't see it.
>
> In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
> variables that have intrinsic functions in Mathematica? Maybe I am
> misunderstanding the output with regard to implicit parentheses etc.
> Any help appreciated!
>
> Thanks,
>
> Jim
>
>
>
>
>
--
DrBob@bigfoot.com
| |
| Peter Pein 2005-04-19, 8:59 am |
| Jim Martin wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
>
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
>
> I know the line wrap makes this hard to read so please feel free to
> email me and I can send you the output as a picture.
>
> In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
>
> I can numerically integrate this function and obtain a value for that
> sample data set of 14.04. When I put those sample values into the
> solution that Mathematica produces, I get 10.01.
>
> Can any of you please give a hand here? I must be making some simple
> Mathematica-beginner error but I just can't see it.
>
> In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
> variables that have intrinsic functions in Mathematica? Maybe I am
> misunderstanding the output with regard to implicit parentheses etc.
> Any help appreciated!
>
> Thanks,
>
> Jim
>
>
Hi Jim,
1. use square brackets for functions: Cos[f] instead of Cos(f).
2. use Pi instead of pi.
How did you get /any/ result with these typos?
Please download
http://people.freenet.de/Peter_Berl...ral/Integral.nb
or have just a look at
http://people.freenet.de/Peter_Berl...l/Integral.html
--
Peter Pein
Berlin
| |
| Chris Chiasson 2005-04-19, 8:59 am |
| Try this instead:
Integrate[(hillb*((f0 + hilla)/(2*
Pi*f*a*Cos[ArcSin[x/a]] + hillb))) - hilla, {x, -a, a}]
% /. {hilla -> 3, hillb -> 50, f0 -> 8, a -> 1, f -> 1}
% // N
On 4/18/05, Chris Chiasson <chris.chiasson@gmail.com> wrote:
> Of course, that might be expected when none of the fuctions have their
> arguments specified with brackets, as they are supposed to...
>
> On 4/18/05, Chris Chiasson <chris.chiasson@gmail.com> wrote:
>
> --
> Chris Chiasson
> Kettering University
> Mechanical Engineering
> Graduate Student
> 1 810 265 3161
>
--
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161
| |
|
| i'm surprised that you actually get any numerical result.
your syntax is wrong. this is what you need to evaluate:
Integrate[hillb*(f0+hilla)/(2*Pi*f*a*Cos[ArcSin[x/a]] +hillb)-hilla,{x,-a,a},GenerateConditions->False]
(you might want to replace a*Cos[ArcSin[x/a]] by Sqrt[a^2-x^2])
| |
| nafod40 2005-04-19, 8:59 am |
| Jim Martin wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
You need to write the cosine of x as Cos[x], not Cos(x).
Also write the constant pi as "Pi" with caps on first letter.
That ought to do it.
| |
| Helen Read 2005-04-19, 8:59 am |
| Jim Martin wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
The number pi is denoted Pi in Mathematica. Remember that *all* built-in
functions, constants, etc., begin with a capital letter.
And argument(s) of a function are always enclosed within square
brackets. f[x], Sin[x], Log[x], etc.
So what you need is the following.
Integrate[(hillb*((f0 + hilla)/(2*Pi*f*a*Cos[ArcSin[x/a]] + hillb))) -
hilla, {x, -a, a}]
--
Helen Read
University of Vermont
| |
| Paul Abbott 2005-04-19, 8:59 am |
| In article <d3vn1h$jm9$1@smc.vnet.net>,
Jim Martin <jim.martin@utah.edu> wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
Instead of 2*pi*f*a*Cos(ArcSin(x/a)) you mean
2 Pi f a Cos[ArcSin[x/a]] + hillb
(In StandardForm, pi needs to be capitalised and square brackets are
required).
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
In this output you will see expressions like
ArcSin Cos f pi
which make no sense. Correcting the integrand, and massaging the result
from Integrate, I get
((f0 + hilla) hillb (Pi (Sqrt[hillb^2 - 4 a^2 f^2 Pi^2] - hillb) +
2 hillb ArcTan[(2 a f Pi)/Sqrt[hillb^2 - 4 a^2 f^2 Pi^2]]))/
(2 f Pi Sqrt[hillb^2 - 4 a^2 f^2 Pi^2]) - 2 a hilla
> In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
For this dataset, numerical evaluation gives 14.0372.
> I can numerically integrate this function and obtain a value for that
> sample data set of 14.04.
But how did you do this and get this correct result if you used the
wrong integrand?
> In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
> variables that have intrinsic functions in Mathematica? Maybe I am
> misunderstanding the output with regard to implicit parentheses etc.
Wrong type of parentheses. If you use TraditionalForm for input and
output (Cell | Default Input FormatType, etc.) you _can_ enter
expressions using () instead of [].
Cheers,
Paul
--
Paul Abbott Phone: +61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul@physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul
| |
| Mischa Oliver ALtmann 2005-04-20, 9:00 am |
| Jim Martin <jim.martin@utah.edu> wrote in message news:<d3vn1h$jm9$1@smc.vnet.net>...
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
I think you are misunderstanding functions in Mathematica. They are
called via "FunctionName[arguments]" (note the square brackets!) By
convention all built-in functions are capitalised (e.g. Cos[x]) and
user-defined ones are generally in lowercase.
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
Here you can see that Mathematica treated Arcsin and Cos (note your
incorrect use of round brackets) as variables(!).
If you have enough time it might be worth taking an hour to go through
the built-in basic tutorial in the included help file.
Mischa
| |
| yehuda ben-shimol 2005-04-20, 9:00 am |
| I follow APC's comments,
After correcting them you get (in InputForm)
res=(-4*a^2*f*hilla*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2] +
a*f0*hillb*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2] +
a*hilla*hillb*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2] +
2*a*(f0 + hilla)*hillb^2*
ArcTan[(2*a*f*Pi)/Sqrt[hillb^2 - 4*a^2*f^2*
Pi^2]] - I*Sqrt[a^2]*(f0 + hilla)*hillb^2*
Log[-((I*Sqrt[a^2]*hillb)/
(2*a*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2]))] +
I*Sqrt[a^2]*f0*hillb^2*Log[(I*Sqrt[a^2]*
hillb)/
(2*a*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])] +
I*Sqrt[a^2]*hilla*hillb^2*
Log[(I*Sqrt[a^2]*hillb)/
(2*a*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])])/
(2*a*f*Pi*Sqrt[hillb^2 - 4*a^2*f^2*Pi^2])
And then
res/.{hilla -> 3, hillb -> 50, f0 -> 8, a -> 1, f -> 1}//N//Chop
will give you
14.0372
First notice that you get a general closed form result, which is more
efficient to use since you need to integrate (symbolically) only once.
Then the numerical values are assigned and do not involve with the
accuracy of the integration.
Anyway, NIntegrate[] returns the same result
yehuda
On 4/18/05, Jim Martin <jim.martin@utah.edu> wrote:
> Hello Mathematica Experts:
>
> I am a biomechanist and work mostly in the area of muscle contraction. I
> do a lot of numerical computations using excel, but right now I need an
> analytical solution that represents force as a function of position
> integrated over a shortening amplitude. I downloaded a trial version of
> Mathematica and have tried to obtain a solution for this:
>
> Integrate[(hillb*((f0 + hilla)/(2*pi*f*a*Cos(ArcSin(x/a)) + hillb))) -
> hilla, {x, -a, a}]
>
> Mathematica returns this:
> (-4 a ArcSin Cos f hilla pi + (f0 + hilla) hillb (-Log[hillb - 2 a
> ArcSin Cos f pi] + Log[hillb + 2 a ArcSin Cos f pi]))/(4 a ArcSin
> Cos f pi)
>
> I know the line wrap makes this hard to read so please feel free to
> email me and I can send you the output as a picture.
>
> In a sample data set, hilla=3, hillb=50, f0=8, a=1, f=1
>
> I can numerically integrate this function and obtain a value for that
> sample data set of 14.04. When I put those sample values into the
> solution that Mathematica produces, I get 10.01.
>
> Can any of you please give a hand here? I must be making some simple
> Mathematica-beginner error but I just can't see it.
>
> In Mathematica, Log is Log to base e, right (LN in excel)? Did I use
> variables that have intrinsic functions in Mathematica? Maybe I am
> misunderstanding the output with regard to implicit parentheses etc.
> Any help appreciated!
>
> Thanks,
>
> Jim
>
>
| |
|
| > I think you are misunderstanding functions in Mathematica. They are
> called via "FunctionName[arguments]" (note the square brackets!)
Several people have pointed this out, but actually, Jim's code is valid TraditionalForm input (except that pi should be Pi). That wouldn't explain the output he got, of course.
Bobby
On Wed, 20 Apr 2005 05:29:51 -0400 (EDT), Mischa Oliver ALtmann <moaltmann@gmail.com> wrote:
> Jim Martin <jim.martin@utah.edu> wrote in message news:<d3vn1h$jm9$1@smc.vnet.net>...
> I think you are misunderstanding functions in Mathematica. They are
> called via "FunctionName[arguments]" (note the square brackets!) By
> convention all built-in functions are capitalised (e.g. Cos[x]) and
> user-defined ones are generally in lowercase.
>
> Here you can see that Mathematica treated Arcsin and Cos (note your
> incorrect use of round brackets) as variables(!).
>
> If you have enough time it might be worth taking an hour to go through
> the built-in basic tutorial in the included help file.
>
> Mischa
>
>
>
>
--
DrBob@bigfoot.com
|
|
|
|
|