Group Abstract Group Abstract

Message Boards Message Boards

0
|
10.9K Views
|
8 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Using an image as a variable for integrating

Posted 12 years ago

In v7 it was allowed to integrate (derive, etc.) using images as variables. I loved that funcionality because, literally, let me show my students how to integrate with little apples. This is a screenshot from v7:

Integration with image v7

Now I'm using v9, but when I try to integrate this way, the result is this:

Integration with image v9

Does anyone know, first, why this backward step?, and second, is there a way to get back that funcionality? Thanks

POSTED BY: Daniel Solis
8 Replies

I was goofing around, apologies. The reference, such as it was, was to the powers to which the apples appeared.

POSTED BY: Daniel Lichtblau

So, the Image head (from the drag or copy/past) is not treated by the Integrate in the same way as the graphics head (from the Rasterize). I imagine this is just something that was overlooked on the language unification, and that it could be improved on future versions. Right?

POSTED BY: Pedro Fonseca

It certainly seems so since one can integrate something with an arbitrary head with respect to such a thing and get the expected answer. E.g.,

Integrate[f[z]^2, f[z]]

gives

( f[z]^3)/3

But

img=Image[ConstantArray[.4, {4, 4}]]

gives the noted error when tried with

Integrate[img^2, img]

If however we recognize that img is the same as

f[{{0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 
   0.4}, {0.4, 0.4, 0.4, 
    0.4}}, "Real", ColorSpace -> Automatic, Interleaving -> None]

and try the obvious (but unwieldy) expression (i.e., replacing Image by an arbitrary undefined head f)

Integrate[
 f[{{0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 
    0.4}, {0.4, 0.4, 0.4, 
     0.4}}, "Real", ColorSpace -> Automatic, Interleaving -> None]^2, 
 f[{{0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 
    0.4}, {0.4, 0.4, 0.4, 
     0.4}}, "Real", ColorSpace -> Automatic, Interleaving -> None]]

we get the expected (ugly) result

1/3 f[{{0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 0.4}, {0.4, 0.4, 0.4, 
    0.4}, {0.4, 0.4, 0.4, 0.4}}, "Real", ColorSpace -> Automatic, 
  Interleaving -> None]^3

So, yes, it seems a bug.... ;-)

I sent in a report....

POSTED BY: David Reiss
Posted 12 years ago
POSTED BY: Itai Seggev

It seems your apples went from cubes to quarts. Was this a packing problem?

POSTED BY: Daniel Lichtblau
POSTED BY: Daniel Solis
POSTED BY: David Reiss

You are right, rasterizing the image first works fine. Too bad I have to do it prior the integration (I liked just dropping images), but, it works, good enough.

Thanks!

POSTED BY: Daniel Solis
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard