COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Integrate problem

• Email
• Follow

Hi, Group
I am new to Mathematica and now meet one problem I can't solve by
self.  First I defined 3 functions: h, f and g

\!$$\(h[t_] := \(-20$$*Cos[t] Exp[$$-t$$\/20];\)\[IndentingNewLine]
$$f[x_, y_] := Cos[x] Sin[y];$$\[IndentingNewLine]
$$g[α_, β_, t_] := If[t == 0, \(-1$$, If[h[t] <
β, $$-1$$, If[h[t] > α, $$+1$$, g[α, β, t - 0.1]]]];\)\)

Now I try to integrate the function f[x,y]*g[x,y,10] on a triangle
region:

\!$$∫\_\(-20$$\%20$$∫\_\(-20$$\%x$$(N[f[ x, y]\ g[x, y, 10]])$$ \[DifferentialD]y \[DifferentialD]x\)\)

The output result is strange. How to get correct answer for this
integration?

Thank you for help.


 0
Reply yuerlong (1) 4/5/2006 11:10:14 AM

See related articles to this posting

On Wed, 5 Apr 2006 11:10:14 +0000 (UTC), axman <yuerlong@gmail.com> wrote:

> Hi, Group
>     I am new to Mathematica and now meet one problem I can't solve by
> self.  First I defined 3 functions: h, f and g
>
> \!$$\(h[t_] := \(-20$$*Cos[t] Exp[$$-t$$\/20];\)\[IndentingNewLine]
>   $$f[x_, y_] := Cos[x] Sin[y];$$\[IndentingNewLine]
>   $$g[_, _, t_] := > If[t == 0, \(-1$$, If[h[t] <
>        , $$-1$$, If[h[t] > , $$+1$$, g[, , t - 0.1]]]];\)\)
>
>
> Now I try to integrate the function f[x,y]*g[x,y,10] on a triangle
> region:
>
> \!$$\_\(-20$$\%20$$\_\(-20$$\%x$$(N[f[ > x, y]\ g[x, y, 10]])$$ \[DifferentialD]y \[DifferentialD]x\)\)
>
> The output result is strange. How to get correct answer for this
> integration?
>
> Thank you for help.
>

This is a tricky one, because it involves recursion and so we can't just
unwind all the nested If's at once. One way to handle this is to introduce
a dummy function and perform the integrations step by step
(PiecewiseIntegrate code is available at
http://library.wolfram.com/infocenter/MathSource/5117/ ):

In[2]:= h[t_] := -20*Cos[t]*Exp[-t/20];
f[x_, y_] := Cos[x]*Sin[y];
g[a_, b_, t_] := If[t == 0, -1, If[h[t] < b, -1,
If[h[t] > a, 1, g[a, b, t - 1/10]]]];

In[5]:= g2[a_, b_, t_] := If[t == 0, -1, If[h[t] < b, -1,
If[h[t] > a, 1, g2dummy[a, b, t - 1/10]]]];

In[6]:= FixedPoint[# /.
{g2dummy -> g2, Integrate -> PiecewiseIntegrate}&,
Integrate[f[x, y]*g2[x, y, 1020], {x, -20, 20}, {y, -20, x}]] //
Timing

Out[6]= {12.516*Second,
-11.434671065806804881623297750815.290914394480588}

To evaluate the integral by purely numerical methods we notice that the
problematic points are where x == h[t] or y == h[t], and t will take
values 10, 10 - 1/10, and so on:

In[7]:= Lcp = Union@ h@ Range[10., 0., -.1];
NIntegrate[f[x, y]*g[x, y, 10.],
{x, -20, Sequence @@ Lcp, 20} // Evaluate,
{y, -20, Sequence @@ (Min[#, x]&) /@ Lcp, x} // Evaluate,
Method -> MultiDimensional] // Timing

Out[8]= {48.406*Second, -11.434671066765237}

In fact, with exact input we can even get the exact value of the integral
using the same combination of PiecewiseIntegrate and FixedPoint; the exact

(20*Cos[10])/Sqrt[E] - 2*Cos[20]*Sin[(20*Cos[31/10])/E^(31/200)]
+ 2*Cos[(20*Cos[31/5])/E^(31/100)]*Sin[(20*Cos[31/10])/E^(31/200)] -
2*Cos[(20*Cos[31/5])/E^(31/100)]*Sin[(20*Cos[47/5])/E^(47/100)]
+ 2*Cos[(20*Cos[10])/Sqrt[E]]*Sin[(20*Cos[47/5])/E^(47/100)] -
(1/2)*Sin[(40*Cos[10])/Sqrt[E]]

Maxim Rytin
m.r@inbox.ru

`
 0
Reply m.r (134) 4/6/2006 11:29:04 AM

1 Replies
39 Views

Similar Articles

12/10/2013 6:04:18 PM
[PageSpeed]

Similar Artilces:

A simple problem, but a problem ...
Hello, can anyone solve the following problem ? It looks quite simple to me, but I can't get it right. The advice suggests the following: mr(yes). mr(no). mrs(yes). mrs(no). marcel(yes). marcel(no). jacqu(yes). jacqu(no). grandpa(yes). grandpa(no). but how can I use this to solve the problem ? thanx a lot Maxx Problem: If Mr. Johnson goes, his wife goes too. At least one of the children, Marcel or Jacqueline, goes too. If Marcel goes, grandpa goes too. If Mrs. Johnson goes, grandpa stays at home. If Jacqueline goes, Mr. Johnson and Marcel go too. Write a prolog program, which...: > "If Mr. Johnson goes, his wife goes too." > Can you give me a concret example for this line ?=20 Same problem here, Andr=E9. I have come this far, but I'm missing the=20 if_clause condition: % A family is about to visit their friends. They are a bit complicated=20 as to who % is going. The problematic part of the family consist of Mr. Funky,=20 Mrs. Funky, % the kids Marc and Joseline and grandpa Funky. The rules are as follows:= % % If Mrs. Funky goes, his wife goes as well. % At least one of the kids Marc and Joseline will be going. % If Marc goes, grandpa Funky

problem with edk
\. LibGen Done. make: *** [microblaze_0/lib/libxil.a] Error 2 Done. Have you an idea to resolve this problem? thanks Regards R!SC Last time I checked with EDK6.2i, it did not like embedded spaces in the path name. IIRC, one could either put the files in a path without embedded spaces, or use the subst command. - Newman "R!SC" <opb@xilinx.com> wrote in message news:_XdCd.622615$35.25734702@news4.tin.it... > Hi all, > > i'm first time approch with fpga, i have xilinx ise and edk 6.3i version. > With XPS I have create a new project with project builder... > Done. > > > Have you an idea to resolve this problem? > > thanks > Regards > R!SC > Problem with Widcards that have Longs as keys > and Lists of *the specific type List<?>* as keys. That?s wrong. The problem is, that Map<Long, List<?>> can map Longs on any type of list. I.e., 3 could map to a List<String>, whereas 5 maps to List<Number> and so on. Thus, the moment you give Java a Map<Long, List<Double>>, it says: cannot assign, because imagine that this would work, then the following code would be possible, and of course we don?t want that: Map<Long, List<?>> badMap = new HashMap<Long, List<Double>>; //will not compile map.put Problem formdesign Dear All, Every time I open a pop-up-datsheet-form the form-width increases. And I can't change the Form-width-property. auto resize = no auto center = no pop-up = yes Modal = yes What am I missing ? Filip On Mar 2, 4:24 pm, "Filips Benoit" <benoit.fil...@telenet.be> wrote: > Dear All, > > Every time I open a pop-up-datsheet-form the form-width increases. > And I can't change the Form-width-property. > > auto resize = no > auto center = no > pop-up = yes > Modal = yes > > What am I missing ? > > Filip What is the BorderSty StarCraft problem Battlenet to update you to the latest version. > > Will I have to start over? Even if you do, you can use cheat codes to skip levels with no ill-effects. The only things you have to worry about appear in BroodWar, and there is still a way to work around that problem. Select into problem Hi Guys, I have a question about PL/SQL code I have the following select into statement : SELECT STUD_AGE INTO v_cHP_MaxAge FROM STUDENT WHERE GDU = '015346001002'; I know It has no value returned but it give a no_data_found error. How do I escape that error without using exception? Is there any way to force the query return some value instead of an error? Thanks in advance Jun wrote: > Hi Guys, > > I have a question about PL/SQL code > > I have the following select into statement : > > SELECT STUD_AGE INTO v_cHP_MaxAge FROM STUDENT W mhchem problem Using mhchem, I wanted to put reaction rate constants above and below <=> with this: \documentclass{article} \usepackage[version=3]{mhchem} \begin{document} \ce{CO2(aq) + H2O <=>[\ce{$k_+$}][\ce{$k_-$}] H+ + HCO3-} \ce{CO2(aq) + H2O <=>[\text{$k_+$}][\text{$k_-$}] H+ + HCO3-} \end{document Alas,$k_+$above <=> appeared in the .dvi file at the correct size in both equations but$k_-\$ was too small in both. What should I have done? -- John Harper, School of Mathematics, Statistics and Computer Science, Victoria University, PO Box 600, Wellington 6140, New Zealand e-

problem in kde
I'm running KDE3.1 from Slackware 9.1 and I notice that sometimes I have problems when I hit the "enter" key. It sometimes opens up Konqueror. Is this a known issue and is there a way to fix it (other than not using the "enter" key). Miguel De Anda wrote: > I'm running KDE3.1 from Slackware 9.1 and I notice that sometimes I have > problems when I hit the "enter" key. It sometimes opens up Konqueror. Is > this a known issue and is there a way to fix it (other than not using the > "enter" key). is konqueror web borwser ( or home di

verbatim problem
Hi, I would like to write three lines like the following: 8 adders/subtractors + 4 Data Registers = 120 + 28 = 148 (CLBs) (conventional implementation) When I use verbatim I found the fonts for these three lines are different from the fonts I used in the paper. Is there a better way to write these three lines? Thank you very much! sincerely ------------- Kuan Zhou ECSE department Kuan Zhou wrote: > I would like to write three lines like the following: > > > 8 adders/subtractors + 4 Data Registers > = 120

Problem with tkinter
Hello Friends, i installed the new Python 2.3 tarball but have a little (or big) problem. When testing turtle.py i get the following message. I am using Linux SUSE 8.2, Tk ist installed as version 8.4 ../configure, make and make install work fine .... Python 2.3 (#2, Nov 11 2003, 17:40:46) [GCC 3.3 20030226 (prerelease) (SuSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> but: ropebu@z3pc47:/usr/local/lib/python2.3/lib-tk> python turtle.py Traceback (most recent call last): File "turtle.py", line 4, in ? import Tkinter File "/usr/local/lib/python2.3/lib-tk/Tkinter.py", line 38, in ? import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter So the questions is: how to configure python to use Tk. Greeting from Karlsruhe Hi! ropebu@web.de (rolf peter) wrote: >So the questions is: how to configure python to use Tk. IIRC the package "tcl-devel" isn't installed by default, but nessesary before compiling python. hth Jan Thank You, that was it after installing the package